Ejemplo n.º 1
0
 /// <summary>
 /// Update the Project Info in the database
 /// </summary>
 /// <param name="model"></param>
 public void UpdateProjectInfo(InfoModel model)
 {
     using (SqlCommand command = new SqlCommand("[RTP].[UpdateProjectVersionInfo]") { CommandType = CommandType.StoredProcedure })
     {
         command.Parameters.AddWithValue("@PROJECTVERSIONID", model.ProjectVersionId);
         command.Parameters.AddWithValue("@TIMEPERIOD", model.RtpYear);
         command.Parameters.AddWithValue("@PROJECTID", model.ProjectId);
         command.Parameters.AddWithValue("@PROJECTNAME", model.ProjectName);
         command.Parameters.AddWithValue("@ProjectTypeID", model.ProjectTypeId);
         command.Parameters.AddWithValue("@SPONSORID", model.SponsorId != null ? (object)model.SponsorId.Value : (object)DBNull.Value);
         command.Parameters.AddWithValue("@SPONSORCONTACTID", model.SponsorContactId != null ? (object)model.SponsorContactId.Value : (object)DBNull.Value);
         command.Parameters.AddWithValue("@ADMINLEVELID", model.AdministrativeLevelId != null ? (object)model.AdministrativeLevelId.Value : (object)DBNull.Value);
         command.Parameters.AddWithValue("@IMPTYPEID", model.ImprovementTypeId != null ? (object)model.ImprovementTypeId.Value : (object)DBNull.Value);
         command.Parameters.AddWithValue("@TRANSTYPEID", model.TransportationTypeId != null ? (object)model.TransportationTypeId.Value : (object)DBNull.Value);
         command.Parameters.AddWithValue("@SelectionAgencyID", model.SelectionAgencyId != null ? (object)model.SelectionAgencyId.Value : (object)DBNull.Value);
         command.Parameters.AddWithValue("@SPONSORNOTES", model.SponsorNotes);
         command.Parameters.AddWithValue("@DRCOGNOTES", model.DRCOGNotes);
         command.Parameters.AddWithValue("@RegionallySignificant", model.IsRegionallySignificant != null ? (object)model.IsRegionallySignificant.Value : (object)DBNull.Value);
         this.ExecuteNonQuery(command);
     }
 }
Ejemplo n.º 2
0
 protected IDictionary<int, string> AvailableSponsorContacts(InfoModel info)
 {
     if (info.SponsorId.HasValue)
     {
         return GetSponsorContacts(info.SponsorId.Value);
     }
     return null;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Get a RtpProjectVersionInfoModel. This is the model behind the
        /// Info Tab
        /// </summary>
        /// <param name="versionId"></param>
        /// <param name="tipYear"></param>
        /// <returns></returns>
        public InfoModel GetProjectInfo(int versionId, string year)
        {
            //throw new NotImplementedException();
            InfoModel result = null;
            using (SqlCommand command = new SqlCommand("[RTP].[GetProjectVersionInfo]") { CommandType = CommandType.StoredProcedure })
            {
                command.Parameters.AddWithValue("@RtpYear", year);
                command.Parameters.AddWithValue("@RtpProjectVersion", versionId);
                command.Parameters.AddWithValue("@IsActive", 1);

                using (IDataReader rdr = ExecuteReader(command))
                {
                    if (rdr.Read())
                    {
                        result = new InfoModel();
                        result.AdministrativeLevelId = rdr["AdministrativeLevelID"] != DBNull.Value ? (int?)rdr["AdministrativeLevelID"] : null;
                        result.DRCOGNotes = rdr["DRCOGNotes"].ToString();
                        result.ImprovementTypeId = rdr["ImprovementTypeId"] != DBNull.Value ? (int?)rdr["ImprovementTypeId"] : null;
                        result.PoolMasterVersionID = rdr["PoolMasterVersionID"] != DBNull.Value ? (int?)rdr["PoolMasterVersionID"] : null;
                        result.ProjectId = rdr["ProjectID"] != DBNull.Value ? (int?)rdr["ProjectID"] : null;
                        result.ProjectName = rdr["ProjectName"].ToString();
                        result.ProjectTypeId = rdr["ProjectTypeID"] != DBNull.Value ? (int?)rdr["ProjectTypeID"] : null;
                        result.ProjectType = rdr["ProjectType"].ToString();
                        result.ProjectVersionId = rdr["ProjectVersionID"] != DBNull.Value ? (int)rdr["ProjectVersionID"] : default(int);
                        result.SponsorContactId = rdr["SponsorContactID"] != DBNull.Value ? (int?)rdr["SponsorContactID"] : null;
                        result.SponsorId = rdr["SponsorID"] != DBNull.Value ? (int?)rdr["SponsorID"] : null;
                        result.SponsorNotes = rdr["SponsorNotes"].ToString();
                        result.RtpId = rdr["RtpId"].ToString();
                        result.RtpYear = rdr["RtpYear"].ToString();
                        result.TransportationTypeId = rdr["TransportationTypeID"] != DBNull.Value ? (int?)rdr["TransportationTypeID"] : null;
                        result.SelectionAgencyId = rdr["SelectionAgencyID"] != DBNull.Value ? (int?)rdr["SelectionAgencyID"] : null;
                        result.IsRegionallySignificant = rdr["RegionalSignificance"] != DBNull.Value ? (bool)rdr["RegionalSignificance"] : false;
                    }
                }
            }
            return result;
        }