protected void ViewEL_Activate(object sender, EventArgs e) { Dictionary <String, String> dssPostPut = RequestBus.GetPostPutData(Request: Request); InitValueFromRequest(dssPostPut: dssPostPut); DrawItemListTable(dssPostPut: dssPostPut); }
private void DrawItemListTable(Dictionary <String, String> dssPostPut = null) { #region prepare data for table DataTable dt = new DataTable("ExampleItem", "ExampleList"); dssPostPut = dssPostPut ?? RequestBus.GetPostPutData(Request: Request); string jumpdata = RequestBus.Param("jumpdata"); List <Dictionary <string, string> > ldss = new List <Dictionary <string, string> >(); string tableExampleInformationQueryItemListPerPageRowCount = dssPostPut.TryGetValue("ChangeExampleInformationQueryItemListPerPageRowCountTo", out tmpStr) ? tmpStr : "5"; string tableExampleInformationQueryItemListCurrPageNum = "1"; #region set data to the view string exampleType = vEL_QExampleType.Text = dssPostPut.TryGetValue("QExampleType", out exampleType) ? exampleType : String.Empty; tableExampleInformationQueryItemListPerPageRowCount = vELTableExampleInformationQueryItemList_PerPageRowCount.Text = dssPostPut.TryGetValue("vELTableExampleInformationQueryItemListPerPageRowCount", out tmpStr) ? tmpStr : tableExampleInformationQueryItemListPerPageRowCount; tableExampleInformationQueryItemListCurrPageNum = vELTableExampleInformationQueryItemList_CurrPageNum.Text = dssPostPut.TryGetValue("vELTableExampleInformationQueryItemListCurrPageNum", out tmpStr) ? tmpStr : tableExampleInformationQueryItemListCurrPageNum; string tableExampleInformationQueryItemListPageTotalCount = vELTableExampleInformationQueryItemList_PageTotalCount.Text = dssPostPut.TryGetValue("vELTableExampleInformationQueryItemListPerPageRowCount", out tmpStr) ? tmpStr : tableExampleInformationQueryItemListCurrPageNum; string tableExampleInformationQueryItemListRowTotalCount = vELTableExampleInformationQueryItemList_RowTotalCount.Text = dssPostPut.TryGetValue("vELTableExampleInformationQueryItemListRowTotalCount", out tmpStr) ? tmpStr : "X"; #endregion int perPageRowCount = int.TryParse(tableExampleInformationQueryItemListPerPageRowCount, out perPageRowCount) ? perPageRowCount : 5; /* * Use RFDataTable to deal with the data. * */ RFDataTable rfdteiqil = new RFDataTable("vELTableExampleInformationQueryItemList", request: Request, response: Response); rfdteiqil.BeforePageChange += new RFDataTable.BeforePageChangeHandler(rfdteiqil_BeforePageChange); rfdteiqil.WhenPageChange += new RFDataTable.WhenPageChangeHandler(rfdteiqil_WhenPageChange); rfdteiqil.AfterPageChange += new RFDataTable.AfterPageChangeHandler(rfdteiqil_AfterPageChange); dataSet.Tables.Add( rfdteiqil.ChangePageTo( currPage: tableExampleInformationQueryItemListCurrPageNum, perPageRowCount: perPageRowCount.ToString(), dssPostData: dssPostPut, dataTableName: "TableExampleInformationQueryItemList", dataTableNamespace: "ExampleList", columnKeyIDPair: new Dictionary <string, string> { { "RowCount", "id" } , { "Code", "code" } , { "Name", "name" } , { "Status", "status" } , { "Description", "description" } } , t: vELTableExampleInformationQueryItemList ) ); #endregion #region draw data table with data try { RF.GlobalClass.WebForm.fillTableAccordingToData(vELTableExampleInformationQueryItemList, dataSet.Tables["TableExampleInformationQueryItemList", "ExampleList"]); } catch (Exception ex) { } #endregion }
private void DrawItemDropDownList() { Dictionary <String, String> dssPostPut = RequestBus.GetPostPutData(Request: Request); SRExample.ResultMsg resultMsg = GetExampleType(); if (resultMsg.RetCode != RequestBus.RetCode.success.ToString()) { return; } else { } Dictionary <String, List <Dictionary <String, String> > > dsldss = RequestBus.ConvertResultMsgProperty <Dictionary <String, List <Dictionary <String, String> > > >(resultMsg.Obj); List <Dictionary <String, String> > ldss = RequestBus.ConvertResultMsgObj(resultMsg.Obj); ldss = dsldss.TryGetValue(RFDataTable.ServiceResultMsg.DataRecordsName, out ldss) ? ldss : ldss; GB.WebControl.DropDownListBindData(ddl: vEQ_QExampleTypeList, ldss: ldss, dataTextField: "name", dataValueField: "code"); string exampleType = vEQ_QExampleTypeList.SelectedValue = dssPostPut.TryGetValue("QExampleType", out exampleType) ? exampleType : vEQ_QExampleTypeList.SelectedValue; }
protected void Page_Load(object sender, EventArgs e) { GBA = RequestBus.getGBA(Response: Response, moduleID: ModuleID.Value, openName: "rfOaService", methodName: "redforce"); //getGBA(Response, ModuleID.Value); GBW = RequestBus.getGBW(Response: Response); // getGBW(Response); passengers = new RequestBus.Passengers(); Dictionary <string, string> dssPP = RequestBus.GetPostPutData(Request: Request); string tmp = String.Empty; serviceName = dssPP.TryGetValue("serviceName", out tmp) ? tmp : serviceName; interfaceName = dssPP.TryGetValue("interfaceName", out tmp) ? tmp : interfaceName; specifiedFiledSuffixName = dssPP.TryGetValue("specifiedFiledSuffixName", out tmp) ? tmp : specifiedFiledSuffixName; keyIDPairSuffixName = dssPP.TryGetValue("keyIDPairSuffixName", out tmp) ? tmp : keyIDPairSuffixName; Type requestBusType = (new RequestBus()).GetType(); dssSpecifiedFields = RF.GlobalClass.Utils.Do.MagicField <Dictionary <string, string> >((new RequestBus()), serviceName + interfaceName + specifiedFiledSuffixName) ?? RF.GlobalClass.Utils.Do.MagicField <Dictionary <string, string> >((new RequestBus()), serviceName + specifiedFiledSuffixName) ?? dssSpecifiedFields; dssKeyIDPair = RF.GlobalClass.Utils.Do.MagicField <Dictionary <string, string> >((new RequestBus()), serviceName + interfaceName + keyIDPairSuffixName) ?? RF.GlobalClass.Utils.Do.MagicField <Dictionary <string, string> >((new RequestBus()), serviceName + keyIDPairSuffixName) ?? dssKeyIDPair; #region interface name SRExample.ServiceSoapClient rsc = new SRExample.ServiceSoapClient(); DropDownList ddlInterfaceName = new DropDownList(); ddlInterfaceName.ID = "InterfaceName"; ddlInterfaceName.DataTextField = "txt"; ddlInterfaceName.DataValueField = "val"; DataTable dt = new DataTable(); dt.Columns.Add("txt"); dt.Columns.Add("val"); rsc.GetType().GetMethods().Select(x => (x.ReturnType == typeof(SRExample.ResultMsg)) ? (dt.Rows.Add(new object[] { x.Name, x.Name }) == null ? true : true) : false).ToArray(); /* might meet methods with same name and different return type * RF.GlobalClass.Utils.Do.getMethodNamesOfObject(CWRCS).Select(delegate(string name) * { * // CWRCS.GetType().GetMethods().Select(x=> dt.Rows.Add(new object[]{x,x})).ToArray(); * * if (CWRCS.GetType().GetMethod(name).ReturnType == typeof(CheckinWebReference.ResultMsg)) * { * dt.Rows.Add(new object[]{ name, name }); * } * else { } * return name; * }).ToArray(); * */ ddlInterfaceName.DataSource = dt; ddlInterfaceName.DataBind(); ddlInterfaceName.SelectedValue = interfaceName; ddlInterfaceName.TextChanged += new EventHandler(ddlInterfaceName_TextChanged); Label lbInterfaceName = new Label(); lbInterfaceName.Text = "Interface Name:"; form1.Controls.Add(lbInterfaceName); form1.Controls.Add(ddlInterfaceName); #endregion Label lb = new Label(); CheckBox cb = new CheckBox(); TextBox tx = new TextBox(); Panel pl = new Panel(); cc = new RF.GlobalClass.WebForm.ControlCollection(RF.GlobalClass.Utils.Do.getPropertyNamesOfObject(passengers).Select(delegate(string _name) { string name = _name; if (dssKeyIDPair.ContainsKey(_name)) { name = dssKeyIDPair[_name]; } else { } lb = new Label(); lb.Text = name; lb.Style.Add(HtmlTextWriterStyle.Margin, "2px 2px 2px 4px"); cb = new CheckBox(); cb.ID = "cb_" + name; cb.Checked = dssSpecifiedFields.ContainsKey(name); cb.ToolTip = "check to use it creating sign name."; tx = new TextBox(); if (cb.Checked) { tx.ToolTip = dssSpecifiedFields[name] ?? String.Empty; if (!String.IsNullOrEmpty(tx.ToolTip)) { lb.Text = tx.ToolTip; } else { } } else { } tx.ID = name; tx.Style.Add(HtmlTextWriterStyle.Margin, "2px 4px 2px 2px"); switch (_name) { case "empid": tx.Text = GBA.UserSession.empid; break; case "mdlid": tx.Text = GBA.ModuleID; break; case "pwrid": tx.Text = GBA.PowerID; break; case "dptid": tx.Text = GBA.UserSession.dptid; break; case "TimeStamp": tx.Text = RequestBus.GetDateTimeString(DateTime.Now); break; case "openName": tx.Text = GBA.OpenName; break; case "methodName": tx.Text = GBA.MethodName; break; case "Sign": tx.Width = Unit.Pixel(300); tx.ReadOnly = true; break; default: break; } System.Web.UI.HtmlControls.HtmlGenericControl span = new System.Web.UI.HtmlControls.HtmlGenericControl("span"); span.Style.Add(HtmlTextWriterStyle.WhiteSpace, "nowrap"); span.Style.Add(HtmlTextWriterStyle.Display, "inline-block"); span.Controls.Add(lb); span.Controls.Add(cb); span.Controls.Add(tx); form1.Controls.Add(span); return(tx); }).ToArray()); System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div.Style.Add(HtmlTextWriterStyle.WhiteSpace, "nowrap"); div.Style.Add(HtmlTextWriterStyle.Margin, "4px"); Button btn = new Button(); btn.Text = "Generate Sign"; btn.Click += new EventHandler(btnGenerateSign_Click); div.Controls.Add(btn); btn = new Button(); btn.Text = "Send Request"; btn.Click += new EventHandler(btnSendRequest_Click); div.Controls.Add(btn); form1.Controls.Add(div); div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div.Style.Add(HtmlTextWriterStyle.WhiteSpace, "nowrap"); div.Style.Add(HtmlTextWriterStyle.Margin, "4px"); #region result lb = new Label(); lb.Text = "ResultMsg.RetCode:"; div.Controls.Add(lb); tx = new TextBox(); tx.ID = "ResultMsgRetCode"; div.Controls.Add(tx); div.Controls.Add(new Label()); lb = new Label(); lb.Text = "ResultMsg.RetMsg:"; div.Controls.Add(lb); tx = new TextBox(); tx.ID = "ResultMsgRetMsg"; div.Controls.Add(tx); form1.Controls.Add(div); div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div.Style.Add(HtmlTextWriterStyle.WhiteSpace, "nowrap"); div.Style.Add(HtmlTextWriterStyle.Margin, "4px"); lb = new Label(); lb.Text = "ResultMsg.Obj:"; div.Controls.Add(lb); tx = new TextBox(); tx.Rows = 10; tx.ID = "ResultMsgObj"; tx.Width = Unit.Percentage(80.0); tx.TextMode = TextBoxMode.MultiLine; div.Controls.Add(tx); form1.Controls.Add(div); div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div.Style.Add(HtmlTextWriterStyle.WhiteSpace, "nowrap"); div.Style.Add(HtmlTextWriterStyle.Margin, "4px"); lb = new Label(); lb.Text = "ResultMsg.Objj:"; div.Controls.Add(lb); tx = new TextBox(); tx.Rows = 10; tx.ID = "ResultMsgObjj"; tx.Width = Unit.Percentage(80.0); tx.TextMode = TextBoxMode.MultiLine; div.Controls.Add(tx); form1.Controls.Add(div); div = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); div.Style.Add(HtmlTextWriterStyle.WhiteSpace, "nowrap"); div.Style.Add(HtmlTextWriterStyle.Margin, "4px"); div.Controls.Add(new Panel()); lb = new Label(); lb.Text = "Request JSON:"; div.Controls.Add(lb); tx = new TextBox(); tx.Rows = 10; tx.ID = "RequestJSON"; tx.Width = Unit.Percentage(80.0); tx.TextMode = TextBoxMode.MultiLine; div.Controls.Add(tx); form1.Controls.Add(div); #endregion }