Пример #1
0
    protected void search_Click(object sender, EventArgs e)
    {
        ViewState["search"] = " 1=1";
        string qita = SystemTool.NoHtml(qitatiaojian.Value.ToString().Trim());
        string id   = ddlmoduleName.SelectedValue;
        string mkdz = mokuaidizhi.Value;
        string px   = paixu.Value;
        string tb   = tubiao.Value;

        if (qita != "")
        {
            ViewState["search"] += " and m.moduleName like '%" + qita + "%'";
        }
        if (id != "--")
        {
            ViewState["search"] += " and m.parentId=" + id;
        }
        if (mkdz != "")
        {
            ViewState["search"] += " and m.modelHref like '%" + mkdz + "%'";
        }
        if (px != "")
        {
            ViewState["search"] += " and m.paixu =" + px;
        }
        if (tb != "")
        {
            ViewState["search"] += " and m.tubiao like '%" + tb + "%'";
        }
        BindInfo();
    }
Пример #2
0
    protected void btnok_Click(object sender, EventArgs e)
    {
        if (txtname.Text == "")
        {
            SystemTool.AlertShow(this, "管理员名称不能为空");
            return;
        }
        if (txtpassok.Text != txtpassok2.Text)
        {
            SystemTool.AlertShow(this, "两次输入密码不一致");
            return;
        }
        string sql    = "";
        int    result = 0;

        if (null != Request.QueryString["manId"])
        {
            //更新操作
            if (txtpassok.Text == "")
            {//密码不更新
                sql = "UPDATE manager_info set roleId='" + ddljiaose.SelectedValue + "',remark='" + SystemTool.NoHtml(txtbeizhu.Value) + "',state='" + ddlState.SelectedValue + "' where man_id=" + SystemTool.NoHtml(Request.QueryString["manId"]);
            }
            else
            {
                sql = "UPDATE manager_info set man_psw='" + SystemTool.jimi(SystemTool.NoHtml(txtpassok.Text)) + "',roleId='" + ddljiaose.SelectedValue + "',remark='" + SystemTool.NoHtml(txtbeizhu.Value) + "',state='" + ddlState.SelectedValue + "' where man_id=" + SystemTool.NoHtml(Request.QueryString["manId"]);
            }

            result = DB.ExecuteSql(sql, null);
        }
        else
        {
            sql = "select man_id from manager_info where man_name='" + SystemTool.NoHtml(txtname.Text) + "'";
            string r = DB.ExecuteSqlValue(sql, null);
            if (r != "" && r != "no")
            {
                SystemTool.AlertShow(this, "管理员名称已存在");
                return;
            }
            if (txtpassok.Text == "")
            {
                SystemTool.AlertShow(this, "管理员密码不能为空");
                return;
            }
            sql    = "insert into manager_info (man_name,man_psw,roleId,remark,state) values('" + SystemTool.NoHtml(txtname.Text) + "','" + SystemTool.jimi(SystemTool.NoHtml(txtpassok.Text)) + "'," + ddljiaose.SelectedValue + ",'" + SystemTool.NoHtml(txtbeizhu.Value) + "','" + ddlState.SelectedValue + "')";
            result = DB.ExecuteSql(sql, null);
        }

        if (result > 0)
        {
            SystemTool.AlertShow_Refresh1(this, "保存成功", "guanliyuanlist.aspx");
        }
        else
        {
            SystemTool.AlertShow(this, "保存失败");
            return;
        }
    }
