Example #1
0
 public ReturnValue GetEmployeePWD(string EmployeeGZID)
 {
     BLL_LoginUser bll = new BLL_LoginUser();
     return bll.GetEmployeePWD(EmployeeGZID);
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strUserID = txtLoginID.Text.Trim();
        string strMail = txtMail.Text.Trim();
        XTHospital.BLL.BLL_LoginUser bll = new XTHospital.BLL.BLL_LoginUser();
        XTHospital.COM.ReturnValue resoult = bll.GetEmployeePWD(strUserID);
        if (resoult.ErrorFlag)
        {
            if (resoult.Count < 1)
            {
                XTHospital.BLL.BLL_Log.AddLog("用户[" + strUserID + "]尝试找回密码失败,用户名不存在!", "1", Page.Request.UserHostAddress);//添加日志
                LiteralMsg.Text = "用户名不存在!";
                LiteralMsg.DataBind();
                return;
            }
            else
            {
                if (strMail == resoult.ResultDataSet.Tables[0].Rows[0]["EmployeeEmail"].ToString())
                {
                    bool blFlag = false;
                    string strPassWord = resoult.ResultDataSet.Tables[0].Rows[0]["EmployeePWD"].ToString();
                    string strUserName = resoult.ResultDataSet.Tables[0].Rows[0]["EmployeeName"].ToString();
                    string strMessage=string.Empty;
                    string strTitle="健康查询系统找回密码";
                    string strMailTo=resoult.ResultDataSet.Tables[0].Rows[0]["EmployeeEmail"].ToString().Trim();
                    string strMailBody = @"尊敬的阁下:
        您好!很高兴您能收到这封邮件。

        您最近忘记密码了吗?以后要牢记哦。

        您的账号为:" + strUserID + "   密码:" + strPassWord;
                    strMailBody += @"

        致
        敬

        子扬软件

        本邮件为系统自动发送,请勿回复。";
                    blFlag = XTHospital.COM.Method.SendMail1(strMailTo, strTitle, strMailBody, out strMessage);
                    if (blFlag)
                    {
                        XTHospital.BLL.BLL_Log.AddLog("用户[" + strUserName + "]使用了找回密码功能,将密码发送到了邮箱[" + strMailTo + "].", "1", Page.Request.UserHostAddress);//添加日志
                        LiteralMsg.Text = "密码已经发送到了您的邮箱!请查收";
                        LiteralMsg.DataBind();
                        return;
                    }
                    else
                    {
                        XTHospital.BLL.BLL_Log.AddLog("用户[" + strUserName + "]使用了找回密码功能,发送到邮箱[" + strMailTo + "]时失败." + strMessage, "1", Page.Request.UserHostAddress);//添加日志
                        LiteralMsg.Text = "发送到邮箱[" + strMailTo + "]时失败.";
                        LiteralMsg.DataBind();
                        return;
                    }
                }
                else
                {
                    XTHospital.BLL.BLL_Log.AddLog("用户[" + strUserID + "]尝试找回密码失败,所填邮箱不存在或不是其绑定的邮箱!", "1", Page.Request.UserHostAddress);//添加日志
                    LiteralMsg.Text = "输入的邮箱不存在或不是您当时绑定的邮箱!";
                    LiteralMsg.DataBind();
                    return;
                }
            }
        }
        else
        {
            LiteralMsg.Text = resoult.ErrorID;
            LiteralMsg.DataBind();
            return;
        }
    }
Example #3
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         LiteralMsg.Text = "";
         LiteralMsg.DataBind();
         if (this.txtValidateCode.Text.Trim().ToUpper() == Session["CheckCode"].ToString().ToUpper())
         {
             string strUserID = txtLoginID.Text.Trim();
             string strUserPWD = txtPWD.Text.Trim();
             string strEmployeeName = string.Empty;
             XTHospital.BLL.BLL_LoginUser bll = new XTHospital.BLL.BLL_LoginUser();
             XTHospital.COM.ReturnValue resoult = bll.GetEmployeePWD(strUserID);
             if (resoult.ErrorFlag)
             {
                 if (resoult.Count < 1)
                 {
                     XTHospital.BLL.BLL_Log.AddLog("查询用户[" + strUserID + "]尝试登录系统失败,用户名或密码错误!", "1", Page.Request.UserHostAddress);//添加日志
                     LiteralMsg.Text = "用户名或密码错误!";
                     LiteralMsg.DataBind();
                     return;
                 }
                 else
                 {
                     if (strUserPWD == resoult.ResultDataSet.Tables[0].Rows[0]["EmployeePWD"].ToString())
                     {
                         Session["LoginUserID"] = strUserID;
                         Session["LoginUserName"] = strEmployeeName;
                         strEmployeeName = resoult.ResultDataSet.Tables[0].Rows[0]["EmployeeName"].ToString().Trim();
                         Session["EmployeeID"] = resoult.ResultDataSet.Tables[0].Rows[0]["EmployeeID"].ToString().Trim();
                         Session["EmployeeMail"] = resoult.ResultDataSet.Tables[0].Rows[0]["EmployeeEmail"].ToString().Trim();
                         Session["EmployeePhone"] = resoult.ResultDataSet.Tables[0].Rows[0]["EmployeePhone"].ToString().Trim();
                         XTHospital.BLL.BLL_Log.AddLog("查询用户[" + strEmployeeName + "]登录了系统.", "1", Page.Request.UserHostAddress);//添加日志
                         Response.Redirect("XTHospitalDefault.aspx");
                     }
                     else
                     {
                         LiteralMsg.Text = "用户名或密码错误!";
                         LiteralMsg.DataBind();
                         return;
                     }
                 }
             }
             else
             {
                 LiteralMsg.Text = resoult.ErrorID;
                 LiteralMsg.DataBind();
                 return;
             }
         }
         else
         {
             LiteralMsg.Text = "验证码错误!";
             LiteralMsg.DataBind();
             return;
         }
     }
     catch(Exception ex)
     {
         LiteralMsg.Text = ex.Message;
         LiteralMsg.DataBind();
         return;
     }
 }