예제 #1
0
        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);
        }
예제 #2
0
        public ActionResult OpenContent(int pageId)
        {
            helperOpenContent helperItem = new helperOpenContent();
            pageShared ps = new pageShared(db);

            var item = db.tbl_page.Include("tbl_category").Where(a => a.pageId == pageId).FirstOrDefault();

            helperItem.pageTitle = item.name;

            if (!string.IsNullOrWhiteSpace(item.title))
            {
                helperItem.pageTitle = item.title;
            }

            var parentCategoryList = db.tbl_category.Include("tbl_page").Where(a => a.parentId == item.tbl_category.parentId && a.statu).ToList();
            var selectedUrl = ps.getPageUrl(item);

            helperItem.leftMenuList = getStaticLeftMenu(parentCategoryList, pageId);

            helperItem.breadCrumbItem = getBreadCrumbStaticPage(item.name);

            helperItem.list = db.tbl_openContent.Where(a => a.langId == langId && a.categoryId == item.categoryId && a.statu).OrderBy(a => a.sequence).Select(a => new openContentItem() { title = a.title, detail = a.detail }).ToList();

            //Title
            ps.pageTitleBind(item, helperItem, langId);

            return View(helperItem);
        }
예제 #3
0
        public ActionResult Index(int pageId)
        {
            helperStaticPage helperItem = new helperStaticPage();
            pageShared ps = new pageShared(db);

            var item = db.tbl_page.Include("tbl_category").Where(a => a.pageId == pageId).FirstOrDefault();

            if (item.tbl_category == null)
            {
                return null;
            }

            var parentCategoryList = db.tbl_category.Include("tbl_page").Where(a => a.parentId == item.tbl_category.parentId).ToList();
            var selectedUrl = ps.getPageUrl(item);

            helperItem.leftMenuList = getStaticLeftMenu(parentCategoryList, pageId);
            helperItem.breadCrumbItem = getBreadCrumbStaticPage(item.name);
            helperItem.pageTitle = item.name;

            if (!string.IsNullOrWhiteSpace(item.title))
            {
                helperItem.pageTitle = item.title;
            }

            helperItem.detail = item.detail;

            //Title
            ps.pageTitleBind(item, helperItem, langId);

            return View(helperItem);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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 });
        }
예제 #6
0
        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;
            }
        }
예제 #7
0
        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 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);
        }
예제 #9
0
        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 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);
            }
        }
예제 #11
0
        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);
        }
예제 #12
0
        // 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;
        }
예제 #13
0
        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;
        }
예제 #14
0
        private List<leftMenuItem> getStaticLeftMenu(List<tbl_category> list, int selectedPageId)
        {
            List<leftMenuItem> helperList = new List<leftMenuItem>();

            pageShared ps = new pageShared(db);

            foreach (var item in list.Where(a => a.statu).OrderBy(a => a.sequence))
            {
                leftMenuItem helper = new leftMenuItem();

                helper.name = item.name;
                var pageItem = item.tbl_page.Where(a => a != null && a.statu).FirstOrDefault();

                if (pageItem != null)
                {
                    helper.url = mainPath + langCode + "/" + ps.getPageUrl(pageItem) + ".html";

                    if (pageItem.pageId == selectedPageId)
                    {
                        helper.className = "active";
                    }
                }
                else
                {
                    helper.url = "#";
                }

                helperList.Add(helper);

            }

            return helperList;
        }
        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 });
        }
예제 #16
0
        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);
        }
예제 #17
0
        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);
        }
예제 #18
0
        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 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);
        }
예제 #20
0
        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 });
        }
예제 #21
0
        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 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;
        }
예제 #23
0
        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);
        }
예제 #24
0
        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);
        }
예제 #25
0
        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);
                }
            }
        }
예제 #26
0
        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);
        }
예제 #27
0
        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);
        }
예제 #28
0
        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);
        }
예제 #29
0
        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 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 });
        }