예제 #1
0
        public void GridViewBind()
        {
            string str1 = " WHERE B.UI_LX='企业' AND DL_ZT='登录系统' AND DL_RQ BETWEEN '" + hkdb.GetStr(txtSdate.Text) + "' AND '" + hkdb.GetStr(txtEdate.Text) + "'";

            //个人权限
            if (hkdb.StrIx("603091", Session["roleqx"].ToString()))
            {
                str1 = str1 + " AND DL_ID='" + this.Session["userid"] + "'";
            }

            //部门权限
            if (hkdb.StrIx("603092", Session["roleqx"].ToString()))
            {
                if (this.Session["bmglqx"].ToString() == "Y")
                {
                    string        cal   = "";
                    SqlDataReader dr_bm = SqlHelper.ExecuteReader("EXEC sp_RECUR_BM '" + this.Session["deptid"].ToString() + "'");
                    while (dr_bm.Read())
                    {
                        if (string.IsNullOrEmpty(cal))
                        {
                            cal = dr_bm["bm_id"].ToString();
                        }
                        else
                        {
                            cal = cal + "','" + dr_bm["bm_id"].ToString();
                        }
                    }
                    dr_bm.Close();

                    str1 = str1 + " AND DL_ID IN(SELECT UI_ID FROM YH WHERE UI_SSBM IN('" + cal + "'))";
                }
                else
                {
                    str1 = str1 + " AND DL_ID IN(SELECT UI_ID FROM YH WHERE UI_SSBM='" + this.Session["deptid"] + "')";
                }
            }

            if (!string.IsNullOrEmpty(rysq.Text))
            {
                str1 = str1 + " AND (DL_ID LIKE '%" + hkdb.GetStr(rysq.Text) + "%' OR UI_DESC LIKE '%" + hkdb.GetStr(rysq.Text) + "%')";
            }

            if (!string.IsNullOrEmpty(dl_rk.SelectedValue))
            {
                str1 = str1 + " AND dl_rk='" + dl_rk.SelectedValue + "'";
            }

            AspNetPager1.RecordCount = (int)SqlHelper.ExecuteScalar("SELECT COUNT(*) FROM(SELECT A.DL_ID,B.UI_DESC,COUNT(*)AS DLNUMS FROM HK_DLRZ A LEFT OUTER JOIN YH B ON(A.DL_ID=B.UI_ID) " + str1 + " GROUP BY A.DL_ID,B.UI_DESC)Z");
            DataSet ds = SqlHelper.ExecuteDs("SELECT A.DL_ID,B.UI_DESC,COUNT(*)AS DLNUMS FROM HK_DLRZ A LEFT OUTER JOIN YH B ON(A.DL_ID=B.UI_ID) " + str1 + " GROUP BY A.DL_ID,B.UI_DESC ORDER BY COUNT(*) DESC", AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize);

            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
예제 #2
0
        public void GridViewBind()
        {
            string str1 = " WHERE 1=1";

            //个人权限
            if (hkdb.StrIx("603091", Session["roleqx"].ToString()))
            {
                str1 = str1 + " AND UserID='" + this.Session["userid"] + "'";
            }

            //部门权限
            if (hkdb.StrIx("603092", Session["roleqx"].ToString()))
            {
                if (this.Session["bmglqx"].ToString() == "Y")
                {
                    string        cal   = "";
                    SqlDataReader dr_bm = SqlHelper.ExecuteReader("EXEC sp_RECUR_BM '" + this.Session["deptid"].ToString() + "'");
                    while (dr_bm.Read())
                    {
                        if (string.IsNullOrEmpty(cal))
                        {
                            cal = dr_bm["bm_id"].ToString();
                        }
                        else
                        {
                            cal = cal + "','" + dr_bm["bm_id"].ToString();
                        }
                    }
                    dr_bm.Close();

                    str1 = str1 + " AND DeptID IN('" + cal + "')";
                }
                else
                {
                    str1 = str1 + " AND DeptID='" + this.Session["deptid"] + "'";
                }
            }

            if (!string.IsNullOrEmpty(txtSdate.Text))
            {
                str1 = str1 + " AND NowTime>='" + hkdb.GetStr(txtSdate.Text) + "'";
            }

            if (!string.IsNullOrEmpty(txtEdate.Text))
            {
                str1 = str1 + " AND NowTime<='" + hkdb.GetStr(txtEdate.Text) + "'";
            }

            if (!string.IsNullOrEmpty(UserName.Text))
            {
                str1 = str1 + " AND UserName LIKE '%" + hkdb.GetStr(UserName.Text) + "%'";
            }

            if (!string.IsNullOrEmpty(IPAddress.Text))
            {
                str1 = str1 + " AND IPAddress='" + hkdb.GetStr(IPAddress.Text) + "'";
            }

            if (!string.IsNullOrEmpty(LogContent.Text))
            {
                str1 = str1 + " AND LogContent LIKE '%" + hkdb.GetStr(LogContent.Text) + "%'";
            }

            if (!string.IsNullOrEmpty(ModuName.Text))
            {
                if (ModuName.Text == "00000")
                {
                    str1 = str1 + " AND MODUID='00000'";
                }
                else
                {
                    str1 = str1 + " AND (MODUID LIKE '%" + hkdb.GetStr(ModuName.Text) + "%' OR MODU_MC LIKE '%" + hkdb.GetStr(ModuName.Text) + "%')";
                }
            }
            else
            {
                str1 = str1 + " AND MODUID<>'00000'";
            }

            AspNetPager1.RecordCount = (int)SqlHelper.ExecuteScalar("SELECT COUNT(*) FROM HK_SYSTEMLOG A LEFT OUTER JOIN HK_MODU B ON(A.MODUID=B.MODU_ID) " + str1 + "");
            DataSet ds = SqlHelper.ExecuteDs("SELECT A.*,B.MODU_MC FROM HK_SYSTEMLOG A LEFT OUTER JOIN HK_MODU B ON(A.MODUID=B.MODU_ID) " + str1 + " ORDER BY NOWTIME DESC", AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize);

            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hkdb.VeriSess("3");

            if (!IsPostBack)
            {
                hkdb.PassTo("60302", "0");

                LabelRole.Text = Request.QueryString["rolename"];

                GridviewBind();

                SqlDataReader datar = SqlHelper.ExecuteReader("SELECT * FROM JS WHERE ROLE_ID='" + hkdb.GetStr(Request.QueryString["roleid"]) + "'");
                if (datar.Read())
                {
                    RoleQxStr = datar["role_qx"].ToString();
                    datar.Close();

                    for (int i = 0; i < GridView1.Rows.Count; i++)
                    {
                        GridViewRow row = GridView1.Rows[i];

                        CheckBox Co_que = (CheckBox)row.FindControl("o_que");
                        Label    Lo_que = (Label)row.FindControl("o_queid");

                        CheckBox Co_full = (CheckBox)row.FindControl("o_full");
                        Label    Lo_full = (Label)row.FindControl("o_fullid");

                        CheckBox Co_add = (CheckBox)row.FindControl("o_add");
                        Label    Lo_add = (Label)row.FindControl("o_addid");

                        CheckBox Co_mod = (CheckBox)row.FindControl("o_mod");
                        Label    Lo_mod = (Label)row.FindControl("o_modid");

                        CheckBox Co_del = (CheckBox)row.FindControl("o_del");
                        Label    Lo_del = (Label)row.FindControl("o_delid");

                        CheckBox Co_exp = (CheckBox)row.FindControl("o_exp");
                        Label    Lo_exp = (Label)row.FindControl("o_expid");

                        CheckBox Co_aud = (CheckBox)row.FindControl("o_aud");
                        Label    Lo_aud = (Label)row.FindControl("o_audid");

                        CheckBox Co_exe = (CheckBox)row.FindControl("o_exe");
                        Label    Lo_exe = (Label)row.FindControl("o_exeid");

                        RadioButton Cindi = (RadioButton)row.FindControl("indi");
                        Label       Lindi = (Label)row.FindControl("indiid");

                        RadioButton Cdept = (RadioButton)row.FindControl("dept");
                        Label       Ldept = (Label)row.FindControl("deptid");

                        RadioButton Ccorp = (RadioButton)row.FindControl("corp");
                        Label       Lcorp = (Label)row.FindControl("corpid");

                        if (hkdb.StrIx(Lindi.Text, RoleQxStr) && Lindi.Text != "0")
                        {
                            Cindi.Checked = true;
                        }

                        if (hkdb.StrIx(Ldept.Text, RoleQxStr) && Ldept.Text != "0")
                        {
                            Cdept.Checked = true;
                        }

                        if (hkdb.StrIx(Lcorp.Text, RoleQxStr) && Lcorp.Text != "0")
                        {
                            Ccorp.Checked = true;
                        }

                        if (hkdb.StrIx(Lo_full.Text, RoleQxStr) && Lo_full.Text != "0")
                        {
                            Co_full.Checked = true;
                        }

                        if (hkdb.StrIx(Lo_add.Text, RoleQxStr) && Lo_add.Text != "0")
                        {
                            Co_add.Checked = true;
                        }

                        if (hkdb.StrIx(Lo_mod.Text, RoleQxStr) && Lo_mod.Text != "0")
                        {
                            Co_mod.Checked = true;
                        }

                        if (hkdb.StrIx(Lo_del.Text, RoleQxStr) && Lo_del.Text != "0")
                        {
                            Co_del.Checked = true;
                        }

                        if (hkdb.StrIx(Lo_exp.Text, RoleQxStr) && Lo_exp.Text != "0")
                        {
                            Co_exp.Checked = true;
                        }

                        if (hkdb.StrIx(Lo_aud.Text, RoleQxStr) && Lo_aud.Text != "0")
                        {
                            Co_aud.Checked = true;
                        }

                        if (hkdb.StrIx(Lo_exe.Text, RoleQxStr) && Lo_exe.Text != "0")
                        {
                            Co_exe.Checked = true;
                        }

                        if (hkdb.StrIx(Lo_que.Text, RoleQxStr) && Lo_que.Text != "0")
                        {
                            Co_que.Checked = true;
                        }
                    }
                }
                else
                {
                    datar.Close();
                    mydb.Alert_Goto("此记录不存在,可能已被删除!", "role.aspx");
                }

                //快速定位
                string Sql = "";
                if (this.Session["systype"].ToString() != "A")     //主登录页
                {
                    Sql = " AND MODU_LX IN('P','" + this.Session["systype"] + "')";
                }

                int           k  = 0;
                SqlDataReader dr = SqlHelper.ExecuteReader("SELECT MODU_ID,MODU_MC FROM hk_Modu WHERE YN_OPER='是' AND LEN(MODU_ID)=3 " + Sql + " ORDER BY ORDERID");
                while (dr.Read())
                {
                    lbldw.Text += "[<a href=#" + dr["modu_id"] + " class=yellow>" + dr["modu_mc"] + "</a>]&nbsp;";

                    k = k + 1;

                    if (k == 8)
                    {
                        lbldw.Text += "<br>";
                        k           = 0;
                    }
                }
                dr.Close();
            }
        }