示例#1
0
        public async Task <IEnumerable <Document_Type> > Document_Type(List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return(new List <Document_Type>().AsEnumerable());
            }
            try
            {
                using (var t = new Document_TypeClient())
                {
                    var res = await t.GetDocument_Type(includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(res.Select(x => new Document_Type(x)).AsEnumerable());
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
示例#2
0
        public async Task <Document_Type> GetDocument_Type(string id, List <string> includesLst = null)
        {
            try
            {
                using (var t = new Document_TypeClient())
                {
                    var res = await t.GetDocument_TypeByKey(id, includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(new Document_Type(res)
                        {
                            // Customs_Procedure = new System.Collections.ObjectModel.ObservableCollection<Customs_Procedure>(res.Customs_Procedure.Select(y => new Customs_Procedure(y)))
                        });
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
 private void UpdateDocument_Type()
 {
     using (var ctx = new Document_TypeClient())
     {
         var dto = ctx.GetDocument_Type().Result.FirstOrDefault(x => x.Document_TypeId == this.Document_TypeId);
         if (dto != null)
         {
             Document_Type = new Document_Type(dto);
         }
     }
 }
示例#4
0
 public async Task <decimal> SumNav(string whereExp, Dictionary <string, string> navExp, string sumExp)
 {
     try
     {
         using (var t = new Document_TypeClient())
         {
             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;
     }
 }
示例#5
0
 public decimal SumField(string whereExp, string sumExp)
 {
     try
     {
         using (var t = new Document_TypeClient())
         {
             return(t.SumField(whereExp, sumExp));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
示例#6
0
 public async Task <bool> DeleteDocument_Type(string id)
 {
     try
     {
         using (var t = new Document_TypeClient())
         {
             return(await t.DeleteDocument_Type(id).ConfigureAwait(continueOnCapturedContext: false));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
示例#7
0
 public async Task <Document_Type> CreateDocument_Type(Document_Type entity)
 {
     try
     {
         using (var t = new Document_TypeClient())
         {
             return(new Document_Type(await t.CreateDocument_Type(entity.DTO).ConfigureAwait(continueOnCapturedContext: false)));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
示例#8
0
        //Virtural List Implementation

        public async Task <Tuple <IEnumerable <Document_Type>, 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 <Document_Type>, int>(new List <Document_Type>().AsEnumerable(), overallCount));
            }

            try
            {
                using (var t = new Document_TypeClient())
                {
                    IEnumerable <DTO.Document_Type> 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 <Document_Type>, int>(res.Select(x => new Document_Type(x)).AsEnumerable(), overallCount));
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
示例#9
0
        public async Task <IEnumerable <Document_Type> > GetDocument_TypeByExpressionNav(string exp, Dictionary <string, string> navExp, List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime || exp == null || exp == "None")
            {
                return(new List <Document_Type>().AsEnumerable());
            }
            try
            {
                using (var t = new Document_TypeClient())
                {
                    IEnumerable <DTO.Document_Type> res = null;
                    if (exp == "All" && navExp.Count == 0)
                    {
                        res = await t.GetDocument_Type(includesLst).ConfigureAwait(continueOnCapturedContext: false);
                    }
                    else
                    {
                        res = await t.GetDocument_TypeByExpressionNav(exp, navExp, includesLst).ConfigureAwait(continueOnCapturedContext: false);
                    }

                    if (res != null)
                    {
                        return(res.Select(x => new Document_Type(x)).AsEnumerable());
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
示例#10
0
        public async Task <Document_Type> UpdateDocument_Type(Document_Type entity)
        {
            if (entity == null)
            {
                return(entity);
            }
            var entitychanges = entity.ChangeTracker.GetChanges().FirstOrDefault();

            if (entitychanges != null)
            {
                try
                {
                    using (var t = new Document_TypeClient())
                    {
                        var updatedEntity = await t.UpdateDocument_Type(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);
            }
        }