コード例 #1
0
        public async Task <IEnumerable <SalesData> > SalesDatas(List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return(new List <SalesData>().AsEnumerable());
            }
            try
            {
                using (var t = new SalesDataClient())
                {
                    var res = await t.GetSalesDatas(includesLst).ConfigureAwait(continueOnCapturedContext: false);

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

                    if (res != null)
                    {
                        return(new SalesData(res)
                        {
                            // SalesDataDetails = new System.Collections.ObjectModel.ObservableCollection<SalesDataDetail>(res.SalesDataDetails.Select(y => new SalesDataDetail(y))),
                            // AsycudaDocumentSets = new System.Collections.ObjectModel.ObservableCollection<AsycudaDocumentSetEntryData>(res.AsycudaDocumentSets.Select(y => new AsycudaDocumentSetEntryData(y))),
                            // SalesDataAllocations = new System.Collections.ObjectModel.ObservableCollection<SalesDataAllocations>(res.SalesDataAllocations.Select(y => new SalesDataAllocations(y))),
                            // AsycudaDocuments = new System.Collections.ObjectModel.ObservableCollection<AsycudaDocumentEntryData>(res.AsycudaDocuments.Select(y => new AsycudaDocumentEntryData(y)))
                        });
                    }
                    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 <IEnumerable <SalesData> > GetSalesDataByAsycudaDocumentId(string AsycudaDocumentId, List <string> includesLst = null)
        {
            if (AsycudaDocumentId == "0")
            {
                return(null);
            }
            try
            {
                using (SalesDataClient t = new SalesDataClient())
                {
                    var res = await t.GetSalesDataByAsycudaDocumentId(AsycudaDocumentId, includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(res.Select(x => new SalesData(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 <IEnumerable <AsycudaDocument> > GetSalesDocuments(int docSetId)
 {
     using (var t = new SalesDataClient())
     {
         return((await t.GetSalesDocuments(docSetId).ConfigureAwait(false)).Select(x => new AsycudaDocument(x)));
     }
 }
コード例 #5
0
 public async Task DownloadQBData(DateTime startDate, DateTime endDate, bool importSales, bool importInventory,
                                  int docSetId)
 {
     using (var t = new SalesDataClient())
     {
         await t.DownloadQBData(startDate, endDate, importSales, importInventory, docSetId).ConfigureAwait(false);
     }
 }
コード例 #6
0
 public async Task <decimal> SumNav(string whereExp, Dictionary <string, string> navExp, string sumExp)
 {
     try
     {
         using (var t = new SalesDataClient())
         {
             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;
     }
 }
コード例 #7
0
 public decimal SumField(string whereExp, string sumExp)
 {
     try
     {
         using (var t = new SalesDataClient())
         {
             return(t.SumField(whereExp, sumExp));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
コード例 #8
0
 public async Task <bool> DeleteSalesData(string id)
 {
     try
     {
         using (var t = new SalesDataClient())
         {
             return(await t.DeleteSalesData(id).ConfigureAwait(continueOnCapturedContext: false));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
コード例 #9
0
 public async Task <SalesData> CreateSalesData(SalesData entity)
 {
     try
     {
         using (var t = new SalesDataClient())
         {
             return(new SalesData(await t.CreateSalesData(entity.DTO).ConfigureAwait(continueOnCapturedContext: false)));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
コード例 #10
0
        //Virtural List Implementation

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

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

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

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