Exemplo n.º 1
0
        public virtual ActionResult DeleteVersion(int?planVersionId, int year, string operationNumber = "")
        {
            var messageStatus = MessageNotificationCodes.SaveDataSucessfully;

            if ((planVersionId == null) || (operationNumber == string.Empty) || (year == 0) || (planVersionId == 0))
            {
                messageStatus   = MessageNotificationCodes.DeleteDataFail;
                operationNumber = IDBContext.Current.Operation;
                year            = DateTime.Now.Year;
            }
            else
            {
                ViewBag.planVersionId = planVersionId;
                messageStatus         = MessageNotificationCodes.SaveDataSucessfully;
                if (planVersionId != -1)
                {
                    VisitRepository.DeleteVisitPlan((int)planVersionId);
                }

                if (year == DateTime.Now.Year)
                {
                    year++;
                }
                else
                {
                    year--;
                }
            }

            return(RedirectToAction("VisitsPlanSummary", new
            {
                operationNumber = operationNumber,
                year = year,
                messageStatus = messageStatus
            }));
        }