Example #1
0
    private void initCode()
    {
        //初始化下拉列表
        string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
        SqlCode1.SelectCommand = sql;
        SqlCode1.DataBind();
        SqlCode2.SelectCommand = sql;
        SqlCode2.DataBind();
        //txtPCode.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;
        //txtPCode1.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;
        //txtPCode2.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;

        string Sql2 = "  select pt_part from copy_pt_mstr order by pt_part";

        SqlICode.SelectCommand = Sql2;
        SqlICode.DataBind();

        string    Sql3 = "select DETECT_NAME from code_detect where pline_code in ( SELECT PLINE_ID FROM VW_USER_ROLE_PROGRAM WHERE USER_ID='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "')  ";
        DataTable dt3  = dc.GetTable(Sql3);

        ASPxListBoxUnused.DataSource = dt3;
        ASPxListBoxUnused.DataBind();
    }
    protected void btnCodeFilter_Click(object sender, EventArgs e)
    {
        if (Session["user"] == null || Session["access"] != "ADMIN")
        {
            Response.Redirect("../index.aspx");
        }


        string codeType = CodeTypeSearch.SelectedValue.Trim();
        string codeId   = CodeIdSearch.SelectedValue.Trim();

        if (codeType == "%" && codeId == "%")
        {
            Session["codemainselect"] = "SELECT *  FROM [CODE] ORDER BY [CODE_TYPE], [CODE_ID]";
            SqlCode.SelectCommand     = (string)Session["codemainselect"];
            gvCode.DataBind();
        }
        else if (codeType != "%" && codeId == "%")
        {
            Session["codemainselect"] = "SELECT * FROM [CODE] WHERE CODE_TYPE = '" + codeType + "' ORDER BY CODE_TYPE, CODE_ID";
            SqlCode.SelectCommand     = (string)Session["codemainselect"];
            gvCode.DataBind();
        }
        else if (codeType != "%" && codeId != "%")
        {
            Session["codemainselect"] = "SELECT * FROM [CODE] WHERE CODE_TYPE = '" + codeType + "' AND CODE_ID = '" + codeId + "' ORDER BY CODE_TYPE, CODE_ID";
            SqlCode.SelectCommand     = (string)Session["codemainselect"];
            SqlCode.DataBind();
            gvCode.DataBind();
        }
    }
Example #3
0
        /// <summary>
        /// 保存框架文件对应的SQL语句 By CYQ
        /// </summary>
        public void SaveSQL()
        {
            string msg;
            bool   result = SqlCode.SaveSourceCode(ObjName, Query <string>("sys_code"), out msg);

            jsonResult = JsonHelper.OutResult(result, result ? "保存成功!" : "保存失败!" + msg);
        }
