コード例 #1
0
 private void addReceipt_()
 {
     using (ReceiptsEditFm receiptEditFm = new ReceiptsEditFm(Utils.Operation.Add, new ReceiptsDTO()))
     {
         if (receiptEditFm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             resultDTO = receiptEditFm.Return();
             receiptsGridView.BeginUpdate();
             resultDTO.Changes = 1;
             resultDTO.OrderId = ((OrdersDTO)Item).OrderId;
             receiptsBS.Add(resultDTO);
             receiptsBS.EndEdit();
             receiptsGridView.EndUpdate();
         }
     }
     receiptsGridView.BeginSummaryUpdate();
     receiptsGridView.EndSummaryUpdate();
     receiptsGrid.Refresh();
 }
コード例 #2
0
        private void editReceipt_()
        {
            if ((ReceiptsDTO)receiptsBS.Current != null)
            {
                using (ReceiptsEditFm receiptEditFm = new ReceiptsEditFm(Utils.Operation.Update, (ReceiptsDTO)receiptsBS.Current))
                {
                    if (receiptEditFm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        resultDTO = receiptEditFm.Return();
                        receiptsGridView.BeginUpdate();

                        if (resultDTO.Changes == null)
                        {
                            resultDTO.Changes = 2;
                        }

                        resultDTO.OrderId = ((OrdersDTO)Item).OrderId;
                        ((ReceiptsDTO)receiptsBS.Current).OrderId       = resultDTO.OrderId;
                        ((ReceiptsDTO)receiptsBS.Current).UnitPrice     = resultDTO.UnitPrice;
                        ((ReceiptsDTO)receiptsBS.Current).TotalPrice    = resultDTO.TotalPrice;
                        ((ReceiptsDTO)receiptsBS.Current).Quantity      = resultDTO.Quantity;
                        ((ReceiptsDTO)receiptsBS.Current).MaterialId    = resultDTO.MaterialId;
                        ((ReceiptsDTO)receiptsBS.Current).Name          = resultDTO.Name;
                        ((ReceiptsDTO)receiptsBS.Current).Article       = resultDTO.Article;
                        ((ReceiptsDTO)receiptsBS.Current).UnitId        = resultDTO.UnitId;
                        ((ReceiptsDTO)receiptsBS.Current).UnitLocalName = resultDTO.UnitLocalName;
                        receiptsBS.EndEdit();
                        receiptsBS.ResetCurrentItem();
                        receiptsGridView.EndUpdate();
                    }
                }
                receiptsGridView.Focus();
                receiptsGrid.Refresh();
                receiptsGridView.BeginSummaryUpdate();
                receiptsGridView.EndSummaryUpdate();
            }
        }