using System; using System.Collections.Generic; using System.Linq; using System.Text; using DataLibrary; using System.Web.UI.WebControls; namespace CoreSavingLibrary { public class PageWebDialog : PageWeb { private WebDialog webDialog; public bool isLogon = false; protected bool databaseConnected = false; protected void Page_Load(object sender, EventArgs e) { tDwDates = new List(); xmlconfig = new XmlConfigService(WebUtil.GetGcoopPath()); try { state = new WebStateFactory(this, PageWebType.Dialog); } catch (Exception ex) { Response.Clear(); Response.Write(WebUtil.ErrorMessage(ex)); Response.End(); } wcf = new WcfCalling(xmlconfig); isLogon = true; webDialog = (WebDialog)this; //เริ่มต้นการทำงานของ WebDialog try { this.GenerateJsPostBack(); webDialog.InitJsPostBack(); } catch (NotImplementedException nex) { } try { if (Page.Master != null) { Literal lt = (Literal)this.Master.FindControl("LtDialogServerMessage"); if (lt != null) { LtServerMessage = lt; } } } catch { } try { webDialog.WebDialogLoadBegin(); } catch (NotImplementedException nex) { } if (IsPostBack) { String eventArg = ""; try { eventArg = Request["__EVENTARGUMENT"]; } catch { } try { webDialog.CheckJsPostBack(eventArg); } catch (NotImplementedException nex) { } } // หา winParameter String winParameter = ""; String uri = Request.Url.AbsoluteUri; int indexOfUriApplications = uri.ToLower().IndexOf("/applications/"); if (indexOfUriApplications >= 0) { String tmp = uri.Substring(uri.IndexOf("/Applications/") + 14); tmp = tmp.Substring(0, tmp.IndexOf("/")); winParameter = tmp; } if (String.IsNullOrEmpty(winParameter)) { winParameter = state.SsApplication; } String url = state.SsUrl; string strq = "?qdt" + DateTime.Today.ToString("yyyyMMdd"); String onLoad = ""; onLoad += "\n"; onLoad += ""; onLoad += "\n"; onLoad += "\n"; onLoad += "\n"; onLoad += "\n"; onLoad += "\n"; onLoad += "\n"; onLoad += "\n"; onLoad += ""; onLoad += SetDwThDateJavaScriptEvent(); Type t = this.GetType(); ClientScript.RegisterClientScriptBlock(t, "DsScript", onLoad); String lastFocus = ""; try { lastFocus = Request["tempLastFocus"]; } catch { } String dsTempElementEnter = "\n\n"; dsTempElementEnter += "\n"; dsTempElementEnter += "\n\n"; ClientScript.RegisterClientScriptBlock(t, "DsTempElementEnter", dsTempElementEnter); } protected void Page_LoadComplete(object sender, EventArgs e) { if (isLogon) { try { webDialog.WebDialogLoadEnd(); try { for (int i = 0; i < this.binder.Count; i++) { this.binder[i].HtmlJsControlBuild(); } } catch { } this.SetOnLoadedScript(); this.DisConnectSQLCA(); } catch (Exception ex) { this.SetOnLoadedScript(); this.DisConnectSQLCA(); throw ex; } } PrepareResponse(databaseConnected); try { this.oracleTA.Close(); } catch { } wcf.Close(); } } }