/// <summary> /// SaveUser /// </summary> /// <param name="AccountModelDTO"></param> /// <returns></returns> public int SaveUser(UsersModel UsersDTO) { return objUsersDAL.SaveUser(UsersDTO); }
/// <summary> /// RegisterNewUSer /// </summary> /// <returns></returns> public int RegisterNewUSer(UsersModel UsersDTO) { return objUsersDAL.RegisterNewUSer(UsersDTO); }
/// <summary> /// RegisterNewUSer /// </summary> /// <returns></returns> public int RegisterNewUSer(UsersModel UsersDTO) { int retVal = 0; retVal = SaveUser(UsersDTO); return retVal; }
/// <summary> /// SaveUser /// </summary> /// <param name="AccountModelDTO"></param> /// <returns></returns> public int SaveUser(UsersModel UsersDTO) { try { LoginUser objUser = null; if (UsersDTO != null && UsersDTO.ID == 0) { objUser = new LoginUser(); //objUser.id = UsersDTO.ID; objUser.emailaddress = UsersDTO.EmailAddress; objUser.Password = UsersDTO.Password; objUser.created = DateTime.Now; objUser.last_login = DateTime.Now; objUser.status = UsersDTO.Status; objUser.encodestring = UsersDTO.encodestring; mtpusersData.LoginUsers.AddObject(objUser); mtpusersData.SaveChanges(); return 1; } else if (UsersDTO != null && UsersDTO.ID != 0) { objUser = mtpusersData.LoginUsers.FirstOrDefault(t => t.id == UsersDTO.ID); //objUser.id = UsersDTO.ID; //objUser.emailaddress = UsersDTO.EmailAddress; objUser.Password = UsersDTO.Password; objUser.status = UsersDTO.Status; objUser.encodestring = UsersDTO.encodestring; //objUser.last_login = DateTime.Now; mtpusersData.SaveChanges(); return 1; } } catch (Exception) { return 0; } return 0; }
/// <summary> /// RegisterNewUser /// </summary> /// <param name="strEmailAddress"></param> /// <param name="password"></param> /// <returns></returns> public int RegisterNewUser(string strEmailAddress, string password, string encodestring) { UsersBAL objUser = new UsersBAL(); try { UsersModel objUsersModel = new UsersModel(); objUsersModel.EmailAddress = strEmailAddress; objUsersModel.Password = password; objUsersModel.ID = 0; objUsersModel.Status = "pending"; objUsersModel.encodestring = encodestring; int intNewUserRegistered = objUser.RegisterNewUSer(objUsersModel); //Send E-mail //SendEmail(Common.MailType.ConfirmRegistration, strEmailAddress); emailModel objEmailmodel = new emailModel(); emailBAL objEmailBAL = new emailBAL(); List<emailModel> lstemailmodel = objEmailBAL.FindEmail("MyTP-Confirm-Register-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"]); //string buffer = Common.ReadFileFromDisk(FileName, ref logger); XmlDocument xd = new XmlDocument(); xd.LoadXml("<tbdoc><encodestring>" + Server.UrlEncode(encodestring) + "</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, strEmailAddress, cc, bcc, subject, body, true); } } return intNewUserRegistered; } catch { return 2; } finally { objUser = null; } }