Example #4
0
        //是点击按钮的时候才执行吗?
        //callback方式刷新gridview
        //protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        //{
        //    //ASPxGridView1.JSProperties.Add("cpCallbackValue", ".txt");
        //    string s = e.Parameters;
        //    string[] s1 = s.Split('|');
        //    if (s1.Length > 1)
        //    {
        //        if (s1[0] == "XLS")
        //        {
        //            //try
        //            //{
        //                //创建一个新的excel文档
        //                Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
        //                Workbooks wbks = excel.Workbooks;
        //                //若打开已有excel,把“true”替换成该excel的文件路径;
        //                //注:若新建一个excel文档,“xxx”替换成true即可;不过这里新建的excel文档默认只有一个sheet。
        //                _Workbook _wbk = wbks.Add(true);

        //                //取得sheet
        //                Sheets shs = _wbk.Sheets;
        //                //i是要取得的sheet的index
        //                _Worksheet _wsh = (_Worksheet)shs.get_Item(1);

        //                //_wsh.Cells[1, 1] = "
        //                //添加行
        //                //((Range)_wsh.Rows[11, Missing.Value]).Insert(Missing.Value, XlInsertFormatOrigin.xlFormatFromLeftOrAbove);
        //                //添加列
        //                //_wsh.get_Range(_wsh.Cells[1, 1], Missing.Value).Insert(Missing.Value, XlInsertShiftDirection.xlShiftToRight);
        //                //_wsh.get_Range(_wsh.Cells[1, 1], _wsh.Cells[_wsh.Rows.Count, 1]).Insert(Missing.Value, XlInsertShiftDirection.xlShiftToRight);
        //                //设置单元格颜色
        //                //((Range)_wsh.Rows[1, Missing.Value]).Interior.ColorIndex = 3;

        //                _wsh.Cells[1, 1] = "流水号";
        //                _wsh.Cells[1, 2] = "零件号";
        //                _wsh.Cells[1, 3] = "零件名称";
        //                _wsh.Cells[1, 4] = "数量";
        //                _wsh.Cells[1, 5] = "工序";
        //                _wsh.Cells[1, 6] = "工位";
        //                _wsh.Cells[1, 7] = "计划号";
        //                _wsh.Cells[1, 8] = "SO";
        //                _wsh.Cells[1, 9] = "地点";
        //                _wsh.Cells[1, 10] = "供应商";
        //                _wsh.Cells[1, 11] = "类型";
        //                _wsh.Cells[1, 12] = "保管员";

        //                for (int i = 0; i < ASPxGridView1.VisibleRowCount; i++)
        //                {
        //                    //添加行
        //                    //object a = ASPxGridView1.GetRow(i);
        //                    _wsh.Cells[i + 2, 1] = ASPxGridView1.GetRowValues(i, "GHTM");
        //                    _wsh.Cells[i + 2, 2] = ASPxGridView1.GetRowValues(i, "ABOM_COMP");
        //                    _wsh.Cells[i + 2, 3] = ASPxGridView1.GetRowValues(i, "ABOM_DESC");
        //                    _wsh.Cells[i + 2, 4] = ASPxGridView1.GetRowValues(i, "ABOM_QTY");
        //                    _wsh.Cells[i + 2, 5] = ASPxGridView1.GetRowValues(i, "ABOM_OP");
        //                    _wsh.Cells[i + 2, 6] = ASPxGridView1.GetRowValues(i, "ABOM_WKCTR");
        //                    _wsh.Cells[i + 2, 7] = ASPxGridView1.GetRowValues(i, "ABOM_JHDM");
        //                    _wsh.Cells[i + 2, 8] = ASPxGridView1.GetRowValues(i, "ABOM_SO");
        //                    _wsh.Cells[i + 2, 9] = ASPxGridView1.GetRowValues(i, "GZDD");
        //                    _wsh.Cells[i + 2, 10] = ASPxGridView1.GetRowValues(i, "ABOM_GYS");
        //                    _wsh.Cells[i + 2, 11] = ASPxGridView1.GetRowValues(i, "COMP_FLAG");
        //                    _wsh.Cells[i + 2, 12] = ASPxGridView1.GetRowValues(i, "BGY");
        //                    string compFlag = ASPxGridView1.GetRowValues(i, "COMP_FLAG").ToString();
        //                    switch (compFlag)
        //                    {
        //                        case "0":
        //                            //2代表白色
        //                            ((Range)_wsh.Rows[i + 2, Missing.Value]).Interior.ColorIndex = 2;
        //                            break;
        //                        case "1":
        //                            //3代表红色
        //                            ((Range)_wsh.Rows[i + 2, Missing.Value]).Interior.ColorIndex = 3;
        //                            break;
        //                        case "2":
        //                            //10代表不刺眼的绿色
        //                            ((Range)_wsh.Rows[i + 2, Missing.Value]).Interior.ColorIndex = 10;
        //                            break;
        //                        default:
        //                            return;
        //                    }
        //                }

        //                //如果目录不存在则创建目录
        //                //if (!Directory.Exists("C:\\tranlist\\Storage"))
        //                //{
        //                //    Directory.CreateDirectory("C:\\tranlist\\Storage");
        //                //}

        //                //屏蔽掉系统跳出的覆盖文件Alert
        //                excel.DisplayAlerts = false;
        //                _wbk.Saved = true;
        //                //保存到指定目录
        //                //替换点否会报错
        //                string theWriteFile = "Restruct" + System.DateTime.Now.ToString("yyyyMMddHHmmss");
        //                _wbk.SaveAs("C:\\tranlist\\" + theWriteFile + ".xls",
        //                Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value,
        //                Missing.Value, Missing.Value);
        //                //_wbk.SaveCopyAs("C:\\tranlist\\" + theWriteFile + ".xls");
        //                //用@的方法只是不会报错,但\显示不出来
        //                //showAlert(this, @"文件已保存至C:\excel\改制差异清单明细信息导出.xls");
        //                //加一个中文的双引号就不会有什么问题
        //                //showAlert(this, "文件已成功保存!");
        //                //设置回默认值
        //                excel.DisplayAlerts = true;

        //                excel.Quit();

        //                //释放掉多余的excel进程
        //                //??释放有问题,关闭电脑的时候会提示--将这些资源依次释放再设置为空,最后回收内存就不会再有问题
        //                System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
        //                System.Runtime.InteropServices.Marshal.ReleaseComObject((object)wbks);
        //                System.Runtime.InteropServices.Marshal.ReleaseComObject((object)_wbk);
        //                System.Runtime.InteropServices.Marshal.ReleaseComObject((object)shs);
        //                System.Runtime.InteropServices.Marshal.ReleaseComObject((object)_wsh);

        //                _wsh = null;
        //                shs = null;
        //                _wbk = null;
        //                wbks = null;
        //                excel = null;

        //                GC.Collect(0);

        //                try
        //                {
        //                    ASPxGridView1.JSProperties.Add("cpCallbackValue", theWriteFile + ".xls");
        //                }
        //                catch { }
        //            //}
        //            //catch
        //            //{
        //            //    showAlert(this, "导出失败!");
        //            //    return;
        //            //}
        //        }
        //    }
        //    else
        //    {
        //        //string theWriteFile = "";
        //        ASPxGridView1.JSProperties.Add("cpCallbackValue", ".xls");

        //    }

        //    setCondition();
        //}

        //初始化生产线
        private void initPlineCode()
        {
            string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

            SqlCode.SelectCommand = sql;
            SqlCode.DataBind();
        }
        public SqlCode DeleteCounsellor(int CounsellorID)
        {
            SqlClasses.Counsellors counsellorHelper = new SqlClasses.Counsellors();
            SqlCode code = counsellorHelper.DeleteCounsellor(CounsellorID);

            return(code);
        }
