/// <summary> /// Update the project scope information in the database /// </summary> /// <remarks>Uses the [dbo].[UpdateProjectScope] stored proc.</remarks> /// <param name="model"></param> public void UpdateProjectScope(ScopeModel model, Project project) { CheckUpdateStatusId(project); using (SqlCommand command = new SqlCommand("[dbo].[UpdateProjectScope]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@ProjectVersionID", model.ProjectVersionId); command.Parameters.AddWithValue("@ProjectDescription", model.ProjectDescription); command.Parameters.AddWithValue("@BeginConstructionYear", model.BeginConstructionYear); command.Parameters.AddWithValue("@EndConstructionYear", model.OpenToPublicYear); command.Parameters.AddWithValue("@Module", 1); this.ExecuteNonQuery(command); } }
public ScopeModel GetScopeModel(int projectVersionId, string year) { ScopeModel result = null; using (SqlCommand command = new SqlCommand("[Survey].[GetProjectScope]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@ProjectVersionId", projectVersionId); using (IDataReader rdr = ExecuteReader(command)) { if (rdr.Read()) { result = new ScopeModel(); result.BeginConstructionYear = rdr["BeginConstructionYear"] != DBNull.Value ? Convert.ToInt32(rdr["BeginConstructionYear"]) : default(int); result.OpenToPublicYear = rdr["EndConstructionYear"] != DBNull.Value ? Convert.ToInt32(rdr["EndConstructionYear"]) : default(int); result.ProjectDescription = rdr["ProjectDescription"].ToString(); result.ProjectId = rdr["ProjectId"] != DBNull.Value ? (int)rdr["ProjectId"] : default(int); result.ProjectName = rdr["ProjectName"].ToString(); result.ProjectVersionId = rdr["ProjectVersionId"] != DBNull.Value ? (int)rdr["ProjectVersionId"] : default(int); } } } return result; }