Beispiel #1
0
 private void btnPreview_Click(object sender, EventArgs e)
 {
     try
     {
         if (PISGridView.GetFocusedRow() is PIS item)
         {
             item            = new UnitOfWork().PISRepo.Find(x => x.Id == item.Id);
             item.PISDetails = item.PISDetails.OrderBy(x => x.ItemNo).ToList();
             if (item.PISDetails.Count < 20)
             {
                 var counter = 20 - item.PISDetails.Count;
                 for (var i = 0; i <= counter; i++)
                 {
                     item.PISDetails.Add(new PISDetails());
                 }
             }
             frmReportViewer frm = new frmReportViewer(new rptPIS()
             {
                 DataSource = new List <PIS>()
                 {
                     item
                 }
             });
             frm.ShowDialog();
         }
     }
     catch (Exception exception)
     {
     }
 }
Beispiel #2
0
 private void btnEditPQRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         if (PISGridView.GetFocusedRow() is PIS item)
         {
             UnitOfWork    unitOfWork = new UnitOfWork();
             frmAddEditPIS frm        = new frmAddEditPIS(MethodType.Edit, item);
             frm.ShowDialog();
             Init();
         }
     }
     catch (Exception exception)
     {
     }
 }
Beispiel #3
0
 private void btnDeletePQRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         if (!User.UserInAction("can delete"))
         {
             return;
         }
         if (PISGridView.GetFocusedRow() is PIS item)
         {
             if (MessageBox.Show("Do you want to submit this?", "Submit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
             {
                 return;
             }
             UnitOfWork unitOfWork = new UnitOfWork();
             unitOfWork.PISRepo.Delete(x => x.Id == item.Id);
             unitOfWork.Save();
             Init();
         }
     }
     catch (Exception exception)
     {
     }
 }