コード例 #1
0
ファイル: ExportService.cs プロジェクト: penzhaohui/Crab
 public Guid CreateExportContract(string number, Guid creator)
 {
     if (RequestContext.Current.TenantId == Guid.Empty)
     {
         throw new ArgumentNullException("tenantId");
     }
     if (number == null || string.IsNullOrEmpty(number.Trim()))
     {
         throw new ArgumentNullException("number");
     }
     if (creator == Guid.Empty)
     {
         throw new ArgumentNullException("creator");
     }
     try
     {
         DataModelContext.Initialize(RequestContext.Current.TenantId);
         return(ExportLogic.CreateExportContract(RequestContext.Current.TenantId, number.Trim(), creator));
     }
     catch (Exception ex)
     {
         throw new ExportContractExcepiton(ex.Message, ex);
     }
     finally
     {
         DataModelContext.Clear();
     }
 }
コード例 #2
0
ファイル: MetadataService.cs プロジェクト: penzhaohui/Crab
        public EntityFieldDef AddEntityFieldDef(Guid entityDefId, string fieldName, string caption, DataTypes dataType, int length)
        {
            if (RequestContext.Current.TenantId == Guid.Empty)
            {
                throw new ArgumentNullException("tenantId");
            }
            if (entityDefId == Guid.Empty)
            {
                throw new ArgumentNullException("entityDefId");
            }
            if (string.IsNullOrEmpty(fieldName))
            {
                throw new ArgumentNullException("fieldName");
            }
            EntityFieldDef result = null;

            try
            {
                DataModelContext.Initialize(RequestContext.Current.TenantId);
                result = MetadataLogic.AddEntityFieldDef(entityDefId, fieldName, caption, dataType, length);
            }
            finally
            {
                DataModelContext.Clear();
            }
            return(result);
        }
コード例 #3
0
ファイル: MetadataService.cs プロジェクト: penzhaohui/Crab
        public EntityDef[] GetEntityDefs()
        {
            if (RequestContext.Current.TenantId == Guid.Empty)
            {
                throw new ArgumentNullException("tenantId");
            }

            EntityDef[] result = null;
            try
            {
                DataModelContext.Initialize(RequestContext.Current.TenantId);
                result = MetadataLogic.GetEntityDefs();
            }
            finally
            {
                DataModelContext.Clear();
            }
            return(result);
        }
コード例 #4
0
ファイル: ExportService.cs プロジェクト: penzhaohui/Crab
 public void DeleteExportContract(Guid id)
 {
     if (RequestContext.Current.TenantId == Guid.Empty)
     {
         throw new ArgumentNullException("tenantId");
     }
     try
     {
         DataModelContext.Initialize(RequestContext.Current.TenantId);
         ExportLogic.DeleteExportContract(id);
     }
     catch (Exception ex)
     {
         throw new ExportContractExcepiton(ex.Message, ex);
     }
     finally
     {
         DataModelContext.Clear();
     }
 }
コード例 #5
0
ファイル: MetadataService.cs プロジェクト: penzhaohui/Crab
        public void UpdateEntityDef(Guid entityDefId, string caption)
        {
            if (RequestContext.Current.TenantId == Guid.Empty)
            {
                throw new ArgumentNullException("tenantId");
            }
            if (entityDefId == Guid.Empty)
            {
                throw new ArgumentNullException("entityDefId");
            }

            try
            {
                DataModelContext.Initialize(RequestContext.Current.TenantId);
                MetadataLogic.UpdateEntityDef(entityDefId, caption);
            }
            finally
            {
                DataModelContext.Clear();
            }
        }
コード例 #6
0
ファイル: MetadataService.cs プロジェクト: penzhaohui/Crab
        public void DeleteEntityFieldDef(Guid fieldDefId)
        {
            if (RequestContext.Current.TenantId == Guid.Empty)
            {
                throw new ArgumentNullException("tenantId");
            }

            if (fieldDefId == Guid.Empty)
            {
                throw new ArgumentNullException("fieldDefId");
            }
            try
            {
                DataModelContext.Initialize(RequestContext.Current.TenantId);
                MetadataLogic.DeleteEntityFieldDef(fieldDefId);
            }
            finally
            {
                DataModelContext.Clear();
            }
        }