Example #6
0
 static void LoadViewSchema(object para)
 {
     try
     {
         Dictionary <string, string> fileList = SqlCode.FileList;
         if (fileList != null && fileList.Count > 0)
         {
             foreach (KeyValuePair <string, string> item in fileList)
             {
                 if (item.Key.StartsWith("V_"))//视图文件
                 {
                     string sql = "";
                     if (item.Value.Contains(":\\"))//存档的是文件路径
                     {
                         sql = SqlCode.GetCode(item.Key);
                     }
                     else
                     {
                         sql = item.Value;
                     }
                     if (sql.IndexOf('@') == -1)//仅处理无参数的。
                     {
                         DBTool.GetColumns(sql, GetConn(sql));
                     }
                 }
             }
         }
     }
     catch
     {
     }
 }
        public SqlCode UpdateCounsellor(Classes.Counsellor Counsellor)
        {
            SqlClasses.Counsellors counsellorHelper = new SqlClasses.Counsellors();
            SqlCode code = counsellorHelper.UpdateCounsellor(Counsellor);

            return(code);
        }
        public SqlCode DeleteLogin(string Username)
        {
            SqlClasses.Logins loginHelper = new SqlClasses.Logins();
            SqlCode           code        = loginHelper.DeleteLogin(Username);

            return(code);
        }
        public SqlCode UpdateLogin(Classes.Login Login)
        {
            SqlClasses.Logins loginHelper = new SqlClasses.Logins();
            SqlCode           code        = loginHelper.UpdateLogin(Login);

            return(code);
        }
        public SqlCode UpdateAppointment(Classes.Appointment Appointment)
        {
            SqlClasses.Appointments appHelper = new SqlClasses.Appointments();
            SqlCode code = appHelper.UpdateAppointment(Appointment);

            return(code);
        }
Example #11
0
        /// <summary>
        /// 保存框架文件对应的SQL语句 By CYQ
        /// </summary>
        public void SaveSQL()
        {
            string msg;
            bool   result = SqlCode.SaveSourceCode(ObjName, Query <string>("sys_code"), out msg);

            jsonResult = JsonHelper.OutResult(result, result ? LangConst.SaveSuccess : LangConst.SaveError + msg);
        }
        public SqlCode DeleteAppointment(int AppointmentID)
        {
            SqlClasses.Appointments appHelper = new SqlClasses.Appointments();
            SqlCode code = appHelper.DeleteAppoinment(AppointmentID);

            return(code);
        }
Example #13
0
        /// <summary>
        /// 获取框架文件对应的SQL语句 By CYQ
        /// </summary>
        public void GetSQL()
        {
            string sql    = SqlCode.GetSourceCode(ObjName);
            bool   result = !string.IsNullOrEmpty(sql);

            jsonResult = JsonHelper.OutResult(result, sql);
        }
        public SqlCode DeleteClient(Classes.Client Client)
        {
            SqlClasses.Clients clientHelper = new SqlClasses.Clients();
            SqlCode            code         = clientHelper.DeleteClient(Client);

            return(code);
        }
