/// <summary> /// 获取权限 /// </summary> /// <param name="signName"></param> /// public string RequestPowerID(string moduleID = "") { string resultStr = ""; moduleID = "" == moduleID ? ModuleID : moduleID; //string jsonText = @"{""empid"":'"+userSession.empid+@"',""mdlid"":'0018',""clsid"":'getPWR',""TimeStamp"":'2013-11-13 10:42:35',""OpenName"":'rfOaService',""Sign"":'" + signName + @"',""MethodName"":'redforce'}"; string pwrid = (UserSession.empid == "47" ? "01" : ""); string jsonText = GetJsonTextWithSignName("GetPwr" , @"{""empid"":'" + UserSession.empid + @"',""mdlid"":'" + moduleID + @"',""clsid"":'getPWR'" + @",""TimeStamp"":'" + RequestBus.GetDateTimeString(DateTime.Now) + @"',""OpenName"":'" + OpenName + @"',""Sign"":'" + SignName + @"',""MethodName"":'" + MethodName + @"'}"); //Response.Write(nm.GetPwr(jsonText).Obj); //SRExample.ResultMsg resultMsg = (new GB.WebReference(response: Response)) // .GetSRExampleResultMsg("ExampleData", jsonText); string interfaceName = "GetPowerInfo"; jsonText = GetJsonTextWithSignName(methodName: interfaceName, jsonText: ""); SRExample.ResultMsg resultMsg = (new GB.WebReference(response: Response)) .GetResultMsg <SRExample.ServiceSoapClient, Func <SRExample.ServiceSoapClient, String, SRExample.ResultMsg>, SRExample.ResultMsg>(serviceSoapClient: new SRExample.ServiceSoapClient(), interfaceName: interfaceName, jsonText: jsonText); if (null != resultMsg && null != resultMsg.Obj) { if ("00" == resultMsg.RetCode) { RequestBus.ConvertResultMsgObj(resultMsg.Obj); List <Dictionary <string, string> > power = RequestBus.ConvertResultMsgObj(resultMsg.Obj); //Power power = (Power)RequestBus.JsonConvertDeserializeObject(resultMsg.Obj.ToString(), type:typeof(Power)) ?? new Power(); resultStr = 0 == power.Count ? pwrid : (power[0]["powerID"] ?? pwrid).ToString().Trim() ?? pwrid; } else { resultStr = ""; } } else { } PowerID = resultStr; return(resultStr); }
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; }
void btnSendRequest_Click(object sender, EventArgs e) { Dictionary <string, string> specifiedFields = new Dictionary <string, string>(); Dictionary <string, string> keyIDPair = new Dictionary <string, string>(); cc.Controls.Select(delegate(Control c) { string t = ((TextBox)c).Text; string cID = c.ID; if (dssKeyIDPair.ContainsValue(cID)) { cID = dssKeyIDPair.Keys.Where(delegate(string _i) { return(dssKeyIDPair[_i] == cID); }).FirstOrDefault <string>(); } else { } passengers.GetType().GetProperty(cID).SetValue(passengers, t, null); keyIDPair[cID] = c.ID; if (cID != "Sign") { if ((form1.FindControl("cb_" + c.ID) as CheckBox).Checked) { specifiedFields[c.ID] = (c as TextBox).ToolTip ?? String.Empty; if (String.IsNullOrEmpty(specifiedFields[c.ID])) { // openWith.Add(c.ID, t); } else { // openWith.Add(specifiedFields[c.ID], t); } } else { // openWith.Add(c.ID, t); } } else { } return(c); }).ToArray(); string sign = String.Empty; ((Dictionary <string, string>)RF.GlobalClass.Utils.Convert.JSONToObject(GBA.GetJsonTextWithSignName(methodName: ((DropDownList)form1.FindControl("InterfaceName")).Text, methodParamObjectArray: new Object [] { passengers, specifiedFields, keyIDPair }), type: typeof(Dictionary <string, string>))).TryGetValue("Sign", out sign); ((TextBox)form1.FindControl("Sign")).Text = sign; passengers.passenger0 = sign; // SRExample.ResultMsg resultMsg = GBW.GetSRExampleResultMsg(((DropDownList)form1.FindControl("InterfaceName")).Text, obj: passengers, specifiedFields: specifiedFields, keyIDpair: keyIDPair); #region test string @namespace = "WAExample"; AppDomain.CurrentDomain.GetAssemblies().SelectMany(t => t.GetTypes()) .Where(t => t.IsClass && t.Namespace == @namespace && t.Name == serviceName).FirstOrDefault(); var q = from t in System.Reflection.Assembly.GetExecutingAssembly().GetTypes() where t.IsClass && t.Namespace == @namespace && t.Name == serviceName select t; q.ToList().ForEach(t => Console.WriteLine(t.Name)); #endregion GB.Authorization gba = new WAExample.GB.Authorization(); string jsonText = gba.GetJsonTextWithSignName(methodName: interfaceName, jsonText: String.Empty, methodParamObjectArray: new object[] { passengers, specifiedFields, keyIDPair }); var gim = GBW.GetInterfaceMethod <SRExample.ServiceSoapClient, SRExample.ResultMsg, Func <SRExample.ServiceSoapClient, String, SRExample.ResultMsg> >(interfaceName: ((DropDownList)form1.FindControl("InterfaceName")).Text); SRExample.ResultMsg resultMsg = gim(new SRExample.ServiceSoapClient(), jsonText); resultMsg = GBW.GetResultMsg <SRExample.ServiceSoapClient , Func <SRExample.ServiceSoapClient, String, SRExample.ResultMsg> , SRExample.ResultMsg > (serviceSoapClient: new SRExample.ServiceSoapClient(), interfaceName: ((DropDownList)form1.FindControl("InterfaceName")).Text, jsonText: "", obj: passengers, specifiedFields: specifiedFields, keyIDpair: keyIDPair) as SRExample.ResultMsg; resultMsg = GBW.GetResultMsg <SRExample.ServiceSoapClient , Func <SRExample.ServiceSoapClient, String, SRExample.ResultMsg> , SRExample.ResultMsg > (serviceSoapClient: new SRExample.ServiceSoapClient() , interfaceName: ((DropDownList)form1.FindControl("InterfaceName")).Text , jsonText: "", obj: passengers , specifiedFields: specifiedFields , keyIDpair: keyIDPair) as SRExample.ResultMsg; if (null != resultMsg) { ((TextBox)form1.FindControl("ResultMsgRetCode")).Text = resultMsg.RetCode; ((TextBox)form1.FindControl("ResultMsgRetMsg")).Text = resultMsg.RetMsg; ((TextBox)form1.FindControl("ResultMsgObj")).Text = RF.GlobalClass.Utils.Convert.ObjectToJSON(RequestBus.ConvertResultMsgObj(resultMsg.Obj)); ((TextBox)form1.FindControl("ResultMsgObjj")).Text = RF.GlobalClass.Utils.Convert.ObjectToJSON(RequestBus.ConvertResultMsgObjj(resultMsg.Obj)); } else { ((TextBox)form1.FindControl("ResultMsgRetCode")).Text = String.Empty; ((TextBox)form1.FindControl("ResultMsgRetMsg")).Text = String.Empty; ((TextBox)form1.FindControl("ResultMsgObj")).Text = String.Empty; } }
public void _ChangePageTo(string currPage = "0", string perPageRowCount = "0", Dictionary <string, string> dssPostData = null) { try { string date = string.Empty; Dictionary <string, string> dss = RequestBus.GetPostData(Request: Request) ?? dssPostData; AjaxResponse ar = new AjaxResponse(); #region set status ar.status = "success"; // ar.location = new Location(); // ar.location.search = "?view=1&date=" + date; #endregion Dictionary <string, AjaxResponse> dsar = new Dictionary <string, AjaxResponse>(); Dictionary <string, List <Dictionary <string, string> > > resultData = new Dictionary <string, List <Dictionary <string, string> > >(); List <Dictionary <string, string> > ldss = new List <Dictionary <string, string> >(); Boolean carryOnAfterEvent = false; #region TableInfo try { currPage = RequestBus.GetPageNum(currPage, dss: dss, currPageNumKeyName: this.Name + this.CurrPageNumKey, pageTotalCountKeyName: this.Name + this.PageTotalCountKey); perPageRowCount = "0" == perPageRowCount ? (dss.TryGetValue(this.Name + this.PerPageRowCountKey, out perPageRowCount) ? perPageRowCount : "5") : perPageRowCount; this.ResultMsgFromService = RequestPageData(dss, currPageNum: currPage, perPageRowCount: perPageRowCount); #region trigger Before PageChange event EventArgsForBeforePageChange eventArgsForBeforePageChange = new EventArgsForBeforePageChange(dss, currPageNum: currPage, perPageRowCount: perPageRowCount); if (false == OnBeforePageChange(eventArgsForBeforePageChange)) { return; } else { } #endregion RFDataTable.ServiceResultMsg resultMsg = this.ResultMsgFromService; if (null == resultMsg) { } else if ("00" != resultMsg.RetCode) { } else { #region trigger WhenPageChange event EventArgsForWhenPageChange eventArgsForWhenPageChange = new EventArgsForWhenPageChange(this.ResultMsgFromService); carryOnAfterEvent = OnPageChange(eventArgsForWhenPageChange); #endregion if (false != carryOnAfterEvent) { #region fill data to result //ldss = RequestBus.ConvertResultMsgObjj(resultMsg.Obj); // [{"dptid":"合计 ","zs":"1212","ROWSTAT":null},{"dptid":"6156 ","zs":"11","ROWSTAT":null},{"dptid":"1672 ","zs":"8","ROWSTAT":null}] ldss = RequestBus.ConvertResultMsgObjj(resultMsg.Obj); resultData[Name] = ldss; ldss = RequestBus.ConvertResultMsgObj(resultMsg.Obj); // [{"recordcount":"744","pagecount":"248","currentpage":"1"}] string recordCount = "", pageCount = "", currentPage = ""; ldss.ForEach(delegate(Dictionary <string, string> _dss) { _dss.TryGetValue(ServiceResultMsg.RecordCountName, out recordCount); _dss.TryGetValue(ServiceResultMsg.PageCountName, out pageCount); _dss.TryGetValue(ServiceResultMsg.CurrentPageName, out currentPage); }); currentPage = currentPage ?? currPage; int currentPageIndex = 0; int.TryParse(currentPage.Trim(), out currentPageIndex); currentPageIndex = --currentPageIndex; int rowTotalCount = 0; int pageTotalCount = 0; int.TryParse(recordCount.Trim(), out rowTotalCount); pageCount = pageCount == "0" ? "1" : pageCount; int.TryParse(pageCount.Trim(), out pageTotalCount); resultData[InfoName] = (new List <Dictionary <string, string> > { new Dictionary <string, string> { { RowTotalCountKey, recordCount }, { PerPageRowCountKey, Math.Max(int.Parse(perPageRowCount), (0 == pageTotalCount? 0: ((rowTotalCount) / (pageTotalCount) + (0 == (rowTotalCount) % (pageTotalCount)?0:1)))).ToString() }, { PageTotalCountKey, pageCount }, { CurrPageIndexKey, currentPageIndex.ToString() }, { CurrPageNumKey, currentPage }, { RowCheckedStatusKey, "false" } } }); #endregion } else { } } } catch (Exception ex) { } #endregion ar.data = resultData; dsar["d"] = ar; ResultDataToAjaxResponse = ar; #region trigger After PageChange event EventArgsForAfterPageChange eventArgsForAfterPageChange = new EventArgsForAfterPageChange(this.ResultDataToAjaxResponse); carryOnAfterEvent = OnAfterPageChange(eventArgsForAfterPageChange); #endregion if (false != carryOnAfterEvent) { Response.ClearContent(); Response.Write(RF.GlobalClass.Utils.Convert.ObjectToJSON(dsar)); // Response.End(); HttpContext.Current.Response.Flush(); // Sends all currently buffered output to the client. HttpContext.Current.Response.SuppressContent = true; // Gets or sets a value indicating whether to send HTTP content to the client. HttpContext.Current.ApplicationInstance.CompleteRequest(); // Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event. } else { } } catch (Exception ex) { Response.ClearContent(); AjaxResponse ar = new AjaxResponse(); Dictionary <string, AjaxResponse> dsar = new Dictionary <string, AjaxResponse>(); ar.status = "failure"; ar.message = "系统异常,请稍后再试。"; // ex.Message; dsar["d"] = ar; Response.Write(RF.GlobalClass.Utils.Convert.ObjectToJSON(dsar)); Response.End(); } }