Пример #3
0
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        string name = SystemTool.NoHtml(txt_name.Text);
        string pass = SystemTool.NoHtml(txt_psw.Text);

        if (name == "" || pass == "")
        {
            SystemTool.AlertShow(this, "账户和密码不能为空");
            return;
        }
        if (vCode.Value == "")
        {
            SystemTool.AlertShow(this, "验证码不能为空");
            return;
        }
        if (Session["Code"] == null)
        {
            SystemTool.AlertShow(this, "验证码已过期");
            return;
        }
        if (Session["Code"].ToString() != vCode.Value)
        {
            SystemTool.AlertShow(this, "验证码不正确");
            return;
        }
        //string sql = "select man_id from manager_info where man_name='" + name + "' and man_psw='" + SystemTool.jimi(pass) + "'";
        string  sql = "select man_id,manager_info.state mstate,role_info.state rstate from manager_info,role_info where roleId=id and man_name='" + name + "' and man_psw='" + SystemTool.jimi(pass) + "'";
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        if (ds.Tables[0].Rows.Count == 0)
        {
            SystemTool.AlertShow(this, "账号或密码错误");
            return;
        }
        if (ds.Tables[0].Rows[0]["mstate"].ToString() == "禁止")
        {
            SystemTool.AlertShow(this, "该用户被禁用");
            return;
        }
        if (ds.Tables[0].Rows[0]["rstate"].ToString() == "禁止")
        {
            SystemTool.AlertShow(this, "该用户所在的组被禁用");
            return;
        }
        HttpCookie cookid = new HttpCookie(Cookie.ComplanyId, ds.Tables[0].Rows[0]["man_id"].ToString());

        cookid.Expires = DateTime.Now.AddDays(1);
        Response.Cookies.Add(cookid);
        Response.Redirect("index.aspx");
    }
Пример #4
0
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        string name = SystemTool.NoHtml(txt_name.Text);
        string pass = SystemTool.NoHtml(txt_psw.Text);

        if (name == "" || pass == "")
        {
            SystemTool.AlertShow(this, "账户和密码不能为空");
            return;
        }
        if (vCode.Value == "")
        {
            SystemTool.AlertShow(this, "验证码不能为空");
            return;
        }
        if (Session["Code"] == null)
        {
            SystemTool.AlertShow(this, "验证码已过期");
            return;
        }
        if (Session["Code"].ToString() != vCode.Value)
        {
            SystemTool.AlertShow(this, "验证码不正确");
            return;
        }
        //string sql = "select man_id from manager_info where man_name='" + name + "' and man_psw='" + SystemTool.jimi(pass) + "'";
        string  sql = "select man_id,manager_info.state mstate,role_info.state rstate from manager_info,role_info where roleId=id and man_name='" + name + "' and man_psw='" + SystemTool.jimi(pass) + "'";
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        if (ds.Tables[0].Rows.Count == 0)
        {
            SystemTool.AlertShow(this, "账号或密码错误");
            return;
        }
        if (ds.Tables[0].Rows[0]["mstate"].ToString() == "禁止")
        {
            SystemTool.AlertShow(this, "该用户被禁用");
            return;
        }
        if (ds.Tables[0].Rows[0]["rstate"].ToString() == "禁止")
        {
            SystemTool.AlertShow(this, "该用户所在的组被禁用");
            return;
        }

        //登录记录
        //string area = SystemTool.GetAddressByIp(SystemTool.GetIP());
        string ip = SystemTool.GetIP();
        string dz = "";
        //if (SystemTool.IsIP(ip)) {
        //    dz = GetAddressByIp(ip);
        //}
        string managerid = ds.Tables[0].Rows[0]["man_id"].ToString();
        string time      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        //string sqlin = "insert into denglujilu(man_id,addtime,dengluip,dengludizhi) values(" + managerid + ",'" + time + "','" + ip + "','"+dz+"')";
        //int result=DB.ExecuteSql(sqlin, null);
        //if (result <= 0) {
        //    SystemTool.AlertShow(this, "网路连接错误,请重新登录");
        //    return;
        //}
        HttpCookie cookid = new HttpCookie(Cookie.ComplanyId, ds.Tables[0].Rows[0]["man_id"].ToString());

        cookid.Expires = DateTime.Now.AddDays(1);
        Response.Cookies.Add(cookid);
        Response.Redirect("index.aspx");
        //  SystemTool.AlertShow_Refresh(this, "登录成功", "index.aspx");
    }