Example #15
0
    private void initCode()
    {
        //初始化用户下拉列表
        string sql = "SELECT PLINE_CODE,PLINE_NAME FROM CODE_PRODUCT_LINE WHERE COMPANY_CODE = '" + theCompanyCode + "' ORDER BY PLINE_CODE";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
    }
Example #16
0
    private void initCode()
    {
        //初始化生产线下拉列表
        string sql = "select pline_code,pline_name from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
    }
Example #17
0
    private void initCode()
    {
        //初始化工位下拉列表
        string sql = "SELECT distinct STATION_NAME  LOCATION_NAME FROM CODE_STATION WHERE COMPANY_CODE = '" + theCompanyCode + "' and pline_code in ((select pline_id from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "')) ORDER BY LOCATION_NAME";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
    }
Example #18
0
    private void initCode()
    {
        //初始化生产线下拉列表
        string sql = "select a.depotid pline_code,a.depotname pline_name from dp_dmdepot a left join REL_USER_DMDEPOT b on a.depotid=b.depotid where b.user_code='" + theUserCode + "' and b.PROGRAM_CODE='INV9700'  ";

        //string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";
        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
    }
Example #19
0
    private void initCode()
    {
        //初始化下拉列表
        string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
        //txtPCode.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;
    }
Example #20
0
        private void initCode()
        {
            //初始化下拉列表
            string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

            SqlCode.SelectCommand = sql;
            SqlCode.DataBind();
            //string sql2 = "select distinct a.plan_code  from data_plan where ";
            //SqlPlanCode.SelectCommand = sql2;
            //SqlPlanCode.DataBind();
        }
Example #21
0
 protected void btnSaveCode_Click(object sender, EventArgs e)
 {
     SqlCode.InsertParameters["Code_Type"].DefaultValue        = txtCodeType.Text.ToUpper().Trim();
     SqlCode.InsertParameters["Code_Description"].DefaultValue = txtCodeDescription.Text.ToUpper().Trim();
     SqlCode.Insert();
     gvCode.DataBind();
     PaneladdCode.Visible    = false;
     PanelgvCode.Visible     = true;
     txtCodeType.Text        = string.Empty;
     txtCodeDescription.Text = string.Empty;
 }
Example #22
0
    private void initCode()
    {
        //初始化生产线下拉列表
        string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
        //txtPCode.SelectedIndex = txtPCode.Items.Count >= 0 ? 0 : -1;
        string sql2 = "select STATION_CODE,STATION_NAME from CODE_STATION where pline_code in(select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "') order by STATION_NAME";

        StationCode.SelectCommand = sql2;
        StationCode.DataBind();
    }
        public IActionResult OnPostDelete(int ClientID)
        {
            ResolutionsSystem rs = new ResolutionsSystem();

            Classes.Client client = new Client()
            {
                ClientID = ClientID
            };

            SqlCode code = rs.DeleteClient(client);

            System.Diagnostics.Debug.WriteLine($"Deleting client {ClientID}");
            return(new RedirectToPageResult("ViewClients"));
        }
Example #24
0
        private void AddTestLogin()
        {
            string password = Util.HashPassword("password");

            //System.Diagnostics.Debug.WriteLine(password);

            Classes.Login login = new Classes.Login()
            {
                Username  = "******",
                Password  = password,
                StaffType = "Counsellor"
            };

            ResolutionsSystem rs   = new ResolutionsSystem();
            SqlCode           code = rs.CreateLogin(login);
        }