コード例 #7
0
ファイル: MetadataService.cs プロジェクト: penzhaohui/Crab
        public EntityDef GetEnityDefByName(string name)
        {
            if (RequestContext.Current.TenantId == Guid.Empty)
            {
                throw new ArgumentNullException("tenantId");
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }
            EntityDef result = null;

            try
            {
                DataModelContext.Initialize(RequestContext.Current.TenantId);
                result = MetadataLogic.GetEnityDefByName(name);
            }
            finally
            {
                DataModelContext.Clear();
            }
            return(result);
        }
コード例 #8
0
ファイル: MetadataService.cs プロジェクト: penzhaohui/Crab
        public EntityFieldDef GetFieldDefById(Guid fieldId)
        {
            if (RequestContext.Current.TenantId == Guid.Empty)
            {
                throw new ArgumentNullException("tenantId");
            }
            if (fieldId == Guid.Empty)
            {
                throw new ArgumentNullException("fieldId");
            }
            EntityFieldDef result = null;

            try
            {
                DataModelContext.Initialize(RequestContext.Current.TenantId);
                result = MetadataLogic.GetFieldDefById(fieldId);
            }
            finally
            {
                DataModelContext.Clear();
            }
            return(result);
        }
コード例 #9
0
ファイル: ExportService.cs プロジェクト: penzhaohui/Crab
 public ShippingExportDC[] FindExportContractList(string numberToMatch, int?status, Guid?owner)
 {
     if (RequestContext.Current.TenantId == Guid.Empty)
     {
         throw new ArgumentNullException("tenantId");
     }
     try
     {
         DataModelContext.Initialize(RequestContext.Current.TenantId);
         return(ExportLogic.FindExportContractList(
                    RequestContext.Current.TenantId,
                    numberToMatch != null?numberToMatch.Trim():string.Empty,
                    status, owner));
     }
     catch (Exception ex)
     {
         throw new ExportContractExcepiton(ex.Message, ex);
     }
     finally
     {
         DataModelContext.Clear();
     }
 }
コード例 #10
0
ファイル: ExportService.cs プロジェクト: penzhaohui/Crab
 public ShippingExportDC GetExportContractByNumber(string number)
 {
     if (RequestContext.Current.TenantId == Guid.Empty)
     {
         throw new ArgumentNullException("tenantId");
     }
     if (string.IsNullOrEmpty(number))
     {
         throw new ArgumentNullException("number");
     }
     try
     {
         DataModelContext.Initialize(RequestContext.Current.TenantId);
         return(ExportLogic.GetExportContractByNumber(RequestContext.Current.TenantId, number.Trim()));
     }
     catch (Exception ex)
     {
         throw new ExportContractExcepiton(ex.Message, ex);
     }
     finally
     {
         DataModelContext.Clear();
     }
 }
コード例 #11
0
ファイル: ExportService.cs プロジェクト: penzhaohui/Crab
 public ShippingExportDC GetExportContractById(Guid id)
 {
     if (RequestContext.Current.TenantId == Guid.Empty)
     {
         throw new ArgumentNullException("tenantId");
     }
     if (id == Guid.Empty)
     {
         throw new ArgumentNullException("id");
     }
     try
     {
         DataModelContext.Initialize(RequestContext.Current.TenantId);
         return(ExportLogic.GetExportContractById(id));
     }
     catch (Exception ex)
     {
         throw new ExportContractExcepiton(ex.Message, ex);
     }
     finally
     {
         DataModelContext.Clear();
     }
 }
コード例 #12
0
ファイル: ExportService.cs プロジェクト: penzhaohui/Crab
 public void UpdateExportContract(ShippingExportDC contract)
 {
     if (RequestContext.Current.TenantId == Guid.Empty)
     {
         throw new ArgumentNullException("tenantId");
     }
     if (contract == null || contract.Id == Guid.Empty)
     {
         throw new ArgumentNullException("contract");
     }
     try
     {
         DataModelContext.Initialize(RequestContext.Current.TenantId);
         ExportLogic.UpdateExportContract(contract);
     }
     catch (Exception ex)
     {
         throw new ExportContractExcepiton(ex.Message, ex);
     }
     finally
     {
         DataModelContext.Clear();
     }
 }