예제 #1
0
    /// <summary>
    /// 保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lbtnPwd_Click(object sender, EventArgs e)
    {
        string msg     = "";
        bool   retulst = false;

        try
        {
            string oldPwd = PbProject.WebCommon.Web.Cookie.SiteCookie.GetMD5(OldPWD.Text.Trim());
            string newPwd = PbProject.WebCommon.Web.Cookie.SiteCookie.GetMD5(NewPwd.Text.Trim());

            if (mUser.LoginPassWord != oldPwd)
            {
                msg = "原密码错误!";
            }
            else if (oldPwd == newPwd)
            {
                msg = "原密码和新密码不能一样!";
            }
            else if (NewPwd.Text.Trim() != RNewPWD.Text.Trim())
            {
                msg = "两次输入的密码不一致!";
            }

            if (msg == "")
            {
                HashObject parameter = new HashObject();
                parameter.Add("id", mUser.id);
                parameter.Add("LoginPassWord", newPwd);
                retulst = new PbProject.Logic.User.User_EmployeesBLL().UpdateById(parameter);
                if (retulst)
                {
                    msg = "密码修改成功!请重新登录!";
                }
                else
                {
                    msg = "密码修改失败!";
                }
            }
        }
        catch (Exception)
        {
            msg = "密码修改失败!";
        }

        ScriptManager.RegisterStartupScript(this, GetType(), "456", "showdialog('" + msg + "');", true);
    }
예제 #2
0
    /// <summary>
    /// 隐藏 和 显示 返点
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lbntIsShow_Click(object sender, EventArgs e)
    {
        try
        {
            int tmpiShow = (lbntIsShow.Text == "隐") ? 1 : 0;
            lbntIsShow.Text = (lbntIsShow.Text == "隐") ? "显" : "隐";

            if (tmpiShow == 0)
            {
                if (mUser.UserPower == "|2|")
                {
                    mUser.UserPower = "";
                }
                else
                {
                    mUser.UserPower = mUser.UserPower.Replace("|2|", "|");
                }
            }
            else
            {
                if (!mUser.UserPower.Contains("|2|"))
                {
                    if (mUser.UserPower.Trim() == "")
                    {
                        mUser.UserPower = mUser.UserPower + "|2|";
                    }
                    else
                    {
                        mUser.UserPower = mUser.UserPower + "2|";
                    }
                }
            }

            HashObject parameter = new HashObject();
            parameter.Add("id", mUser.id);
            parameter.Add("UserPower", mUser.UserPower);
            bool retulst = new PbProject.Logic.User.User_EmployeesBLL().UpdateById(parameter);
        }
        catch (Exception ex)
        {
            //OnErrorNew(0, ex.ToString(), "lbntIsShow_Click");
        }
    }
예제 #3
0
    /// <summary>
    /// 绑定
    /// </summary>
    /// <param name="source"></param>
    /// <param name="e"></param>
    protected void Repeater_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string msg = "";

        try
        {
            IHashObject paramter = new HashObject();
            string      id       = e.CommandArgument.ToString();
            if (e.CommandName == "Update")
            {
                string s = (e.Item.FindControl("UpDateButton") as LinkButton).Text;

                if (s.Equals("冻 结"))
                {
                    paramter.Add("State", 0);
                }
                else if (s.Equals("解 冻"))
                {
                    paramter.Add("State", 1);
                }
                paramter.Add("id", e.CommandArgument.ToString());
                msg = new PbProject.Logic.User.User_EmployeesBLL().UpdateById(paramter) == true ? s + " 成 功" : s + " 失 败";
            }
            else
            {
                paramter.Add("id", id);
                paramter.Add("LoginPassWord", PbProject.WebCommon.Web.Cookie.SiteCookie.GetMD5("888888"));
                msg = new PbProject.Logic.User.User_EmployeesBLL().UpdateById(paramter) == true ? "密码恢复成功,初始密码888888" : "恢复失败";
            }
            PageDataBind();
        }
        catch (Exception)
        {
            msg = "操作失败!";
        }
        ScriptManager.RegisterStartupScript(this, GetType(), "", "showdialog('" + msg + "');", true);
    }