Example #25
0
        public IActionResult OnGet()
        {
            string username = GetSessionValue("Username");

            if (username == null || username == string.Empty)
            {
                return(new RedirectToPageResult("Index"));
            }

            if (AppointmentID == null)
            {
                return(new RedirectToPageResult("Index"));
            }

            ResolutionsSystem rs   = new ResolutionsSystem();
            SqlCode           code = rs.DeleteAppointment((int)AppointmentID);

            return(new RedirectToPageResult("ViewAppointments"));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user"] == null || Session["access"] != "ADMIN")
        {
            Response.Redirect("../index.aspx");
        }

        if (!IsPostBack)
        {
            Session["codemainselect"] = "SELECT *  FROM [CODE] ORDER BY [CODE_TYPE], [CODE_ID]";
            SqlCode.SelectCommand     = (string)Session["codemainselect"];
            SqlCode.DataBind();
        }
        if (IsPostBack)
        {
            SqlCode.SelectCommand = (string)Session["codemainselect"];
            SqlCode.DataBind();
        }
    }
    protected void btnUpdateCode_Click(object sender, EventArgs e)
    {
        if (Session["user"] == null || Session["access"] != "ADMIN")
        {
            Response.Redirect("../index.aspx");
        }

        string UserName    = (string)Session["commonname"];
        string CurrentDate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString();

        SqlCode.UpdateParameters["CODE_ISN"].DefaultValue         = codeisn.Value;
        SqlCode.UpdateParameters["CODE_TYPE"].DefaultValue        = txtCodeType.Text;
        SqlCode.UpdateParameters["CODE_ID"].DefaultValue          = txtCodeId.Text;
        SqlCode.UpdateParameters["CODE_DESCRIPTION"].DefaultValue = txtCodeDescription.Text;
        SqlCode.UpdateParameters["CODE_STATUS"].DefaultValue      = rbCodeEnablelist.SelectedValue;
        SqlCode.UpdateParameters["UPDATED_BY"].DefaultValue       = UserName.ToUpper().Trim();
        SqlCode.UpdateParameters["UPDATED_DATE"].DefaultValue     = CurrentDate;

        try
        {
            SqlCode.Update();
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("alert('Record Updated Successfully');");
            sb.Append("$('#editModal').modal('hide');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AddHideModalScript", sb.ToString(), false);
            gvCode.DataBind();
            upCode.Update();
        }
        catch
        {
            editError.Text      = "An error has occured in updation of Record";
            editError.ForeColor = System.Drawing.Color.Red;
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#editModal').modal('show');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AddHideModalScript", sb.ToString(), false);
        }
    }
Example #28
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            Client AddClient = new Client();

            AddClient.FirstName  = FName;
            AddClient.LastName   = LName;
            AddClient.MiddleName = MName;
            AddClient.Email      = Email;
            AddClient.Phone      = Phone;
            AddClient.Address    = Address;

            ResolutionsSystem rs   = new ResolutionsSystem();
            SqlCode           code = rs.CreateClient(AddClient);

            return(new RedirectToPageResult("Index"));
        }
Example #29
0
    private void initCode()
    {
        //初始化生产线下拉列表
        string sql = "select distinct a.pline_code,b.pline_name,a.pline_id from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

        SqlCode.SelectCommand = sql;
        SqlCode.DataBind();
        DataTable dt   = dc.GetTable(sql);
        string    sql2 = "";

        if (dt.Rows.Count > 0)
        {
            sql2 = "select distinct location_code from code_location where pline_code ='" + dt.Rows[0][2].ToString() + "' ORDER BY LOCATION_CODE";
        }
        else
        {
            sql2 = "select distinct location_code from code_location where pline_code in (select pline_id from vw_user_role_program where user_id='" + theUserId + "' and program_code='" + theProgramCode + "' and company_code='" + theCompanyCode + "') ORDER BY LOCATION_CODE";
        }
        SqlRLocation.SelectCommand = sql2;
        SqlRLocation.DataBind();
    }
Example #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            theProgramCode = "rept3200";
            userManager theUserManager = (userManager)Session["theUserManager"];

            theCompanyCode = theUserManager.getCompanyCode();
            theUserId      = theUserManager.getUserId();

            string sql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a left join code_product_line b on a.pline_code=b.pline_code where a.user_id='" + theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";

            SqlCode.SelectCommand = sql;
            SqlCode.DataBind();
            SqlCode1.SelectCommand = sql;
            SqlCode1.DataBind();

            if (!IsPostBack)
            {
                //第一次进入页面默认取东区
                txtPCode.SelectedIndex = 0;

                //第一次进入页面取不到生产线,用这种方式给ASPxGridView1增加数据
                //string plineSql = "select distinct a.pline_code,b.pline_name from vw_user_role_program a "
                //+ " left join code_product_line b on a.pline_code=b.pline_code where a.user_id='"
                //+ theUserId + "' and a.program_code='" + theProgramCode + "' and a.company_code='" + theCompanyCode + "'";
                //DataTable dt1 = dc.GetTable(plineSql);
                ////注意此处用rows才能取到,用columns取不到
                //string pline = dt1.Rows[0]["PLINE_CODE"].ToString();
                //string inSqlTemp = "";
                //inSqlTemp = " SELECT DISTINCT SN FROM DATA_STORE WHERE PLINE_CODE = '" + pline + "' ";

                //DataTable dt = dc.GetTable(inSqlTemp);
                //ASPxGridView1.DataSource = dt;
                //ASPxGridView1.DataBind();
            }
            //initPlineCode();
            //放在pageload里,模糊查询,分页等功能才能正常使用,因为这些事件都会来后台处理数据,所以要查询的相关数据必须要放在pageload里,否则
            //无法实现正常功能
            setCondition1();
            setCondition();
        }