Esempio n. 1
0
        void Init()
        {
            try
            {
                if (methodType == MethodType.Edit)
                {
                    Details(itenaryofTravels);
                    return;
                }

                UnitOfWork unitOfWork = new UnitOfWork();
                this.itenaryofTravels = new ItenaryofTravels()
                {
                    DateCreated = DateTime.Now,
                    OBRId       = itenaryofTravels.OBRId,
                    CreatedBy   = User.UserId,
                };
                unitOfWork.ItenaryofTravelsRepo.Insert(this.itenaryofTravels);
                unitOfWork.Save();
                Details(itenaryofTravels);
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
 public frmAddEditIOT(MethodType methodType, ItenaryofTravels itenaryofTravels)
 {
     InitializeComponent();
     this.methodType       = methodType;
     this.itenaryofTravels = itenaryofTravels;
     this.Init();
 }
Esempio n. 3
0
        void Details(ItenaryofTravels item)
        {
            try
            {
                UnitOfWork unitOfWork = new UnitOfWork();
                this.employeesBindingSource.DataSource = unitOfWork.EmployeesRepo.Get();


                item = unitOfWork.ItenaryofTravelsRepo.Find(x => x.Id == item.Id);
                this.cboEmployeeName.EditValue = item.EmployeeId;
                this.dtDate.EditValue          = item.DateCreated;
                this.txtPosition.EditValue     = item.Position;
                this.txtStation.EditValue      = item.OfficialAddress;
                this.txtPurpose.EditValue      = item.Purpose;
                this.cboApprovedBy.EditValue   = item.ApprovedBy;

                itenaryDetailsBindingSource.DataSource =
                    new BindingList <ItenaryDetails>(unitOfWork.ItenaryDetailsRepo.Get(x => x.IOTId == item.Id));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }