Esempio n. 1
0
        public void BillingSearch()
        {
            if (!ValidateChildren())
            {
                return;
            }

            if (!CheckInput())
            {
                return;
            }

            var billingSearch = GetSearchCondition();

            BillingsResult resultBilling = null;

            try
            {
                var task = LoadBillingAsync(billingSearch);
                ProgressDialog.Start(ParentForm, task, false, SessionKey);
                resultBilling = task.Result;
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.ToString());
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
            }
            if (!resultBilling.ProcessResult.Result)
            {
                ShowWarningDialog(MsgWngNotExistSearchData);
                return;
            }

            var searchResult = resultBilling.Billings.Where(x => !BillingId.Contains(x.Id)).ToArray();

            if (searchResult.Length == 0)
            {
                ShowWarningDialog(MsgWngNotExistSearchData);
                return;
            }
            else
            {
                BillingInfo             = searchResult;
                ParentForm.DialogResult = DialogResult.OK;
            }
        }
Esempio n. 2
0
        private void UpdateOutputAt()
        {
            DateTime?dateFrom = datBillingFrom.Value;

            dateFrom = dateFrom?.Date;
            DateTime?dateTo = datBillingTo.Value;

            dateTo = dateTo?.Date.AddDays(1).AddMilliseconds(-1);

            BillingsResult result     = null;
            var            updateTask = ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <BillingServiceClient>();
                result      = await service.UpdateOutputAtAsync(SessionKey, CompanyId,
                                                                dateFrom, dateTo, CurrencyId, Login.UserId);
            });

            ProgressDialog.Start(ParentForm, updateTask, false, SessionKey);
        }
Esempio n. 3
0
        private void Cancel()
        {
            if (!ShowConfirmDialog(MsgQstConfirmCancelJournalizing))
            {
                DispStatusMessage(MsgInfProcessCanceled);
                return;
            }
            try
            {
                var model = grdBilling.Rows
                            .Where(x => Convert.ToBoolean(x[CellName("SelectFlag")].Value))
                            .Select(x => x.DataBoundItem as JournalizingSummary).ToList();
                var        outputAtArr = model.Select(x => x.OutputAt).ToArray();
                DateTime[] outputAts   = outputAtArr.Cast <DateTime>().ToArray();

                BillingsResult result     = null;
                var            cancelTask = ServiceProxyFactory.LifeTime(async factory =>
                {
                    var service = factory.Create <BillingServiceClient>();
                    result      = await service.CancelBillingJournalizingAsync(SessionKey, CompanyId, CurrencyId, outputAts, Login.UserId);
                });
                ProgressDialog.Start(ParentForm, cancelTask, false, SessionKey);

                if (result.ProcessResult.Result && result.Billings.Any())
                {
                    DispStatusMessage(MsgInfFinishedSuccessJournalizingCancelingProcess);
                    datBillingFrom.Clear();
                    datBillingTo.Clear();
                    datBillingFrom.Enabled = true;
                    datBillingTo.Enabled   = true;
                    lblExtractionAmount.Clear();
                    lblExtractionNumber.Clear();
                    lblOutputAmount.Clear();
                    lblOutputNumber.Clear();
                    BaseContext.SetFunction03Enabled(false);
                    BaseContext.SetFunction04Enabled(false);
                    BaseContext.SetFunction06Enabled(false);
                    BaseContext.SetFunction07Enabled(false);
                    BaseContext.SetFunction08Enabled(false);
                    if (UseForeignCurrency)
                    {
                        txtCurrencyCode.Clear();
                        txtCurrencyCode.Enabled = true;
                        btnCurrencyCode.Enabled = true;
                        grdBilling.Rows.Clear();
                        BaseContext.SetFunction01Enabled(false);
                    }
                    else
                    {
                        List <JournalizingSummary> updateList = LoadGridData(0);
                        grdBilling.DataSource = new BindingSource(updateList, null);
                    }
                }
                else
                {
                    ShowWarningDialog(MsgErrSomethingError, "取消");
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.ToString());
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
            }
        }