Ejemplo n.º 1
0
    // 单个删除
    protected void lbtnDelCa_Click(object sender, EventArgs e)
    {
        // 当前点击的按钮
        LinkButton lb   = (LinkButton)sender;
        int        caId = int.Parse(lb.CommandArgument);
        ps_manager bll  = new ps_manager();

        bll.GetModel(caId);
        string title = bll.user_name;

        ps_join_depot bllqd = new ps_join_depot();

        bllqd.user_id = caId;
        ps_salse_depot bllss = new ps_salse_depot();

        bllss.user_id = caId;
        if (!bllqd.ExistsYH() && !bllss.ExistsCZXS())
        {
            bll.Delete(caId);
            mym.AddAdminLog("删除", "删除用户名(账号):" + title + ""); //记录日志
            mym.JscriptMsg(this.Page, " 成功删除用户名(账号):" + title + "", Utils.CombUrlTxt("manager_list.aspx", "status={0}&category_id={1}&depot_id={2}&keywords={3}&page={4}", this.status.ToString(), this.category_id.ToString(), this.depot_id.ToString(), this.keywords, this.page.ToString()), "Success");
        }
        else
        {
            mym.JscriptMsg(this.Page, "系统中有该用户的相关操作记录,不能删除!可以通过修改禁用该用户!", "", "Error");
            return;
        }
    }
Ejemplo n.º 2
0
    private void ShowInfo(int _id)
    {
        ps_manager model = new ps_manager();

        model.GetModel(_id);
        Lituser_name.Text = model.user_name;
        Litreal_name.Text = model.real_name;
        txtmobile.Text    = model.mobile;
        Litdepot_id.Text  = model.depot_id.ToString();

        if (Convert.ToInt32(model.depot_id) != 0)
        {
            mdxx.Visible = true;
            ps_depot model1 = new ps_depot();
            model1.GetModel(Convert.ToInt32(model.depot_id));

            Litdepotname.Text       = model1.title;
            Litcontact_name.Text    = model1.contact_name;
            Litcontact_tel.Text     = model1.contact_mobile;
            txtcontact_address.Text = model1.contact_address;
        }

        if (Convert.ToInt32(model.depot_category_id) != 0)
        {
            bmxx.Visible = true;
            ps_depot_category model2 = new ps_depot_category();
            model2.GetModel(Convert.ToInt32(model.depot_category_id));
            Litdepot_category_name.Text = model2.title;
        }
    }
Ejemplo n.º 3
0
    private void ShowInfo(int _id)
    {
        ps_manager model = new ps_manager();

        model.GetModel(_id);
        ddlRoleId.SelectedValue = model.role_id.ToString();

        if (model.role_id == 2 || model.role_id == 3)
        {
            bm.Visible = false;
            md.Visible = false;
        }
        if (model.role_id == 4)
        {
            bm.Visible = true;
            md.Visible = true;
            CategoryBind(Convert.ToInt32(Session["DepotCatID"]));           //绑定地区
            DepotBind(Convert.ToInt32(model.depot_category_id.ToString())); //绑定商家
        }
        ddlCategoryId.SelectedValue = model.depot_category_id.ToString();
        ddlDepotId.SelectedValue    = model.depot_id.ToString();

        txtUserName.Text = model.user_name;
        if (_id == 1)//admin账号不能修改
        {
            txtUserName.ReadOnly = true;
        }

        if (!string.IsNullOrEmpty(model.password))
        {
            txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword;
        }
        txtRealName.Text = model.real_name;
        txtmobile.Text   = model.mobile;
        txtremark.Text   = model.remark;
        if (model.is_lock == 1)
        {
            cbIsLock.Checked = true;
        }
        else
        {
            cbIsLock.Checked = false;
        }
    }
Ejemplo n.º 4
0
    //保存
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ps_manager model = new ps_manager();

        model.GetModel(Convert.ToInt32(Session["AID"]));

        string userPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtOldPassword.Text.Trim(), "MD5");

        if (userPwd != model.password)
        {
            mym.JscriptMsg(this.Page, "旧密码不正确!", "", "Warning");
            return;
        }
        if (txtPassword.Text.Trim() != txtPassword1.Text.Trim())
        {
            mym.JscriptMsg(this.Page, "两次密码不一致!", "", "Warning");
            return;
        }
        model.password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.Trim(), "MD5");
        model.mobile   = txtmobile.Text.Trim();


        model.id = Convert.ToInt32(Session["AID"]);

        if (!model.UpdateMY())
        {
            ps_depot model1 = new ps_depot();
            model1.id = Convert.ToInt32(Litdepot_id.Text);
            model1.contact_address = txtcontact_address.Text.Trim();
            model1.UpdateAddress();

            mym.JscriptMsg(this.Page, "保存过程中发生错误!", "", "Error");
            return;
        }
        mym.AddAdminLog("修改", "修改个人信息:用户名:" + Lituser_name.Text); //记录日志
        mym.JscriptMsg(this.Page, "个人信息修改成功!请下次用新密码登陆!", "", "Success");
    }
