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

                    if (res != null)
                    {
                        return(res.Select(x => new OverShortDetailsEX(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 <OverShortDetailsEX> GetOverShortDetailsEX(string id, List <string> includesLst = null)
        {
            try
            {
                using (var t = new OverShortDetailsEXClient())
                {
                    var res = await t.GetOverShortDetailsEXByKey(id, includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(new OverShortDetailsEX(res)
                        {
                            // OverShortDetailAllocations = new System.Collections.ObjectModel.ObservableCollection<OverShortDetailAllocation>(res.OverShortDetailAllocations.Select(y => new OverShortDetailAllocation(y))),
                            // OversShortEX = (res.OversShortEX != null?new OversShortEX(res.OversShortEX): null),
                            // InventoryItem = (res.InventoryItem != null?new InventoryItem(res.InventoryItem): null),
                            // OverShortAllocationsEXes = new System.Collections.ObjectModel.ObservableCollection<OverShortAllocationsEX>(res.OverShortAllocationsEXes.Select(y => new OverShortAllocationsEX(y)))
                        });
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
        public async Task <IEnumerable <OverShortDetailsEX> > GetOverShortDetailsEXByOversShortsId(string OversShortsId, List <string> includesLst = null)
        {
            if (OversShortsId == "0")
            {
                return(null);
            }
            try
            {
                using (OverShortDetailsEXClient t = new OverShortDetailsEXClient())
                {
                    var res = await t.GetOverShortDetailsEXByOversShortsId(OversShortsId, includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(res.Select(x => new OverShortDetailsEX(x)).AsEnumerable());
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
Пример #4
0
 public async Task RemoveOverShortDetail(int osd)
 {
     using (var t = new OverShortDetailsEXClient())
     {
         await t.RemoveOverShortDetail(osd).ConfigureAwait(false);
     }
 }
Пример #5
0
 public async Task MatchToCurrentItem(int currentDocumentItem, OverShortDetailsEX osd)
 {
     using (var t = new OverShortDetailsEXClient())
     {
         await t.MatchToCurrentItem(currentDocumentItem, osd.DTO).ConfigureAwait(false);
     }
 }
 public async Task <decimal> SumNav(string whereExp, Dictionary <string, string> navExp, string sumExp)
 {
     try
     {
         using (var t = new OverShortDetailsEXClient())
         {
             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 OverShortDetailsEXClient())
         {
             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> DeleteOverShortDetailsEX(string id)
 {
     try
     {
         using (var t = new OverShortDetailsEXClient())
         {
             return(await t.DeleteOverShortDetailsEX(id).ConfigureAwait(continueOnCapturedContext: false));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
 public async Task <OverShortDetailsEX> CreateOverShortDetailsEX(OverShortDetailsEX entity)
 {
     try
     {
         using (var t = new OverShortDetailsEXClient())
         {
             return(new OverShortDetailsEX(await t.CreateOverShortDetailsEX(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 <OverShortDetailsEX>, 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 <OverShortDetailsEX>, int>(new List <OverShortDetailsEX>().AsEnumerable(), overallCount));
            }

            try
            {
                using (var t = new OverShortDetailsEXClient())
                {
                    IEnumerable <DTO.OverShortDetailsEX> 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 <OverShortDetailsEX>, int>(res.Select(x => new OverShortDetailsEX(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 <OverShortDetailsEX> > GetOverShortDetailsByExpressionNav(string exp, Dictionary <string, string> navExp, List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime || exp == null || exp == "None")
            {
                return(new List <OverShortDetailsEX>().AsEnumerable());
            }
            try
            {
                using (var t = new OverShortDetailsEXClient())
                {
                    IEnumerable <DTO.OverShortDetailsEX> res = null;
                    if (exp == "All" && navExp.Count == 0)
                    {
                        res = await t.GetOverShortDetails(includesLst).ConfigureAwait(continueOnCapturedContext: false);
                    }
                    else
                    {
                        res = await t.GetOverShortDetailsByExpressionNav(exp, navExp, includesLst).ConfigureAwait(continueOnCapturedContext: false);
                    }

                    if (res != null)
                    {
                        return(res.Select(x => new OverShortDetailsEX(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 <OverShortDetailsEX> UpdateOverShortDetailsEX(OverShortDetailsEX entity)
        {
            if (entity == null)
            {
                return(entity);
            }
            var entitychanges = entity.ChangeTracker.GetChanges().FirstOrDefault();

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