public IList<TipSummary> GetRestoreProjectList(int timePeriodId) { IList<TipSummary> list = new List<TipSummary>(); try { using (SqlCommand command = new SqlCommand("[TIP].[GetRestoreProjectList]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@TimePeriodId", timePeriodId); using (IDataReader rdr = this.ExecuteReader(command)) { while (rdr.Read()) { TipSummary summary = new TipSummary() { ProjectId = rdr["ProjectId"] != DBNull.Value ? rdr["ProjectId"].ToString().SmartParseDefault(default(int)) : default(int) , TipYearTimePeriodID = rdr["TimePeriodId"] != DBNull.Value ? rdr["TimePeriodId"].ToString().SmartParseDefault(default(short)) : default(short) , TipYear = rdr["TimePeriod"].ToString() , ProjectVersionId = rdr["ProjectVersionId"] != DBNull.Value ? rdr["ProjectVersionId"].ToString().SmartParseDefault(default(int)) : default(int) , ProjectName = rdr["ProjectName"].ToString() , AmendmentDate = rdr["AmendmentDate"] != DBNull.Value ? rdr["AmendmentDate"].ToString().SmartParseDefault<DateTime>(DateTime.MinValue) : DateTime.MinValue , AmendmentStatusId = rdr["ProjectVersionId"] != DBNull.Value ? rdr["ProjectVersionId"].ToString().SmartParseDefault(default(int)) : default(int) , AmendmentStatus = rdr["AmendmentStatus"].ToString() , TipId = rdr["TIPID"].ToString() }; list.Add(summary); } } } } catch { } return list; }
public IList<TipSummary> GetProjectsByAmendmentStatusId(int timePeriodId, Enums.TIPAmendmentStatus amendmentStatus) { IList<TipSummary> list = new List<TipSummary>(); try { using (SqlCommand command = new SqlCommand("[TIP].[GetProjects]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@TimePeriodId", timePeriodId); command.Parameters.AddWithValue("@VersionStatusId", (int)Enums.TIPVersionStatus.Pending); command.Parameters.AddWithValue("@AmendmentStatusId", (int)amendmentStatus); using (IDataReader rdr = this.ExecuteReader(command)) { while (rdr.Read()) { TipSummary summary = new TipSummary() { SponsorAgency = rdr["Sponsor"].ToString() , ProjectName = rdr["ProjectName"].ToString() , TipYear = rdr["TipYear"].ToString() , TipId = rdr["TIPID"].ToString() , ProjectVersionId = rdr["TIPProjectVersionID"] != DBNull.Value ? rdr["TIPProjectVersionID"].ToString().SmartParseDefault(default(int)) : default(int) }; list.Add(summary); } } } } catch { } return list; }
protected IDictionary<int, string> AvailablePools(TipSummary summary) { return GetPoolNames(1, summary.TipYearTimePeriodID); }
public TipSummary GetTIPSummary(string tipYear) { //Now get the Resources (the money) associated with this SqlCommand cmd = new SqlCommand("[TIP].[GetSummary]"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@TIPYEAR", tipYear); TipSummary model = new TipSummary(); using (IDataReader rdr = this.ExecuteReader(cmd)) { if (rdr.Read()) { model.TipYearTimePeriodID = rdr["TimePeriodId"] != DBNull.Value ? (short)rdr["TimePeriodId"] : default(short); model.TipYear = tipYear; model.IsCurrent = rdr["IsCurrent"] != DBNull.Value ? (bool)rdr["IsCurrent"] : false; } else { //return null model = null; } } return model; }
/// <summary> /// Gets a human readable summary for the TIP Project Version /// </summary> /// <param name="versionId"></param> /// <param name="tipYear"></param> /// <remarks> /// This is used in the project general information block on the right of /// the project tabs</remarks> /// <returns></returns> public TipSummary GetProjectSummary(int versionId) { TipSummary result = null; using (SqlCommand command = new SqlCommand("[TIP].[GetProjectVersionInfoSummary]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@TipProjectVersion", versionId); using (IDataReader rdr = ExecuteReader(command)) { if (rdr.Read()) { result = new TipSummary(); result.ProjectType = rdr["ImprovementType"].ToString(); result.ProjectName = rdr["ProjectName"].ToString(); result.COGID = rdr["COGID"].ToString(); result.ProjectId = (int)rdr["ProjectId"]; //To be editable, a ProjectVersion must be both Current and in the Current TIP // IsVersionCurrent = Active //bool IsVersionCurrent = rdr["IsVersionCurrent"] != DBNull.Value ? (bool)rdr["IsVersionCurrent"] : false; result.IsActive = rdr["IsVersionCurrent"] != DBNull.Value ? (bool)rdr["IsVersionCurrent"] : false; result.IsPending = rdr["IsTipPending"] != DBNull.Value ? (bool)rdr["IsTipPending"] : false; result.IsCurrent = rdr["IsTipCurrent"] != DBNull.Value ? (bool)rdr["IsTipCurrent"] : false; result.IsTopStatus = rdr["IsTopStatus"] != DBNull.Value ? (bool)rdr["IsTopStatus"] : false; int amendmentStatusId = (int)rdr["AmendmentStatusId"]; result.AmendmentStatusId = amendmentStatusId; //(Int32)TIPAmendmentStatus.Amended //result.IsEditable = result.IsCurrent; //result.IsTopStatus && //&& (new int[] { (int)TIPAmendmentStatus.Proposed, (int)TIPAmendmentStatus.Submitted }.Contains(amendmentStatusId)); result.AmendmentStatus = rdr["AmendmentStatus"].ToString(); result.ProjectVersionId = rdr["ProjectVersionID"] != DBNull.Value ? (int)rdr["ProjectVersionID"] : default(int); result.PreviousVersionId = rdr["PreviousVersionID"].ToString().SmartParseDefault<int>(default(int)); result.NextVersionId = rdr["NextVersionID"] != DBNull.Value ? (int?)rdr["NextVersionID"] : null; result.SponsorAgency = rdr["Sponsor"].ToString(); result.TipId = rdr["TipId"].ToString(); result.TipYear = rdr["TipYear"].ToString(); result.NextVersionYear = rdr["NextVersionTipYear"].ToString(); result.PreviousVersionYear = rdr["PreviousVersionTipYear"].ToString(); result.TipYearTimePeriodID = rdr["TipYearTimePeriodID"] != DBNull.Value ? (short)rdr["TipYearTimePeriodID"] : (short)0; result.ProjectFinancialRecordId = rdr["ProjectFinancialRecordId"].ToString().SmartParseDefault<int>(default(int)); } } } return result; }