public Task <Netting> SaveAsync(Netting Netting, CancellationToken token = default(CancellationToken)) { var query = @" INSERT INTO Netting ( CompanyId, CurrencyId, CustomerId, ReceiptCategoryId, SectionId, RecordedAt, DueAt, Amount, AssignmentFlag, Note, ReceiptMemo ) OUTPUT inserted.* VALUES ( @CompanyId, @CurrencyId, @CustomerId, @ReceiptCategoryId, @SectionId, @RecordedAt, @DueAt, @Amount, @AssignmentFlag, @Note, @ReceiptMemo );"; return(dbHelper.ExecuteAsync <Netting>(query, Netting, token)); }
public async Task <ActionResult <IEnumerable <Netting> > > GetItems(Netting netting, CancellationToken token) => (await nettingSearchProcessor.GetAsync(netting.CompanyId, netting.CustomerId, netting.CurrencyId, token)).ToArray();
/// <summary>Save Netting Items</summary> private void SaveNettingItems() { Func <Row, bool> isCategoryCode = (row) => row["celCategoryCode"].Value != null && row["celCategoryCode"].Value is string && row["celCategoryCode"].Value.ToString() != ""; var nettingSearch = new List <Netting>(); foreach (var row in grdNettingInput.Rows.Where(x => isCategoryCode(x))) { var netting = new Netting(); netting.CompanyId = CompanyId; netting.CustomerId = CustomerId; netting.ReceiptCategoryId = Convert.ToInt32(row.Cells["celId"].Value); netting.Note = row.Cells["celNote"].Value.ToString(); if (row.Cells["celDueAt"].Value != null) { netting.DueAt = Convert.ToDateTime(row.Cells["celDueAt"].Value.ToString()); } netting.Amount = Convert.ToDecimal(row.Cells["celAmount"].Value); netting.ReceiptMemo = row.Cells["celMemoData"].Value.ToString(); netting.RecordedAt = datPaymentDate.Value.Value; netting.CurrencyId = CurrencyId; if (ApplicationControl.UseReceiptSection == 1) { netting.SectionId = SectionId; } else { netting.SectionId = null; } nettingSearch.Add(netting); } NettingResult resultData = null; var success = false; var task = ServiceProxyFactory.LifeTime(async factory => { var service = factory.Create <NettingServiceClient>(); resultData = await service.SaveAsync(SessionKey, nettingSearch.ToArray()); success = resultData?.ProcessResult.Result ?? false; if (success) { await SearchNettingItems(); } }); ProgressDialog.Start(ParentForm, task, false, SessionKey); if (resultData.ProcessResult.Result) { DispStatusMessage(MsgInfSaveSuccess); grdNettingInput.DataSource = null; InitializeInputGridSetting(); datPaymentDate.Focus(); datPaymentDate.Text = DateTime.Today.ToShortDateString(); txtSectionCode.Clear(); lblSectionName.Clear(); nmbTotalFee.Value = 0M; } else { ShowWarningDialog(MsgErrSaveError); } }