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); }
private string basketSwitchAndRedirect(tbl_user 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"); } } string redirectPage = ""; if (Session["redirectPage"] != null) { redirectPage = Session["redirectPage"].ToString(); } else { redirectPage = getSiteName(Request); } return redirectPage; }