Пример #1
0
        public async Task <IEnumerable <Customs_Procedure> > Customs_Procedure(List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return(new List <Customs_Procedure>().AsEnumerable());
            }
            try
            {
                using (var t = new Customs_ProcedureClient())
                {
                    var res = await t.GetCustoms_Procedure(includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(res.Select(x => new Customs_Procedure(x)).AsEnumerable());
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
 private void UpdateCustoms_Procedure()
 {
     using (var ctx = new Customs_ProcedureClient())
     {
         var dto = ctx.GetCustoms_Procedure().Result.FirstOrDefault(x => x.Customs_ProcedureId == this.Customs_ProcedureId);
         if (dto != null)
         {
             Customs_Procedure = new Customs_Procedure(dto);
         }
     }
 }
Пример #3
0
        public async Task <IEnumerable <Customs_Procedure> > GetCustoms_ProcedureByExpressionNav(string exp, Dictionary <string, string> navExp, List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime || exp == null || exp == "None")
            {
                return(new List <Customs_Procedure>().AsEnumerable());
            }
            try
            {
                using (var t = new Customs_ProcedureClient())
                {
                    IEnumerable <DTO.Customs_Procedure> res = null;
                    if (exp == "All" && navExp.Count == 0)
                    {
                        res = await t.GetCustoms_Procedure(includesLst).ConfigureAwait(continueOnCapturedContext: false);
                    }
                    else
                    {
                        res = await t.GetCustoms_ProcedureByExpressionNav(exp, navExp, includesLst).ConfigureAwait(continueOnCapturedContext: false);
                    }

                    if (res != null)
                    {
                        return(res.Select(x => new Customs_Procedure(x)).AsEnumerable());
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }