public async Task <CollationSetting> SaveAsync(CollationSetting setting, CancellationToken token = default(CancellationToken)) { using (var scope = transactionScopeBuilder.Create()) { var companyId = setting.CompanyId; await DeleteAsync(companyId, token); var result = await addCollationSettingQueryProcessor.SaveAsync(setting, token); var collationOrders = new List <CollationOrder>(); foreach (var order in setting.CollationOrders) { collationOrders.Add(await addCollationSettingQueryProcessor.SaveCollationOrderAsync(order, token)); } var matchingOrders = new List <MatchingOrder>(); foreach (var order in setting.BillingMatchingOrders.Concat(setting.ReceiptMatchingOrders)) { matchingOrders.Add(await addCollationSettingQueryProcessor.SaveMatchingOrderAsync(order, token)); } scope.Complete(); result.CollationOrders = collationOrders.OrderBy(x => x.ExecutionOrder).ToArray(); result.BillingMatchingOrders = matchingOrders.Where(x => x.TransactionCategory == 1).OrderBy(x => x.ExecutionOrder).ToArray(); result.ReceiptMatchingOrders = matchingOrders.Where(x => x.TransactionCategory == 2).OrderBy(x => x.ExecutionOrder).ToArray(); return(result); } }
internal void Dispose() { CollationSetting = null; ApplicationControl = null; DefaultCurrency = null; DefaultReceiptCategory = null; LegalPersonalities = null; }
public Task <CollationSetting> SaveAsync(CollationSetting CollationSetting, CancellationToken token = default(CancellationToken)) { #region insert query var query = @" INSERT INTO CollationSetting (CompanyId ,RequiredCustomer ,AutoAssignCustomer ,LearnKanaHistory ,UseApportionMenu ,ReloadCollationData ,UseAdvanceReceived ,AdvanceReceivedRecordedDateType ,AutoMatching ,AutoSortMatchingEnabledData ,PrioritizeMatchingIndividuallyMultipleReceipts ,ForceShareTransferFee ,LearnSpecifiedCustomerKana ,MatchingSilentSortedData ,BillingReceiptDisplayOrder ,RemoveSpaceFromPayerName ,PrioritizeMatchingIndividuallyTaxTolerance ,JournalizingPattern ,CalculateTaxByInputId ,UseFromToNarrowing ,SetSystemDateToCreateAtFilter ,SortOrderColumn ,SortOrder ) OUTPUT inserted.* VALUES (@CompanyId ,@RequiredCustomer ,@AutoAssignCustomer ,@LearnKanaHistory ,@UseApportionMenu ,@ReloadCollationData ,@UseAdvanceReceived ,@AdvanceReceivedRecordedDateType ,@AutoMatching ,@AutoSortMatchingEnabledData ,@PrioritizeMatchingIndividuallyMultipleReceipts ,@ForceShareTransferFee ,@LearnSpecifiedCustomerKana ,@MatchingSilentSortedData ,@BillingReceiptDisplayOrder ,@RemoveSpaceFromPayerName ,@PrioritizeMatchingIndividuallyTaxTolerance ,@JournalizingPattern ,@CalculateTaxByInputId ,@UseFromToNarrowing ,@SetSystemDateToCreateAtFilter ,@SortOrderColumn ,@SortOrder )"; #endregion return(dbHelper.ExecuteAsync <CollationSetting>(query, CollationSetting, token)); }
private void ClearCollation(CollationSetting setting) { if (UseSection) { cbxUseApportionMenu.Enabled = false; } cbxReloadCollationData.Checked = setting?.ReloadCollationData == 1; cbxAutoMatching.Checked = setting?.AutoMatching == 1; cbxAutoSortMatchingEnabledData.Checked = setting?.AutoSortMatchingEnabledData == 1; cbxUseFromToNarrowing.Checked = setting?.UseFromToNarrowing == 1; cbxSetSystemDateToCreateAtFilter.Checked = setting?.SetSystemDateToCreateAtFilter == 1; cbxPrioritizeMatchingIndividuallyMultipleReceipts.Checked = setting?.PrioritizeMatchingIndividuallyMultipleReceipts == 1; cbxForceShareTransferFee.Checked = setting?.ForceShareTransferFee == 1; cbxPrioritizeMatchingIndividuallyTaxTolerance.Checked = setting?.PrioritizeMatchingIndividuallyTaxTolerance == 1; cbxUseApportionMenu.Checked = setting?.UseApportionMenu == 1; cbxRequiredCustomer.Checked = setting?.RequiredCustomer == 1; cbxAutoAssignCustomer.Checked = setting?.AutoAssignCustomer == 1; cbxLearnKanaHistory.Checked = setting?.LearnKanaHistory == 1; cbxLearnSpecifiedCustomerKana.Checked = setting?.LearnSpecifiedCustomerKana == 1; cbxUseAdvanceReceived.Checked = setting?.UseAdvanceReceived == 1; cbxRemoveSpaceFromPayerName.Checked = setting?.RemoveSpaceFromPayerName == 1; cbxCalculateTaxByInputId.Checked = setting?.CalculateTaxByInputId == 1; if (setting == null) { rdoDisplayOrder.Checked = true; rdoBillingReceiptOrder.Checked = true; cmbAdvanceReceivedRecordedDateType.SelectedIndex = cmbAdvanceReceivedRecordedDateType.Items.Count > 0 ? 0 : -1; rdoStandard.Checked = true; cmbSortOrderColumn.SelectedIndex = cmbSortOrderColumn.Items.Count > 0 ? 0 : -1; cmbSortOrder.SelectedIndex = cmbSortOrder.Items.Count > 0 ? 0 : -1; } else { rdoDisplayOrder.Checked = setting.MatchingSilentSortedData == 0; rdoMatchingOrder.Checked = setting.MatchingSilentSortedData == 1; rdoBillingReceiptOrder.Checked = setting.BillingReceiptDisplayOrder == 0; rdoReceiptBillingOrder.Checked = setting.BillingReceiptDisplayOrder == 1; ListItem advRecvRecordedDateType = cmbAdvanceReceivedRecordedDateType.Items.Cast <ListItem>().FirstOrDefault(i => (int)i.SubItems[1].Value == setting.AdvanceReceivedRecordedDateType); cmbAdvanceReceivedRecordedDateType.SelectedIndex = advRecvRecordedDateType != null?cmbAdvanceReceivedRecordedDateType.Items.IndexOf(advRecvRecordedDateType) : -1; rdoStandard.Checked = setting.JournalizingPattern == 0; rdoGeneral.Checked = setting.JournalizingPattern == 1; ListItem sortOrderColumn = cmbSortOrderColumn.Items.Cast <ListItem>().FirstOrDefault(i => (int)i.SubItems[1].Value == setting.SortOrderColumn); cmbSortOrderColumn.SelectedIndex = sortOrderColumn != null?cmbSortOrderColumn.Items.IndexOf(sortOrderColumn) : -1; ListItem sortOrder = cmbSortOrder.Items.Cast <ListItem>().FirstOrDefault(i => (int)i.SubItems[1].Value == setting.SortOrder); cmbSortOrder.SelectedIndex = sortOrder != null?cmbSortOrder.Items.IndexOf(sortOrder) : -1; } if (!cbxUseApportionMenu.Checked) { cbxRequiredCustomer.Enabled = false; cbxAutoAssignCustomer.Enabled = false; cbxLearnKanaHistory.Enabled = false; } }
private async Task InitializeCollationSettingAsync(CompanySource source, CancellationToken token) { var setting = new CollationSetting { CompanyId = source.Company.Id, UseApportionMenu = 1, UseAdvanceReceived = 1, AdvanceReceivedRecordedDateType = 1, ForceShareTransferFee = 1, }; await collationSettingQueryProcessor.SaveAsync(setting, token); }
private void SetInitialCollationSetting() { var loadTask = new List <Task>(); var collationSetting = new CollationSetting(); var collationOrder = new List <CollationOrder>(); var matchingBillingOrder = new List <MatchingOrder>(); var matchingReceiptOrder = new List <MatchingOrder>(); var loadCollationSettingTask = GetCollationSettingAsync(); loadCollationSettingTask.ContinueWith(task => collationSetting = task.Result); loadTask.Add(loadCollationSettingTask); var loadCollationOrderTask = GetCollationOrdersAsync(); loadCollationOrderTask.ContinueWith(task => collationOrder.AddRange(task.Result)); loadTask.Add(loadCollationOrderTask); var loadBillingOrderTask = GetBillingOrdersAsync(); loadBillingOrderTask.ContinueWith(task => matchingBillingOrder.AddRange(task.Result)); loadTask.Add(loadBillingOrderTask); var loadReceiptOrderTask = GetReceiptOrdersAsync(); loadReceiptOrderTask.ContinueWith(task => matchingReceiptOrder.AddRange(task.Result)); loadTask.Add(loadReceiptOrderTask); ProgressDialog.Start(ParentForm, Task.WhenAll(loadTask.ToArray()), false, SessionKey); ClearCollation(collationSetting); CreateCollationOrderGridTemplate(); DisplayCollationOrderGrid(collationOrder); CreateBillingOrderGridTemplate(); DisplayBillingOrderGrid(matchingBillingOrder); CreateReceiptOrderGridTemplate(); DisplayReceiptOrderGrid(matchingReceiptOrder); Modified = false; cbxReloadCollationData.Select(); }
public async Task <CollationSettingResult> SaveAsync(string SessionKey, CollationSetting CollationSetting, CollationOrder[] CollationOrder, MatchingOrder[] MatchingBillingOrder, MatchingOrder[] MatchingReceiptOrder) { return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token => { CollationSetting.CollationOrders = CollationOrder; CollationSetting.BillingMatchingOrders = MatchingBillingOrder; CollationSetting.ReceiptMatchingOrders = MatchingReceiptOrder; var result = await collationSettingProcessor.SaveAsync(CollationSetting, token); return new CollationSettingResult { ProcessResult = new ProcessResult { Result = true }, CollationSetting = result, }; }, logger)); }
private void SaveCollationSetting() { ClearStatusMessage(); try { if (!ValidateInputValues()) { return; } if (!ShowConfirmDialog(MsgQstConfirmSave)) { DispStatusMessage(MsgInfProcessCanceled); return; } var collationOrder = new List <CollationOrder>(); var billingOrder = new List <MatchingOrder>(); var receiptOrder = new List <MatchingOrder>(); var setting = new CollationSetting(); setting.CompanyId = CompanyId; setting.ReloadCollationData = cbxReloadCollationData.Checked ? 1 : 0; setting.AutoMatching = cbxAutoMatching.Checked ? 1 : 0; setting.AutoSortMatchingEnabledData = cbxAutoSortMatchingEnabledData.Checked ? 1 : 0; setting.UseFromToNarrowing = (cbxUseFromToNarrowing.Checked) ? 1 : 0; setting.SetSystemDateToCreateAtFilter = cbxSetSystemDateToCreateAtFilter.Checked ? 1 : 0; setting.PrioritizeMatchingIndividuallyMultipleReceipts = cbxPrioritizeMatchingIndividuallyMultipleReceipts.Checked ? 1 : 0; setting.ForceShareTransferFee = cbxForceShareTransferFee.Checked ? 1 : 0; setting.PrioritizeMatchingIndividuallyTaxTolerance = cbxPrioritizeMatchingIndividuallyTaxTolerance.Checked ? 1 : 0; setting.UseApportionMenu = cbxUseApportionMenu.Checked ? 1 : 0; setting.RequiredCustomer = cbxRequiredCustomer.Checked ? 1 : 0; setting.AutoAssignCustomer = cbxAutoAssignCustomer.Checked ? 1 : 0; setting.LearnKanaHistory = cbxLearnKanaHistory.Checked ? 1 : 0; setting.LearnSpecifiedCustomerKana = cbxLearnSpecifiedCustomerKana.Checked ? 1 : 0; setting.UseAdvanceReceived = cbxUseAdvanceReceived.Checked ? 1 : 0; setting.MatchingSilentSortedData = rdoDisplayOrder.Checked ? 0 : 1; setting.AdvanceReceivedRecordedDateType = Convert.ToInt32(cmbAdvanceReceivedRecordedDateType.SelectedItem.SubItems[1].Value); setting.BillingReceiptDisplayOrder = rdoBillingReceiptOrder.Checked ? 0 : 1; setting.RemoveSpaceFromPayerName = cbxRemoveSpaceFromPayerName.Checked ? 1 : 0; setting.JournalizingPattern = rdoStandard.Checked ? 0 : 1; setting.CalculateTaxByInputId = cbxCalculateTaxByInputId.Checked ? 1 : 0; setting.SortOrderColumn = Convert.ToInt32(cmbSortOrderColumn.SelectedItem.SubItems[1].Value); setting.SortOrder = Convert.ToInt32(cmbSortOrder.SelectedItem.SubItems[1].Value); foreach (var row in grdCollationOrder.Rows) { var collation = new CollationOrder(); collation.ExecutionOrder = int.Parse(row.Cells[CellName("Order")].Value.ToString()); collation.Available = int.Parse(row.Cells[CellName(nameof(CollationOrder.Available))].Value.ToString()); var collationTypeName = row.Cells[CellName("CollationTypeName")].Value.ToString(); collation.CollationTypeId = CollationOrderName.FirstOrDefault(x => x.Value == collationTypeName).Key; collation.CompanyId = CompanyId; collation.CreateBy = Login.UserId; collation.UpdateBy = Login.UserId; collationOrder.Add(collation); } foreach (var row in grdMatchingBillingOrder.Rows) { var matchingBillingOrder = new MatchingOrder(); matchingBillingOrder.ExecutionOrder = int.Parse(row.Cells[CellName("Order")].Value.ToString()); matchingBillingOrder.Available = int.Parse(row.Cells[CellName(nameof(MatchingOrder.Available))].Value.ToString()); matchingBillingOrder.ItemName = row.Cells[CellName("BillingItemName")].Value.ToString(); matchingBillingOrder.TransactionCategory = 1; matchingBillingOrder.SortOrder = int.Parse(row.Cells[CellName(nameof(MatchingOrder.SortOrder))].Value.ToString()); matchingBillingOrder.CompanyId = CompanyId; matchingBillingOrder.CreateBy = Login.UserId; matchingBillingOrder.UpdateBy = Login.UserId; billingOrder.Add(matchingBillingOrder); } foreach (var row in grdMatchingReceiptOrder.Rows) { var matchingReceiptOrder = new MatchingOrder(); matchingReceiptOrder.ExecutionOrder = int.Parse(row.Cells[CellName("Order")].Value.ToString()); matchingReceiptOrder.Available = int.Parse(row.Cells[CellName(nameof(MatchingOrder.Available))].Value.ToString()); matchingReceiptOrder.ItemName = row.Cells[CellName("ReceiptItemName")].Value.ToString(); matchingReceiptOrder.SortOrder = int.Parse(row.Cells[CellName(nameof(MatchingOrder.SortOrder))].Value.ToString()); matchingReceiptOrder.TransactionCategory = 2; matchingReceiptOrder.CompanyId = CompanyId; matchingReceiptOrder.CreateBy = Login.UserId; matchingReceiptOrder.UpdateBy = Login.UserId; receiptOrder.Add(matchingReceiptOrder); } var task = ServiceProxyFactory.DoAsync(async(CollationSettingMasterClient client) => await client.SaveAsync(SessionKey, setting, collationOrder.ToArray(), billingOrder.ToArray(), receiptOrder.ToArray())); ProgressDialog.Start(ParentForm, task, false, SessionKey); var result = task.Result; if (result != null && result.ProcessResult.Result) { DispStatusMessage(MsgInfSaveSuccess); } else { ShowWarningDialog(MsgErrSaveError); } Modified = false; } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } }
public async Task <CollationSetting> Save(CollationSetting setting, CancellationToken token) => await collationSettingProcessor.SaveAsync(setting, token);
public async Task <IEnumerable <CollationOrder> > GetCollationOrder(CollationSetting setting, CancellationToken token) => (await collationSettingProcessor.GetCollationOrderAsync(setting.CompanyId)).ToArray();
public async Task <CollationSetting> Get(CollationSetting setting, CancellationToken token) => await collationSettingProcessor.GetAsync(setting.CompanyId, token);
public async Task <ActionResult <IEnumerable <MatchingOrder> > > GetMatchingReceiptOrder(CollationSetting setting, CancellationToken token) => (await collationSettingProcessor.GetMatchingReceiptOrderAsync(setting.CompanyId)).ToArray();