예제 #4
0
    /// <summary>
    /// 获取要修改的员工信息
    /// </summary>
    /// <param name="id"></param>
    protected void BindUserInfo(string id)
    {
        User_Employees muser = new PbProject.Logic.User.User_EmployeesBLL().GetById(id);

        txtUser.Text = muser.LoginName;
        txtPass.Text = muser.LoginPassWord;
        txtPass.Attributes.Add("value", "888888");//密码
        txtName.Text     = muser.UserName;
        txtNameEasy.Text = muser.NameEasy;
        txtGong.Text     = muser.WorkNum;
        ddlCertificateType.SelectedValue = muser.CertificateType;
        txtCertificateNum.Text           = muser.CertificateNum;
        txtTel.Text            = muser.Tel;
        txtPhone.Text          = muser.Phone;
        txtEmail.Text          = muser.Email;
        txtAddr.Text           = muser.Address;
        rblState.SelectedValue = muser.State.ToString();
        txtovertime.Value      = muser.OverDueTime.ToString("yyyy-MM-dd");
        txtQQ.Text             = muser.QQ;
        txtMSN.Text            = muser.MSN;
        txtBZ.Text             = muser.Remark;
        rblSex.SelectedValue   = muser.Sex;
        txtYB.Text             = muser.PostalCode;
        //rbIsPrompt.SelectedValue = muser.IsPrompt.ToString();
        ddlUserPermissions.SelectedValue = muser.DeptId;
        string sqlParams = " RestrictLoginAccount = '" + txtUser.Text.Trim() + "'";
        List <User_Login_RestrictIp> listuloginip = baseDataManage.CallMethod("User_Login_RestrictIp", "GetList", null, new object[] { sqlParams }) as List <User_Login_RestrictIp>;

        if (mCompany.RoleType == 1 && mUser.IsAdmin == 0)
        {
            if (listuloginip != null && listuloginip.Count > 0)
            {
                if (listuloginip[0].RestrictLoginIP != "")
                {
                    for (int i = 0; i < 5; i++)
                    {
                        ((System.Web.UI.HtmlControls.HtmlTableRow) this.FindControl("tr" + i)).Style.Value = "display: none";
                    }
                    hidtxtCount.Value = listuloginip[0].RestrictLoginIP.Split('|').Length.ToString();
                    for (int i = 0; i < listuloginip[0].RestrictLoginIP.Split('|').Length; i++)
                    {
                        //不是最后一个
                        if (i < listuloginip[0].RestrictLoginIP.Split('|').Length - 1)
                        {
                            if (i != 4)
                            {
                                ((System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("sAdd" + i)).Style.Value = "display: none";
                            }
                            if (i != 0)
                            {
                                ((System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("sDelete" + i)).Style.Value = "display: none";
                            }
                        }
                        //最后一个
                        else
                        {
                            if (i != 4)
                            {
                                ((System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("sAdd" + i)).Style.Value = "display: block";
                            }
                            if (i != 0)
                            {
                                ((System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("sDelete" + i)).Style.Value = "display: block";
                            }
                        }
                        ((System.Web.UI.HtmlControls.HtmlTableRow) this.FindControl("tr" + i)).Style.Value = "display: block";
                        txtA      = ((TextBox)this.FindControl("txtA" + i));
                        txtA.Text = listuloginip[0].RestrictLoginIP.Split('|')[i].ToString();
                    }
                }
            }
        }
    }
예제 #5
0
    /// <summary>
    /// 保存信息
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lbsave_Click(object sender, EventArgs e)
    {
        string   msg     = "";
        DateTime timenow = Convert.ToDateTime(DateTime.Now.ToString());

        try
        {
            string pwdMd5 = PbProject.WebCommon.Web.Cookie.SiteCookie.GetMD5(txtPass.Text.Trim());
            //IHashObject parameter = new HashObject();
            //parameter.Add("CpyNo", mCompany.UninCode);
            //parameter.Add("UserName", txtName.Text);
            //parameter.Add("NameEasy", txtNameEasy.Text);
            //parameter.Add("WorkNum", txtGong.Text);
            //parameter.Add("CertificateType", ddlCertificateType.SelectedValue);
            //parameter.Add("CertificateNum", txtCertificateNum.Text);
            //parameter.Add("Tel", txtTel.Text);
            //parameter.Add("Phone", txtPhone.Text);
            //parameter.Add("Email", txtEmail.Text);
            //parameter.Add("Address", txtAddr.Text);
            //parameter.Add("State", rblState.SelectedValue);
            //parameter.Add("QQ", txtQQ.Text);
            //parameter.Add("MSN", txtMSN.Text);
            //parameter.Add("Remark", txtBZ.Text);
            //parameter.Add("Sex", rblSex.SelectedValue);
            //parameter.Add("PostalCode", txtYB.Text);
            //parameter.Add("IsAdmin", 1);
            //parameter.Add("DeptId", ddlUserPermissions.SelectedValue);
            //parameter.Add("OverDueTime", txtovertime.Value);
            List <string> sqllist = new List <string>();
            string        sql2 = " ", ip = "", sql1 = "";
            string        errormsg = "操作失败";
            if (mCompany.RoleType == 1 && mUser.IsAdmin == 0)
            {
                for (int i = 0; i < int.Parse(hidtxtCount.Value); i++)
                {
                    txtA = ((TextBox)this.FindControl("txtA" + i));
                    ip  += txtA.Text.Trim() + "|";
                }
                ip = ip.TrimEnd('|');
            }
            if (Request["id"] != null)
            {
                //parameter.Add("id", Request["id"].ToString());
                //msg = new PbProject.Logic.User.User_EmployeesBLL().UpdateById(parameter) ? "更新成功" : "更新失败";


                //修改员工信息
                sql1 = string.Format("update User_Employees set Sex='{0}',QQ='{1}',MSN='{2}',Email='{3}',Tel='{4}',Phone='{5}',PostalCode='{6}',Address='{7}',UserName='******',NameEasy='{9}',WorkNum='{10}',CertificateType='{11}',CertificateNum='{12}',State={13},Remark='{14}',DeptId='{15}',OverDueTime='{16}' where id='{17}'",
                                     rblSex.SelectedValue, txtQQ.Text, txtMSN.Text, txtEmail.Text, txtTel.Text, txtPhone.Text, txtYB.Text, txtAddr.Text, txtName.Text, txtNameEasy.Text, txtGong.Text, ddlCertificateType.SelectedValue, txtCertificateNum.Text, rblState.SelectedValue, txtBZ.Text, ddlUserPermissions.SelectedValue, txtovertime.Value, Request["id"].ToString());
                sqllist.Add(sql1);

                if (mCompany.RoleType == 1 && mUser.IsAdmin == 0)
                {
                    string sqlParams = " RestrictLoginAccount = '" + txtUser.Text.Trim() + "'";
                    List <User_Login_RestrictIp> listuloginip = baseDataManage.CallMethod("User_Login_RestrictIp", "GetList", null, new object[] { sqlParams }) as List <User_Login_RestrictIp>;
                    if (listuloginip != null && listuloginip.Count > 0)//有ip数据
                    {
                        sql2 = string.Format("update User_Login_RestrictIp set RestrictLoginIP='{0}',OperTime='{1}' where RestrictLoginAccount='{2}'", ip, DateTime.Now.ToString(), txtUser.Text.Trim());
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(ip))
                        {
                            sql2 = string.Format("insert into User_Login_RestrictIp(CpyNo,RestrictLoginAccount,RestrictLoginIP,OperTime) values ('{0}','{1}','{2}','{3}')", mCompany.UninCode, txtUser.Text.Trim(), ip, DateTime.Now.ToString());
                        }
                    }
                    sqllist.Add(sql2);
                }
                msg = baseDataManage.ExecuteSqlTran(sqllist, out errormsg) == true ? "更新成功" : "更新失败";
                BindUserInfo(Request["id"].ToString());
            }
            else
            {
                //parameter.Add("LoginPassWord", pwdMd5);
                //parameter.Add("CreateTime", timenow);
                //parameter.Add("StartTime", timenow);
                //parameter.Add("LoginName", txtUser.Text.Trim());
                List <User_Employees> listuser = new PbProject.Logic.User.User_EmployeesBLL().GetListByLoginName(txtUser.Text);
                if (listuser != null && listuser.Count > 0)
                {
                    msg = "改账户已存在请重新输入";
                }
                else
                {
                    //msg = new PbProject.Logic.User.User_EmployeesBLL().Insert(parameter) == true ? "添加成功" : "添加失败";
                    sql1 = string.Format("insert into User_Employees (Sex,QQ,MSN,Email,Tel,Phone,PostalCode,Address,UserName,NameEasy,WorkNum,CertificateType,CertificateNum,State,Remark,DeptId,OverDueTime,LoginPassWord,CreateTime,StartTime,LoginName,IsAdmin,CpyNo)" +
                                         "values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}',{13},'{14}','{15}','{16}','{17}','{18}','{19}','{20}',{21},'{22}')",
                                         rblSex.SelectedValue, txtQQ.Text, txtMSN.Text, txtEmail.Text, txtTel.Text, txtPhone.Text, txtYB.Text, txtAddr.Text, txtName.Text, txtNameEasy.Text, txtGong.Text, ddlCertificateType.SelectedValue, txtCertificateNum.Text, rblState.SelectedValue, txtBZ.Text, ddlUserPermissions.SelectedValue, txtovertime.Value, pwdMd5, timenow, timenow, txtUser.Text.Trim(), 1, mCompany.UninCode);
                    sqllist.Add(sql1);

                    if (mCompany.RoleType == 1 && mUser.IsAdmin == 0)
                    {
                        if (!string.IsNullOrEmpty(ip) && ip != "...")
                        {
                            sql2 = string.Format("insert into User_Login_RestrictIp(CpyNo,RestrictLoginAccount,RestrictLoginIP,OperTime) values ('{0}','{1}','{2}','{3}')", mCompany.UninCode, txtUser.Text.Trim(), ip, DateTime.Now.ToString());
                            sqllist.Add(sql2);
                        }
                    }
                }
                msg = baseDataManage.ExecuteSqlTran(sqllist, out errormsg) == true ? "添加成功" : "添加失败";
            }
        }
        catch (Exception)
        {
            msg = "操作失败";
        }
        ScriptManager.RegisterStartupScript(this, GetType(), "", "showdialog('" + msg + "');", true);
    }
예제 #6
0
    /// <summary>
    /// InfoBind()
    /// </summary>
    private void InfoBind()
    {
        try
        {
            string sqlParams = " RestrictLoginAccount = '" + mUser.LoginName + "'";
            List <User_Login_RestrictIp> listuloginip = baseDataManage.CallMethod("User_Login_RestrictIp", "GetList", null, new object[] { sqlParams }) as List <User_Login_RestrictIp>;
            User_Employees ue = new PbProject.Logic.User.User_EmployeesBLL().GetById(mUser.id.ToString());
            if (ue != null)
            {
                txtLoginName.Text     = ue.LoginName;
                txtWorkNum.Text       = ue.WorkNum;
                txtUserName.Text      = ue.UserName;
                rblType.SelectedValue = string.IsNullOrEmpty(ue.Sex) || ue.Sex == "0" ? "0" : "1";
                txtQQ.Text            = ue.QQ;
                txtMSN.Text           = ue.MSN;
                txtEmail.Text         = ue.Email;
                txtTel.Text           = ue.Tel;
                txtPhone.Text         = ue.Phone;
                txtPostalCode.Text    = ue.PostalCode;
                txtAdress.Text        = ue.Address;
                UserPowerControl1.ImportantMarkStr = ue.UserPower;
                if (listuloginip != null && listuloginip.Count > 0)
                {
                    if (listuloginip[0].RestrictLoginIP != "")
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            ((System.Web.UI.HtmlControls.HtmlTableRow) this.FindControl("tr" + i)).Style.Value = "display: none";
                        }
                        hidtxtCount.Value = listuloginip[0].RestrictLoginIP.Split('|').Length.ToString();
                        for (int i = 0; i < listuloginip[0].RestrictLoginIP.Split('|').Length; i++)
                        {
                            //不是最后一个
                            if (i < listuloginip[0].RestrictLoginIP.Split('|').Length - 1)
                            {
                                if (i != 4)
                                {
                                    ((System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("sAdd" + i)).Style.Value = "display: none";
                                }
                                if (i != 0)
                                {
                                    ((System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("sDelete" + i)).Style.Value = "display: none";
                                }
                            }
                            //最后一个
                            else
                            {
                                if (i != 4)
                                {
                                    ((System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("sAdd" + i)).Style.Value = "display: block";
                                }
                                if (i != 0)
                                {
                                    ((System.Web.UI.HtmlControls.HtmlGenericControl) this.FindControl("sDelete" + i)).Style.Value = "display: block";
                                }
                            }
                            ((System.Web.UI.HtmlControls.HtmlTableRow) this.FindControl("tr" + i)).Style.Value = "display: block";
                            txtA      = ((TextBox)this.FindControl("txtA" + i));
                            txtA.Text = listuloginip[0].RestrictLoginIP.Split('|')[i].ToString();
                        }
                    }
                }
            }

            else
            {
            }
        }
        catch (Exception ex)
        {
        }
    }