Пример #1
0
 public SponsorNew(ISurveyRepository repo, Instance version)
 {
     SurveyRepository = repo;
     Version = version;
 }
Пример #2
0
        public ActionResult Edit(int projectVersionId, int previousVersionId)
        {
            Instance version = new Instance()
            {
                ProjectVersionId = projectVersionId
                ,
                PreviousVersionId = previousVersionId
                ,
                UpdateStatusId = (int)DRCOG.Domain.Enums.SurveyUpdateStatus.Edited
            };
            IAmendmentStrategy strategy = new AmendmentStrategy(_surveyRepository, version).PickStrategy();
            projectVersionId = strategy.Amend();

            return RedirectToAction("Info", new { controller = "Survey", id = projectVersionId, message = "Amendment processed successfully." });
        }
Пример #3
0
 /*
     *Get Current Amendment Status
      * Does project need to be copied?
      * Amend Project
      * Check if Previous Active Amendment needs to be changed to inactive
      * Return to details page
 */
 public AmendmentStrategy(ISurveyRepository repo, Instance version)
 {
     SurveyRepository = repo;
     Version = version;
 }
Пример #4
0
        public void SetSurveyStatus(Instance version)
        {
            IList<SqlParameter> parms = new List<SqlParameter>();
            string sproc = string.Empty;

            version.UpdateStatusId = (version.UpdateStatusId == (int)DRCOG.Domain.Enums.SurveyUpdateStatus.Revised)
                ? (int)DRCOG.Domain.Enums.SurveyUpdateStatus.Edited
                : version.UpdateStatusId;

            switch (version.UpdateStatusId)
            {
                case (int)DRCOG.Domain.Enums.SurveyUpdateStatus.Completed:
                    sproc = "[Survey].[SetOpenToPublic]";
                    parms.Add(new SqlParameter("@ProjectVersionId", version.ProjectVersionId));
                    parms.Add(new SqlParameter("@EndConstructionYear", version.EndConstructionYear));
                    parms.Add(new SqlParameter("@UpdateStatusId", version.UpdateStatusId));
                    break;
                case (int)DRCOG.Domain.Enums.SurveyUpdateStatus.Edited:
                case (int)DRCOG.Domain.Enums.SurveyUpdateStatus.Withdrawn:
                case (int)DRCOG.Domain.Enums.SurveyUpdateStatus.Reviewed:
                case (int)DRCOG.Domain.Enums.SurveyUpdateStatus.Accepted:
                case (int)DRCOG.Domain.Enums.SurveyUpdateStatus.Current:
                case (int)DRCOG.Domain.Enums.SurveyUpdateStatus.AwaitingAction:
                    sproc = "[Survey].[UpdateProjectUpdateStatusId]";
                    parms.Add(new SqlParameter("@ProjectVersionId", version.ProjectVersionId));
                    parms.Add(new SqlParameter("@UpdateStatusId", version.UpdateStatusId));
                    break;
                }

            using (SqlCommand command = new SqlCommand(sproc) { CommandType = CommandType.StoredProcedure })
            {
                foreach (SqlParameter p in parms)
                {
                    command.Parameters.Add(p);
                }
                this.ExecuteNonQuery(command);
            }
        }