Пример #1
0
        public Delay GetDelay(Delay delay)
        {
            using (SqlCommand cmd = new SqlCommand("[TIP].[GetDelay]"))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ProjectVersionId", delay.ProjectVersionId);
                cmd.Parameters.AddWithValue("@ProjectFinancialRecordId", delay.ProjectFinancialRecordId);
                cmd.Parameters.AddWithValue("@FundingIncrementId", delay.FundingIncrementId);
                cmd.Parameters.AddWithValue("@FundingResourceId", delay.FundingResourceId);
                cmd.Parameters.AddWithValue("@PhaseId", delay.PhaseId);

                using (IDataReader rdr = this.ExecuteReader(cmd))
                {
                    while (rdr.Read())
                    {
                        delay.ProjectVersionId = (int)rdr["TIPProjectVersionId"];
                        delay.TimePeriodId = rdr["TimePeriodId"].ToString().SmartParseDefault<int>(default(int)); ;
                        delay.TimePeriod = rdr["TimePeriod"].ToString();
                        delay.Year = rdr["Year"].ToString();
                        delay.TipId = rdr["TIPID"].ToString();
                        delay.Sponsor = rdr["Sponsor"].ToString();
                        delay.ProjectName = rdr["ProjectName"].ToString();
                        delay.Phase = rdr["Phase"].ToString();
                        delay.FederalAmount = rdr["FederalAmount"].ToString().SmartParseDefault<double>(default(double));
                        delay.Notes = rdr["Notes"].ToString();
                        delay.MidYearStatus = rdr["MidYearStatus"].ToString();
                        delay.EndYearStatus = rdr["EndYearStatus"].ToString();
                        delay.ActionPlan = rdr["ActionPlan"].ToString();
                        delay.MeetingDate = rdr["MeetingDate"].ToString().SmartParseDefault<DateTime?>(null);
                        delay.IsInitiated = rdr["IsInitiated"].ToString().SmartParseDefault<bool>(false);
                        delay.IsChecked = rdr["IsChecked"].ToString().SmartParseDefault<bool>(false);
                    }
                }
            }
            return delay;
        }
Пример #2
0
        public ActionResult DelayUpdate(FormCollection collection)
        {
            Delay model = new Delay();

            if (TryUpdateModel(model, new string[] {
                "ProjectFinancialRecordId"
                , "FundingIncrementId"
                , "FundingResourceId"
                , "PhaseId"
                , "IsInitiated"
                , "IsChecked"
                , "MidYearStatus"
                , "EndYearStatus"
                , "ActionPlan"
                , "MeetingDate"
                , "Notes"
                , "TimePeriodId"
                , "TimePeriod"
                , "Year"
            }))
            {
                var ret = _tipRepository.UpdateDelay(model);
            }
            else
            {
                if (Request.IsAjaxRequest())
                {
                    return Json(new
                    {
                        message = "Form was not valid"
                        ,
                        error = "true"
                    });
                }
            }

            if (Request.IsAjaxRequest())
            {

                return Json(new
                {
                    message = "Delay updated successfully"
                    ,
                    error = "false"
                    ,
                    data = ""
                });
            }

            // A standard (non-Ajax) HTTP Post came in
            TempData["Message"] = "Delay updated successfully";
            return RedirectToAction("Delays", "TIP", new { @id = model.TimePeriod, @year = model.Year });
        }
Пример #3
0
        public bool UpdateDelay(Delay delay)
        {
            int rowsAffected = 0;
            using (SqlCommand cmd = new SqlCommand("[TIP].[UpdateDelay]"))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ProjectFinancialRecordId", delay.ProjectFinancialRecordId);
                cmd.Parameters.AddWithValue("@FundingIncrementId", delay.FundingIncrementId);
                cmd.Parameters.AddWithValue("@FundingResourceId", delay.FundingResourceId);
                cmd.Parameters.AddWithValue("@PhaseId", delay.PhaseId);

                cmd.Parameters.AddWithValue("@IsInitiated", delay.IsInitiated);
                cmd.Parameters.AddWithValue("@IsChecked", delay.IsChecked);
                cmd.Parameters.AddWithValue("@MidYearStatus", delay.MidYearStatus);
                cmd.Parameters.AddWithValue("@EndYearStatus", delay.EndYearStatus);
                cmd.Parameters.AddWithValue("@ActionPlan", delay.ActionPlan);
                cmd.Parameters.AddWithValue("@MeetingDate", delay.MeetingDate);
                cmd.Parameters.AddWithValue("@Notes", delay.Notes);

                rowsAffected = this.ExecuteNonQuery(cmd);
            }
            return rowsAffected > -1 ? true : false;
        }
Пример #4
0
        public ActionResult DelayUpdate(Delay model)
        {
            model = _tipRepository.GetDelay(model);

            if (Request.IsAjaxRequest())
            {
                return PartialView("Partials/_DelaysUpdate", model);
            }
            return PartialView("Partials/_DelaysUpdate", model);
        }