예제 #1
0
        /// <summary>
        /// 初始化页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        protected void Page_Load(object sender, EventArgs e)
        {
            string username = Request.QueryString["username"];

            if (!userLogin.CheckLogin(username))
            {
                string js = "alert('" + GetLangStr("Department18", "您没有登录或操作超时,请重新登录!") + "');window.top.location.href='" + StaticInfo.LoginPage + "'";
                System.Web.HttpContext.Current.Response.Write("<script type='text/javascript'>" + js + "</script>");
                return;
            }
            if (!X.IsAjaxRequest)
            {
                SystemID = "00";
                StoreClass.DataSource = GetRedisData.GetData("t_sys_code:140004");
                StoreClass.DataBind();

                DataTable dt = settingManager.GetConfigDepartment(SystemID);//Bll.Common.ChangColName(ToDataTable(GetRedisData.GetData("t_cfg_department").Select("", "class asc,departid asc")));
                while (dt.Columns.Count > 3)
                {
                    dt.Columns.RemoveAt(3);
                }
                dtSsjg = dt;

                Storedepart.DataSource = dt;
                jgname = dt.Rows[0]["col2"].ToString();
                Storedepart.DataBind();
                FirstGetSysConfig();
                UserInfo userinfo = Session["Userinfo"] as UserInfo;
                uName = userinfo.UserName;
                nowIp = userinfo.NowIp;
                logManager.InsertLogRunning(userinfo.UserName, GetLangStr("Department18", "访问:") + Request.QueryString["funcname"], userinfo.NowIp, "0");
            }
            this.DataBind();
        }
예제 #2
0
        public void GetDepart()
        {
            try
            {
                if (!string.IsNullOrEmpty(CmbClass.SelectedItem.Text))
                {
                    string    text = CmbClass.SelectedItem.Text;
                    DataTable dt   = settingManager.GetConfigDepartment(SystemID);
                    while (dt.Columns.Count > 3)
                    {
                        dt.Columns.RemoveAt(3);
                    }
                    if (text.Equals(GetLangStr("Department43", "总队")))
                    {
                        //Storedepart.DataSource = new DataTable();
                        //Storedepart.DataBind();
                        CmbDepart.Value    = "";
                        CmbDepart.Disabled = true;
                    }
                    else if (text.Equals(GetLangStr("Department44", "支队")))
                    {
                        CmbDepart.Value    = "";
                        CmbDepart.Disabled = false;
                        DataRow[] rows = dt.Select("col2 like '%" + text + "%'");
                        for (int i = 0; i < rows.Length; i++)
                        {
                            dt.Rows.Remove(rows[i]);
                        }
                        DataRow[] rows1 = dt.Select("col2 like '%" + GetLangStr("Department45", "大队") + "%'");
                        for (int i = 0; i < rows1.Length; i++)
                        {
                            dt.Rows.Remove(rows1[i]);
                        }
                        DataRow[] rows2 = dt.Select("col2 like '%" + GetLangStr("Department46", "中队") + "%'");
                        for (int i = 0; i < rows2.Length; i++)
                        {
                            dt.Rows.Remove(rows2[i]);
                        }

                        DataRow[] rows3 = dt.Select("col2 like '%" + GetLangStr("Department43", "总队") + "%'");
                        {
                            if (rows3.Length <= 0)
                            {
                                CmbDepart.Disabled = true;
                            }
                        }
                    }
                    else if (text.Equals(GetLangStr("Department45", "大队")))
                    {
                        CmbDepart.Value    = "";
                        CmbDepart.Disabled = false;
                        DataRow[] rows1 = dt.Select("col2 like '%" + text + "%'");
                        for (int i = 0; i < rows1.Length; i++)
                        {
                            dt.Rows.Remove(rows1[i]);
                        }
                        DataRow[] rows2 = dt.Select("col2 like '%" + GetLangStr("Department46", "中队") + "%'");
                        for (int i = 0; i < rows2.Length; i++)
                        {
                            dt.Rows.Remove(rows2[i]);
                        }

                        DataRow[] rows3 = dt.Select("col2 like '%" + GetLangStr("Department44", "支队") + "%'");
                        {
                            if (rows3.Length <= 0)
                            {
                                CmbDepart.Disabled = true;
                            }
                        }
                    }
                    else if (text.Equals(GetLangStr("Department46", "中队")))
                    {
                        CmbDepart.Value    = "";
                        CmbDepart.Disabled = false;
                        DataRow[] rows1 = dt.Select("col2 like '%" + text + "%'");
                        for (int i = 0; i < rows1.Length; i++)
                        {
                            dt.Rows.Remove(rows1[i]);
                        }

                        DataRow[] rows2 = dt.Select(" col2 like '%" + GetLangStr("Department44", "支队") + "%'");
                        for (int i = 0; i < rows2.Length; i++)
                        {
                            dt.Rows.Remove(rows2[i]);
                        }

                        DataRow[] rows3 = dt.Select("col2 like '%" + GetLangStr("Department45", "大队") + "%'");
                        {
                            if (rows3.Length <= 0)
                            {
                                CmbDepart.Disabled = true;
                            }
                        }
                    }
                    else
                    {
                    }
                    Storedepart.DataSource = dt;
                    Storedepart.DataBind();
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                ILog.WriteErrorLog(ex);
                logManager.InsertLogError("Department.aspx-GetDepart", ex.Message + ";" + ex.StackTrace, "GetDepart has an exception");
            }
        }