private void btnDeleteItemRepo_ButtonClick(object sender,
                                            DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (ItemsGridView.GetFocusedRow() is AIRDetails item)
     {
         try
         {
             if (MessageBox.Show("Do you want to delete this?", "Delete", MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Question) == DialogResult.No)
             {
                 return;
             }
             UnitOfWork unitOfWork = new UnitOfWork();
             unitOfWork.AIRDetailsRepo.Delete(x => x.Id == item.Id);
             unitOfWork.Save();
             ItemsGridControl.DataSource =
                 new BindingList <AIRDetails>(
                     new UnitOfWork(false, false).AIRDetailsRepo.Get(x => x.AIReportId == item.AIReportId));
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #2
0
 private void BtnSelectItemRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         if (ItemsGridView.GetFocusedRow() is AOQDetails item)
         {
             UnitOfWork unitOfWork = new UnitOfWork();
             po = unitOfWork.PurchaseOrdersRepo.Find(x => x.Id == po.Id);
             po.PODetails.Add(new PODetails()
             {
                 Item        = item.Item,
                 POId        = po.Id,
                 ItemNo      = item.ItemNo ?? 0,
                 Category    = item.Category ?? "",
                 Cost        = item.Cost ?? 0,
                 Quantity    = item.Quantity ?? 0,
                 TotalAmount = item.TotalAmount ?? 0,
                 UOM         = item.UOM
             });
             unitOfWork.Save();
             this.ItemsGridView.DeleteRow(ItemsGridView.FocusedRowHandle);
             frm.ItemsGridControl.DataSource = new BindingList <PODetails>(unitOfWork.PODetailsRepo.Get(x => x.POId == po.Id));
         }
         // Init();
     }
     catch (Exception exception)
     {
     }
 }
Exemple #3
0
 private void BtnDeleteItemRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         if (ItemsGridView.GetFocusedRow() is AOQDetails item)
         {
             UnitOfWork unitOfWork = new UnitOfWork();
             unitOfWork.AOQDetailsRepo.Delete(x => x.Id == item.Id);
             unitOfWork.Save();
             ItemsGridControl.DataSource =
                 new BindingList <AOQDetails>(unitOfWork.AOQDetailsRepo.Get(x => x.AOQId == item.AOQId));
         }
     }
     catch (Exception exception)
     {
     }
 }
Exemple #4
0
 private void btnDeleteItemRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         UnitOfWork unitOfWork = new UnitOfWork();
         if (ItemsGridView.GetFocusedRow() is PISDetails item)
         {
             if (MessageBox.Show("Do you want to delete this?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
             {
                 return;
             }
             unitOfWork.PISDetailsRepo.Delete(x => x.Id == item.Id);
             unitOfWork.Save();
             this.ItemsGridControl.DataSource =
                 new BindingList <PISDetails>(unitOfWork.PISDetailsRepo.Get(x => x.PISId == item.PISId));
         }
     }
     catch (Exception exception)
     {
     }
 }
Exemple #5
0
 private void btnDeleteItemRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (ItemsGridView.GetFocusedRow() is APRDetails item)
     {
         if (MessageBox.Show("Do you want to delete this?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             return;
         }
         UnitOfWork unitOfWork = new UnitOfWork();
         unitOfWork.APRDetailsRepo.Delete(x => x.Id == item.Id);
         unitOfWork.Save();
         var counter = 1;
         foreach (var i in unitOfWork.APRDetailsRepo.Get(x => x.APRId == this.aPRs.Id))
         {
             i.ItemNo = counter;
             counter++;
         }
         unitOfWork.Save();
         ItemsGridControl.DataSource =
             new BindingList <APRDetails>(unitOfWork.APRDetailsRepo.Get(x => x.APRId == this.aPRs.Id));
     }
 }