Пример #1
0
        public async Task <IEnumerable <AsycudaDocument> > GetAsycudaDocumentByDocument_TypeId(string Document_TypeId, List <string> includesLst = null)
        {
            if (Document_TypeId == "0")
            {
                return(null);
            }
            try
            {
                using (AsycudaDocumentClient t = new AsycudaDocumentClient())
                {
                    var res = await t.GetAsycudaDocumentByDocument_TypeId(Document_TypeId, includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(res.Select(x => new AsycudaDocument(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 <IEnumerable <AsycudaDocument> > AsycudaDocuments(List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return(new List <AsycudaDocument>().AsEnumerable());
            }
            try
            {
                using (var t = new AsycudaDocumentClient())
                {
                    var res = await t.GetAsycudaDocuments(includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(res.Select(x => new AsycudaDocument(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 IM72Ex9Document(string fileName)
 {
     using (var ctx = new AsycudaDocumentClient())
     {
         ctx.IM72Ex9Document(fileName);
     }
 }
Пример #4
0
        public async Task <AsycudaDocument> GetAsycudaDocument(string id, List <string> includesLst = null)
        {
            try
            {
                using (var t = new AsycudaDocumentClient())
                {
                    var res = await t.GetAsycudaDocumentByKey(id, includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(new AsycudaDocument(res)
                        {
                            // AsycudaDocumentItems = new System.Collections.ObjectModel.ObservableCollection<AsycudaDocumentItem>(res.AsycudaDocumentItems.Select(y => new AsycudaDocumentItem(y))),
                            // AsycudaDocumentSetEx = (res.AsycudaDocumentSetEx != null?new AsycudaDocumentSetEx(res.AsycudaDocumentSetEx): null)
                        });
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
 public async Task ExportDocument(string fileName, int asycudaDocumentId)
 {
     using (var ctx = new AsycudaDocumentClient())
     {
         await ctx.ExportDocument(fileName, asycudaDocumentId).ConfigureAwait(false);
     }
 }
 public async Task DeleteDocument(int asycudaDocumentId)
 {
     using (var ctx = new AsycudaDocumentClient())
     {
         await ctx.DeleteDocument(asycudaDocumentId).ConfigureAwait(false);
     }
 }
        public async Task <AsycudaDocument> NewDocument(int docSetId)
        {
            using (var ctx = new AsycudaDocumentClient())
            {
                var dto = await ctx.NewDocument(docSetId).ConfigureAwait(false);

                return(new AsycudaDocument(dto));
            }
        }
 private void UpdateAsycudaDocument()
 {
     using (var ctx = new AsycudaDocumentClient())
     {
         var dto = ctx.GetAsycudaDocuments().Result.FirstOrDefault(x => x.ASYCUDA_Id == this.AsycudaDocumentId);
         if (dto != null)
         {
             AsycudaDocument = new AsycudaDocument(dto);
         }
     }
 }
 public async Task SaveDocumentCT(AsycudaDocument doc)
 {
     if (doc == null)
     {
         return;
     }
     using (var ctx = new AsycudaDocumentClient())
     {
         await ctx.SaveDocumentCT(doc.DTO).ConfigureAwait(false);
     }
 }
Пример #10
0
 public async Task <decimal> SumNav(string whereExp, Dictionary <string, string> navExp, string sumExp)
 {
     try
     {
         using (var t = new AsycudaDocumentClient())
         {
             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;
     }
 }
Пример #11
0
 public decimal SumField(string whereExp, string sumExp)
 {
     try
     {
         using (var t = new AsycudaDocumentClient())
         {
             return(t.SumField(whereExp, sumExp));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Пример #12
0
 public async Task <bool> DeleteAsycudaDocument(string id)
 {
     try
     {
         using (var t = new AsycudaDocumentClient())
         {
             return(await t.DeleteAsycudaDocument(id).ConfigureAwait(continueOnCapturedContext: false));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Пример #13
0
 public async Task <AsycudaDocument> CreateAsycudaDocument(AsycudaDocument entity)
 {
     try
     {
         using (var t = new AsycudaDocumentClient())
         {
             return(new AsycudaDocument(await t.CreateAsycudaDocument(entity.DTO).ConfigureAwait(continueOnCapturedContext: false)));
         }
     }
     catch (FaultException <ValidationFault> e)
     {
         throw new Exception(e.Detail.Message, e.InnerException);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Пример #14
0
        //Virtural List Implementation

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

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

                    if (res != null)
                    {
                        return(res.Select(x => new AsycudaDocument(x)).AsEnumerable());
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
Пример #16
0
        public async Task <AsycudaDocument> UpdateAsycudaDocument(AsycudaDocument entity)
        {
            if (entity == null)
            {
                return(entity);
            }
            var entitychanges = entity.ChangeTracker.GetChanges().FirstOrDefault();

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