コード例 #1
0
 public static GB.Authorization getGBA(HttpResponse Response = null, string moduleID = "0057", string openName = "WangZhi", string methodName = "")
 {
     // return pir.WAPublicInformationReference.RequestBus.getGBA(Response: Response, moduleID: moduleID, openName: openName, methodName: methodName) as WAPublicInformationReferenceB.GB.Authorization;
     GB.Authorization GBA = new GB.Authorization(response: Response);
     GBA.ModuleID   = moduleID;
     GBA.OpenName   = openName;
     GBA.MethodName = methodName;
     GBA.RequestUserSession();
     GBA.RequestPowerID();
     return(GBA);
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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
        }