示例#1
0
 private void m_DataContext_GetListCompleted(object siurce, GetListAsyncCompletedEventArgs e)
 {
     try
     {
         m_DataContext.GetListCompleted -= m_DataContext_GetListCompleted;
         if (e.Error != null)
         {
             x_TextBoxSelectedBatch.Text = "Not found";
             x_TextBoxTotalStock.Text    = e.Error.Message;
         }
         if (e.Cancelled)
         {
             x_TextBoxSelectedBatch.Text = "Not found";
             x_TextBoxTotalStock.Text    = "Cancelled";
         }
         Accounts = e.Result <CustomsWarehouse>();
         if (Accounts.Count == 0)
         {
             x_TextBoxSelectedBatch.Text = "Not found";
             x_TextBoxTotalStock.Text    = "N/A";
             return;
         }
         CustomsWarehouse _noValue = Accounts.FirstOrDefault <CustomsWarehouse>(x => !x.Value.HasValue);
         if (_noValue != null)
         {
             x_TextBoxSelectedBatch.Text = "No Value";
             x_TextBoxTotalStock.Text    = "N/A";
             return;
         }
         Accounts.Sort(new Comparison <CustomsWarehouse>(CustomsWarehouse.CompareCustomsWarehouse));
         x_TextBoxSelectedBatch.Text = String.Format("{0}/{1} accounts", Accounts.First <CustomsWarehouse>().Batch, Accounts.Count);
         m_Available = Accounts.Sum(x => x.TobaccoNotAllocated.Value);
         x_TextBoxTotalStock.Text = m_Available.ToString(c_DoubleFormat);
         x_TextBoxQtyToClear.Text = 0.0.ToString(c_DoubleFormat);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Serach exception", MessageBoxButton.OK);
     }
 }
示例#2
0
 private void context_GetListCompleted(object siurce, GetListAsyncCompletedEventArgs e)
 {
     try
     {
         DataContext.GetListCompleted -= context_GetListCompleted;
         if (e.Cancelled)
         {
             return;
         }
         if (e.Error != null)
         {
             Parent.OnProgressChanged(new ProgressChangedEventArgs(0, String.Format("Exception {0} at m_DataContext.GetListAsync", e.Error.Message)));
         }
         DisposalRequest _Dr = DisposalRequest.Create(e.Result <CustomsWarehouse>(), m_BatchGroup, (x, y) => Parent.RaisePropertyChanged(y));
         Parent.Add(_Dr);
         _Dr.AutoCalculation = true;
     }
     catch (Exception _ex)
     {
         Parent.OnProgressChanged(new ProgressChangedEventArgs(0, String.Format("Exception {0} at context_GetListCompleted", _ex)));
     }
     DoNext();
 }
示例#3
0
        private void m_Context_GetDisposals4RequestCompleted(object siurce, GetListAsyncCompletedEventArgs e)
        {
            m_Context.GetListCompleted -= m_Context_GetDisposals4RequestCompleted;
            if (e.Cancelled)
            {
                Log = "GetList has been canceled";
                return;
            }
            if (e.Error != null)
            {
                ExceptionHandling(e.Error);
                return;
            }
            Log = "GetListCompleted .GetDataContext  " + CommonDefinition.CustomsWarehouseDisposalTitle;
            List <CustomsWarehouseDisposal> _list = e.Result <CustomsWarehouseDisposal>();

            this.DisposalRequestObservable.GetDataContext(m_DisposalRequestLibId.Value, _list, m_Context, () => OnDataLoaded());
            if (this.RequestCollection.CanSort == true)
            {
                this.RequestCollection.SortDescriptions.Add(new SortDescription("Batch", ListSortDirection.Ascending)); // By default, sort by Batch.
            }
            Log = "GetData RunWorker Completed";
        }