public static FederalRentalAffordabilityResult AddCountyUnitRent(int CountyRentID, int UnitType, decimal HighRent, decimal LowRent) { try { using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["dbConnection"].ConnectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "AddCountyUnitRent"; command.Parameters.Add(new SqlParameter("CountyRentID", CountyRentID)); command.Parameters.Add(new SqlParameter("UnitType", UnitType)); command.Parameters.Add(new SqlParameter("HighRent", HighRent)); command.Parameters.Add(new SqlParameter("LowRent", LowRent)); SqlParameter parmMessage = new SqlParameter("@isDuplicate", SqlDbType.Bit); parmMessage.Direction = ParameterDirection.Output; command.Parameters.Add(parmMessage); SqlParameter parmMessage1 = new SqlParameter("@isActive", SqlDbType.Int); parmMessage1.Direction = ParameterDirection.Output; command.Parameters.Add(parmMessage1); command.CommandTimeout = 60 * 5; command.ExecuteNonQuery(); FederalRentalAffordabilityResult ap = new FederalRentalAffordabilityResult(); ap.IsDuplicate = DataUtils.GetBool(command.Parameters["@isDuplicate"].Value.ToString()); ap.IsActive = DataUtils.GetBool(command.Parameters["@isActive"].Value.ToString()); return(ap); } } } catch (Exception ex) { throw ex; } }
public static FederalRentalAffordabilityResult AddCountyRent(int FedProgID, int County, DateTime StartDate, DateTime EndDate) { try { using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["dbConnection"].ConnectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "AddCountyRent"; command.Parameters.Add(new SqlParameter("FedProgID", FedProgID)); command.Parameters.Add(new SqlParameter("County", County)); command.Parameters.Add(new SqlParameter("StartDate", StartDate.ToShortDateString() == "1/1/0001" ? System.Data.SqlTypes.SqlDateTime.Null : StartDate)); command.Parameters.Add(new SqlParameter("EndDate", EndDate.ToShortDateString() == "1/1/0001" ? System.Data.SqlTypes.SqlDateTime.Null : EndDate)); SqlParameter parmMessage = new SqlParameter("@isDuplicate", SqlDbType.Bit); parmMessage.Direction = ParameterDirection.Output; command.Parameters.Add(parmMessage); SqlParameter parmMessage1 = new SqlParameter("@isActive", SqlDbType.Int); parmMessage1.Direction = ParameterDirection.Output; command.Parameters.Add(parmMessage1); command.CommandTimeout = 60 * 5; command.ExecuteNonQuery(); FederalRentalAffordabilityResult ap = new FederalRentalAffordabilityResult(); ap.IsDuplicate = DataUtils.GetBool(command.Parameters["@isDuplicate"].Value.ToString()); ap.IsActive = DataUtils.GetBool(command.Parameters["@isActive"].Value.ToString()); return(ap); } } } catch (Exception ex) { throw ex; } }