public void Put(LocationModel model)
 {
     try
     {
         ProjectRepository.UpdateProjectLocationModel(model);
     }
     catch (Exception ex)
     {
         Logger.WarnException("Could not update TIP Project Location", ex);
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.ExpectationFailed) { ReasonPhrase = ex.Message });
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Store the Location model attributes - Facility Name and Limits ONLY
        /// </summary>
        /// <param name="model"></param>
        public void UpdateProjectLocationModel(LocationModel model)
        {
            using (SqlCommand command = new SqlCommand("[TIP].[UpdateProjectLocation]") { CommandType = CommandType.StoredProcedure })
            {
                //model.Adoption != null ? (object)model.Adoption.Value : (object)DBNull.Value
                command.Parameters.AddWithValue("@PROJECTVERSIONID", model.ProjectVersionId);
                command.Parameters.AddWithValue("@FACILITYNAME", model.FacilityName);
                command.Parameters.AddWithValue("@LIMITS", model.Limits);
                command.Parameters.AddWithValue("@CDOTRegionId", model.CdotRegionId);
                command.Parameters.AddWithValue("@AffectedProjectDelaysLocationId", model.AffectedProjectDelaysLocationId);

                this.ExecuteNonQuery(command);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get the Location Model
        /// </summary>
        /// <param name="versionId"></param>
        /// <param name="tipYear"></param>
        /// <returns></returns>
        public LocationModel GetProjectLocationModel(int versionId, string tipYear)
        {
            LocationModel result = null;
             using (SqlCommand command = new SqlCommand("[TIP].[GetProjectLocation]") { CommandType = CommandType.StoredProcedure })
             {
                 command.Parameters.AddWithValue("@PROJECTVERSIONID", versionId);
                 command.Parameters.AddWithValue("@TIPYEAR", tipYear);

                 using (IDataReader rdr = ExecuteReader(command))
                 {
                     if (rdr.Read())
                     {
                         result = new LocationModel();
                         result.FacilityName = rdr["FacilityName"].ToString();
                         result.Limits = rdr["Limits"].ToString();
                         result.ProjectVersionId = versionId;
                         result.TipYear = tipYear;
                         result.ProjectName = rdr["ProjectName"].ToString();
                         result.ProjectId = rdr["ProjectId"] != DBNull.Value ? (int?)rdr["ProjectId"] : null;
                         result.LocationMapId = rdr["LocationMapID"].ToString().SmartParseDefault<int>(default(int));
                         result.CdotRegionId = rdr["CDOTRegionId"].ToString().SmartParseDefault<int>(default(int));
                         result.AffectedProjectDelaysLocationId = rdr["AffectedProjectDelaysLocationId"].ToString().SmartParseDefault<int>(default(int));
                     }
                 }
             }
             return result;
        }