public async Task <IEnumerable <OversShortEX> > OversShorts(List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return(new List <OversShortEX>().AsEnumerable());
            }
            try
            {
                using (var t = new OversShortEXClient())
                {
                    var res = await t.GetOversShorts(includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(res.Select(x => new OversShortEX(x)).AsEnumerable());
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
 public async Task <StringBuilder> BuildOSLst(List <int> lst)
 {
     using (var t = new OversShortEXClient())
     {
         return(await t.BuildOSLst(lst).ConfigureAwait(false));
     }
 }
 public async Task AutoMatch(IEnumerable <int> slst)
 {
     using (var t = new OversShortEXClient())
     {
         await t.AutoMatch(slst).ConfigureAwait(false);
     }
 }
 public async Task CreateOversOps(IEnumerable <int> selOS, int docSetId)
 {
     using (var t = new OversShortEXClient())
     {
         await t.CreateOversOps(selOS, docSetId).ConfigureAwait(false);
     }
 }
 public async Task MatchEntries(IEnumerable <int> olst)
 {
     using (var t = new OversShortEXClient())
     {
         await t.MatchEntries(olst).ConfigureAwait(false);
     }
 }
 public async Task RemoveSelectedOverShorts(IEnumerable <int> lst)
 {
     using (var t = new OversShortEXClient())
     {
         await t.RemoveSelectedOverShorts(lst).ConfigureAwait(false);
     }
 }
 public async Task Import(string fileName, string fileType, int docSetId, bool overWriteExisting)
 {
     using (var t = new OversShortEXClient())
     {
         await t.Import(fileType, fileType, docSetId, overWriteExisting).ConfigureAwait(false);
     }
 }
 public async Task SaveCNumber(IEnumerable <int> slst, string cntxt)
 {
     using (var t = new OversShortEXClient())
     {
         await t.SaveCNumber(slst, cntxt).ConfigureAwait(false);
     }
 }
        public async Task <OversShortEX> GetOversShortEX(string id, List <string> includesLst = null)
        {
            try
            {
                using (var t = new OversShortEXClient())
                {
                    var res = await t.GetOversShortEXByKey(id, includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(new OversShortEX(res)
                        {
                            // OverShortDetailsEXes = new System.Collections.ObjectModel.ObservableCollection<OverShortDetailsEX>(res.OverShortDetailsEXes.Select(y => new OverShortDetailsEX(y))),
                            // OverShortSuggestedDocuments = (res.OverShortSuggestedDocuments != null?new OverShortSuggestedDocument(res.OverShortSuggestedDocuments): null)
                        });
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
 public async Task CreateShortsEx9(IEnumerable <int> selos, int docSetId,
                                   bool BreakOnMonthYear, bool ApplyEX9Bucket)
 {
     using (var t = new OversShortEXClient())
     {
         await t.CreateShortsEx9(selos, docSetId, BreakOnMonthYear, ApplyEX9Bucket).ConfigureAwait(false);
     }
 }
 public async Task <decimal> SumNav(string whereExp, Dictionary <string, string> navExp, string sumExp)
 {
     try
     {
         using (var t = new OversShortEXClient())
         {
             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;
     }
 }
 public decimal SumField(string whereExp, string sumExp)
 {
     try
     {
         using (var t = new OversShortEXClient())
         {
             return(t.SumField(whereExp, sumExp));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
 public async Task <bool> DeleteOversShortEX(string id)
 {
     try
     {
         using (var t = new OversShortEXClient())
         {
             return(await t.DeleteOversShortEX(id).ConfigureAwait(continueOnCapturedContext: false));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
 public async Task <OversShortEX> CreateOversShortEX(OversShortEX entity)
 {
     try
     {
         using (var t = new OversShortEXClient())
         {
             return(new OversShortEX(await t.CreateOversShortEX(entity.DTO).ConfigureAwait(continueOnCapturedContext: false)));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
        //Virtural List Implementation

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

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

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

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