public ActionResult Edit(User user) { ViewBag.Country = CountryList.ToArray(); ViewBag.Message = string.Empty; if (ModelState.IsValid) { if (_repository.Find(u => u.Email.ToLower().Equals(user.Email) && u.ID != user.ID && u.SiteID == user.SiteID).FirstOrDefault() == null) { user.AuditDetails.DateModified = DateTimeWithZone.Now; user.AuditDetails.ByUserID = user.ID; user.AuditDetails.HttpHeaderDump = Request.Headers.ToString(); user.AuditDetails.IP = Request.UserHostAddress; _service.SaveCustomer(user, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID); ViewBag.Message = "<div class='alert-success'>" + WBSSLStore.Resources.GeneralMessage.Message.SavedSuccessfully + "</div>"; //ViewBag.Message = WBSSLStore.Resources.ErrorMessage.Message.SavedSuccessfully; return(View(user)); } else { ViewBag.Message = "<div class='alert-danger'>" + WBSSLStore.Resources.GeneralMessage.Message.EmailExists + "</div>"; //ViewBag.Message = WBSSLStore.Resources.ErrorMessage.Message.EmailExists; return(View(user)); } } else { return(View(user)); } }
public ActionResult paypalipn() { try { User U = null; if (U == null) { int UserID = Convert.ToInt32(Request.QueryString[SettingConstants.QS_USERID]); var repo = DependencyResolver.Current.GetService <IRepository <User> >(); User user = repo.FindByID(UserID); if (user != null && user.ID > 0) { System.Web.Security.Membership.ApplicationName = user.SiteID.ToString(); System.Web.Security.FormsAuthentication.SetAuthCookie(user.Email, false); U = user; } } Site = GetSite(U.SiteID); currentsitesettings = new CurrentSiteSettings(Site); SetSiteIDInSession(); _logger.Log("Start PayPal IPN Call Success. Url :" + Request.Url.AbsoluteUri.ToString(), Logger.LogType.INFO); if (System.Web.HttpContext.Current.Request.QueryString[SettingConstants.PAYPAL_PAYMENTTYPE].ToString().ToLower().Equals("reissueaddfund")) { _service.ProcessPayPalIPNRequestReIssue(Site, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID, currentsitesettings.SiteAdminEmail, currentsitesettings.InvoicePrefix); } else { _service.ProcessPayPalIPNRequest(Site, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID, currentsitesettings.SiteAdminEmail, currentsitesettings.InvoicePrefix); } _logger.Log("end Paypal IPN Call Success. Url :" + Request.Url.AbsoluteUri.ToString(), Logger.LogType.INFO); } catch (Exception e) { _logger.LogException(e); } finally { currentsitesettings = null; } return(null); }
public bool AddEdit(User user) { try { bool bIsEmailExist = _service.EmailExist(user.Email, Site.ID, user.ID); if (bIsEmailExist) { ViewBag.IsUserExist = true; return(false); } else { ViewBag.IsUserExist = false; } user.AuditID = user.AuditDetails.ID; user.AuditDetails.DateModified = DateTimeWithZone.Now; user.AuditDetails.ByUserID = CurrentUser.ID; user.AuditDetails.HttpHeaderDump = HttpUtility.UrlDecode(Request.Headers.ToString()); user.AuditDetails.IP = Request.UserHostAddress; user.UserType = UserType.CUSTOMER; user.UserTypeID = (int)UserType.CUSTOMER; if (user.ID == 0) { user.AuditDetails.DateCreated = DateTimeWithZone.Now; user.SiteID = Site.ID; user.PasswordSalt = WBSSLStore.Web.Helpers.WBHelper.CreateSalt(); user.PasswordHash = WBSSLStore.Web.Helpers.WBHelper.CreatePasswordHash(user.PasswordHash, user.PasswordSalt); user.ConfirmPassword = user.PasswordHash; } return(_service.SaveCustomer(user, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID)); } catch (Exception exc) { ViewBag.ErrMsg = exc.Message.ToString(); return(false); } }
public ActionResult Preferences(FormCollection collection) { if (!string.IsNullOrEmpty(collection["txtPassword"])) { string PasswordHash = WBHelper.CreatePasswordHash(collection["txtPassword"].ToString(), LoginUser.PasswordSalt); WBSSLStore.Domain.User objUser = LoginUser; objUser.ConfirmPassword = PasswordHash; objUser.PasswordHash = PasswordHash; _repository.Update(objUser); _unitOfWork.Commit(); var _emailservice = DependencyResolver.Current.GetService <IEmailQueueService>(); if (LoginUser.UserType == UserType.CUSTOMER) { _emailservice.PrepareEmailQueue(Site.ID, WBHelper.CurrentLangID(), EmailType.CUSTOMER_CHANGE_PASSWORD, SiteCacher.SiteSMTPDetail().ID, LoginUser.Email, LoginUser); } else { _emailservice.PrepareEmailQueue(Site.ID, WBHelper.CurrentLangID(), EmailType.RESELLER_CHANGE_PASSWORD_EMAIL, SiteCacher.SiteSMTPDetail().ID, LoginUser.Email, LoginUser); } _unitOfWork.Commit(); ViewBag.Message = "<div class='alert-success'>" + WBSSLStore.Resources.GeneralMessage.Message.Pwdchanged + "</div>"; return(View(LoginUser)); } else { ViewBag.Message = "<div class='alert-danger'>" + WBSSLStore.Resources.ErrorMessage.Message.PasswordRequired + "</div>"; return(View(LoginUser)); } }
//public bool AddEdit(ResellerContract resellercontract) public bool AddEdit(CusUserUserOption resellercontract) { try { bool bIsEmailExist = _service.EmailExist(resellercontract.objResContract.Reseller.Email, Site.ID, resellercontract.objResContract.Reseller.ID); if (bIsEmailExist) { ViewBag.IsUserExist = true; return(false); } else { ViewBag.IsUserExist = false; } //resellercontract.Reseller.AuditDetails.ID = resellercontract.Reseller.AuditID; resellercontract.objResContract.Reseller.AuditDetails.DateModified = DateTimeWithZone.Now; resellercontract.objResContract.Reseller.AuditDetails.ByUserID = CurrentUser.ID; resellercontract.objResContract.Reseller.AuditDetails.HttpHeaderDump = HttpUtility.UrlDecode(Request.Headers.ToString()); resellercontract.objResContract.Reseller.AuditDetails.IP = Request.UserHostAddress; // resellercontract.AuditID = resellercontract.AuditDetails.ID; resellercontract.objResContract.AuditDetails.DateModified = DateTimeWithZone.Now; resellercontract.objResContract.AuditDetails.ByUserID = 0; resellercontract.objResContract.AuditDetails.HttpHeaderDump = "admin system"; resellercontract.objResContract.AuditDetails.IP = Request.UserHostAddress; resellercontract.objResContract.Reseller.UserType = UserType.RESELLER; resellercontract.objResContract.Reseller.UserTypeID = (int)UserType.RESELLER; if (resellercontract.objResContract.UserID == 0) { resellercontract.objResContract.Reseller.AuditDetails.DateCreated = DateTimeWithZone.Now; resellercontract.objResContract.AuditDetails.DateCreated = DateTimeWithZone.Now; resellercontract.objResContract.Reseller.SiteID = Site.ID; resellercontract.objResContract.SiteID = Site.ID; resellercontract.objResContract.Reseller.PasswordSalt = WBSSLStore.Web.Helpers.WBHelper.CreateSalt(); resellercontract.objResContract.Reseller.PasswordHash = WBSSLStore.Web.Helpers.WBHelper.CreatePasswordHash(resellercontract.objResContract.Reseller.PasswordHash, resellercontract.objResContract.Reseller.PasswordSalt); resellercontract.objResContract.Reseller.ConfirmPassword = resellercontract.objResContract.Reseller.PasswordHash; } if (resellercontract.objUserOption.ID == 0) { resellercontract.objUserOption.SiteID = Site.ID; resellercontract.objUserOption.DateAdded = DateTimeWithZone.Now; } return(_service.SaveReseller(resellercontract.objResContract, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID, resellercontract.objUserOption)); } catch (Exception exc) { ViewBag.ErrMsg = exc.Message.ToString(); return(false); } }
public ActionResult ChangeStatus(int id) { var bStatus = _service.UpdateUserStatus(id, Site.ID, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID); return(Json(bStatus)); }
public ActionResult resellersignup(User user) { Site Site = GetSite(user.SiteID); string AuthToken = ""; if (ModelState.IsValid) { user.RecordStatusID = NeedApproveReseller ? (int)RecordStatus.INACTIVE : (int)RecordStatus.ACTIVE; user.PasswordSalt = WBHelper.CreateSalt(); user.PasswordHash = WBHelper.CreatePasswordHash(user.PasswordHash, user.PasswordSalt); int result = _service.SaveReseller(user, Site.ID, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID, WBHelper.SiteAdminEmail(Site)); if (result.Equals(1)) { if (!NeedApproveReseller) { AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("true" + SettingConstants.Seprate + user.Email + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "true", true)); } else { AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("true" + SettingConstants.Seprate + user.Email + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "false", false)); } } else if (result.Equals(-1)) { AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-1" + SettingConstants.Seprate + "false", true)); } else { AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-2" + SettingConstants.Seprate + "false", true)); } } else { AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-3" + SettingConstants.Seprate + "false", true)); } // If we got this far, something failed, redisplay form string url = "http://" + (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias) + "/staticpage/resellersignupresult?authtoken=" + AuthToken; return(Redirect301(url, (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias))); }
private void SendMailForResellerSignUp(ResellerSignup objReseller) { try { var ToEmail = Site.Settings.Where(ss => ss.SiteID == Site.ID && ss.Key.ToLower() == SettingConstants.CURRENT_SITE_TOEMAIL.ToLower()).FirstOrDefault(); SiteSettings thankyou = Site.Settings.Where(o => o.Key == WBSSLStore.Domain.SettingConstants.CURRENT_SITE_THANKYOUPAGE && o.SiteID == Site.ID).FirstOrDefault(); var objEmailQue = DependencyResolver.Current.GetService <WBSSLStore.Service.IEmailQueueService>(); WBSSLStore.Domain.User objUser = new Domain.User(); objUser.FirstName = objReseller.FirstName; objUser.LastName = objReseller.LastName; objUser.Email = objReseller.Email; objUser.Address = new Address(); objUser.Address.Street = objReseller.Street; objUser.Address.City = objReseller.City; objUser.Address.CompanyName = objReseller.CompanyName; objUser.Address.Country = new Country(); objUser.Address.Country.CountryName = objReseller.CountryName; objUser.Address.State = objReseller.State; objUser.Address.Fax = objReseller.Fax; objUser.Address.Phone = objReseller.Phone; objUser.CompanyName = objReseller.CountryName; objUser.HeardBy = objReseller.HearedBy; objEmailQue.PrepareEmailQueue(Site.ID, WBHelper.CurrentLangID(), EmailType.ADMIN_NEW_RESELLER, SiteCacher.SiteSMTPDetail().ID, !string.IsNullOrEmpty(Convert.ToString(ToEmail.Value)) ? Convert.ToString(ToEmail.Value) : "*****@*****.**", objUser); objEmailQue.PrepareEmailQueue(Site.ID, WBHelper.CurrentLangID(), EmailType.RESELLER_WELCOME_EMAIL, SiteCacher.SiteSMTPDetail().ID, Convert.ToString(objReseller.Email), objUser); _unitOfWork.Commit(); } catch (Exception ex) { throw ex; } }
public ActionResult contactuspost(FormCollection collection) { string CompanyName = string.Empty; string Name = string.Empty; string Phone = string.Empty; string Email = string.Empty; string Comment = string.Empty; string Subject = string.Empty; try { CompanyName = Convert.ToString(collection["txtCompany"]); Name = Convert.ToString(collection["txtFullname"]); Phone = Convert.ToString(collection["txtPhone"]); Email = Convert.ToString(collection["txtEmail"]); Comment = Convert.ToString(collection["txtComment"]); var subject = Site.Settings.Where(ss => ss.SiteID == Site.ID && ss.Key == SettingConstants.CURRENT_SITE_SUBJECTFEIELD).FirstOrDefault(); var ToEmail = Site.Settings.Where(ss => ss.SiteID == Site.ID && ss.Key.ToLower() == SettingConstants.CURRENT_SITE_TOEMAIL.ToLower()).FirstOrDefault(); SiteSettings thankyou = Site.Settings.Where(o => o.Key == WBSSLStore.Domain.SettingConstants.CURRENT_SITE_THANKYOUPAGE && o.SiteID == Site.ID).FirstOrDefault(); Subject = Convert.ToString(subject.Value); var objEmailQue = DependencyResolver.Current.GetService <WBSSLStore.Service.IEmailQueueService>(); string[] strValues = new string[] { CompanyName, Name, Phone, Email, Comment, Subject }; objEmailQue.PrepareEmailQueue(Site.ID, WBHelper.CurrentLangID(), EmailType.CONTACTUS_EMAIL, SiteCacher.SiteSMTPDetail().ID, Convert.ToString(ToEmail.Value), strValues); _unitOfWork.Commit(); } catch (Exception ex) { Logger.Logger.Log_Exception(ex); return(Json(new { issuccess = "false" }, JsonRequestBehavior.AllowGet)); } return(Json(new { issuccess = "true" }, JsonRequestBehavior.AllowGet)); }
public ActionResult Forgotpassword(FormCollection collection) { string EmailAddress = Convert.ToString(Request.Form["txtEmailAddress"]); if (!string.IsNullOrEmpty(EmailAddress)) { ViewBag.Message = _service.SendForgotPasswordEmail(EmailAddress, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID, Site.ID, WBSiteSettings.AppPath + "/resetpassword?token="); } return(View()); }
public ActionResult AddFund(FormCollection collection, int ID) { User currentuser = null; if (User.Identity.IsAuthenticated) { SSLStoreUser loginuser = (SSLStoreUser)Membership.GetUser(); if (loginuser != null && loginuser.Details != null) { currentuser = loginuser.Details; } } var _user = DependencyResolver.Current.GetService <IRepository <User> >(); User objUser = _user.Find(u => u.ID == ID && u.SiteID == Site.ID).FirstOrDefault(); if (Convert.ToDecimal(collection["txtAmount"]) != 0) { if (objUser != null) { Audit audit = new Audit(); audit.ByUserID = currentuser.ID; audit.DateCreated = DateTimeWithZone.Now; audit.HttpHeaderDump = HttpUtility.UrlDecode(Request.Headers.ToString()); audit.IP = Request.UserHostAddress; UserTransaction usertransaction = new UserTransaction(); usertransaction.AuditDetails = audit; usertransaction.TransactionModeID = (int)TransactionMode.ADDFUND; usertransaction.ReceipientInstrumentDetails = collection["txtReceiptDetails"]; usertransaction.Comment = collection["txtRemark"]; usertransaction.TransactionAmount = Convert.ToDecimal(collection["txtAmount"]); usertransaction.UserID = ID; usertransaction.SiteID = Site.ID; _repository.Add(usertransaction); _unitOfWork.Commit(); var _newusertransaction = _repository.Find(ut => ut.ID == usertransaction.ID) .EagerLoad(ut => ut.User) .FirstOrDefault(); _service.PrepareEmailQueue(Site.ID, WBHelper.CurrentLangID(), EmailType.ADMIN_ADD_FUND_NOTIFICATION, SiteCacher.SiteSMTPDetail().ID, SiteAdminEmail, _newusertransaction); _unitOfWork.Commit(); return(RedirectToAction("edit", objUser.UserType.ToString().ToLower(), new { id = ID })); } } else { ViewBag.AmountMsg = WBSSLStore.Resources.ErrorMessage.Message.AmtGreaterthanzero; } return(View()); }
public ActionResult pay(CheckOutViewModel collection) { bool result = true; try { // TODO: Add insert logic here if (collection != null) { _viewModel = collection; Site = GetSite(_viewModel.SiteID); currentsitesettings = new CurrentSiteSettings(Site); //SetSiteIDInSession(); if (!User.Identity.IsAuthenticated) { _viewModel.user.PasswordSalt = WBSSLStore.Web.Helpers.WBHelper.CreateSalt(); _viewModel.user.PasswordHash = WBSSLStore.Web.Helpers.WBHelper.CreatePasswordHash(_viewModel.user.FirstName + _viewModel.SiteID, _viewModel.user.PasswordSalt); _viewModel.user.ConfirmPassword = _viewModel.user.PasswordHash; User user = _viewModel.user; int resultid = _service.AddUserandUpdateCart(user, _viewModel.ShoppingCartID, Site.ID, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID, currentsitesettings.SiteAdminEmail); if (resultid.Equals(1)) { //Set Auhtentic ticket in Member Ship. System.Web.Security.Membership.ApplicationName = Site.ID.ToString(); if (System.Web.Security.Membership.ValidateUser(user.Email, user.FirstName + Site.ID)) { System.Web.Security.FormsAuthentication.SetAuthCookie(user.Email, false); } } else if (resultid.Equals(2)) { _viewModel.Errormsg = WBSSLStore.Resources.ErrorMessage.Message.UserExist; result = false; } else if (resultid.Equals(-1)) { _viewModel.Errormsg = WBSSLStore.Resources.ErrorMessage.Message.ProcessError; result = false; } } else if (User.Identity.IsAuthenticated && _viewModel.user != null && _viewModel.user.ID.Equals(0)) { _viewModel.user = CurrentUser; } try { // validate Amount var cartdeatil = _repository.Find(x => x.ShoppingCartID == _viewModel.ShoppingCartID).EagerLoad(c => c.ShoppingCart, c => c.Product, c => c.ProductPricing).ToList(); _viewModel.OrderAmount = cartdeatil.Sum(p => p.Price); _viewModel.PromoDiscount = cartdeatil.Sum(p => p.PromoDiscount); _viewModel.AvailableCredit = _service.GetCreditAmount(_viewModel.user.ID, _viewModel.user.SiteID); //Calculate VAT if (currentsitesettings.IsVatApplicable) { if (!string.IsNullOrEmpty(_viewModel.VATNumber) || _viewModel.Tax > 0) { int vatpercent = currentsitesettings.VATTax; if (vatpercent > 0) { _viewModel.Tax = (((_viewModel.OrderAmount - _viewModel.PromoDiscount) * vatpercent) / 100); } } else { _viewModel.Tax = 0; } } else { _viewModel.Tax = 0; } // _viewModel.PayableAmount = ((_viewModel.OrderAmount - _viewModel.PromoDiscount) + _viewModel.Tax) - _viewModel.AvailableCredit; _viewModel.PayableAmount = _viewModel.PayableAmount <= 0 ? 0 : _viewModel.PayableAmount; _viewModel.PayableAmount = Convert.ToDecimal(_viewModel.PayableAmount.ToString("0.00")); // Set Country Name if (_viewModel.user.Address.CountryID > 0) { Country c = CountryList.Find(x => x.ID == _viewModel.user.Address.CountryID & x.RecordStatusID == (int)RecordStatus.ACTIVE); if (c != null) { _viewModel.BillingCountry = c.CountryName; } else { _viewModel.BillingCountry = "US"; } c = null; } else { _viewModel.BillingCountry = "US"; } //End // Make Payment if (string.IsNullOrEmpty(_viewModel.Errormsg) && result) { result = _service.PlaceOrder(_viewModel, Site, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID, currentsitesettings.SiteAdminEmail, currentsitesettings.InvoicePrefix); ViewBag.Errormsg = _viewModel.Errormsg; } else { ViewBag.Errormsg = _viewModel.Errormsg; } } catch (Exception ex) { ViewBag.Errormsg = ex.Message; _logger.LogException(ex); result = false; } } if (_viewModel.OrderID > 0 && string.IsNullOrEmpty(_viewModel.Errormsg) && result) { //if (!currentsitesettings.USESSL) // System.Web.Security.FormsAuthentication.SignOut(); Host = (currentsitesettings.USESSL && currentsitesettings.IsSiteRunWithHTTPS ? "https://" : "http://") + (string.IsNullOrEmpty(currentsitesettings.CurrentSite.Alias) ? currentsitesettings.CurrentSite.CName : currentsitesettings.CurrentSite.Alias); if (currentsitesettings.IsRunWithWWW && !Host.Contains("www.")) { Host = Host.Replace(Host, "www." + Host); } else if (!currentsitesettings.IsRunWithWWW && Host.Contains("www.")) { Host = Host.Replace("www.", ""); } string url = Host + "/client/thankyou?token=" + HttpUtility.UrlEncode(WBSSLStore.CryptorEngine.Encrypt(_viewModel.OrderID + SettingConstants.Seprate + _viewModel.user.ID, true)); return(Redirect(url)); } } catch (Exception ex) { ViewBag.Errormsg = ex.Message; _logger.LogException(ex); result = false; if (currentsitesettings != null) { currentsitesettings.Dispose(); } } SetDefaultData(_viewModel.ShoppingCartID); if (currentsitesettings != null) { currentsitesettings.Dispose(); } return(View("index", _viewModel)); }