public JsonResult AddressAdd(string userGuid) { addressModelItem item = new addressModelItem(); userShared us = new userShared(db); var userItem = us.getUserByGuid(userGuid); //Close Url pageShared ps = new pageShared(db); var mainPage = ps.getPageByType(pageType.account, langId); var addressPage = ps.getPageByType(pageType.accountAddress, langId); item.closeUrl = getSiteName(Request) + langCode + "/" + mainPage.url + "/" + addressPage.url + ".html"; if (userItem == null) { item.isMessageExist = true; item.message = getErrorMessage(lang.unexpectedErrorMsg); return Json(new { html = RenderRazorViewToString("AddressAdd", item) }, JsonRequestBehavior.AllowGet); } item.guid = userItem.guid; item.addressItem = new tbl_address(); item.addressItem.isPersonal = true; string htmlText = RenderRazorViewToString("AddressAdd", item); return Json(new { html = htmlText }, JsonRequestBehavior.AllowGet); }
public ActionResult Index() { pageShared ps = new pageShared(db); helperMainPage helperPage = new helperMainPage(); // Page All Brand var pageAllBrand = ps.getPageByType(pageType.allBrand, langId); if (pageAllBrand != null) { helperPage.brandUrl = mainPath + langCode + "/" + pageAllBrand.url + ".html"; helperPage.allBrandName = pageAllBrand.name; } // Page Product List var pageProductList = ps.getPageByType(pageType.productList, langId); if (pageProductList != null) { helperPage.newProductList = getNewProductList(pageProductList.url); } var settingItem = db.tbl_settings.Where(a => a.langId == 1).FirstOrDefault(); if (settingItem != null) { helperPage.title = settingItem.mainPageTitle; helperPage.browserTitle = settingItem.mainPageTitle; helperPage.description = settingItem.metaDescription; helperPage.meta = settingItem.metaDescriptionAdditional; helperPage.keyword = settingItem.metaKeyword; } return View(helperPage); }
public JsonResult AddressAdd(addressModelItem item) { System.Threading.Thread.Sleep(1500); //Close Url pageShared ps = new pageShared(db); addressShared ads = new addressShared(db); var mainPage = ps.getPageByType(pageType.account, langId); var addressPage = ps.getPageByType(pageType.accountAddress, langId); item.closeUrl = getSiteName(Request) + langCode + "/" + mainPage.url + "/" + addressPage.url + ".html"; int addressId = 0; userShared us = new userShared(db); var userItem = us.getUserByGuid(item.guid); if (userItem == null) { item.isMessageExist = true; item.message = getErrorMessage(lang.unexpectedErrorMsg); return Json(new { html = RenderRazorViewToString("AddressAdd", item) }, JsonRequestBehavior.AllowGet); } extraValidation(item); if (ModelState.IsValid) { try { item.addressItem.userId = userItem.userId; item.addressItem.statu = true; item.addressItem = ads.addAddress(item.addressItem); item.isMessageExist = true; item.message = getSuccesMessage(lang.addressAddSuccess); item.isSuccess = true; addressId = item.addressItem.addressId; } catch (Exception ex) { errorSend(ex, "Account Address Add", true); item.isMessageExist = true; item.message = getErrorMessage(lang.unexpectedErrorMsg); } } string htmlText = RenderRazorViewToString("AddressAdd", item); return Json(new { html = htmlText, addressId = addressId }); }
private void bindBasketAndRegisterUrl(titizOtoEntities db, int langId, topCart helperItem) { pageShared ps = new pageShared(db); var registerPage = ps.getPageByType(pageType.registerLogin, langId); if (registerPage != null) { helperItem.registerUrl = registerPage.url + ".html"; } var basketPage = ps.getPageByType(pageType.basket, langId); if (basketPage != null) { helperItem.basketUrl = basketPage.url + ".html"; } }
public ActionResult brandList() { pageShared ps = new pageShared(db); var productPage = ps.getPageByType(pageType.productList,langId); if (productPage != null) { var item = getCarBrandList(productPage.url); return PartialView(item); } else { return null; } }
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); }
public JsonResult AddressEdit(addressModelItem item) { System.Threading.Thread.Sleep(1500); //Close Url pageShared ps = new pageShared(db); addressShared ads = new addressShared(db); var mainPage = ps.getPageByType(pageType.account, langId); var addressPage = ps.getPageByType(pageType.accountAddress, langId); item.closeUrl = getSiteName(Request) + langCode + "/" + mainPage.url + "/" + addressPage.url + ".html"; userShared us = new userShared(db); var userItem = us.getUserByGuid(item.guid); if (userItem == null || item.addressItem == null || item.addressItem.userId != userItem.userId) { item.isMessageExist = true; item.message = getErrorMessage(lang.unexpectedErrorMsg, "autoHide"); return Json(new { html = RenderRazorViewToString("AddressEdit", item) }, JsonRequestBehavior.AllowGet); } extraValidation(item); if (ModelState.IsValid) { try { item.addressItem.userId = userItem.userId; item.addressItem.statu = true; var updateItem = ads.getAddressById(item.addressItem.addressId); db.Entry<tbl_address>(updateItem).CurrentValues.SetValues(item.addressItem); db.SaveChanges(); item.isMessageExist = true; item.message = getSuccesMessage(lang.addressEditSuccess, "autoHide"); item.isSuccess = true; } catch (Exception ex) { errorSend(ex, "Account Address Edit", true); item.isMessageExist = true; item.message = getErrorMessage(lang.unexpectedErrorMsg, "autoHide"); } } string htmlText = RenderRazorViewToString("AddressEdit", item); return Json(new { html = htmlText }); }
public JsonResult AddressDelete(string userGuid, int addressId) { userShared us = new userShared(db); addressShared ads = new addressShared(db); var userItem = us.getUserByGuid(userGuid); var addressItem = ads.getAddressById(addressId); addressModelItem item = new addressModelItem(); if (userItem == null || addressItem == null || addressItem.userId != userItem.userId) { item.isMessageExist = true; item.message = getErrorMessage(lang.unexpectedErrorMsg); item.addressItem = new tbl_address(); item.guid = ""; } else { item.guid = userItem.guid; item.addressItem = addressItem; } //Close Url pageShared ps = new pageShared(db); var mainPage = ps.getPageByType(pageType.account, langId); var addressPage = ps.getPageByType(pageType.accountAddress, langId); item.closeUrl = getSiteName(Request) + langCode + "/" + mainPage.url + "/" + addressPage.url + ".html"; return Json(new { html = RenderRazorViewToString("AddressDelete", item) }, JsonRequestBehavior.AllowGet); }
public JsonResult AddressDelete(addressModelItem item) { System.Threading.Thread.Sleep(1500); //Close Url pageShared ps = new pageShared(db); addressShared ads = new addressShared(db); var mainPage = ps.getPageByType(pageType.account, langId); var addressPage = ps.getPageByType(pageType.accountAddress, langId); item.closeUrl = getSiteName(Request) + langCode + "/" + mainPage.url + "/" + addressPage.url + ".html"; userShared us = new userShared(db); var userItem = us.getUserByGuid(item.guid); if (userItem == null || item.addressItem == null || item.addressItem.userId != userItem.userId) { item.isMessageExist = true; item.message = getErrorMessage(lang.unexpectedErrorMsg, "autoHide"); return Json(new { html = RenderRazorViewToString("AddressEdit", item) }, JsonRequestBehavior.AllowGet); } try { ads.updateAddressIsDeleted(item.addressItem.addressId); item.isMessageExist = true; item.message = getSuccesMessage(lang.deleteAddressSuccess); item.isSuccess = true; } catch (Exception ex) { errorSend(ex, "Account Address Delete", true); item.isMessageExist = true; item.message = getErrorMessage(lang.unexpectedErrorMsg, "autoHide"); } string htmlText = RenderRazorViewToString("AddressDelete", item); return Json(new { html = htmlText }); }
public ActionResult RegisterUser(registerItem item) { System.Threading.Thread.Sleep(1500); var enCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); var trCulture = System.Globalization.CultureInfo.CreateSpecificCulture("tr-TR"); // lower Emal item.email = item.email.ToLower(enCulture); // Upper case Name And Surname var currentCulture = System.Threading.Thread.CurrentThread.CurrentCulture; item.name = currentCulture.TextInfo.ToTitleCase(item.name); item.surname = currentCulture.TextInfo.ToTitleCase(item.surname); string redirectPage = ""; pageShared ps = new pageShared(db); userShared us = new userShared(db); string html = ""; var aggrementModule = ps.getModuleByType(moduleType.registerAgreement, langId); if (aggrementModule != null) { item.agreementContent = aggrementModule.htmlContent; } // Input Validate #region Validate if (item.gender == 0) { ModelState.AddModelError("gender", App_GlobalResources.lang.formGenderRequired); } if (item.day == 0) { ModelState.AddModelError("day", App_GlobalResources.lang.formDayRequired); } if (item.month == 0) { ModelState.AddModelError("month", App_GlobalResources.lang.formMonthRequired); } if (item.year == 0) { ModelState.AddModelError("year", App_GlobalResources.lang.formYearRequired); } if (!item.isAggrementCheck) { ModelState.AddModelError("isAggrementCheck", App_GlobalResources.lang.formUserDocumentRequired); } DateTime birthday = DateTime.Now; try { birthday = new DateTime(item.year, item.month, item.day); } catch { ModelState.AddModelError("validDate", App_GlobalResources.lang.formValidDate); } try { System.Net.Mail.MailAddress mailItem = new System.Net.Mail.MailAddress(item.email); } catch { ModelState.AddModelError("email", App_GlobalResources.lang.formValidEmail); } if (item.password != item.passwordRep) { ModelState.AddModelError("passwordRep", App_GlobalResources.lang.formPassworRepSame); } #endregion // Register Statu Validate #region RegisterControl if (ModelState.IsValid) { var registerStatuItem = us.getUserRegisterStatuByEmail(item.email); string errorMessage = ""; bool isRegisterStatuValid = false; switch (registerStatuItem) { case registerStatu.registered: var forgetPassword = ps.getPageByType(pageType.forgetPassword, langId); errorMessage = App_GlobalResources.lang.activationHasRegisteredUser; errorMessage = errorMessage.Replace("[email]", item.email); if (forgetPassword != null) { errorMessage = errorMessage.Replace("[forgetPasswordUrl]", (Url.Content("~/") + langCode + "/" + forgetPassword.url + ".html")); } break; case registerStatu.waitingActivation: var pageMailResent = ps.getPageByType(pageType.activationResent, langId); // Send Error Message // Replace [email],[activationResent] errorMessage errorMessage = App_GlobalResources.lang.activationNoApprove; errorMessage = errorMessage.Replace("[email]", item.email); if (pageMailResent != null) { errorMessage = errorMessage.Replace("[activationResent]", (Url.Content("~/") + langCode + "/" + pageMailResent.url + ".html")); } break; case registerStatu.ban: errorMessage = App_GlobalResources.lang.unexpectedErrorMsg; break; case registerStatu.unregistered: isRegisterStatuValid = true; break; } if (!isRegisterStatuValid) { item.isMessageExist = true; item.message = getErrorMessage(errorMessage); html = RenderRazorViewToString("Register", item); return Json(new { htmlText = html }); } } #endregion if (ModelState.IsValid) { bool isProoceessError = false; #region Shared var settingItem = db.tbl_settings.Where(a => a.langId == langId).FirstOrDefault(); var userItem = new tbl_user(); mailShared ms = new mailShared(db, langId); userItem.birthday = birthday; userItem.email = item.email; userItem.gender = item.gender; userItem.guid = Guid.NewGuid().ToString(); userItem.isPasswordUpdate = false; userItem.name = item.name; userItem.password = MD5(item.password); userItem.registerStatuId = (int)registerStatu.waitingActivation; userItem.surname = item.surname; userItem.userTypeId = (int)userType.normalMember; userItem.createDate = DateTime.Now; #endregion // Has Activation if (settingItem.registerIsActivationExist) { #region Add User try { db.tbl_user.Add(userItem); db.SaveChanges(); } catch (Exception ex) { errorSend(ex, "User Aktivasyonlu Ekleme"); isProoceessError = true; } #endregion #region Activation Add tbl_activation activationItem = new tbl_activation(); try { activationItem = us.addActivationWithItem(userItem.guid, userItem.userId); } catch (Exception ex) { errorSend(ex, "User Aktivation Ekleme"); isProoceessError = true; } #endregion #region Action if (!isProoceessError) { var mailItem = ms.getActivationMailContent(userItem.name, userItem.surname, activationItem.code, getSiteName(Request), langCode); string mailSubject = mailItem.Item1; string mailBody = mailItem.Item2; try { mailSend(userItem.email, mailSubject, mailBody); ModelState.Clear(); item.isMessageExist = true; item.message = getSuccesMessage(App_GlobalResources.lang.activationMailSend.Replace("[email]", userItem.email)); // Add Resent Mail Link var pageMailResent = ps.getPageByType(pageType.activationResent, langId); string resentMailMsg = ""; if (pageMailResent != null) { resentMailMsg = App_GlobalResources.lang.activationMailResend; resentMailMsg = resentMailMsg.Replace("[resentMailLink]", Url.Content("~/" + langCode + "/" + pageMailResent.url + ".html")); } item.message = item.message + resentMailMsg; } catch (Exception ex) { errorSend(ex, "Send Activation Mail"); isProoceessError = true; } } #endregion } else // No Activation { userItem.registerStatuId = (int)registerStatu.registered; #region Add User try { db.tbl_user.Add(userItem); db.SaveChanges(); } catch (Exception ex) { errorSend(ex, "User Aktivasyonsuz Ekleme"); isProoceessError = true; } #endregion #region Thank Message if (!isProoceessError && settingItem.registerIsThankMessageSend) { var mailItem = ms.getRegisterThankMailContent(userItem.name, userItem.surname); string mailSubject = mailItem.Item1; string mailBody = mailItem.Item2; try { mailSend(userItem.email, mailSubject, mailBody); } catch (Exception ex) { errorSend(ex, "Send Thank Mail"); } } #endregion #region Action item.isMessageExist = true; item.message = getSuccesMessage("Üyeliğiniz başarıyla oluşturuldu.Kaldığınız sayfaya yönlendiriliyorsunuz..."); // Set UserId, User Role , CheckoutProcess setLoginSession(userItem); // Switch Guest to Basket && Redirect redirectPage = basketSwitchAndRedirect(userItem); #endregion } // Process Has Error if (isProoceessError) { item.isMessageExist = true; item.message = getErrorMessage(App_GlobalResources.lang.unexpectedErrorMsg, ""); errorSend(new Exception("Kayıt Sırasında Hata"), "Kayıt Sırasında Hata", true); } } html = RenderRazorViewToString("Register", item); return Json(new { htmlText = html, redirectPage = redirectPage }); }
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; }
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 JsonResult SearchModal(string keyWord) { helperSearchModal helperItem = new helperSearchModal(); pageShared ps = new pageShared(db); productShared pc = new productShared(db); var searchPage = ps.getPageByType(pageType.search, langId); helperItem.searchLink = Url.Content("~/") + langCode + "/" + searchPage.url + ".html?keyWord=" + keyWord; helperItem.searchList = getSearchResultList(keyWord); helperItem.totalSearch = helperItem.searchList.Count; helperItem.searchList = helperItem.searchList.Take(5).ToList(); string isResultCome = "no"; if (helperItem.totalSearch > 0) { isResultCome = "yes"; } string htmlText = RenderRazorViewToString("SearchModal", helperItem); return Json(new { html = htmlText, keywordList = getSearchKeywordList(keyWord), isResultCome = isResultCome }); }
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 OrderSearch(helperOrderSearch pageHelper, int pageId) { topCart cartItem = (topCart)ViewData["topCart"]; pageShared ps = new pageShared(db); var pageMainAccount = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); if (cartItem.isRegisteredUser) { var pageOrderList = ps.getPageByType(pageType.accountOrders, langId); return Redirect("~/" + langCode + "/" + pageMainAccount.url + "/" + pageOrderList.url + ".html"); } var pageItem = db.tbl_page.Include("tbl_category").Where(a => a.pageId == pageId).FirstOrDefault(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.detail = pageItem.detail; pageHelper.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); var parentCategoryList = db.tbl_category.Include("tbl_page").Where(a => a.parentId == pageItem.tbl_category.parentId && a.statu).ToList(); pageHelper.leftMenuList = getStaticLeftMenu(parentCategoryList, pageId); // Redirect to Login Page With Session if (!string.IsNullOrWhiteSpace(pageHelper.toLogin)) { Session["redirectPage"] = Request.Url.ToString(); var loginPage = ps.getPageByType(pageType.registerLogin, langId); if (loginPage == null) { errorSend(new Exception("loginPage gelmemesi, checkout Step 0"), "LoginPage gelmemesi, checkout Step 0", true); return null; } return Redirect("~/" + langCode + "/" + loginPage.url + ".html"); } else // Search Order { if (ModelState.IsValid) { orderShared os = new orderShared(db); var orderItem = os.getUnregisteredOrder(pageHelper.email, pageHelper.orderNo); if (orderItem != null) { var orderDetailPage = ps.getPageByType(pageType.accountOrderDetail, langId); return Redirect("~/" + langCode + "/" + orderDetailPage.url + ".html?orderGuid=" + orderItem.orderGuid); } else { pageHelper.isMessageExist = true; pageHelper.message = getErrorMessage(lang.orderSearchNotFound); return View(pageHelper); } } else { pageHelper.isMessageExist = true; pageHelper.message = getErrorMessage(getModelStateError(ModelState)); return View(pageHelper); } } }
public ActionResult Facebook(string accessToken) { var client = new FacebookClient(accessToken); dynamic result = client.Get("me", new { fields = "first_name,id,gender,last_name,email" }); facebookItem faceItem = new facebookItem(result); pageShared ps = new pageShared(db); userShared us = new userShared(db); var userItemStatu = us.getUserRegisterStatuByEmail(faceItem.email); // Registered User if (userItemStatu == registerStatu.registered) { var userItem = db.tbl_user.Where(a => a.email == faceItem.email).FirstOrDefault(); // Set UserId, User Role , CheckoutProcess setLoginSession(userItem); // Switch Guest to Basket && Redirect string redirectPage = basketSwitchAndRedirect(userItem); return Redirect(redirectPage); } if (userItemStatu == registerStatu.unregistered) { var userItem = new tbl_user(); mailShared ms = new mailShared(db, langId); try { userItem.birthday = faceItem.birthday; userItem.email = faceItem.email; userItem.gender = faceItem.gender; userItem.guid = Guid.NewGuid().ToString(); userItem.isPasswordUpdate = false; userItem.name = faceItem.firstName; userItem.password = MD5(Guid.NewGuid().ToString().Substring(0, 7)); userItem.registerStatuId = (int)registerStatu.registered; userItem.surname = faceItem.last_name; userItem.userTypeId = (int)userType.facebookMember; userItem.createDate = DateTime.Now; db.tbl_user.Add(userItem); db.SaveChanges(); var settingItem = db.tbl_settings.Where(a => a.langId == langId).FirstOrDefault(); if (settingItem != null && settingItem.registerIsThankMessageSend) { var mailItem = ms.getRegisterThankMailContent(userItem.name, userItem.surname); string mailSubject = mailItem.Item1; string mailBody = mailItem.Item2; try { mailSend(userItem.email, mailSubject, mailBody); } catch (Exception ex) { errorSend(ex, "Send Thank Mail With Facebook"); } } // Set UserId, User Role , CheckoutProcess setLoginSession(userItem); // Switch Guest to Basket && Redirect string redirectPage = basketSwitchAndRedirect(userItem); return Redirect(redirectPage); } catch (Exception ex) { errorSend(ex, "Facebook Register", true); #region ErrorFacebook - Redirect Facebook Error Link var registerLoginPage = ps.getPageByType(pageType.registerLogin, langId); string redirectErrorPage = "~/"; if (registerLoginPage != null) { redirectErrorPage = getSiteName(Request) + langCode + "/" + registerLoginPage.url + ".html?facebookError=yes"; return Redirect(redirectErrorPage); } else { return null; } #endregion } } if (userItemStatu == registerStatu.waitingActivation) { try { var userItem = db.tbl_user.Where(a => a.email == faceItem.email).FirstOrDefault(); userItem.registerStatuId = (int)registerStatu.registered; db.SaveChanges(); // Set UserId, User Role , CheckoutProcess setLoginSession(userItem); // Switch Guest to Basket && Redirect string redirectPage = basketSwitchAndRedirect(userItem); return Redirect(redirectPage); } catch (Exception ex) { errorSend(ex, "Facebook Register Waiting Activation", true); #region ErrorFacebook - Redirect Facebook Error Link var registerLoginPage = ps.getPageByType(pageType.registerLogin, langId); string redirectErrorPage = "~/"; if (registerLoginPage != null) { redirectErrorPage = getSiteName(Request) + langCode + "/" + registerLoginPage.url + ".html?facebookError=yes"; return Redirect(redirectErrorPage); } else { return null; } #endregion } } return null; }
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 List<searchResultItem> getSearchResultList(string searchWord) { List<searchResultItem> helperList = new List<searchResultItem>(); productShared ps = new productShared(db); pageShared pas = new pageShared(db); //Regex regexItem = new Regex(pattern, RegexOptions.None); var currentCultureInfo = CultureInfo.CreateSpecificCulture(langCulture); var enCulture = CultureInfo.CreateSpecificCulture("en-US"); string productUrl = ""; var productPage = pas.getPageByType(pageType.productList, langId); if (productPage != null) { productUrl = productPage.url; } string searchText = ""; #region Product // Search Product List var newProductList = db.tbl_product.Include("tbl_stock").Include("tbl_gallery").Include("tbl_carModelProduct.tbl_carModel.tbl_carBrand").Where(a => a.statu && 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(); foreach (var item in newProductList) { searchText = item.name + item.detail + item.shortDescription + item.metaKeyword + item.metaDescription; searchText = generateSearchText(searchText, new CultureInfo[] { currentCultureInfo, enCulture }); if (isMatchSearchWord(searchText, searchWord.ToLower(currentCultureInfo))) { searchResultItem searchItem = new searchResultItem(); searchItem.objType = searchObjType.product; searchItem.resultTitle = item.name; searchItem.resultSubTitle = item.metaDescription; searchItem.productItem = ps.getProductSummaryOneItem(productUrl, item, currentCultureInfo, langCode, "150", "100"); helperList.Add(searchItem); } } #endregion #region Brand var brandList = db.tbl_carBrand.Where(a => a.statu).ToList(); foreach (var item in brandList) { searchText = item.name + item.metaDescription + item.metaKeyword; searchText = generateSearchText(searchText, new CultureInfo[] { currentCultureInfo, enCulture }); if (isMatchSearchWord(searchText, searchWord.ToLower(currentCultureInfo))) { searchResultItem searchItem = new searchResultItem(); searchItem.objType = searchObjType.brand; searchItem.resultTitle = item.name; searchItem.resultSubTitle = item.metaDescription; searchItem.photo = "ImageShow/carBrand/" + item.photo + "/" + item.photoCoordinate + "/60/60/1"; searchItem.url = langCode + "/" + productUrl + "/" + item.url + ".html"; helperList.Add(searchItem); } } #endregion #region Model var modelList = db.tbl_carModel.Include("tbl_carBrand").Where(a => a.statu).ToList(); foreach (var item in modelList) { searchText = item.name + item.metaDescription + item.metaKeyword; searchText = generateSearchText(searchText, new CultureInfo[] { currentCultureInfo, enCulture }); if (isMatchSearchWord(searchText, searchWord.ToLower(currentCultureInfo))) { searchResultItem searchItem = new searchResultItem(); searchItem.objType = searchObjType.model; searchItem.resultTitle = item.name; searchItem.resultSubTitle = item.metaDescription; searchItem.photo = "ImageShow/carBrand/" + item.tbl_carBrand.photo + "/" + item.tbl_carBrand.photoCoordinate + "/60/60/1"; searchItem.url = langCode + "/" + productUrl + "/" + item.tbl_carBrand.url + "/" + item.url + ".html"; helperList.Add(searchItem); } } #endregion #region Page var pageList = db.tbl_page.Where(a => a.statu).ToList(); foreach (var item in pageList) { searchText = item.name + item.detail + item.metaKeyword + item.metaDescription; searchText = generateSearchText(searchText, new CultureInfo[] { currentCultureInfo, enCulture }); if (isMatchSearchWord(searchText, searchWord.ToLower(currentCultureInfo))) { switch ((pageType)item.pageTypeId) { case pageType.activation: continue; case pageType.resetPassword: continue; case pageType.search: continue; case pageType.yonlendirmeIcerik: continue; default: var accountPageList = new pageType[] { pageType.accountDashboard, pageType.accountUserInfo, pageType.accountPassword, pageType.accountAddress, pageType.accountOrders, pageType.accountDiscount }; searchResultItem searchItem = new searchResultItem(); searchItem.resultTitle = item.name; searchItem.resultSubTitle = item.metaDescription; searchItem.objType = searchObjType.staticPage; if (accountPageList.Contains((pageType)item.pageTypeId)) { var accountPage = pas.getPageByType(pageType.account, langId); searchItem.url = langCode + "/" + accountPage.url + "/" + item.url + ".html"; } else { searchItem.url = langCode + "/" + item.url + ".html"; } helperList.Add(searchItem); break; } } } #endregion return helperList; }
public ActionResult CheckoutOption(int pageId, helperPageRegisterStatu pageHelper) { checkoutProcess checkoutItem = (checkoutProcess)Session["checkoutProcess"]; if (ModelState.IsValid) { // Go to Delivery if (pageHelper.registerStatu == (int)registerOption.guestUser) { checkoutItem.registerOption = registerOption.guestUser; checkoutItem.lastSuccessStep = checkoutStep.registerOptions; Session["checkoutProcess"] = checkoutItem; return Redirect("~/" + checkoutItem.stepLinkList.Where(a => a.step == checkoutStep.delivery).First().url); } // Redirect Login Page if (pageHelper.registerStatu == (int)registerOption.registerOrLogin) { pageShared ps = new pageShared(db); checkoutItem.registerOption = registerOption.registerOrLogin; Session["redirectPage"] = Request.Url.ToString(); Session["checkoutProcess"] = checkoutItem; var loginPage = ps.getPageByType(pageType.registerLogin, langId); if (loginPage == null) { errorSend(new Exception("loginPage gelmemesi, checkout Step 0"), "LoginPage gelmemesi, checkout Step 0", true); return null; } return Redirect("~/" + langCode + "/" + loginPage.url + ".html"); } } addErrorTempData(getErrorMessage(getModelStateError(ModelState))); return CheckoutOption(pageId); }
public ActionResult ModelList() { pageShared ps = new pageShared(db); var productUrlWithCategory = ps.getPageByType(pageType.productList, langId); var item = getModelList(productUrlWithCategory.url); return View(item); }
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 JsonResult Login(loginItem item) { System.Threading.Thread.Sleep(1500); string html = ""; string msg = ""; string redirectPage = ""; userShared us = new userShared(db); pageShared ps = new pageShared(db); // forget Password Link var forgetPasswordPage = ps.getPageByType(pageType.forgetPassword, langId); if (forgetPasswordPage != null) { item.forgetPasswordUrl = langCode + "/" + forgetPasswordPage.url + ".html"; } var enCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); var trCulture = System.Globalization.CultureInfo.CreateSpecificCulture("tr-TR"); item.email = item.email.ToLower(enCulture); if (ModelState.IsValid) { var statuItem = us.getUserRegisterStatuByEmail(item.email); switch (statuItem) { case registerStatu.registered: var userItem = us.getUserItemByEmailAndPassword(item.email, MD5(item.password)); if (userItem != null) { msg = App_GlobalResources.lang.loginSuccess; // Set UserId, User Role , CheckoutProcess setLoginSession(userItem); // Switch Guest to Basket && Redirect redirectPage = basketSwitchAndRedirect(userItem); // Add Cookie if (item.isRememberMe) { HttpCookie myCookie = new HttpCookie("userCookie"); myCookie["userHashVal"] = MD5(userItem.email).Substring(0, 7); myCookie["userHashValTwo"] = userItem.password.Substring(0, 7); myCookie.Expires = DateTime.Now.AddMonths(9); Response.Cookies.Add(myCookie); } msg = App_GlobalResources.lang.loginSuccess; msg = getSuccesMessage(msg); } else { msg = App_GlobalResources.lang.loginUnregisteredOrPassword; msg = getErrorMessage(msg); } break; case registerStatu.waitingActivation: var pageMailResent = ps.getPageByType(pageType.activationResent, langId); msg = App_GlobalResources.lang.activationNoApprove; msg = msg.Replace("[email]", item.email); if (pageMailResent != null) { msg = msg.Replace("[activationResent]", (Url.Content("~/") + langCode + "/" + pageMailResent.url + ".html")); } msg = getErrorMessage(msg); break; case registerStatu.ban: msg = getErrorMessage(App_GlobalResources.lang.loginUnregisteredOrPassword); break; case registerStatu.unregistered: msg = getErrorMessage(App_GlobalResources.lang.loginUnregisteredOrPassword); break; } item.message = msg; item.isMessageExist = true; } html = RenderRazorViewToString("Login", item); return Json(new { htmlText = html, redirectPage = redirectPage }); }
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 Index(int pageId) { if (Request.QueryString["keyWord"] == null) { return null; } string searchWord = Request.QueryString["keyWord"]; helperSearch helperItem = new helperSearch(); pageShared ps = new pageShared(db); productShared pc = new productShared(db); var searchPage = ps.getPageByType(pageType.search, langId); helperItem.searchLink = Url.Content("~/") + langCode + "/" + searchPage.url + ".html"; var item = db.tbl_page.Include("tbl_category").Where(a => a.pageId == pageId).FirstOrDefault(); if (item == null) { return null; } helperItem.breadCrumbItem = getBreadCrumbStaticPage(item.name); helperItem.setTitle(item.name); helperItem.detail = item.detail; //Title ps.pageTitleBind(item, helperItem, langId); //string pattern = getPatternBySearchWord(searchWord); helperItem.searchWord = searchWord; //helperItem.searchList = new List<searchResultItem>(); helperItem.searchList = getSearchResultList(searchWord); if (helperItem.searchList.Count > 0) { helperItem.resultFound = string.Format(App_GlobalResources.lang.totalResultFound, helperItem.searchList.Count); } else { helperItem.resultFound = App_GlobalResources.lang.noResultFound; } int productCount = helperItem.searchList.Count; int currentPage = pc.getCurrentPage(Request, productCount, 10); helperItem.pagingItem = pc.getPageItem(productCount, currentPage, 10, "?keyWord=" + searchWord + "&sayfa="); helperItem.searchList = helperItem.searchList.Skip((currentPage - 1) * 10).Take(10).ToList(); helperItem.searchKeyWordList = Newtonsoft.Json.JsonConvert.SerializeObject(getSearchKeywordList(searchWord)); return View(helperItem); }
public ActionResult OrderSearch(int pageId) { topCart cartItem = (topCart)ViewData["topCart"]; pageShared ps = new pageShared(db); var pageMainAccount = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); if (cartItem.isRegisteredUser) { var pageOrderList = ps.getPageByType(pageType.accountOrders, langId); return Redirect("~/" + langCode + "/" + pageMainAccount.url + "/" + pageOrderList.url + ".html"); } var pageItem = db.tbl_page.Include("tbl_category").Where(a => a.pageId == pageId).FirstOrDefault(); helperOrderSearch pageHelper = new helperOrderSearch(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.detail = pageItem.detail; pageHelper.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); var parentCategoryList = db.tbl_category.Include("tbl_page").Where(a => a.parentId == pageItem.tbl_category.parentId && a.statu).ToList(); pageHelper.leftMenuList = getStaticLeftMenu(parentCategoryList, pageId); 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); } }
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext) { base.HandleUnauthorizedRequest(filterContext); DbWithController itemController = (DbWithController)filterContext.Controller; ; pageShared ps = new pageShared(itemController.db); var loginPage = ps.getPageByType(pageType.registerLogin, itemController.langId); if (loginPage != null) { var trCulture = CultureInfo.CreateSpecificCulture("tr-TR"); var enCulture = CultureInfo.CreateSpecificCulture("en-US"); if (filterContext.RouteData.Values["lang"] != null) { string langText = filterContext.RouteData.Values["lang"].ToString().ToLower(); switch (langText) { case "tr": itemController.langCode = "tr"; itemController.langId = 1; itemController.ViewData["langCode"] = "tr"; itemController.ViewData["langId"] = 1; itemController.langCulture = "tr-TR"; System.Threading.Thread.CurrentThread.CurrentCulture = trCulture; System.Threading.Thread.CurrentThread.CurrentUICulture = trCulture; break; case "en": itemController.langCode = "en"; itemController.langId = 2; itemController.ViewData["langCode"] = "en"; itemController.ViewData["langId"] = 2; itemController.langCulture = "en-US"; System.Threading.Thread.CurrentThread.CurrentUICulture = enCulture; System.Threading.Thread.CurrentThread.CurrentCulture = enCulture; break; } } else { itemController.langCode = "tr"; itemController.langId = 1; itemController.ViewData["langCode"] = "tr"; itemController.ViewData["langId"] = 1; itemController.langCulture = "tr-TR"; System.Threading.Thread.CurrentThread.CurrentCulture = trCulture; System.Threading.Thread.CurrentThread.CurrentUICulture = trCulture; } filterContext.HttpContext.Session["redirectPage"] = filterContext.HttpContext.Request.Url.ToString(); filterContext.HttpContext.Response.Redirect("~/" + itemController.langCode + "/" + loginPage.url + ".html?needLogin=yes", true); } else { filterContext.HttpContext.Response.Redirect("~/", true); } }
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); }