Esempio n. 1
0
        void Save()
        {
            try
            {
                if (MessageBox.Show("Do you want to submit this?", "Submit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                UnitOfWork unitOfWork = new UnitOfWork();
                var        res        = unitOfWork.PayrollOTRepo.Find(x => x.Id == payroll.Id);
                res.Description = txtPayDescription.EditValue?.ToString();
                res.Title       = txtPayTitle.EditValue?.ToString();
                if (CboHead.GetSelectedDataRow() is Employees head)
                {
                    res.HeadId       = head.Id;
                    res.HeadPosition = head.Position;
                }

                if (cboApprovedBy.GetSelectedDataRow() is Signatories approvedBy)
                {
                    res.ApprovedById     = approvedBy.Id;
                    res.ApprovedPosition = approvedBy.Position;
                }
                if (txtAccountant.GetSelectedDataRow() is Signatories accountant)
                {
                    res.ApprovedById     = accountant.Id;
                    res.ApprovedPosition = accountant.Position;
                }
                if (txtTreasurer.GetSelectedDataRow() is Signatories treasurer)
                {
                    res.ApprovedById     = treasurer.Id;
                    res.ApprovedPosition = treasurer.Position;
                }

                unitOfWork.Save();

                isClosed = true;
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        void Save()
        {
            try
            {
                if (MessageBox.Show("Do you want to submit this?", "Submit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                UnitOfWork unitOfWork = new UnitOfWork();
                var        res        = unitOfWork.PayrollOTRepo.Find(x => x.Id == payroll.Id);
                res.Description = txtPayDescription.EditValue.ToString();
                res.Title       = txtPayTitle.EditValue.ToString();
                if (CboHead.GetSelectedDataRow() is Signatories item)
                {
                }

                isClosed = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }