public ActionResult NotificationSettings(UserEmailNotificationSettingsVM model)
 {
     try
     {
         foreach (var setting in model.EmailSubscriptions)
         {
             var userNotification = new UserNotificationSubscription {
                 TeamID = TeamID, UserID = UserID
             };
             userNotification.Subscribed         = setting.IsSelected;
             userNotification.ModifiedDate       = DateTime.UtcNow;
             userNotification.NotificationTypeID = setting.NotificationTypeID;
             repo.SaveUserNotificationSubscription(userNotification);
         }
         var msg = new AlertMessageStore();
         msg.AddMessage("success", "Notification Settings updated successfully");
         TempData["AlertMessages"] = msg;
         return(RedirectToAction("NotificationSettings"));
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(View("Error"));
     }
 }
Пример #2
0
        public static void AddAlertMessage(this Request request, string messageType, string alertMessage)
        {
            var container = request.Session.GetSessionValue <AlertMessageStore>(AlertMessageStore.AlertMessageKey);

            if (container == null)
            {
                container = new AlertMessageStore();
            }

            container.AddMessage(messageType, alertMessage);

            request.Session.SetSessionValue(AlertMessageStore.AlertMessageKey, container);
        }
Пример #3
0
        public ActionResult Password(ChangePasswordVM model)
        {
            if (ModelState.IsValid)
            {
                userAccountManager.UpdatePassword(model);

                var msg = new AlertMessageStore();
                msg.AddMessage("success", "Password updated successfully");
                TempData["AlertMessages"] = msg;
            }
            //TO DO : Redirect to the Tab ?
            return(RedirectToAction("Index"));
        }
Пример #4
0
 public ActionResult EditProfile(EditProfileVm model)
 {
     if (ModelState.IsValid)
     {
         userAccountManager.UpdateProfile(model);
         var msg = new AlertMessageStore();
         msg.AddMessage("success", "Profile updated successfully");
         TempData["AlertMessages"] = msg;
         return(RedirectToAction("Index", "Settings"));
     }
     //TO DO : Redirect to the Tab ?
     return(RedirectToAction("Index"));
 }
Пример #5
0
        public ActionResult Settings(DefaultIssueSettings model)
        {
            if (ModelState.IsValid)
            {
                userAccountManager.SaveDefaultProjectForTeam(model.SelectedProject);

                var msg = new AlertMessageStore();
                msg.AddMessage("success", "Settings updated successfully");
                TempData["AlertMessages"] = msg;
                return(RedirectToAction("settings"));
            }
            //
            //  model.Projects = GetProjectListItem();
            return(RedirectToAction("Index"));
        }
        public ActionResult Index(int size = 50, string iteration = "current")
        {
            try
            {
                var statusIds = new List <int> {
                    1, 2, 3, 4
                };
                IssueListVM bugListVM = new IssueListVM {
                    TeamID = userSessionHelper.TeamId
                };
                var projectExists = projectManager.DoesProjectsExist();

                if (!projectExists)
                {
                    return(RedirectToAction("Index", "Projects"));
                }
                else
                {
                    List <IssueVM> issueVMs = new List <IssueVM>();

                    if (Request.IsAjaxRequest())
                    {
                        issueVMs = issueManager.GetIssues(statusIds, 50).ToList();
                        return(Json(issueVMs, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        bugListVM.Bugs          = issueManager.GetIssues(statusIds, 50).ToList();
                        bugListVM.ProjectsExist = true;

                        bool defaultProjectExist = projectManager.GetDefaultProjectForCurrentTeam() > 0;
                        if (!defaultProjectExist)
                        {
                            var alertMessages = new AlertMessageStore();
                            alertMessages.AddMessage("system", String.Format("Hey!, You need to set a default project for the current team. Go to your <a href='{0}account/settings'>profile</a> and set a project as default project.", SiteBaseURL));
                            TempData["AlertMessages"] = alertMessages;
                        }
                        return(View("Index", bugListVM));
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorStore.LogException(ex, System.Web.HttpContext.Current);
                return(View("Error"));
            }
        }
Пример #7
0
        public ActionResult Index(int size = 50, string iteration = "current")
        {
            try
            {
                IssueListVM bugListVM = new IssueListVM {
                    TeamID = userSessionHelper.TeamId
                };
                var projectExists = projectManager.DoesProjectsExist();

                if (!projectExists)
                {
                    return(RedirectToAction("Index", "Projects"));
                }
                else
                {
                    bugListVM.ProjectsExist = true;

                    bool defaultProjectExist = projectManager.GetDefaultProjectForCurrentTeam() != null;
                    if (!defaultProjectExist)
                    {
                        var some = new TestClass {
                            Name = "Tes"
                        };
                        var alertMessages = new AlertMessageStore();

                        // alertMessages.AddMessage("system", String.Format("Hey!, You need to set a default project for the current team. Go to your <a href='{0}account/settings'>profile</a> and set a project as default project.",""));
                        //TempData["AlertMessages"] = some; //alertMessages;// "alertMessages";
                    }
                    return(View("Index", bugListVM));
                }
            }
            catch (Exception ex)
            {
                //ErrorStore.LogException(ex, System.Web.HttpContext.Current);
                return(View("Error"));
            }
        }
 public ActionResult NotificationSettings(UserEmailNotificationSettingsVM model)
 {
     try
     {
         foreach (var setting in model.EmailSubscriptions)
         {
             var userNotification = new UserNotificationSubscription { TeamID = TeamID, UserID = UserID };
             userNotification.Subscribed = setting.IsSelected;
             userNotification.ModifiedDate = DateTime.UtcNow;
             userNotification.NotificationTypeID = setting.NotificationTypeID;
             repo.SaveUserNotificationSubscription(userNotification);
         }
         var msg = new AlertMessageStore();
         msg.AddMessage("success", "Notification Settings updated successfully");
         TempData["AlertMessages"] = msg;
         return RedirectToAction("NotificationSettings");
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return View("Error");
     }
 }