public ActionResult ActivationResent(int pageId) { helperActivationResent helperPage = new helperActivationResent(); pageShared ps = new pageShared(db); var pageItem = ps.getPageById(pageId); if (pageItem == null) { return null; } ps.pageTitleBind(pageItem, helperPage, langId); helperPage.setTitle(pageItem.name); helperPage.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); return View(helperPage); }
public ActionResult Index(int pageId) { helperAllBrand helperItem = new helperAllBrand(); // Brand List pageShared ps = new pageShared(db); var productList = ps.getPageByType(pageType.productList ,langId); helperItem.brandList = getBrandList(productList.url); // All BranName pageShared pc = new pageShared(db); var brandPageItem = pc.getPageById(pageId); helperItem.brandName = brandPageItem.name; helperItem.breadCrumbItem = getBreadCrumbAllBrand(brandPageItem.name); // Title pc.pageTitleBind(brandPageItem, helperItem, langId); return View(helperItem); }
// Account Link => Redirect Dashboard public ActionResult Main(int pageId) { pageShared ps = new pageShared(db); var pageItem = ps.getPageById(pageId); var dashboardPage = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.accountDashboard).FirstOrDefault(); if (pageItem != null && dashboardPage != null) { return Redirect("~/" + langCode + "/" + pageItem.url + "/" + dashboardPage.url + ".html"); } return null; }
public ActionResult DiscountIndex(int pageId) { pageShared ps = new pageShared(db); userShared us = new userShared(db); addressShared ash = new addressShared(db); var pageItem = ps.getPageById(pageId); var mainAccountPage = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); helperDiscount pageHelper = new helperDiscount(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.setTitle(pageItem.name); pageHelper.detail = pageItem.detail; pageHelper.leftMenuList = generateLeftMenu(mainAccountPage, pageItem.url); pageHelper.breadCrumbItem = getBreadCrumbTwoPage(mainAccountPage.name, mainAccountPage.url, pageItem.name, pageItem.url); return View(pageHelper); }
public ActionResult Dashboard(int pageId) { topCart cartItem = (topCart)ViewData["topCart"]; pageShared ps = new pageShared(db); userShared us = new userShared(db); addressShared ash = new addressShared(db); var pageItem = ps.getPageById(pageId); var mainAccountPage = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); helperDashboard pageHelper = new helperDashboard(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.setTitle(pageItem.name); pageHelper.detail = pageItem.detail; pageHelper.leftMenuList = generateLeftMenu(mainAccountPage, pageItem.url); pageHelper.breadCrumbItem = getBreadCrumbTwoPage(mainAccountPage.name, mainAccountPage.url, pageItem.name, pageItem.url); // User Info var userItem = us.getUserById(cartItem.userId); pageHelper.email = userItem.email; pageHelper.nameSurname = userItem.name + " " + userItem.surname; var newsletterPage = ps.getPageByType(pageType.accountUserInfo, langId); pageHelper.registerInfoLink = langCode + "/" + mainAccountPage.url + "/" + newsletterPage.url + ".html"; // Newsletter var newsletterItem = db.tbl_newsletterUser.Where(a => a.email == userItem.email).FirstOrDefault(); if (newsletterItem != null) { pageHelper.isNewsletterRegister = true; } // Address var addressList = ash.getAddressListByUserId(cartItem.userId); if (addressList != null && addressList.Count > 0) { pageHelper.lastAddressItem = addressList.LastOrDefault(); } var addressPage = ps.getPageByType(pageType.accountAddress, langId); pageHelper.registerAddressLink = langCode + "/" + mainAccountPage.url + "/" + addressPage.url + ".html"; //Order var pageOrder = ps.getPageByType(pageType.accountOrders, langId); pageHelper.registerOrderLink = langCode + "/" + mainAccountPage.url + "/" + pageOrder.url + ".html"; pageHelper.lastOrder = null; // ToDo: After The order return View(pageHelper); }
public ActionResult ChangePassword(int pageId, helperChangePassword pageHelper) { pageShared ps = new pageShared(db); userShared us = new userShared(db); addressShared ash = new addressShared(db); var pageItem = ps.getPageById(pageId); var mainAccountPage = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.setTitle(pageItem.name); pageHelper.detail = pageItem.detail; pageHelper.leftMenuList = generateLeftMenu(mainAccountPage, pageItem.url); pageHelper.breadCrumbItem = getBreadCrumbTwoPage(mainAccountPage.name, mainAccountPage.url, pageItem.name, pageItem.url); pageHelper.cancelUrl = langCode + "/" + mainAccountPage.url + ".html"; if (pageHelper.password != pageHelper.passwordRep) { ModelState.AddModelError("passwordRep", lang.formPassworRepSame); } if (ModelState.IsValid) { topCart cartItem = (topCart)ViewData["topCart"]; try { us.updateUserPassword(cartItem.userId, MD5(pageHelper.password)); pageHelper.message = getSuccesMessage(lang.updatePasswordSuccess, "autoHide"); pageHelper.isMessageExist = true; } catch (Exception ex) { errorSend(ex, "Account Password Update", true); } } else { string messages = string.Join("<br /> ", ModelState.Values .SelectMany(x => x.Errors) .Select(x => x.ErrorMessage)); pageHelper.message = getErrorMessage(messages, "autoHide"); pageHelper.isMessageExist = true; } return View(pageHelper); }
public ActionResult AddressIndex(int pageId) { pageShared ps = new pageShared(db); userShared us = new userShared(db); addressShared ash = new addressShared(db); var pageItem = ps.getPageById(pageId); var mainAccountPage = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); helperAddress pageHelper = new helperAddress(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.setTitle(pageItem.name); pageHelper.detail = pageItem.detail; pageHelper.leftMenuList = generateLeftMenu(mainAccountPage, pageItem.url); pageHelper.breadCrumbItem = getBreadCrumbTwoPage(mainAccountPage.name, mainAccountPage.url, pageItem.name, pageItem.url); topCart cartItem = (topCart)ViewData["topCart"]; var userItem = us.getUserById(cartItem.userId); pageHelper.userguid = userItem.guid; pageHelper.addressList = ash.getAddressListTemplate(userItem.userId); return View(pageHelper); }
public void sharedCheckoutItemLoad(int pageId, helperCheckoutShared pageHelper, checkoutProcess checkoutItem) { pageShared ps = new pageShared(db); var pageItem = ps.getPageById(pageId); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.detail = pageItem.detail; pageHelper.stepLinkList = checkoutItem.stepLinkList; pageHelper.activeStep = checkoutItem.currentStep; checkoutItem.lastSuccessStep = ((checkoutStep)((int)checkoutItem.currentStep - 1)); if (TempData["errorMessage"] != null) { pageHelper.isMessageExist = true; pageHelper.message = TempData["errorMessage"].ToString(); } }
public ActionResult UserInfo(int pageId) { pageShared ps = new pageShared(db); userShared us = new userShared(db); addressShared ash = new addressShared(db); var pageItem = ps.getPageById(pageId); var mainAccountPage = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); topCart cartItem = (topCart)ViewData["topCart"]; helperUserInfo pageHelper = new helperUserInfo(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.setTitle(pageItem.name); pageHelper.detail = pageItem.detail; pageHelper.leftMenuList = generateLeftMenu(mainAccountPage, pageItem.url); pageHelper.breadCrumbItem = getBreadCrumbTwoPage(mainAccountPage.name, mainAccountPage.url, pageItem.name, pageItem.url); var userItem = us.getUserById(cartItem.userId); pageHelper.name = userItem.name; pageHelper.surname = userItem.surname; pageHelper.email = userItem.email; if (userItem.birthday.HasValue) { var birthday = userItem.birthday.Value; pageHelper.day = birthday.Day; pageHelper.month = birthday.Month; pageHelper.year = birthday.Year; } if (userItem.gender.HasValue) { pageHelper.gender = userItem.gender.Value; } pageHelper.cancelUrl = langCode + "/" + mainAccountPage.url + ".html"; return View(pageHelper); }
public ActionResult ActivationResent(int pageId, string email) { System.Threading.Thread.Sleep(1500); helperActivationResent helperPage = new helperActivationResent(); pageShared ps = new pageShared(db); email = email.ToLower(System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); var pageItem = ps.getPageById(pageId); var pageLoginRegister = ps.getPageByType(pageType.registerLogin, langId); if (pageItem == null | pageLoginRegister == null) { return null; } helperPage.loginLink = langCode + "/" + pageLoginRegister.url + ".html"; ps.pageTitleBind(pageItem, helperPage, langId); helperPage.setTitle(pageItem.name); helperPage.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); if (string.IsNullOrWhiteSpace(email)) { helperPage.isMessageExist = true; helperPage.message = getErrorMessage(App_GlobalResources.lang.formValidEmail); return View(helperPage); } var userItem = db.tbl_user.Where(a => a.email == email && a.registerStatuId == (int)registerStatu.waitingActivation).FirstOrDefault(); if (userItem != null) { try { tbl_activation activationItem = new tbl_activation(); activationItem.code = Guid.NewGuid().ToString(); activationItem.datetime = DateTime.Now; activationItem.userId = userItem.userId; db.tbl_activation.Add(activationItem); db.SaveChanges(); mailShared ms = new mailShared(db, langId); var mailItem = ms.getActivationMailContent(userItem.name, userItem.surname, activationItem.code, getSiteName(Request), langCode); mailSend(userItem.email, mailItem.Item1, mailItem.Item2); helperPage.isMessageExist = true; helperPage.message = getSuccesMessage(App_GlobalResources.lang.activationResentSuccess); helperPage.email = ""; return View(helperPage); } catch (Exception ex) { errorSend(ex, "Activation Update", true); helperPage.isMessageExist = true; helperPage.message = getErrorMessage(App_GlobalResources.lang.unexpectedErrorMsg); return View(helperPage); } } else { helperPage.isMessageExist = true; string errorMessage = App_GlobalResources.lang.activationResentMailErrorNoUser; var registerPage = db.tbl_page.Where(a => a.langId == langId && a.pageTypeId == (int)pageType.registerLogin).FirstOrDefault(); if (registerPage != null) { errorMessage = errorMessage.Replace("[registerPage]", getSiteName(Request) + langCode + "/" + registerPage.url + ".html"); } helperPage.message = getErrorMessage(errorMessage); return View(helperPage); } }
public ActionResult ForgetPassword(int pageId, string email) { System.Threading.Thread.Sleep(1500); helperForgetPassword helperPage = new helperForgetPassword(); pageShared ps = new pageShared(db); userShared us = new userShared(db); email = email.ToLower(System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); var pageItem = ps.getPageById(pageId); var pageLoginRegister = ps.getPageByType(pageType.registerLogin, langId); if (pageItem == null | pageLoginRegister == null) { return null; } helperPage.loginLink = langCode + "/" + pageLoginRegister.url + ".html"; ps.pageTitleBind(pageItem, helperPage, langId); helperPage.setTitle(pageItem.name); helperPage.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); if (string.IsNullOrWhiteSpace(email)) { helperPage.isMessageExist = true; helperPage.message = getErrorMessage(App_GlobalResources.lang.formValidEmail); return View(helperPage); } var userRegisterStatuItem = us.getUserRegisterStatuByEmail(email); string message = ""; switch (userRegisterStatuItem) { case registerStatu.registered: try { mailShared ms = new mailShared(db, langId); var userItem = db.tbl_user.Where(a => a.email == email).FirstOrDefault(); // Add Forget Table var forgetCodeItem = us.addForgetPasswordWithItem(userItem.userId); // Send Mail var mailItem = ms.getResetPasswordMailContent(userItem.name, userItem.surname, forgetCodeItem.code, getSiteName(Request), langCode); mailSend(userItem.email, mailItem.Item1, mailItem.Item2); message = getSuccesMessage(App_GlobalResources.lang.forgetPasswordSuccess).Replace("[email]", email); helperPage.email = ""; } catch (Exception ex) { errorSend(ex, "Şifre sıfırlama", true); } break; case registerStatu.waitingActivation: var pageMailResent = ps.getPageByType(pageType.activationResent, langId); message = App_GlobalResources.lang.activationNoApprove; message = message.Replace("[email]", email); if (pageMailResent != null) { message = message.Replace("[activationResent]", (Url.Content("~/") + langCode + "/" + pageMailResent.url + ".html")); } message = getErrorMessage(message); break; case registerStatu.ban: message = getErrorMessage(App_GlobalResources.lang.forgetPasswordError); break; case registerStatu.unregistered: message = getErrorMessage(App_GlobalResources.lang.forgetPasswordError); break; } helperPage.isMessageExist = true; helperPage.message = message; return View(helperPage); }
public ActionResult ForgetPassword(int pageId) { helperForgetPassword helperPage = new helperForgetPassword(); pageShared ps = new pageShared(db); var pageItem = ps.getPageById(pageId); if (pageItem == null) { return null; } ps.pageTitleBind(pageItem, helperPage, langId); helperPage.setTitle(pageItem.name); helperPage.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); var loginPage = ps.getPageByType(pageType.registerLogin, langId); if (loginPage != null) { helperPage.loginLink = langCode + "/" + loginPage.url + ".html"; } return View(helperPage); }
public ActionResult ActivationUpdate(int pageId, string activationCode) { helperActivationUpdate helperPage = new helperActivationUpdate(); pageShared ps = new pageShared(db); var pageItem = ps.getPageById(pageId); if (pageItem == null) { return null; } ps.pageTitleBind(pageItem, helperPage, langId); helperPage.setTitle(pageItem.name); helperPage.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); var pageResentActivation = ps.getPageByType(pageType.activationResent, langId); string resendActivationLink = ""; if (pageResentActivation != null) { resendActivationLink = Url.Content("~/") + langCode + "/" + pageResentActivation.url + ".html"; } // activation boş if (string.IsNullOrWhiteSpace(activationCode)) { helperPage.message = getErrorMessage(App_GlobalResources.lang.activationCodeError.Replace("[resendLink]", resendActivationLink)); } var activationItem = db.tbl_activation.Where(a => a.code == activationCode).OrderByDescending(a => a.activationId).FirstOrDefault(); // activation Null if (activationItem == null) { helperPage.message = getErrorMessage(App_GlobalResources.lang.activationCodeError.Replace("[resendLink]", resendActivationLink)); return View(helperPage); } try { var userItem = db.tbl_user.Where(a => a.userId == activationItem.userId).FirstOrDefault(); if (userItem != null) { userItem.registerStatuId = (int)registerStatu.registered; db.tbl_activation.Remove(activationItem); db.SaveChanges(); helperPage.message = getSuccesMessage(App_GlobalResources.lang.activationCodeSucess); // Set UserId, User Role , CheckoutProcess setLoginSession(userItem); // Guest Basket => User Basket if (ViewData["topCart"] != null) { var cartItem = (topCart)ViewData["topCart"]; basketShared bs = new basketShared(db); try { bs.updateUserCartFromGuestCode(userItem.userId, cartItem.guestGuid); } catch (Exception ex) { errorSend(ex, "Guest Sepeti , Usera aktarmada "); } } // Thanks Mail var settingItem = db.tbl_settings.Where(a => a.langId == langId).FirstOrDefault(); if (settingItem != null && settingItem.registerIsThankMessageSend) { mailShared ms = new mailShared(db, langId); var mailContentItem = ms.getRegisterThankMailContent(userItem.name, userItem.surname); try { mailSend(userItem.email, mailContentItem.Item1, mailContentItem.Item2); } catch (Exception ex) { errorSend(ex, "Thank Mail sent"); } } } else // activation var Fakat User ile Eşleşmiyor { helperPage.message = getErrorMessage(App_GlobalResources.lang.activationCodeError.Replace("[resendLink]", resendActivationLink)); } } catch (Exception ex) { errorSend(ex, "Activation Durumu update etmede", true); } return View(helperPage); }
public ActionResult ResetPassword(int pageId, helperResetPassword helperPage) { pageShared ps = new pageShared(db); userShared us = new userShared(db); if (helperPage.password != helperPage.passwordRep) { ModelState.AddModelError("passwordRep", App_GlobalResources.lang.formPassworRepSame); } var pageItem = ps.getPageById(pageId); if (pageItem == null) { return null; } ps.pageTitleBind(pageItem, helperPage, langId); helperPage.setTitle(pageItem.name); helperPage.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); helperPage.detail = pageItem.detail; if (ModelState.IsValid) { // password - code reControl var forgetItem = db.tbl_forgetPassword.Where(a => a.code == helperPage.resetCode).FirstOrDefault(); if (forgetItem == null || forgetItem.userId != helperPage.userId) { helperPage.isErrorExist = true; helperPage.isMessageExist = true; helperPage.message = getErrorMessage(App_GlobalResources.lang.unexpectedErrorMsg); return View(helperPage); } // Reset Password try { us.updateUserPassword(helperPage.userId, MD5(helperPage.password)); helperPage.isMessageExist = true; helperPage.message = getSuccesMessage(App_GlobalResources.lang.resetPasswordSuccess); string loginUrl = ""; var loginPage = ps.getPageByType(pageType.registerLogin, langId); if (loginPage != null) { loginUrl = getSiteName(Request) + langCode + "/" + loginPage.url + ".html"; } helperPage.message = helperPage.message.Replace("[loginPage]", loginUrl); } catch (Exception ex) { errorSend(ex, "updatePassword", true); helperPage.isErrorExist = false; helperPage.isMessageExist = true; helperPage.message = getErrorMessage(App_GlobalResources.lang.unexpectedErrorMsg); } try { us.deleteForgetPasswordByUserId(helperPage.userId); } catch (Exception ex) { errorSend(ex, "ForgetPasswordDelete"); } } return View(helperPage); }
public ActionResult Index(int pageId) { var helperPage = new helperProductList(); // mainProductUrl pageShared ps = new pageShared(db); var item = ps.getPageById(pageId); helperPage.breadCrumbItem = getIndexBreadCrumbProductList(item.name); helperPage.header = item.name; var newProductList = db.tbl_product.Include("tbl_stock").Include("tbl_gallery").Include("tbl_carModelProduct.tbl_carModel.tbl_carBrand").Where(a => a.statu && a.isDeleted == false && a.tbl_stock.Any(b => b.stockCount > 0) && a.tbl_carModelProduct.Any(c => c.tbl_carModel != null) && a.tbl_carModelProduct.Any(c => c.tbl_carModel != null) && a.tbl_carModelProduct.Any(c => c.tbl_carModel.tbl_carBrand != null) && a.langId == langId).OrderByDescending(a => a.sequence).ToList(); productShared pc = new productShared(db); int productCount = newProductList.Count; int currentPage = pc.getCurrentPage(Request, productCount, 6); helperPage.pagingItem = pc.getPageItem(productCount, currentPage, 6, "?sayfa="); helperPage.productList = pc.getProductSummary(item.url, newProductList.Skip((currentPage - 1) * 6).Take(6).ToList(), langCulture, langCode, "240", "160"); // Title ps.pageTitleBind(item, helperPage, langId); return View(helperPage); }
public ActionResult OrderDetail(int pageId, string orderGuid) { orderShared os = new orderShared(db); addressShared ads = new addressShared(db); if (!string.IsNullOrWhiteSpace(orderGuid)) { var orderItem = os.getOrderByGuid(orderGuid); if (orderItem != null) { pageShared ps = new pageShared(db); var pageItem = ps.getPageById(pageId); var orderPage = ps.getPageByType(pageType.accountOrders, langId); helperOrderDetail pageHelper = new helperOrderDetail(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.setTitle(pageItem.name); pageHelper.detail = pageItem.detail; pageHelper.orderSummary = os.getOrderSummary(orderItem); pageHelper.orderNo = orderItem.orderNo; pageHelper.orderStatuHtml = os.getOrderStatuString(orderItem.orderStatu); // On Cargo Add Track Url if ((orderStatu)orderItem.orderStatu == orderStatu.onCargo && !string.IsNullOrWhiteSpace(orderItem.shipmentNo)) { pageHelper.orderStatuHtml = pageHelper.orderStatuHtml + " " + os.getCargoTrackHtml(orderItem); } pageHelper.salesAgreement = orderItem.salesAgreement; pageHelper.preSalesAgreement = orderItem.preSalesAgreement; var deliveryAddressItem = ads.getAddressHtmlFromObj(orderItem.deliveryAddressId, orderItem.deliveryAddressObj); var billingAddressItem = ads.getAddressHtmlFromObj(orderItem.billingAddressId, orderItem.billingAddressObj); pageHelper.deliveryAddress = ads.getAddressHtml(deliveryAddressItem, AddressHtmlType.orderDetail, this); pageHelper.billingAddress = ads.getAddressHtml(billingAddressItem, AddressHtmlType.orderDetail, this); pageHelper.orderNote = orderItem.orderNote; topCart cartItem = (topCart)ViewData["topCart"]; if (cartItem.isRegisteredUser) { pageHelper.isGoBackExist = true; var mainAccountPage = ps.getPageByType(pageType.account, langId); var orderListPage = ps.getPageByType(pageType.accountOrders, langId); pageHelper.goBackLink = langCode + "/" + mainAccountPage.url + "/" + orderListPage.url + ".html"; } return View(pageHelper); } } return null; }
public ActionResult OrderIndex(int pageId) { pageShared ps = new pageShared(db); userShared us = new userShared(db); topCart cartItem = (topCart)ViewData["topCart"]; var pageMainAccount = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); var orderSearchPage = ps.getPageByType(pageType.accountOrderSearch, langId); var orderDetailPage = ps.getPageByType(pageType.accountOrderDetail, langId); if (!cartItem.isRegisteredUser) { return Redirect("~/" + langCode + "/" + orderSearchPage.url + ".html"); } var pageItem = ps.getPageById(pageId); helperOrder pageHelper = new helperOrder(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.setTitle(pageItem.name); pageHelper.detail = pageItem.detail; pageHelper.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); pageHelper.leftMenuList = generateLeftMenu(pageMainAccount, pageItem.url); string orderDatailLinkPrefix = langCode + "/" + orderDetailPage.url + ".html?orderGuid="; pageHelper.orderList = getOrderList(orderDatailLinkPrefix, cartItem.userId, true); return View(pageHelper); }
public ActionResult Index(int pageId) { pageShared ps = new pageShared(db); var helperItem = new ViewModel.LoginRegister.helperLoginRegister(); // Registered User Redirect if (ViewData["topCart"] != null) { var cartItem = (topCart)ViewData["topCart"]; if (cartItem.isRegisteredUser) { return Redirect("~/"); } } helperItem.register = new ViewModel.LoginRegister.registerItem(); var aggrementModule = ps.getModuleByType(moduleType.registerAgreement, langId); if (aggrementModule != null) { helperItem.register.agreementContent = aggrementModule.htmlContent; } helperItem.login = new ViewModel.LoginRegister.loginItem(); var pageItem = ps.getPageById(pageId); if (pageItem == null) { return null; } ps.pageTitleBind(pageItem, helperItem, langId); var pageName = pageItem.name; if (!string.IsNullOrWhiteSpace(pageItem.title)) { pageName = pageItem.title; } // forget Password Link var forgetPasswordPage = ps.getPageByType(pageType.forgetPassword, langId); if (forgetPasswordPage != null) { helperItem.login.forgetPasswordUrl = langCode + "/" + forgetPasswordPage.url + ".html"; } // Facebook Register & login Error if (Request.QueryString["facebookError"] != null && Request.QueryString["facebookError"].ToString() == "yes") { helperItem.isFacebookError = true; helperItem.facebookErrorMessage = getErrorMessage(App_GlobalResources.lang.unexpectedErrorMsg); } if (Request.QueryString["needLogin"] != null && Request.QueryString["needLogin"].ToString() == "yes") { helperItem.isLoginRequeredShown = true; helperItem.isLoginRequeredMessage = getErrorMessage(App_GlobalResources.lang.needLogin, "mTop10 mBottom0 autoHide"); } helperItem.breadCrumbItem = getBreadCrumbStaticPage(pageName); return View(helperItem); }
public ActionResult UserInfo(int pageId, helperUserInfo pageHelper) { pageShared ps = new pageShared(db); userShared us = new userShared(db); addressShared ash = new addressShared(db); var pageItem = ps.getPageById(pageId); var mainAccountPage = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.setTitle(pageItem.name); pageHelper.detail = pageItem.detail; pageHelper.leftMenuList = generateLeftMenu(mainAccountPage, pageItem.url); pageHelper.breadCrumbItem = getBreadCrumbTwoPage(mainAccountPage.name, mainAccountPage.url, pageItem.name, pageItem.url); pageHelper.cancelUrl = langCode + "/" + mainAccountPage.url + ".html"; DateTime birthday = DateTime.Now; try { birthday = new DateTime(pageHelper.year, pageHelper.month, pageHelper.day); } catch { ModelState.AddModelError("validDate", lang.formValidDate); } try { System.Net.Mail.MailAddress mailItem = new System.Net.Mail.MailAddress(pageHelper.email); } catch { ModelState.AddModelError("email", lang.formValidEmail); } if (ModelState.IsValid) { topCart cartItem = (topCart)ViewData["topCart"]; var userItem = us.getUserById(cartItem.userId); try { userItem.birthday = birthday; userItem.email = pageHelper.email; userItem.gender = pageHelper.gender; userItem.name = pageHelper.name; userItem.surname = pageHelper.surname; db.SaveChanges(); pageHelper.message = getSuccesMessage(lang.userInfoUpdated, "autoHide"); pageHelper.isMessageExist = true; } catch (Exception ex) { errorSend(ex, "userAccountUpdate", true); } } else { string messages = string.Join("<br/> ", ModelState.Values .SelectMany(x => x.Errors) .Select(x => x.ErrorMessage)); pageHelper.message = getErrorMessage(messages, "autoHide"); pageHelper.isMessageExist = true; } return View(pageHelper); }
public ActionResult ResetPassword(int pageId, string resetcode) { helperResetPassword helperPage = new helperResetPassword(); pageShared ps = new pageShared(db); var pageItem = ps.getPageById(pageId); if (pageItem == null) { return null; } ps.pageTitleBind(pageItem, helperPage, langId); helperPage.setTitle(pageItem.name); helperPage.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); helperPage.detail = pageItem.detail; bool isErrorExist = false; if (string.IsNullOrWhiteSpace(resetcode)) { helperPage.message = App_GlobalResources.lang.resetPasswordNull; isErrorExist = true; } else { var forgetPasswordItem = db.tbl_forgetPassword.Where(a => a.code == resetcode).FirstOrDefault(); if (forgetPasswordItem != null) { helperPage.resetCode = forgetPasswordItem.code; helperPage.userId = forgetPasswordItem.userId; return View(helperPage); } else { helperPage.message = App_GlobalResources.lang.resetPasswordWrong; isErrorExist = true; } } if (isErrorExist) { string forgetPasswordLink = ""; var forgetPassPage = ps.getPageByType(pageType.forgetPassword, langId); if (forgetPassPage != null) { forgetPasswordLink = getSiteName(Request) + langCode + "/" + forgetPassPage.url + ".html"; } helperPage.message = helperPage.message.Replace("[forgetPasswordLink]", forgetPasswordLink); helperPage.isMessageExist = true; helperPage.isErrorExist = true; return View(helperPage); } return null; }