public ActionResult EditEmailList(EmailList edit) { if (edit.ListEmail != null) { string[] email = edit.ListEmail.Split('\n'); if (email.Length < 10 || email.Length > 20) { Alert("You must enter from 10 to 20 email.", NotificationType.error); return(View(edit)); } if (EmailListDAO.Edit(edit)) { Alert("Updating Email List Successfully", NotificationType.success); return(RedirectToAction("ManageUser")); } Alert("Updating Email List failed", NotificationType.error); return(RedirectToAction("ManageUser")); } else { if (EmailListDAO.Delete(edit.EmailId)) { Alert("Email List has been removed", NotificationType.success); return(RedirectToAction("ManageUser")); } Alert("Removing Email List failed", NotificationType.error); return(RedirectToAction("ManageUser")); } }
//GET: User/CreateTrans public ActionResult CreateTrans(int id) { if (IsLoggedIn()) { var Username = Session["username"].ToString(); var searchUser = UserDAO.GetUserByUsername(Username); var searchPayment = PaymentDAO.GetPaymentByUsername(Username); if (searchPayment != null) { if (searchUser == null) { Alert("You not Register Email List", NotificationType.error); return(RedirectToAction("SubscribeSend")); } if (!searchPayment.IsActive) { Alert("Your Info Payment is not activated. Please contact Administrator by send feedback.", NotificationType.error); return(RedirectToAction("FeedbackIndex")); } else { var searchCard = CardDAO.GetCard(id); var searchEmailList = EmailListDAO.GetEmailListByUsername(searchUser.UserName); if (searchEmailList == null) { Alert("You not register email list to send Card. Please click Subscribe Send Card to register email list.", NotificationType.error); return(RedirectToAction("Index")); } if (searchCard != null) { var model = new Transaction { NameCard = searchCard.NameCard, Username = Session["username"].ToString(), ImageNameTrans = searchCard.ImageName, Receiver = searchEmailList.ListEmail }; return(View(model)); } return(RedirectToAction("Index")); } } Alert("Please purchase to use this feature. Thanks", NotificationType.info); return(RedirectToAction("DescriptionPayment")); } Alert("You need Log in to access this page", NotificationType.warning); return(RedirectToAction("Login", "Home")); }
public ActionResult EditEmailList(EmailList editEmailList) { if (editEmailList != null) { var search = EmailListDAO.GetEmailList(editEmailList.EmailId); if (search != null) { editEmailList.ListEmail.Trim(); string[] ListEmail = editEmailList.ListEmail.Split('\n'); if (ListEmail.Length < 10 || ListEmail.Length > 20) { Alert("You must be enter from 10 to 20 emails.", NotificationType.error); return(View(search)); } if (editEmailList == null) { if (EmailListDAO.Delete(editEmailList.EmailId)) { Alert("Remove email list successfully", NotificationType.success); return(RedirectToAction("Index")); } else { Alert("Remove email list failed", NotificationType.error); return(View(search)); } } else { editEmailList.ListEmail = editEmailList.ListEmail.ToString(); if (EmailListDAO.Edit(editEmailList)) { Alert("Update email list successfully", NotificationType.success); return(RedirectToAction("Index")); } else { Alert("Update email list failed", NotificationType.error); return(View(search)); } } } } Alert("Model was null. Please try again", NotificationType.error); return(RedirectToAction("Index")); }
public ActionResult AddEmailList(EmailList addEmail) { if (addEmail.ListEmail != null) { string[] email = addEmail.ListEmail.Split('\n'); if (email.Length < 10 || email.Length > 20) { Alert("You only input from 10 to 20 emails", NotificationType.error); return(RedirectToAction("SubscribeSend")); } if (Session["username"] != null) { addEmail.Username = Session["username"].ToString().ToLower(); var search = EmailListDAO.SearchEmailListByUsername(addEmail.Username); if (search.Count == 0) { if (EmailListDAO.Create(addEmail)) { var model = new User { UserName = addEmail.Username, IsSubcribeSend = true }; if (UserDAO.UpdateSubscribeSend(model)) { Alert("You are Subscribe Send successfully", NotificationType.success); return(RedirectToAction("Index", "Home")); } else { EmailListDAO.Delete(addEmail.EmailId); Alert("Subscribe Send Failed. Please contact Administrator", NotificationType.error); return(RedirectToAction("SubscribeSend")); } } } Alert("You has already register Email List", NotificationType.error); return(RedirectToAction("Index", "Home")); } } Alert("Please do not empty fields", NotificationType.error); return(RedirectToAction("SubscribeSend")); }
//GET: User/EditEmailList/5 public ActionResult EditEmailList(string username) { if (IsLoggedIn()) { if (username != null) { var search = EmailListDAO.GetEmailListByUsername(username); if (search != null) { return(View(search)); } Alert("Not found Email List with this Username", NotificationType.error); return(RedirectToAction("Index")); } Alert("Username was null", NotificationType.error); return(View()); } Alert("You need Log in to access this page!", NotificationType.warning); return(RedirectToAction("Login", "Home")); }
//GET: Admin/EditEmailList/1 public ActionResult EditEmailList(int id) { if (IsAdmin()) { var search = UserDAO.GetUser(id); if (search != null) { var searchEmail = EmailListDAO.GetEmailListByUsername(search.UserName); if (searchEmail != null) { return(View(searchEmail)); } Alert("Cannot found Email List", NotificationType.warning); return(RedirectToAction("ManageUser", "Admin")); } Alert("Cannot found User", NotificationType.warning); return(RedirectToAction("ManageUser", "Admin")); } Alert("You not permit to access that page", NotificationType.warning); return(RedirectToAction("Login", "Home")); }
public ActionResult ChangeSubscribeSend(User search) { if (search != null) { if (UserDAO.UpdateSubscribeSend(search)) { var searchEmailList = EmailListDAO.GetEmailListByUsername(search.UserName); if (searchEmailList != null) { if (EmailListDAO.Delete(searchEmailList.EmailId)) { Alert("You are Unsubscribe Send Card successfully", NotificationType.success); return(RedirectToAction("Index", "Home")); } Alert("Remove Email List failed", NotificationType.error); return(RedirectToAction("Index", "Home")); } Alert("Not found Email List", NotificationType.error); return(RedirectToAction("Index", "Home")); } } Alert("Unsubscribe Send Card failed", NotificationType.error); return(RedirectToAction("Index", "Home")); }