/// <summary> /// Get data for table list /// </summary> /// <param name="tableName"></param> /// <param name="tableNameSpace"></param> /// <param name="tableCurrPageNum"></param> /// <param name="tablePerPageRowCount"></param> /// <param name="beforePageChange"></param> /// <param name="whenPageChange"></param> /// <param name="afterPageChange"></param> /// <param name="request"></param> /// <param name="response"></param> /// <param name="table"></param> /// <param name="columnKeyIDPair"></param> /// <param name="perPageRowCountControl"></param> /// <param name="currPageNumControl"></param> /// <param name="pageTatolCountControl"></param> /// <param name="rowTotalCountControl"></param> /// <param name="perPageRowCountName"></param> /// <param name="currPageNumName"></param> /// <param name="pageTotalCountName"></param> /// <param name="rowTotalCountName"></param> /// <param name="jumpingDataName"></param> /// <param name="perPageRowCountParamName"></param> /// <param name="dataSet"></param> /// <example> /// <code language="CSharp" description=""> /// WebAppOffice.GB.WebReference.getDataForListTable(tableName: "", tableNameSpace: "", tableCurrPageNum: "1", tablePerPageRowCount: "10", /// beforePageChange: (new WebAppOffice.RFDataTable.BeforePageChangeHandler(rfdtarql_BeforePageChange)), /// whenPageChange: (new WebAppOffice.RFDataTable.WhenPageChangeHandler(rfdtarql_WhenPageChange)), /// afterPageChange: (new WebAppOffice.RFDataTable.AfterPageChangeHandler(rfdtarql_AfterPageChange)), /// request: Request, response: Response, /// table: v2_TableInformationQueryItemList, /// columnKeyIDPair: new Dictionary<string, string> { /// { "Code", "dptid" }, { "Name", "dptdes" }, /// { "Address", "adr1" }, { "PhoneNumber", "tel" }, /// {"Section","prtdptid"},{"EffectsRadius","jl"}, /// {"MasterName","xm"},{"MasterPhoneNumber","sj"}, /// {"SectionDirectorName","prtdz"},{"SectionDirectorPhoneNumber","prtdztel"} }, /// perPageRowCountControl: v2_TableInformationQueryItemList_PerPageRowCount, /// currPageNumControl: v2_TableInformationQueryItemList_CurrPageNum, /// pageTatolCountControl: v2_TableInformationQueryItemList_PageTotalCount, /// rowTotalCountControl: v2_TableInformationQueryItemList_RowTotalCount, /// perPageRowCountName: "PerPageRowCount", /// currPageNumName: "CurrPageNum", /// pageTotalCountName: "pageTotalCount", /// rowTotalCountName: "RowTotalCount", /// jumpingDataName: "jumpdata", /// perPageRowCountParamName: "PerPageRowCount", dataSet:dataSet); /// </code> /// </example> public static void getDataForListTable(string tableName, string tableNameSpace, string tableCurrPageNum, string tablePerPageRowCount, RFDataTable.BeforePageChangeHandler beforePageChange, RFDataTable.WhenPageChangeHandler whenPageChange, RFDataTable.AfterPageChangeHandler afterPageChange, HttpRequest request, HttpResponse response, System.Web.UI.WebControls.Table table, Dictionary <string, string> columnKeyIDPair, System.Web.UI.WebControls.DropDownList perPageRowCountControl, System.Web.UI.WebControls.TextBox currPageNumControl, System.Web.UI.WebControls.Label pageTatolCountControl, System.Web.UI.WebControls.Label rowTotalCountControl, string perPageRowCountName, string currPageNumName, string pageTotalCountName, string rowTotalCountName, string jumpingDataName, string perPageRowCountParamName, System.Data.DataSet dataSet, RFDataTable rfDataTable) { Dictionary <string, string> dssPost = new Dictionary <string, string>(); Dictionary <string, string> dssPut = RequestBus.GetPutData(request); Dictionary <String, List <Dictionary <string, string> > > dsldssPost = RequestBus.GetPostData <Dictionary <String, List <Dictionary <string, string> > > >(request); AjaxResponse ar = new AjaxResponse(); ar.data = dsldssPost; string jumpdata = RequestBus.Param(jumpingDataName); List <Dictionary <string, string> > ldss = new List <Dictionary <string, string> >(); rfDataTable = rfDataTable ?? new RFDataTable(tableName, request: request, response: response); rfDataTable.Name = tableName ?? rfDataTable.Name; tableName = rfDataTable.Name; if (null != dsldssPost && ((dsldssPost.TryGetValue(jumpdata, out ldss)) || dsldssPost.ContainsKey(tableName + perPageRowCountParamName))) { #region set data to the view // ldss[0].TryGetValue("", out jumpdata); dssPost = (ldss.Count > 0 ? (ldss[0] ?? dssPost) : dssPost); dssPut.ToList().ForEach(x => dssPost[x.Key] = dssPost.ContainsKey(x.Key) ? dssPost[x.Key] : x.Value); //string beginDate = v0_BeginDate.Text = dssPost.TryGetValue("BeginDate", out beginDate) ? beginDate : String.Empty; //string endDate = v0_EndDate.Text = dssPost.TryGetValue("EndDate", out endDate) ? endDate : String.Empty; perPageRowCountControl.Text = tablePerPageRowCount ?? perPageRowCountControl.Text; tablePerPageRowCount = perPageRowCountControl.Text = dssPost.TryGetValue(tableName + perPageRowCountName, out tablePerPageRowCount) ? tablePerPageRowCount : perPageRowCountControl.Text; tableCurrPageNum = currPageNumControl.Text = dssPost.TryGetValue(tableName + currPageNumName, out tableCurrPageNum) ? tableCurrPageNum : tableCurrPageNum; string TablePageTotalCount = pageTatolCountControl.Text = dssPost.TryGetValue(tableName + pageTotalCountName, out TablePageTotalCount) ? TablePageTotalCount : tableCurrPageNum; string TableRowTotalCount = rowTotalCountControl.Text = dssPost.TryGetValue(tableName + rowTotalCountName, out TableRowTotalCount) ? TableRowTotalCount : "X"; #endregion } else { } int perPageRowCount = int.TryParse(tablePerPageRowCount, out perPageRowCount) ? perPageRowCount : 5; rfDataTable.BeforePageChange += new RFDataTable.BeforePageChangeHandler(beforePageChange); rfDataTable.WhenPageChange += new RFDataTable.WhenPageChangeHandler(whenPageChange); rfDataTable.AfterPageChange += new RFDataTable.AfterPageChangeHandler(afterPageChange); dataSet.Tables.Add(rfDataTable.ChangePageTo( currPage: tableCurrPageNum, perPageRowCount: perPageRowCount.ToString(), dssPostData: dssPost, dataTableName: tableName, dataTableNamespace: tableNameSpace, columnKeyIDPair: columnKeyIDPair, t: table)); }
protected void Page_Load(object sender, EventArgs e) { Dictionary <string, string> dss = RequestBus.GetPutData(Request: Request); string moduleIDStr = String.Empty; if (!dss.TryGetValue("PageRoleID", out moduleIDStr)) { moduleIDStr = ModuleID.Value; } else { ModuleID.Value = moduleIDStr; vEQ_ModuleID.Text = moduleIDStr; vEL_ModuleID.Text = moduleIDStr; } GBA = RequestBus.getGBA(Response: Response, moduleID: moduleIDStr, openName: "WangZhi", methodName: ""); // getGBA(Response, ModuleID.Value); GBW = RequestBus.getGBW(Response: Response); // getGBW(Response); dataSet = new DataSet(); if (!IsPostBack) { InitPage(); } else { ReLoadPage(); } try { IEV = RF.GlobalClass.Utils.WebBrowser.getInternetExplorerVersion(Request); WV = float.Parse(RF.GlobalClass.Utils.WebBrowser.getPlatform(Request).ToString()); GBW.CheckIEBrowser(Request: Request); } catch (Exception ex) { // Response.Write(ex.Message); } }
/// <summary> /// Combine put data and post data together into Dictionary<string string> /// </summary> /// <param name="Request"></param> /// <returns></returns> public static Dictionary <string, string> GetPostPutData(HttpRequest Request) { Dictionary <string, string> dssPut = RequestBus.GetPutData(Request) ?? new Dictionary <string, string>(); Dictionary <String, List <Dictionary <string, string> > > dsldssPost = null; Dictionary <string, string> dssPost = new Dictionary <string, string>(); #region get post data try { try { string data = RF.GlobalClass.WebForm.getPostData(Request); dssPost = (Dictionary <string, string>)RF.GlobalClass.Utils.Convert.JSONToObject(data, type: typeof(Dictionary <string, string>)); if (null != dssPost && dssPost.ContainsKey("data")) { data = System.Web.HttpUtility.UrlDecode(dssPost["data"], System.Text.Encoding.UTF8); try { dssPost = (Dictionary <string, string>)RF.GlobalClass.Utils.Convert.JSONToObject(data, type: typeof(Dictionary <string, string>)); }catch (Exception ea) { try { dsldssPost = (Dictionary <String, List <Dictionary <string, string> > >)RF.GlobalClass.Utils.Convert.JSONToObject(data, type: typeof(Dictionary <String, List <Dictionary <string, string> > >)); } catch (Exception ex) { } } } else { dssPost = dssPost ?? new Dictionary <String, String>(); } } catch (Exception ex) { } } catch (Exception ex) { } #endregion //AjaxResponse ar = new AjaxResponse(); //ar.data = dsldssPost; string jumpdata = RequestBus.Param("jumpdata"); List <Dictionary <string, string> > ldss = new List <Dictionary <string, string> >(); //Response.Write(RF.GlobalClass.Utils.Convert.ObjectToJSON(dssPost)); //Response.Write("##"); //Response.Write(RF.GlobalClass.Utils.Convert.ObjectToJSON(dssPut)); //Response.Write("##"); //Response.Write("##"); //Response.Write(RF.GlobalClass.Utils.Convert.ObjectToJSON(dsldssPost)); //Response.Write("##"); //Response.Write("##"); //Response.Write("##"); //Response.Write((RF.GlobalClass.Utils.Convert.JSONToObject<Dictionary<String, String>>(Request.Params[jumpdata]) as Dictionary<string, string>)["BusinessClass"]); //{jumpdata:new List<Dictionary<String,String>>(){(RF.GlobalClass.Utils.Convert.JSONToObject<Dictionary<string, string>>(dssPut[jumpdata]) as Dictionary<string, string> )} }) string tmpText = String.Empty; if (null == dsldssPost && dssPut.TryGetValue(jumpdata, out tmpText)) { try { dsldssPost = (new Dictionary <String, List <Dictionary <String, String> > >()); dsldssPost.Add(jumpdata, new List <Dictionary <String, String> >() { (RF.GlobalClass.Utils.Convert.JSONToObject <Dictionary <string, string> >(tmpText) as Dictionary <string, string>) }); } catch (Exception ex) { } } else { } if (null != dsldssPost && dsldssPost.TryGetValue(jumpdata, out ldss)) { try { foreach (KeyValuePair <string, string> _kvp in ldss.FirstOrDefault <Dictionary <String, String> >()) { dssPost[_kvp.Key] = dssPost.ContainsKey(_kvp.Key)? (dssPost[_kvp.Key] ?? _kvp.Value): _kvp.Value; } //tmpText = System.Text.RegularExpressions.Regex.Replace(tmpText, ",\"TableQueryItemListPerPageRowCount.*$", "}"); //dsldssPost = (new Dictionary<String, List<Dictionary<String, String>>>()); //dsldssPost.Add(jumpdata, new List<Dictionary<String, String>>() { (RF.GlobalClass.Utils.Convert.JSONToObject<Dictionary<string, string>>(tmpText) as Dictionary<string, string>) }); } catch (Exception ex) { } } else { } dssPut.ToList().ForEach(x => dssPost[x.Key] = dssPost.ContainsKey(x.Key) ? dssPost[x.Key] : x.Value); return(dssPost); }
protected void MultiViewMenu_Load(object sender, EventArgs e) { Dictionary <string, string> dss = RequestBus.GetPutData(Request: Request); string check = String.Empty; string change = string.Empty; string view = String.Empty; int viewIndex = 0; if (dss.TryGetValue("go", out check)) { switch (check) { default: break; } } else { } if (dss.TryGetValue("do", out check)) { switch (check) { //case "addJobTransfer": // addJobTransfer(); // break; //case "checkJobTransfer": // checkJobTransfer(); //break; default: break; } } //else if (dss.TryGetValue("ChangeExampleInformationQueryItemListPerPageRowCountTo", out change)) //{ // DrawItemListTable(); // // reloadMainInformationQueryItemList(change); //} else if (dss.TryGetValue("ChangeExampleInformationQueryItemListPageTo", out change)) { 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(delegate(object o, RFDataTable.EventArgsForAfterPageChange _e) { return(!rfdteiqil_AfterPageChange(o, _e)); }); rfdteiqil.ChangePageTo(currPage: change , perPageRowCount: "0" , dataTableName: "TableExampleInformationQueryItemList" , dataTableNamespace: "ExampleList" , columnKeyIDPair: new Dictionary <string, string> { { "RowCount", "id" } , { "Code", "code" } , { "Name", "name" } , { "Status", "status" } , { "Description", "description" } }); } else if (dss.TryGetValue("view", out view) && !int.TryParse(view, out viewIndex)) { try { MultiViewMenu.SetActiveView(MultiViewMenu.FindControl(view) as View); } catch (Exception ex) { MultiViewMenu.ActiveViewIndex = viewIndex; } } else { try { int.TryParse(view, out viewIndex); MultiViewMenu.ActiveViewIndex = viewIndex; } catch (Exception ex) { MultiViewMenu.ActiveViewIndex = MultiViewMenu.Views.Count - 1; RequestBus.jumpToAuthorization(Response: Response); } } }