Esempio n. 1
0
        bool rfdteiqil_BeforePageChange(object o, RFDataTable.EventArgsForBeforePageChange e)
        {
            try
            {
                string currPageNum     = e.CurrPageNum;
                string perPageRowCount = e.PerPageRowCount;
                string exampleType     = (e.postData.TryGetValue("QExampleTypeList", out exampleType) ? exampleType : String.Empty).Replace("-", "");
                try
                {
                    vEL_QExampleType.Text = exampleType;
                }
                catch (Exception exa)
                {
                }
                // SRExample.ResultMsg cwrRsultMsg = RequestAttendanceRecordsQueryListData(beginDate: beginDate, endDate: endDate, nowPage: currPageNum, pageSize: perPageRowCount);
                SRExample.ResultMsg resultMsg = GetExampleItem(type: exampleType, pageNum: currPageNum, perPageRowCount: perPageRowCount);
                if (resultMsg.RetCode != RequestBus.RetCode.success.ToString())
                {
                }
                else
                {
                }
                // List<Dictionary<String, String>> ldss = RequestBus.ConvertResultMsgObj(resultMsg.Obj);

                // (o as RFDataTable).ResultMsgFromService.Obj = resultMsg.Obj;
                (o as RFDataTable).ResultMsgFromService.Obj     = resultMsg.Obj;
                (o as RFDataTable).ResultMsgFromService.RetCode = resultMsg.RetCode;
            }
            catch (Exception ex)
            {
            }
            return(true);
        }
Esempio n. 2
0
            /// <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);
            }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
            /// <summary>
            /// 获取SRExample查询结果。
            /// </summary>
            /// <param name="p"></param>
            /// <param name="jsonText"></param>
            /// <param name="obj"></param>
            /// <param name="specifiedFields"></param>
            /// <param name="keyIDpair"></param>
            /// <returns></returns>
            internal SRExample.ResultMsg GetSRExampleResultMsg(string serviceName = "", string methodName = "", string jsonText = "", RequestBus.Passengers obj = null, Dictionary <string, string> specifiedFields = null, Dictionary <string, string> keyIDpair = null)
            {
                Type t = typeof(SRExample.ResultMsg);

                SRExample.ServiceSoapClient ssc       = new SRExample.ServiceSoapClient();
                SRExample.ResultMsg         resultMsg = null;
                try
                {
                    if (null != obj)
                    {
                        GB.Authorization gba = new Authorization();
                        // jsonText = gba.GetJsonTextWithSignName("WPWeb", obj: obj, specifiedFields: specifiedFields, keyIDpair: keyIDpair);
                        jsonText = gba.GetJsonTextWithSignName(serviceName: serviceName, methodName: methodName, methodParamObjectArray: new object[] { obj, specifiedFields, keyIDpair });
                        // Response.Write(jsonText);
                    }
                    else
                    {
                    }
                    resultMsg = (RF.GlobalClass.Utils.Do.MagicMethod <SRExample.ServiceSoapClient, Func <SRExample.ServiceSoapClient, String, SRExample.ResultMsg> >(typeof(SRExample.ServiceSoapClient).GetMethod(methodName, new[] { typeof(string) })))(ssc, jsonText) as SRExample.ResultMsg;
                }
                catch (Exception Exception)
                {
                    throw Exception;
                }
                try
                {
                    if (null == resultMsg)
                    {
                        Response.ClearContent();
                        RequestBus.ajaxResponseOfResultMsgNull(Response: Response);
                        Response.End();
                        return(resultMsg);
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {
                }
                return(resultMsg);
            }
Esempio n. 5
0
 private SRExample.ResultMsg GetExampleItem(String type = "", String pageNum = "1", String perPageRowCount = "10")
 {
     SRExample.ResultMsg resultMsg = new SRExample.ResultMsg();
     try
     {
         RequestBus.Passengers psg = new RequestBus.Passengers();
         psg.passenger0 = "0";
         psg.passenger1 = pageNum;
         psg.passenger2 = perPageRowCount;
         psg.passenger3 = type;
         resultMsg      = GBW.GetSRExampleResultMsg(serviceName: "SRExample",
                                                    methodName: "GetExampleItem",
                                                    obj: psg,
                                                    specifiedFields: RequestBus.SRExampleGetRequestSpecifiedFields,
                                                    keyIDpair: RequestBus.SRExampleGetRequestKeyIDPair);
         // [{"id":"0","code":"0","name":"QueryExample","status":"1","description":"with dropdownlist, view request exmaple","url":""}]'
     }
     catch (Exception ex)
     {
     }
     return(resultMsg);
 }
Esempio n. 6
0
 private SRExample.ResultMsg GetExampleType()
 {
     SRExample.ResultMsg resultMsg = new SRExample.ResultMsg();
     try
     {
         RequestBus.Passengers psg = new RequestBus.Passengers();
         psg.passenger0 = "0";
         psg.passenger1 = "0";
         psg.passenger2 = "0";
         psg.passenger3 = "3";
         // carfs.CARFSecurer.Program.GetEncrytedMessage(encrytionName: RF.GlobalClass.Utils.Convert.EnumValueToString(enumValue: carfs.RF.GlobalClass.Securer.Names.MD5), originMessage: "");
         resultMsg = GBW.GetSRExampleResultMsg(serviceName: "SRExample",
                                               methodName: "GetExampleType",
                                               obj: psg,
                                               specifiedFields: RequestBus.SRExampleGetRequestSpecifiedFields,
                                               keyIDpair: RequestBus.SRExampleGetRequestKeyIDPair);
     }
     catch (Exception ex)
     {
     }
     return(resultMsg);
     // [{"code":"1","name":"Web"}]
 }
        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;
            }
        }