Ejemplo n.º 1
0
        public async Task <IEnumerable <Customs_Procedure> > GetCustoms_ProcedureByDocument_TypeId(string Document_TypeId, List <string> includesLst = null)
        {
            if (Document_TypeId == "0")
            {
                return(null);
            }
            try
            {
                using (Customs_ProcedureClient t = new Customs_ProcedureClient())
                {
                    var res = await t.GetCustoms_ProcedureByDocument_TypeId(Document_TypeId, 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;
            }
        }
Ejemplo n.º 2
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;
            }
        }
Ejemplo n.º 3
0
        public async Task <Customs_Procedure> GetCustoms_Procedure(string id, List <string> includesLst = null)
        {
            try
            {
                using (var t = new Customs_ProcedureClient())
                {
                    var res = await t.GetCustoms_ProcedureByKey(id, includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(new Customs_Procedure(res)
                        {
                            // Document_Type = (res.Document_Type != null?new Document_Type(res.Document_Type): null)
                        });
                    }
                    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);
         }
     }
 }
Ejemplo n.º 5
0
 public async Task <decimal> SumNav(string whereExp, Dictionary <string, string> navExp, string sumExp)
 {
     try
     {
         using (var t = new Customs_ProcedureClient())
         {
             return(await t.SumNav(whereExp, navExp, sumExp).ConfigureAwait(false));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Ejemplo n.º 6
0
 public decimal SumField(string whereExp, string sumExp)
 {
     try
     {
         using (var t = new Customs_ProcedureClient())
         {
             return(t.SumField(whereExp, sumExp));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Ejemplo n.º 7
0
 public async Task <bool> DeleteCustoms_Procedure(string id)
 {
     try
     {
         using (var t = new Customs_ProcedureClient())
         {
             return(await t.DeleteCustoms_Procedure(id).ConfigureAwait(continueOnCapturedContext: false));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Ejemplo n.º 8
0
 public async Task <Customs_Procedure> CreateCustoms_Procedure(Customs_Procedure entity)
 {
     try
     {
         using (var t = new Customs_ProcedureClient())
         {
             return(new Customs_Procedure(await t.CreateCustoms_Procedure(entity.DTO).ConfigureAwait(continueOnCapturedContext: false)));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Ejemplo n.º 9
0
        //Virtural List Implementation

        public async Task <Tuple <IEnumerable <Customs_Procedure>, int> > LoadRange(int startIndex, int count, string exp, Dictionary <string, string> navExp, IEnumerable <string> includeLst = null)
        {
            var overallCount = 0;

            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime || exp == null || exp == "None")
            {
                return(new Tuple <IEnumerable <Customs_Procedure>, int>(new List <Customs_Procedure>().AsEnumerable(), overallCount));
            }

            try
            {
                using (var t = new Customs_ProcedureClient())
                {
                    IEnumerable <DTO.Customs_Procedure> res = null;

                    res = await t.LoadRangeNav(startIndex, count, exp, navExp, includeLst).ConfigureAwait(continueOnCapturedContext: false);

                    overallCount = await t.CountNav(exp, navExp).ConfigureAwait(continueOnCapturedContext: false);



                    if (res != null)
                    {
                        return(new Tuple <IEnumerable <Customs_Procedure>, int>(res.Select(x => new Customs_Procedure(x)).AsEnumerable(), overallCount));
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
Ejemplo n.º 10
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;
            }
        }
Ejemplo n.º 11
0
        public async Task <Customs_Procedure> UpdateCustoms_Procedure(Customs_Procedure entity)
        {
            if (entity == null)
            {
                return(entity);
            }
            var entitychanges = entity.ChangeTracker.GetChanges().FirstOrDefault();

            if (entitychanges != null)
            {
                try
                {
                    using (var t = new Customs_ProcedureClient())
                    {
                        var updatedEntity = await t.UpdateCustoms_Procedure(entitychanges).ConfigureAwait(false);

                        entity.EntityId = updatedEntity.EntityId;
                        entity.DTO.AcceptChanges();
                        //var  = entity.;
                        //entity.ChangeTracker.MergeChanges(,updatedEntity);
                        //entity. = ;
                        return(entity);
                    }
                }
                catch (FaultException <ValidationFault> e)
                {
                    throw new Exception(e.Detail.Message, e.InnerException);
                }
                catch (Exception)
                {
                    Debugger.Break();
                    throw;
                }
            }
            else
            {
                return(entity);
            }
        }