Example #1
0
        public ActionResult RescheduleIssue(UIIssueSchedule_U uim)
        {
            AjaxStatus status = new AjaxStatus();

            using (var context = new DataContext())
            {
                try
                {
                    Account account = base.GetLoginAccount();
                    Issue   dbm     = IssueOperations.TryRead(account, context, uim.id);
                    // Update model
                    uim.UpdateModel(dbm);
                    IssueOperations.TryUpdate(account, context, dbm);
                    // Mark as unread
                    IssueOperations.TryDeleteReaders(account, context, dbm.id);
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    base.HandleException("RescheduleIssue", e);
                    status.SetError(e.Message);
                }
            }
            return(Json(status));
        }
Example #2
0
        public ActionResult UpdateIssueStatus(UIIssueStatus_U uim)
        {
            AjaxStatus status = new AjaxStatus();

            using (var context = new DataContext())
            {
                using (var transaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        Account account = base.GetLoginAccount();
                        Issue   dbm     = IssueOperations.TryRead(account, context, uim.id);
                        // Create transition
                        IssueTransition transition = uim.CreateModel(dbm, account);
                        IssueTransitionOperations.TryCreate(account, context, transition);
                        // Update model
                        uim.UpdateModel(dbm);
                        IssueOperations.TryUpdate(account, context, dbm);
                        // Mark as unread
                        IssueOperations.TryDeleteReaders(account, context, dbm.id);
                        // TODO: If new status is to archive, move to archived tables
                        context.SaveChanges();
                        transaction.Commit();
                    }
                    catch (Exception e)
                    {
                        transaction.Rollback();
                        base.HandleException("UpdateIssueStatus", e);
                        status.SetError(e.Message);
                    }
                }
            }
            return(Json(status));
        }
Example #3
0
        public ActionResult UpdateIssue(UIIssueProblem_U uim)
        {
            AjaxStatus status = new AjaxStatus();

            using (var context = new DataContext())
            {
                try
                {
                    Account account = base.GetLoginAccount();
                    Issue   dbm     = IssueOperations.TryRead(account, context, uim.issueid);
                    dbm = uim.UpdateModel(dbm);
                    IssueOperations.TryUpdate(account, context, dbm);
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    base.HandleException("UpdateIssue", e);
                    status.SetError(e.Message);
                }
            }
            return(Json(status));
        }