internal async Task SaveDocument(AsycudaDocument asycudaDocument) { StatusModel.Timer("Saving Document"); await AsycudaDocumentRepository.Instance.SaveDocument(asycudaDocument).ConfigureAwait(false); StatusModel.StopStatusUpdate(); }
public async Task ReBuildSalesReports(int asycuda_id) { AsycudaDocument doc = null; using (var ctx = new AllocationDSContext()) { doc = ctx.AsycudaDocument.FirstOrDefault(x => x.ASYCUDA_Id == asycuda_id); } await WaterNut.DataSpace.BuildSalesReportClass.Instance.ReBuildSalesReports(doc).ConfigureAwait(false); }
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 SaveAsycudaDocument(AsycudaDocument i) { if (i == null) { return; } using (var ctx = new AsycudaDocumentService()) { await ctx.UpdateAsycudaDocument(i).ConfigureAwait(false); } }
public async Task Send2Excel(string folder, AsycudaDocument doc) { if (doc != null) { using (var ctx = new AsycudaDocumentRepository()) { var doctype = await ctx.GetAsycudaDocument(doc.ASYCUDA_Id.ToString()).ConfigureAwait(false); if (doctype.DocumentType == "IM7") { return; } } } using (var sta = new StaTaskScheduler(numberOfThreads: 1)) { await Task.Factory.StartNew(() => { var s = new ExportToExcel <SaleReportLine, List <SaleReportLine> >(); s.StartUp(); try { folder = Path.GetDirectoryName(folder); var data = GetDocumentSalesReport(doc.ASYCUDA_Id).Result; if (data != null) { string path = Path.Combine(folder, !string.IsNullOrEmpty(doc.CNumber) ? doc.CNumber : doc.ReferenceNumber + ".xls"); s.dataToPrint = data.ToList(); s.SaveReport(path); } else { s.dataToPrint = new List <SaleReportLine>(); File.Create(Path.Combine(folder, doc.CNumber ?? doc.ReferenceNumber + ".xls")); } StatusModel.StatusUpdate(); } catch (Exception ex) { throw ex; } s.ShutDown(); }, CancellationToken.None, TaskCreationOptions.None, sta).ConfigureAwait(false); } }
public async Task SaveDocumentCT(AsycudaDocument entity) { var ct = new DocumentCT(); ct.Document = await WaterNut.DataSpace.BaseDataModel.Instance.GetDocument(entity.ASYCUDA_Id, new List <string>() { "xcuda_ASYCUDA_ExtendedProperties", "xcuda_Identification", "xcuda_Valuation.xcuda_Gs_Invoice", "xcuda_Declarant", "xcuda_General_information.xcuda_Country", "xcuda_Property" }).ConfigureAwait(false); using (var ctx = new xcuda_ItemService()) { var res = (await ctx.Getxcuda_ItemByASYCUDA_Id(entity.ASYCUDA_Id.ToString(), new List <string>() { "xcuda_Previous_doc" }).ConfigureAwait(false)); if (res != null) { ct.DocumentItems = res.ToList(); } } // bl foreach (var itm in ct.DocumentItems.Where(x => x.xcuda_Previous_doc.Summary_declaration != entity.BLNumber)) { itm.xcuda_Previous_doc.StartTracking(); itm.xcuda_Previous_doc.Summary_declaration = entity.BLNumber; } ct.Document.xcuda_Identification.StartTracking(); ct.Document.xcuda_Identification.Manifest_reference_number = entity.Manifest_reference_number; ct.Document.xcuda_Valuation.xcuda_Gs_Invoice.StartTracking(); ct.Document.xcuda_Valuation.xcuda_Gs_Invoice.Currency_code = entity.Currency_code; ct.Document.xcuda_Valuation.xcuda_Gs_Invoice.Currency_rate = entity.Currency_rate.GetValueOrDefault(); ct.Document.xcuda_ASYCUDA_ExtendedProperties.StartTracking(); ct.Document.xcuda_ASYCUDA_ExtendedProperties.Description = entity.Description; ct.Document.xcuda_ASYCUDA_ExtendedProperties.Document_TypeId = entity.Document_TypeId; ct.Document.xcuda_ASYCUDA_ExtendedProperties.Customs_ProcedureId = entity.Customs_ProcedureId; ct.Document.xcuda_Declarant.StartTracking(); ct.Document.xcuda_Declarant.Number = string.Format("{0}-F{1}", entity.ReferenceNumber, ct.Document.xcuda_ASYCUDA_ExtendedProperties.FileNumber); ct.Document.xcuda_General_information.xcuda_Country.StartTracking(); ct.Document.xcuda_General_information.xcuda_Country.Country_first_destination = entity.Country_first_destination; await WaterNut.DataSpace.BaseDataModel.Instance.SaveDocumentCT(ct).ConfigureAwait(false); }
public async Task SaveDocument(AsycudaDocument entity) { await WaterNut.DataSpace.BaseDataModel.Instance.SaveAsycudaDocument(entity).ConfigureAwait(false); }
public async Task SaveDocumentCT(AsycudaDocument entity) { await Channel.SaveDocumentCT(entity).ConfigureAwait(false); }
public async Task <AsycudaDocument> CreateAsycudaDocument(AsycudaDocument entity) { return(await Channel.CreateAsycudaDocument(entity).ConfigureAwait(false)); }
internal async Task SaveDocument(AsycudaDocument asycudaDocument) { await AsycudaDocumentSetsModel.Instance.SaveDocument(asycudaDocument).ConfigureAwait(false); }
private async Task LoadDataFromAdoc(AsycudaDocumentSetEx docSet, AsycudaDocument doc) { if (docSet == null && ((doc != null) && (docSet != doc.AsycudaDocumentSetEx))) { docSet = doc.AsycudaDocumentSetEx; } if (docSet != null && doc == null) //(docSet != null && (doc == null || (doc != null && doc.AutoUpdate == true))) { Document_TypeId = Convert.ToInt32(docSet.Document_TypeId); Description = docSet.Description; Customs_ProcedureId = Convert.ToInt32(docSet.Customs_ProcedureId); Country_of_origin_code = docSet.Country_of_origin_code; Currency_Code = docSet.Currency_Code; Exchange_Rate = Convert.ToSingle(docSet.Exchange_Rate); Declarant_Reference_Number = docSet.Declarant_Reference_Number; Manifest_Number = docSet.Manifest_Number; BLNumber = docSet.BLNumber; TotalGrossWeight = docSet.TotalGrossWeight.GetValueOrDefault(); TotalFreight = docSet.TotalFreight.GetValueOrDefault(); } else if (doc != null)//else if (doc != null && doc.AutoUpdate == false) { Document_TypeId = Convert.ToInt32(doc.Document_TypeId); Description = doc.Description; Customs_ProcedureId = Convert.ToInt32(doc.Customs_ProcedureId); // if (doc.Country_first_destination != null) Country_of_origin_code = doc.Country_first_destination; Currency_Code = doc.Currency_code; Exchange_Rate = Convert.ToSingle(doc.Currency_rate); Declarant_Reference_Number = doc.ReferenceNumber; //docSet.Declarant_Reference_Number; //if (doc.Manifest_reference_number != null) Manifest_Number = doc.Manifest_reference_number; // docSet.Manifest_Number; BLNumber = doc.BLNumber; // docSet.BLNumber; TotalGrossWeight = doc.TotalGrossWeight.GetValueOrDefault(); TotalFreight = doc.TotalFreight.GetValueOrDefault(); } else { Description = ""; Customs_ProcedureId = 0; Country_of_origin_code = null; Currency_Code = ""; Exchange_Rate = 0; Declarant_Reference_Number = ""; Manifest_Number = ""; BLNumber = ""; TotalGrossWeight = 0; } //if (CurrentAsycudaDocument != null) //{ // IsManuallyAssessed = CurrentAsycudaDocument.IsManuallyAssessed; // NotifyPropertyChanged(x => this.IsManuallyAssessed"); //} NotifyPropertyChanged(x => Document_TypeId); NotifyPropertyChanged(x => Description); NotifyPropertyChanged(x => Customs_ProcedureId); NotifyPropertyChanged(x => Declarant_Reference_Number); NotifyPropertyChanged(x => Currency_Code); NotifyPropertyChanged(x => Country_of_origin_code); NotifyPropertyChanged(x => Manifest_Number); NotifyPropertyChanged(x => BLNumber); NotifyPropertyChanged(x => Exchange_Rate); NotifyPropertyChanged(x => TotalFreight); NotifyPropertyChanged(x => TotalGrossWeight); }