Ejemplo n.º 1
0
 private void btnDeletePayrollRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (PayrollGridView.GetFocusedRow() is PayrollWageDetails item)
     {
         try
         {
             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.PayrollWageDetailsRepo.Find(x => x.Id == item.Id, false);
             trashbinHelper.Delete(item, "PayrollWageDetails", "APRs", User.UserId,
                                   new StaticSettings().OfficeId);
             unitOfWork.PayrollWagesRepo.Delete(x => x.Id == item.PayrollWageId);
             unitOfWork.Save();
             Init();
         }
         catch (Exception exception)
         {
             MessageBox.Show(exception.Message, exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Ejemplo n.º 2
0
        private void PayrollGridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (PayrollGridView.GetRow(e.RowHandle) is PayrollOTDetails item)
            {
                var ratePerDay  = item.RatePerMonth / 22.0M;
                var ratePerHour = ratePerDay / 8.0M;
                item.RatePerDay = ratePerDay;
                item.RatePerHr  = ratePerHour;
                var amountWeekEnd  = ((item.WeekEndNoHrs ?? 0) * (item.RatePerHr ?? 0)) * 1.5m;
                var amountWeekDays = ((item.WeekDayNoHrs ?? 0) * (item.RatePerHr ?? 0)) * 1.25m;
                item.SubTotal    = amountWeekEnd + amountWeekDays;
                item.TotalAmount = (item.SubTotal ?? 0) - (item.UnderPay ?? 0);
            }

            // PayrollGridView.RefreshRow(e.RowHandle);
        }
Ejemplo n.º 3
0
 private void btnDeletePayrollRepo_Click(object sender, EventArgs e)
 {
     try
     {
         if (PayrollGridView.GetFocusedRow() is PayrollWages item)
         {
             UnitOfWork unitOfWork = new UnitOfWork();
             unitOfWork.PayrollWageDetailsRepo.Delete(x => x.Id == item.Id);
             unitOfWork.Save();
             PayrollGridControl.DataSource =
                 new BindingList <PayrollWageDetails>(payrollWages.PayrollWageDetails?.ToList() ??
                                                      new List <PayrollWageDetails>());
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message, exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }