Пример #1
0
        //Send Password
        public string GetandSendPassWord(string newPassWord, string usercode, int mailvalue)
        {
            string companyCode = _objcurrentInfo.GetCompanyCode();
            string userName    = _objcurrentInfo.GetUserName();
            string strmail     = "";
            string strMailid   = "";
            string strUserName = "";
            string result      = "";

            try
            {
                DataSet dsEmail    = new DataSet();
                DataSet dspassword = new DataSet();
                BLUser  _objUser   = new BLUser();

                if (mailvalue == 0)
                {
                    dspassword  = _objUser.GetPassword(companyCode, usercode);
                    strUserName = dspassword.Tables[0].Rows[0]["User_Name"].ToString();
                    string pwdflag = _objUser.UpdatePasswordReset(companyCode, usercode, newPassWord);
                    result = "SAVED";
                }
                else
                {
                    dsEmail = _objUser.checkEmailid(companyCode, usercode);
                    if (dsEmail.Tables[0].Rows.Count > 0)
                    {
                        strMailid   = dsEmail.Tables[0].Rows[0]["Email_Id"].ToString();
                        dspassword  = _objUser.GetPassword(companyCode, usercode);
                        strUserName = dspassword.Tables[0].Rows[0]["User_Name"].ToString();
                        string pwdflag = _objUser.UpdatePasswordReset(companyCode, usercode, newPassWord);

                        if (!string.IsNullOrEmpty(strMailid))
                        {
                            strmail = SendMail(newPassWord, strUserName, strMailid);
                            result  = strmail + "*" + strMailid;
                        }
                    }
                    else
                    {
                        result = "ERROR";
                    }
                }
                return(result);
            }

            catch (Exception ex)
            {
                Dictionary <string, string> dicContext = new Dictionary <string, string>();
                dicContext.Add("Filter:UserName", usercode);
                dicContext.Add("Filter:newPassWord", newPassWord);
                DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext);
                return(ex.Message.ToString());
            }
        }