Пример #5
0
    private void BindInfo()
    {
        string  sql = "select man_id,man_name,man_psw,manager_info.remark, manager_info.state state,roleName,roleId from manager_info,role_info where roleId=id and man_id=" + SystemTool.NoHtml(Request.QueryString["manId"]);
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        if (ds.Tables[0].Rows.Count > 0)
        {
            txtname.Text            = ds.Tables[0].Rows[0]["man_name"].ToString();
            txtpassok.Text          = ds.Tables[0].Rows[0]["man_psw"].ToString();
            txtbeizhu.Value         = ds.Tables[0].Rows[0]["remark"].ToString();
            ddljiaose.SelectedValue = ds.Tables[0].Rows[0]["roleId"].ToString();
            ddlState.SelectedValue  = ds.Tables[0].Rows[0]["state"].ToString();
            if (ddljiaose.SelectedValue == "0")
            {
                msg.Text = "该管理员所在的组(" + ds.Tables[0].Rows[0]["roleName"].ToString() + ")已被禁止,请启用该组后再修改";
            }
        }

        txtname.ReadOnly = true;
    }
Пример #6
0
    private void BindInfo()
    {
        //初始化输入框数据
        string  sql = "select * from role_info where id=" + SystemTool.NoHtml(Request.QueryString["manId"]);
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        if (ds.Tables[0].Rows.Count > 0)
        {
            txtname.Text           = ds.Tables[0].Rows[0]["roleName"].ToString();
            txtpassok.Text         = ds.Tables[0].Rows[0]["quanxianzhi"].ToString();
            txtbeizhu.Value        = ds.Tables[0].Rows[0]["remark"].ToString();
            ddlState.SelectedValue = ds.Tables[0].Rows[0]["state"].ToString();
            paixu.Text             = ds.Tables[0].Rows[0]["paixu"].ToString();
        }
        txtname.ReadOnly = true;
        //初始化checkbox数据
        string[] moduleIds = ds.Tables[0].Rows[0]["moduleId"].ToString().Split(',');
        for (int i = 0; i < rpt.Items.Count; i++)
        {
            CheckBox ckb  = rpt.Items[i].FindControl("ckb") as CheckBox;
            Repeater rpta = rpt.Items[i].FindControl("rpta") as Repeater;
            for (int k = 0; k < moduleIds.Length; k++)
            {
                if (ckb.ToolTip == moduleIds[k].ToString())
                {
                    ckb.Checked = true;
                }
            }
            for (int j = 0; j < rpta.Items.Count; j++)
            {
                CheckBox ckba = rpta.Items[j].FindControl("ckba") as CheckBox;
                for (int k = 0; k < moduleIds.Length; k++)
                {
                    if (ckb.ToolTip == moduleIds[k].ToString())
                    {
                        ckb.Checked = true;
                    }
                    if (ckba.ToolTip == moduleIds[k].ToString())
                    {
                        ckba.Checked = true;
                    }
                }
            }
        }
        //string[] diqu_ids = ds.Tables[0].Rows[0]["diqu_ids"].ToString().Split(',');
        //for (int i = 0; i < rpt_sheng.Items.Count; i++)
        //{
        //    CheckBox ckb = rpt_sheng.Items[i].FindControl("ckb") as CheckBox;
        //    Repeater rpta = rpt_sheng.Items[i].FindControl("rpta_sheng") as Repeater;
        //    for (int k = 0; k < diqu_ids.Length; k++)
        //    {
        //        if (ckb.ToolTip == diqu_ids[k].ToString())
        //        {
        //            ckb.Checked = true;
        //        }
        //    }
        //    for (int j = 0; j < rpta.Items.Count; j++)
        //    {
        //        CheckBox ckba = rpta.Items[j].FindControl("ckba") as CheckBox;
        //        for (int k = 0; k < diqu_ids.Length; k++)
        //        {
        //            if (ckb.ToolTip == diqu_ids[k].ToString())
        //            {
        //                ckb.Checked = true;
        //            }
        //            if (ckba.ToolTip == diqu_ids[k].ToString())
        //            {
        //                ckba.Checked = true;
        //            }
        //        }
        //    }
        //}
    }
