コード例 #1
0
ファイル: UserController.cs プロジェクト: vibhutisuthar/TEST
        public int SendMailForRenewPassword(string strEmail)
        {
            try
            {
                UsersBAL objUser = new UsersBAL();
                UsersModel objUsersModel = objUser.FindUser(strEmail);

                if (objUsersModel == null)
                {
                    return 1;
                }

                //Update encode string in database
                objUser.UpdateUserStatus(objUsersModel.ID, objUsersModel.Status, Common.GetSHA1HashData(objUsersModel.EmailAddress));

                //Send email to user, from XSTL
                emailModel objEmailmodel = new emailModel();
                emailBAL objEmailBAL = new emailBAL();
                List<emailModel> lstemailmodel = objEmailBAL.FindEmail("MyTP-Confirm-Reset-JAPA");

                if (lstemailmodel.Count > 0)
                {
                    DataTable DT = Common.ListToDataTable(lstemailmodel);
                    if (DT != null)
                    {

                        DataRow DR = DT.Rows[0];
                        string FileName = ConfigurationManager.AppSettings["EmailTemplatePath"] + Convert.ToString(DR["html_xslt_file"]);
                        XmlDocument xd = new XmlDocument();
                        xd.LoadXml("<tbdoc><encodestring>" + Server.UrlEncode(Common.GetSHA1HashData(objUsersModel.EmailAddress)) + "</encodestring></tbdoc>");
                        string body = RunXSLTransform(FileName, xd).ToHtmlString();

                        string FromAddress = Convert.ToString(DR["from_address"]);
                        string FromName = Convert.ToString(DR["from_name"]);
                        string subject = Convert.ToString(DR["subject"]);
                        string cc = Convert.ToString(DR["cc"]);
                        string bcc = Convert.ToString(DR["bcc"]);

                        Common.SendEmail(FromAddress, FromName, objUsersModel.EmailAddress, cc, bcc, subject, body, true);
                        return 0;
                    }
                }

                return 2;
            }
            catch
            {
                return 2;
            }
        }
コード例 #2
0
ファイル: UserController.cs プロジェクト: vibhutisuthar/TEST
 public ActionResult EmailLogin(FormCollection formCollection)
 {
     string strEMailAddress = "";
     string strPassword = "";
     foreach (string key in formCollection.Keys)
     {
         if (key == "email")
         {
             strEMailAddress = formCollection[key].Trim();
         }
         else if (key == "password")
         {
             strPassword = formCollection[key].Trim();
         }
     }
     Session["LoginEmailAddress"] = null;
     if (strEMailAddress != "" && strPassword != "" && strEMailAddress.ToLower() != "email address")
     {
         UsersBAL objUserBAL = new UsersBAL();
         List<UsersModel> lstUsersModel = objUserBAL.FindUser(strEMailAddress, strPassword);
         if (lstUsersModel != null && lstUsersModel.Count > 0)
         {
             if (lstUsersModel[0].Status == "confirm")
             {
                 Session["LoginEmailAddress"] = strEMailAddress;
                 return RedirectToAction("BookingList", "Bookings");
             }
             else
             {
                 return RedirectToAction("Message", "MessageDisplay", new { E = 50 });
             }
         }
         else
         {
             return RedirectToAction("Message", "MessageDisplay", new { E = 37 });
         }
     }
     else
     {
         return RedirectToAction("Message", "MessageDisplay", new { E = 2 });
     }
 }