Ejemplo n.º 5
0
    private bool DoEdit(int _id)
    {
        bool result = false;

        ps_manager model = new ps_manager();

        model.GetModel(_id);

        model.role_id = int.Parse(ddlRoleId.SelectedValue);
        if (ddlCategoryId.SelectedValue != "")
        {
            model.depot_category_id = int.Parse(ddlCategoryId.SelectedValue);
        }
        else
        {
            model.depot_category_id = 0;
        }

        if (ddlDepotId.SelectedValue != "")
        {
            model.depot_id = int.Parse(ddlDepotId.SelectedValue);
        }
        else
        {
            model.depot_id = 0;
        }

        //检测用户名是否重复
        if (model.ExistsE(txtUserName.Text.Trim(), _id))
        {
            mym.JscriptMsg(this.Page, "用户名已经存在,请更换!", "", "Error");
            return(false);
        }
        model.user_name = txtUserName.Text.Trim();

        //判断密码是否更改
        if (txtPassword.Text.Trim() != defaultpassword)
        {
            model.password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.Trim(), "MD5");
        }
        model.real_name = txtRealName.Text.Trim();
        //model.add_time = DateTime.Now;
        model.mobile = txtmobile.Text.Trim();
        model.remark = txtremark.Text.Trim();


        if (cbIsLock.Checked == true)
        {
            model.is_lock = 1;
        }
        else
        {
            model.is_lock = 2;
        }

        if (model.Update())
        {
            mym.AddAdminLog("修改", "修改用户:" + txtRealName.Text); //记录日志
            result = true;
        }

        return(result);
    }
Ejemplo n.º 6
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string userName = txtUserName.Value.Trim();
        string userPwd  = txtPassword.Value.Trim();

        //判断登录信息
        ps_manager myuser       = new ps_manager();
        string     sqlGetUserID = "select  id  from [ps_manager] where user_name='" + userName + "'";
        int        userid       = Convert.ToInt16(DbHelperSQL.GetSingle(sqlGetUserID));

        myuser.GetModel(userid);
        if (myuser.password != null)
        {
            userPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(userPwd, "MD5");
            if (myuser.password.Trim() != userPwd)
            {
                MessageBox.errorShow(this.Page, "账号或密码有误,请重试!");
                return;
            }

            //判断账号是否被禁用
            if (Convert.ToInt32(myuser.is_lock) == 2)
            {
                MessageBox.errorShow(this.Page, "您的账号被禁用,请联系客服!");
                return;
            }
            ps_depot myd = new ps_depot();
            myd.GetModel(Convert.ToInt32(myuser.depot_id));

            //判断账号对应的商家是否被禁用
            if (Convert.ToInt32(myuser.depot_id) != 0 && Convert.ToInt32(myd.status) == 2)
            {
                MessageBox.errorShow(this.Page, "您所在商家被禁用,请联系客服!");
                return;
            }
            //写入登录日志
            ps_manager_log mylog = new ps_manager_log();
            mylog.user_id     = userid;
            mylog.user_name   = userName;
            mylog.action_type = "登陆";
            mylog.add_time    = DateTime.Now;
            mylog.remark      = "登陆系统";
            mylog.user_ip     = AXRequest.GetIP();
            mylog.Add();


            //写入Cookies
            Utils.WriteCookie("RememberName", userName, 14400);
            Utils.WriteCookie("AdminName", userName, 14400);
            Utils.WriteCookie("RoleID", myuser.role_id.ToString(), 14400);
            Utils.WriteCookie("AID", myuser.id.ToString(), 14400);
            Utils.WriteCookie("RealName", myuser.real_name, 14400);
            Utils.WriteCookie("DepotID", myuser.depot_id.ToString(), 14400);
            Utils.WriteCookie("DepotCatID", myuser.depot_category_id.ToString(), 14400);
            //写入Session
            Session["RememberName"] = userName;
            Session["AdminName"]    = userName;
            Session["RoleID"]       = myuser.role_id.ToString();
            Session["AID"]          = myuser.id.ToString();
            Session["RealName"]     = myuser.real_name;
            Session["DepotID"]      = myuser.depot_id.ToString();
            Session["DepotCatID"]   = myuser.depot_category_id.ToString();
            Session.Timeout         = 45;

            Response.Redirect("main.aspx");
            return;
        }
        else
        {
            MessageBox.errorShow(this.Page, "账号或密码有误,请重试!");
            return;
        }
    }