Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                HttpContext.Current.Session[SessionName] = null;
                if (HttpContext.Current.Session["UserPower"] != null)
                {
                    List <string> sl = (List <string>)HttpContext.Current.Session["UserPower"];
                    if (!sl.Contains("3"))
                    {
                        Response.Write("<script language='JavaScript'>window.location='NoPower.aspx';</script>");
                        return;
                    }
                    if (!sl.Contains("1"))
                    {
                        btnSaveAs.Visible = false;
                    }
                }
                else
                {
                    Response.Write("<script language='JavaScript'>window.location='NoPower.aspx';</script>");
                    return;
                }
            }
            //根据横机、圆机或带子而调用不同的属性控件,因为它们的属性不一样。

            GekComments.Width        = 433;
            GekComments.Height       = 50;
            GekComments.ReadOnly     = true;
            GekComments.ID           = "GekComments";
            GekComments.ClientIDMode = System.Web.UI.ClientIDMode.Static;
            GekComments.Attributes.Add("style", "border:1px solid #FFA200");
            GekComments.TextMode     = TextBoxMode.MultiLine;
            GekComments.ClientIDMode = ClientIDMode.Static;
            string strMG = Request.QueryString["MG"] == null ? "Fabric" : Request.QueryString["MG"].ToString();

            if (strMG == "Fabric")  //圆机
            {
                ViewState["MGType"] = "Fabric";
                attribute           = (Attribute)Page.LoadControl("Attribute.ascx");
                //  gridCustomer = (CustomerEditForm)Page.LoadControl("CustomerEditForm.ascx");

                avaWidth = (AvaWidth)Page.LoadControl("AvaWidth.ascx");
                this.CFTAttribute.Controls.Add(attribute);
                this.AvaPanel.Controls.Add(avaWidth);
                this.gridCustomerPanle.Controls.Add(GekComments);
            }
            else if (strMG == "FlatKnit" || strMG == "Flat Knit Fabric") //横机
            {
                strMG = "FlatKnit";
                GekComments.Height   = 125;
                GekComments.Width    = 487;
                SalesComments.Height = 170;
                avaRemark.Visible    = false;
                ViewState["MGType"]  = "FlatKnit";
                flatAttribute        = (FlagAttribute)Page.LoadControl("FlagAttribute.ascx");
                // gridCustomer = (CustomerEditForm)Page.LoadControl("CustomerEditForm.ascx");
                this.CFTAttribute.Controls.Add(flatAttribute);
                this.labelGekComment.Visible = false;
                this.AWPanel.Text            = "GEK Comments";
                this.AvaPanel.Controls.Add(GekComments);
                this.labelGekComment.Visible = false;
            }
            else if (strMG == "Tapping")  //带子
            {
                GekComments.Height   = 175;
                GekComments.Width    = 487;
                SalesComments.Height = 95;
                ViewState["MGType"]  = "Tapping";
                tapAttribute         = (TappingAttribute)Page.LoadControl("TappingAttribute.ascx");
                //  gridCustomer = (CustomerEditForm)Page.LoadControl("CustomerEditForm.ascx");
                this.CFTAttribute.Controls.Add(tapAttribute);
                this.labelGekComment.Visible = false;
                this.AWPanel.Text            = "GEK Comments";
                avaRemark.Visible            = false;
                this.AvaPanel.Controls.Add(GekComments);
                this.labelGekComment.Visible = false;
            }


            if (Request.QueryString["QC"] != null)
            {
                //如果是"另存为"的情况(即页面地址中QC的参数不为NUll),还需要初始化界面,初始化的方式:调用前台的setGMType 进行初始化。


                ClientScript.RegisterClientScriptBlock(typeof(string), "js", "setGMType('" + strMG + "','" + Request.QueryString["QC"].ToString() + "','" + (Request.QueryString["customerId"] == null ? "" : Request.QueryString["customerId"].ToString()) + "');", true);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(typeof(string), "js", "setGMType('" + strMG + "','','');", true);
            }
        }