예제 #1
0
 public static ShippingExportDC[] FindExportContractList(Guid tenantId, string numberToMatch, int?status, Guid?owner)
 {
     using (ExtensibleObjectContext context = new ExtensibleObjectContext(Constants.Database.TenantData))
     {
         List <ShippingExportDC> dcList      = new List <ShippingExportDC>();
         StringBuilder           queryClause = new StringBuilder();
         queryClause.Append(string.Format("TenantId='{0}'", tenantId.ToString()));
         queryClause.Append(string.Format(" AND Number LIKE '{0}%'", numberToMatch == null?string.Empty:numberToMatch.Trim().Replace("'", "''")));
         if (status != null)
         {
             queryClause.Append(string.Format(" AND Status = {0}", (int)status));
         }
         if (owner != null)
         {
             queryClause.Append(string.Format(" AND Creator = '{0}'", ((Guid)owner).ToString()));
         }
         queryClause.Append(" ORDER BY Number");
         EntityQuery <ShippingExportContract> query = context.GetQuery <ShippingExportContract>(queryClause.ToString());
         foreach (ShippingExportContract exportContract in query)
         {
             ShippingExportDC dc = new ShippingExportDC();
             EntityExchanger.WriteEntityToDC(exportContract, dc);
             dcList.Add(dc);
         }
         return(dcList.ToArray());
     }
 }
예제 #2
0
 public static ShippingExportDC GetExportContractById(Guid id)
 {
     using (ExtensibleObjectContext context = new ExtensibleObjectContext(Constants.Database.TenantData))
     {
         KeyValuePair <string, object>[] keyValue = new KeyValuePair <string, object>[] { new KeyValuePair <string, object>("Id", id) };
         EntityKey key = context.CreateKey(typeof(ExtensibleObjectContext), keyValue);
         ShippingExportContract exportContract = context.GetObjectByKey <ShippingExportContract>(key);
         ShippingExportDC       dc             = new ShippingExportDC();
         EntityExchanger.WriteEntityToDC(exportContract, dc);
         return(dc);
     }
 }
예제 #3
0
 public static ShippingExportDC GetExportContractByNumber(Guid tenantId, string number)
 {
     using (ExtensibleObjectContext context = new ExtensibleObjectContext(Constants.Database.TenantData))
     {
         KeyValuePair <string, object>        keyValueTenantId = new KeyValuePair <string, object>("TenantId", tenantId);
         KeyValuePair <string, object>        keyValueNumber   = new KeyValuePair <string, object>("Number", number);
         EntityQuery <ShippingExportContract> query            = context.GetQuery <ShippingExportContract>(keyValueTenantId, keyValueNumber);
         foreach (ShippingExportContract exportContract in query)
         {
             ShippingExportDC dc = new ShippingExportDC();
             EntityExchanger.WriteEntityToDC(exportContract, dc);
             return(dc);
         }
         return(null);
     }
 }