Ejemplo n.º 1
0
 private void DataPortal_Fetch(PKCriteria criteria)
 {
     Database.LogInfo("Region.DataPortal_Fetch", GetHashCode());
     try
     {
         using (SqlConnection cn = Database.Northwind_SqlConnection)
         {
             ApplicationContext.LocalContext["cn"] = cn;
             using (SqlCommand cm = cn.CreateCommand())
             {
                 cm.CommandType = CommandType.StoredProcedure;
                 cm.CommandText = "getRegion";
                 cm.Parameters.AddWithValue("@RegionID", criteria.RegionID);
                 using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
                 {
                     if (!dr.Read())
                     {
                         _ErrorMessage = "No Record Found";
                         return;
                     }
                     ReadData(dr);
                     // load child objects
                     dr.NextResult();
                     _RegionTerritories = RegionTerritories.Get(dr);
                 }
             }
             // removing of item only needed for local data portal
             if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
             {
                 ApplicationContext.LocalContext.Remove("cn");
             }
         }
     }
     catch (Exception ex)
     {
         Database.LogException("Region.DataPortal_Fetch", ex);
         _ErrorMessage = ex.Message;
         throw new DbCslaException("Region.DataPortal_Fetch", ex);
     }
 }
Ejemplo n.º 2
0
 public RegionTerritoriesPropertyDescriptor(RegionTerritories collection, int index) : base(collection, index)
 {
     ;
 }