Пример #1
0
 private void DataPortal_Fetch(PKCriteria criteria)
 {
     Database.LogInfo("CustomerDemographic.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 = "getCustomerDemographic";
                 cm.Parameters.AddWithValue("@CustomerTypeID", criteria.CustomerTypeID);
                 using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
                 {
                     if (!dr.Read())
                     {
                         _ErrorMessage = "No Record Found";
                         return;
                     }
                     ReadData(dr);
                     // load child objects
                     dr.NextResult();
                     _CustomerDemographicCustomerCustomerDemos = CustomerDemographicCustomerCustomerDemos.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("CustomerDemographic.DataPortal_Fetch", ex);
         _ErrorMessage = ex.Message;
         throw new DbCslaException("CustomerDemographic.DataPortal_Fetch", ex);
     }
 }
 public CustomerDemographicCustomerCustomerDemosPropertyDescriptor(CustomerDemographicCustomerCustomerDemos collection, int index) : base(collection, index)
 {
     ;
 }