public JsonResult DeleteFundingSource(int fundingResourceId, int projectVersionId) { var fundingSource = new FundingSource() { Id = fundingResourceId }; try { _rtpProjectRepository.DeleteFundingSource(fundingSource, projectVersionId); } catch (Exception ex) { return Json(new { error = "Changes could not be stored. An error has been logged." }); } return Json(new { message = "Funding Source successfully removed." }); }
public void DeleteFundingSource(FundingSource model, int projectVersionId) { using (SqlCommand command = new SqlCommand("[dbo].[DeleteProjectFundingSource]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@ProjectVersionID", projectVersionId); command.Parameters.AddWithValue("@FundingResourceId", model.Id); this.ExecuteNonQuery(command); } }
public IList<FundingSource> GetProjectFundingSources(int projectVersionId) { var fundingSources = new List<FundingSource>(); // Get Agencies which are eligible to sponsor projects SqlCommand cmd = new SqlCommand("[RTP].[GetProjectFundingSources]"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ProjectVersionID", projectVersionId); using (IDataReader rdr = this.ExecuteReader(cmd)) { while (rdr.Read()) { var temp = new FundingSource() { Id = rdr["FundingResourceID"].ToString().SmartParseDefault<int>(default(int)) , Name = rdr["FundingType"].ToString() }; if (temp.Id != default(int)) fundingSources.Add(temp); } } return fundingSources; }
public void UpdateFundingSource(FundingSource model, int projectVersionId) { }