Ejemplo n.º 1
0
        void Init()
        {
            try
            {
                UnitOfWork unitOfWork = new UnitOfWork();
                if (methodType == MethodType.Edit)
                {
                    this.Details(model);
                    return;
                }

                model = new RISHeader()
                {
                    Date      = DateTime.Now,
                    CreatedBy = User.UserId,
                    PRId      = this.model.PRId,
                    OfficeId  = model.OfficeId,
                };
                unitOfWork.RISHeaderRepo.Insert(model);
                unitOfWork.Save();
                Details(model);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
 public frmAddEditRIS(MethodType methodType, RISHeader model)
 {
     InitializeComponent();
     this.model      = model;
     this.methodType = methodType;
     Init();
 }
Ejemplo n.º 3
0
 void Details(RISHeader item)
 {
     try
     {
         if (item == null)
         {
             MessageBox.Show("Detail is null");
         }
         UnitOfWork     unitOfWork     = new UnitOfWork();
         StaticSettings staticSettings = new StaticSettings();
         item = unitOfWork.RISHeaderRepo.Find(x => x.Id == item.Id);
         this.dtDate.EditValue = item.Date;
         this.employeesBindingSource.DataSource =
             unitOfWork.EmployeesRepo.Get(x => x.OfficeId == staticSettings.OfficeId);
         this.approvedByBindingSource.DataSource =
             unitOfWork.Signatories.Get(x => x.Office == "Provincial General Services Office");
         this.gsoEmployeesBindingSource.DataSource = unitOfWork.EmployeesRepo.Get(x => x.OffcAcr == "PGSO");
         this.requestedByBindingSource.DataSource  =
             unitOfWork.Signatories.Get(x => x.Office == staticSettings.OfficeName);
         if (string.IsNullOrEmpty(item.ApprovedBy))
         {
             item.ApprovedBy = (approvedByBindingSource.DataSource as List <Signatories>)?.FirstOrDefault()
                               ?.Person;
         }
         if (string.IsNullOrEmpty(item.RequestedBy))
         {
             item.RequestedBy = (requestedByBindingSource.DataSource as List <Signatories>)?.FirstOrDefault()
                                ?.Person;
         }
         this.cboRecevedBy.EditValue      = item.ReceivedBy;
         this.cboRequestedBy.EditValue    = item.RequestedBy;
         this.cboApprovedBy.EditValue     = item.ApprovedBy;
         this.cboIssuedBy.EditValue       = item.IssuedBy;
         this.txtPurpose.EditValue        = item.Purpose;
         this.ItemsGridControl.DataSource = new BindingList <RISDetails>(item.RISDetails.ToList());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 4
0
 public frmAddFromPO(RISHeader item)
 {
     InitializeComponent();
     this.item = item;
     Init();
 }