Пример #1
0
        public async Task <PreviousDocument> GetPreviousDocument(string id, List <string> includesLst = null)
        {
            try
            {
                using (var t = new PreviousDocumentClient())
                {
                    var res = await t.GetPreviousDocumentByKey(id, includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(new PreviousDocument(res)
                        {
                            // PreviousDocumentItems = new System.Collections.ObjectModel.ObservableCollection<PreviousDocumentItem>(res.PreviousDocumentItems.Select(y => new PreviousDocumentItem(y)))
                        });
                    }
                    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 <IEnumerable <PreviousDocument> > GetPreviousDocumentsByExpressionLst(List <string> expLst, List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime || expLst.Count == 0 || expLst.FirstOrDefault() == "None")
            {
                return(new List <PreviousDocument>().AsEnumerable());
            }
            try
            {
                using (var t = new PreviousDocumentClient())
                {
                    IEnumerable <DTO.PreviousDocument> res = null;

                    res = await t.GetPreviousDocumentsByExpressionLst(expLst, includesLst).ConfigureAwait(continueOnCapturedContext: false);


                    if (res != null)
                    {
                        return(res.Select(x => new PreviousDocument(x)).AsEnumerable());
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
Пример #3
0
 public async Task <decimal> SumNav(string whereExp, Dictionary <string, string> navExp, string sumExp)
 {
     try
     {
         using (var t = new PreviousDocumentClient())
         {
             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;
     }
 }
Пример #4
0
 public decimal SumField(string whereExp, string sumExp)
 {
     try
     {
         using (var t = new PreviousDocumentClient())
         {
             return(t.SumField(whereExp, sumExp));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Пример #5
0
 public async Task <bool> DeletePreviousDocument(string id)
 {
     try
     {
         using (var t = new PreviousDocumentClient())
         {
             return(await t.DeletePreviousDocument(id).ConfigureAwait(continueOnCapturedContext: false));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Пример #6
0
 public async Task <PreviousDocument> CreatePreviousDocument(PreviousDocument entity)
 {
     try
     {
         using (var t = new PreviousDocumentClient())
         {
             return(new PreviousDocument(await t.CreatePreviousDocument(entity.DTO).ConfigureAwait(continueOnCapturedContext: false)));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Пример #7
0
        //Virtural List Implementation

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

            try
            {
                using (var t = new PreviousDocumentClient())
                {
                    IEnumerable <DTO.PreviousDocument> 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 <PreviousDocument>, int>(res.Select(x => new PreviousDocument(x)).AsEnumerable(), overallCount));
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
Пример #8
0
        public async Task <PreviousDocument> UpdatePreviousDocument(PreviousDocument entity)
        {
            if (entity == null)
            {
                return(entity);
            }
            var entitychanges = entity.ChangeTracker.GetChanges().FirstOrDefault();

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