public ActionResult ImportSubcriber(int?id)
        {
            SubscribersViewModel model = new SubscribersViewModel();

            if (id == null)
            {
                ViewBag.ListName = new SelectList(M_List.GetLists(), "ListID", "ListName", "Select List");
            }
            else
            {
                model.ListID = id;
                return(View(model));
            }
            return(View(model));
        }
예제 #2
0
        public ActionResult EditList(M_List model)
        {
            bool result;

            try
            {
                result = model.UpdateList();
                return(RedirectToAction("Index"));
            }
            catch (M_CustomException ex)
            {
                ModelState.AddModelError("upadateList", ex.message);
                return(RedirectToAction("EditList"));
            }
        }
        /// <summary>
        /// action is responsible to get view for campaign creation
        /// </summary>
        /// <returns></returns>
        public ActionResult Creation()
        {
            userID = GetUser();
            try
            {
                ViewBag.campTypes = new SelectList(S_CampaignTypes.GetCampTypes(), "CTId", "Name");
                ViewBag.List      = new SelectList(M_List.GetLists(userID), "ListID", "ListName");
            }
            catch (M_CustomException ex)
            {
                ex.LogException();
                ModelState.AddModelError("viewcamp", "problem while showing campaigns");
                return(View("Error"));
            }

            return(View());
        }
 public ActionResult AddSubcriber(int?id)
 {
     userID     = GetUser();
     list       = new M_List();
     subscriber = new M_Subscriber();
     if (id == null)
     {
         // ViewBag.ListName = new SelectList(dbcontext.NewLists, "ListID", "ListName", "Select List");
         ViewBag.ListName = new SelectList(M_List.GetLists(), "ListID", "ListName", "Select List");
     }
     else
     {
         subscriber.ListID = id;
         return(View(subscriber));
     }
     return(View(subscriber));
 }
예제 #5
0
 public ActionResult NewList(M_List model)
 {
     if (ModelState.IsValid)
     {
         string        UsersID   = GetUser();
         List <string> ListNames = new List <string>();
         string        success   = null;
         if (model != null)
         {
             try
             {
                 success = model.SaveList(UsersID);
                 if (success != "Saved")
                 {
                     ModelState.AddModelError("Errorlistname", success);
                     ViewBag.country = new SelectList(S_Country.GetCountries(), "CountryId", "CountryName");
                     return(View());
                 }
             }
             catch (M_CustomException ex)
             {
                 if (ex.ErrorCode == 100)
                 {
                     ModelState.AddModelError("error", ex.message);
                     return(RedirectToAction("NewList"));
                 }
                 else if (ex.ErrorCode == 101)
                 {
                     ModelState.AddModelError("Error", "logical exception");
                     return(RedirectToAction("NewList"));
                 }
             }
             catch (Exception)
             {
                 ModelState.AddModelError("error", "Errr occured in business logic");
                 return(RedirectToAction("NewList"));
             }
         }
         else
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
     }
     return(RedirectToAction("Index"));
 }
예제 #6
0
        public ActionResult Index()
        {
            list    = new M_List();
            LVmodel = new ListViewModel();
            userID  = GetUser();

            try
            {
                LVmodel = list.ViewList(userID);
            }
            catch (M_CustomException ex)
            {
                ModelState.AddModelError("listindex", ex.message);
                return(View());
            }

            return(View(LVmodel));
        }
        public ActionResult editCampaign(int?id)
        {
            userID = GetUser();
            UpdateCampModel campaign = new UpdateCampModel();

            try
            {
                // campaign.Campaigns = dbContext.M_Campaigns.Find(id);
                campaign.Campaigns = M_Campaigns.FindCampaign(id);
                //campaign.Subscribers = dbContext.NewLists.Find(campaign.Campaigns.ListId).Subscribers.ToList();
                campaign.Subscribers = M_Campaigns.subscribersToCampaign(campaign.Campaigns.ListId);
                //WebUtility.HtmlDecode(campaign.Campaigns.EmailContent);
                ViewBag.campTypes        = new SelectList(S_CampaignTypes.GetCampTypes(), "CTId", "Name");
                ViewBag.List             = new SelectList(M_List.GetLists(userID), "ListID", "ListName");
                TempData["emailContent"] = campaign.Campaigns.EmailContent;
                return(View("UpdateCamp", campaign));
            }
            catch (M_CustomException ex)
            {
                if (ex.ErrorCode == 100)
                {
                    ModelState.AddModelError("error", ex.message);
                    return(RedirectToAction("Campaign"));
                }
                else if (ex.ErrorCode == 101)
                {
                    ModelState.AddModelError("Error", "logical exception");
                    return(RedirectToAction("Campaign"));
                }
            }
            catch (InvalidOperationException ex)
            {
                M_CustomException obj = new M_CustomException((int)ErorrTypes.others, ex.Message, ex.StackTrace, ErorrTypes.others.ToString(), Utlities.GetURL());
                obj.LogException();
                ModelState.AddModelError("Error", "Invalid operation");
                return(RedirectToAction("Campaign"));
            }

            return(RedirectToAction("Campaign"));
        }
예제 #8
0
        public ActionResult EditList(int?id)
        {
            ViewBag.country = new SelectList(S_Country.GetCountries(), "CountryId", "CountryName");
            M_List model = new M_List();

            try
            {
                model = model.EditList(id);
            }
            catch (M_CustomException ex)
            {
                if (ex.ErrorCode == 100)
                {
                    ModelState.AddModelError("error", ex.message);
                    return(RedirectToAction("EditList"));
                }
                else if (ex.ErrorCode == 101)
                {
                    ModelState.AddModelError("Error", "logical exception");
                    return(RedirectToAction("EditList"));
                }
            }
            return(View(model));
        }