//protected LRS GetProjectLRS(int projectVersionId) //{ // LRS result = new LRS(); // using (SqlCommand command = new SqlCommand("[RTP].[GetProjectLRS]") { CommandType = CommandType.StoredProcedure }) // { // command.Parameters.AddWithValue("@ProjectVersionId", projectVersionId); // using (IDataReader rdr = ExecuteReader(command)) // { // if (rdr.Read()) // { // result.RouteName = rdr["Routename"].ToString(); // result.BeginMeasure = rdr["BEGINMEASU"] != DBNull.Value ? (double)rdr["BEGINMEASU"] : default(double); // result.EndMeasure = rdr["ENDMEASURE"] != DBNull.Value ? (double)rdr["ENDMEASURE"] : default(double); // result.Comments = rdr["Comments"].ToString(); // result.Offset = rdr["Offset"] != DBNull.Value ? (int)rdr["Offset"] : default(int); // } // } // } // return result; //} /// <summary> /// Update the project scope information in the database /// </summary> /// <remarks>Uses the [RTP].[UpdateProjectScope] stored proc.</remarks> /// <param name="model"></param> public void UpdateProjectScope(ScopeModel model) { using (SqlCommand command = new SqlCommand("[RTP].[UpdateProjectScope]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@ProjectVersionID", model.ProjectVersionId); command.Parameters.AddWithValue("@ProjectDescription", model.ProjectDescription); command.Parameters.AddWithValue("@ShortDescription", model.ShortDescription); this.ExecuteNonQuery(command); } }
public ScopeModel GetScopeModel(int projectVersionId, string year) { ScopeModel result = null; using (SqlCommand command = new SqlCommand("[RTP].[GetProjectScope]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@ProjectVersionId", projectVersionId); command.Parameters.AddWithValue("@Year", year); using (IDataReader rdr = ExecuteReader(command)) { if (rdr.Read()) { result = new ScopeModel(); result.BeginConstructionYear = rdr["BeginConstructionYear"] != DBNull.Value ? (int?)Convert.ToInt32(rdr["BeginConstructionYear"]) : null; //result.OpenToPublicYear = rdr["EndConstructionYear"] != DBNull.Value ? (int?)Convert.ToInt32(rdr["EndConstructionYear"]) : null; result.ProjectDescription = rdr["ProjectDescription"].ToString(); result.ShortDescription = rdr["ShortDescription"].ToString(); result.ProjectId = rdr["ProjectId"] != DBNull.Value ? (int?)rdr["ProjectId"] : null; result.ProjectName = rdr["ProjectName"].ToString(); result.ProjectVersionId = rdr["ProjectVersionId"] != DBNull.Value ? (int)rdr["ProjectVersionId"] : default(int); result.RtpYear = year; } } } return result; }