Пример #7
0
    protected void btnok_Click(object sender, EventArgs e)
    {
        if (txtname.Text == "")
        {
            SystemTool.AlertShow(this, "组名称不能为空");
            return;
        }
        //string diqu_ids = "";
        //for (int i = 0; i < rpt_sheng.Items.Count; i++)
        //{
        //    CheckBox ckb = rpt_sheng.Items[i].FindControl("ckb") as CheckBox;
        //    if (ckb.Checked == true)
        //    {
        //        diqu_ids += ckb.ToolTip + ",";
        //    }
        //    Repeater rpta = rpt_sheng.Items[i].FindControl("rpta_sheng") as Repeater;
        //    for (int j = 0; j < rpta.Items.Count; j++)
        //    {
        //        CheckBox ckba = rpta.Items[j].FindControl("ckba") as CheckBox;
        //        if (ckba.Checked == true)
        //        {
        //            diqu_ids += ckba.ToolTip + ",";
        //        }
        //    }
        //}
        //if (diqu_ids.Length > 0)
        //{
        //    diqu_ids = diqu_ids.Substring(0, diqu_ids.Length - 1);
        //}
        //else
        //{
        //    SystemTool.AlertShow(this, "请选择地区");
        //    return;
        //}
        string moduleIds = "";

        for (int i = 0; i < rpt.Items.Count; i++)
        {
            CheckBox ckb = rpt.Items[i].FindControl("ckb") as CheckBox;
            if (ckb.Checked == true)
            {
                moduleIds += ckb.ToolTip + ",";
            }
            Repeater rpta = rpt.Items[i].FindControl("rpta") as Repeater;
            for (int j = 0; j < rpta.Items.Count; j++)
            {
                CheckBox ckba = rpta.Items[j].FindControl("ckba") as CheckBox;
                if (ckba.Checked == true)
                {
                    moduleIds += ckba.ToolTip + ",";
                }
            }
        }
        if (moduleIds.Length > 0)
        {
            moduleIds = moduleIds.Substring(0, moduleIds.Length - 1);
        }
        else
        {
            SystemTool.AlertShow(this, "请选择组权限");
            return;
        }
        string sql    = "";
        int    result = 0;

        if (null != Request.QueryString["manId"])
        {
            //更新操作
            sql    = "update role_info set roleName='" + SystemTool.NoHtml(txtname.Text) + "',moduleId='" + moduleIds + "',remark='" + SystemTool.NoHtml(txtbeizhu.Value) + "',state='" + ddlState.SelectedValue + "',quanxianzhi=" + SystemTool.NoHtml(txtpassok.Text) + ",paixu=" + SystemTool.NoHtml(paixu.Text) + ",diqu_ids='' where id=" + SystemTool.NoHtml(Request.QueryString["manId"]);
            result = DB.ExecuteSql(sql, null);
        }
        else
        {
            sql = "select id from role_info where roleName='" + SystemTool.NoHtml(txtname.Text) + "'";
            string r = DB.ExecuteSqlValue(sql, null);
            if (r != "" && r != "no")
            {
                SystemTool.AlertShow(this, "组名称已存在");
                return;
            }
            sql    = "insert into role_info (roleName,moduleId,remark,state,quanxianzhi,paixu,diqu_ids) values('" + SystemTool.NoHtml(txtname.Text) + "','" + moduleIds + "','" + SystemTool.NoHtml(txtbeizhu.Value) + "','" + ddlState.SelectedValue + "'," + SystemTool.NoHtml(txtpassok.Text) + "," + SystemTool.NoHtml(paixu.Text) + ",'')";
            result = DB.ExecuteSql(sql, null);
        }

        if (result > 0)
        {
            SystemTool.AlertShow_Refresh1(this, "保存成功", "guanliyuanzulist.aspx");
        }
        else
        {
            SystemTool.AlertShow(this, "保存失败");
            return;
        }
    }