예제 #1
0
 private void btnDeletePQRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         if (!User.UserInAction("can delete"))
         {
             return;
         }
         if (AIGridView.GetFocusedRow() is AIReports item)
         {
             if (MessageBox.Show("Do you want to delete this?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
             {
                 return;
             }
             UnitOfWork     unitOfWork     = new UnitOfWork(false, false);
             TrashbinHelper trashbinHelper = new TrashbinHelper();
             item = unitOfWork.AIReportsRepo.Find(x => x.Id == item.Id, false, includeProperties: "AIRDetails");
             trashbinHelper.Delete(item, "AIReports", "Acceptance and Inspection Report", User.UserId, new StaticSettings().OfficeId);
             unitOfWork.AIReportsRepo.Delete(x => x.Id == item.Id);
             unitOfWork.Save();
             Init();
         }
     }
     catch (Exception exception)
     {
     }
 }
예제 #2
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                UnitOfWork unitOfWork = new UnitOfWork();
                if (AIGridView.GetFocusedRow() is AIReports item)
                {
                    item            = unitOfWork.AIReportsRepo.Find(x => x.Id == item.Id);
                    item.AIRDetails = item.AIRDetails.OrderBy(x => x.ItemNo).ToList();
                    //if (item.AIRDetails.Count < 25)
                    //{
                    //    var counter = 25 - item.AIRDetails.Count;
                    //    for (var i = 1; i <= counter; i++)
                    //    {
                    //        item.AIRDetails.Add(new AIRDetails());
                    //    }
                    //}
                    var rpt = new rptAcceptanceAndInspections()
                    {
                        DataSource = new List <AIReports>()
                        {
                            item
                        }
                    };
                    StaticSettings staticSettings = new StaticSettings();
                    if (staticSettings.Offices.ResponsibilityCenterCode == "1032")
                    {
                        rpt.grpStandard.Visible = false;
                        rpt.grpHR.Visible       = true;
                    }

                    if (string.IsNullOrEmpty(item.PropertyOfficer2))
                    {
                        foreach (var ctrl in rpt.AllControls <XRControl>().Where(x => x.Tag == "hide_isnull"))
                        {
                            ctrl.Visible = false;
                        }
                    }
                    if (string.IsNullOrEmpty(item.Head))
                    {
                        foreach (var ctrl in rpt.AllControls <XRControl>().Where(x => x.Tag == "Head hide_isnull"))
                        {
                            ctrl.Visible = false;
                        }
                    }
                    frmReportViewer frm = new frmReportViewer(rpt);

                    frm.ShowDialog();
                }
            }
            catch (Exception exception)
            {
            }
        }
예제 #3
0
 private void btnEditPQRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         if (AIGridView.GetFocusedRow() is AIReports item)
         {
             item = new UnitOfWork().AIReportsRepo.Find(x => x.Id == item.Id);
             frmAddEditAcceptance frm = new frmAddEditAcceptance(MethodType.Edit, item);
             frm.ShowDialog();
         }
     }
     catch (Exception exception)
     {
     }
 }