private void txtOTMinutes_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (e.KeyCode == Keys.Enter) { if (objRPDBatchActivity.ActivityStatus == RPDBatchActivity.Status.Finalized) { MessageBox.Show(this, "Activity is already Finished", "Wrong Attempt", MessageBoxButtons.OK); Clear_Labour(); } else { try { Decimal OTHours = 0; Decimal OTMinutes = 0; if (txtOT.Text != "") { OTHours = Convert.ToDecimal(txtOT.Text); } if (txtOTMinutes.Text != "") { OTMinutes = Convert.ToDecimal(txtOTMinutes.Text); } RPDActivityDetailsLabour obj = new RPDActivityDetailsLabour(); obj.BatchActID = objRPDBatchActivity.RPDBatchActID; obj.OTHours = Calculate.CalOTHours(OTHours, OTMinutes); obj.StartTime = txtFrom.Text; obj.StopTime = txtTo.Text; obj.Description = "No"; int count = 0; for (int i = 0; i < dgvEmployeeList.Rows.Count; i++) { if (Convert.ToBoolean(dgvEmployeeList.Rows[i].Cells["Select"].Value) == true) { obj.Helper = dgvEmployeeList.Rows[i].Cells["EmpID"].Value.ToString(); count++; objRPDActivityDetailsLabour_DL.Add(obj); } } Clear_Labour(); this.Close(); } catch (Exception) { MessageBox.Show(this, "Error occured while loading Labour Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } }
private void txtOTMinutes_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (e.KeyCode == Keys.Enter) { if (objBatchActivity.BatchActStatus == BatchActivity.Status.Finished) { MessageBox.Show(this, "Activity is already Finished", "Wrong Attempt", MessageBoxButtons.OK); Clear_Labour(); } else { try { Decimal OTHours = 0; Decimal OTMinutes = 0; if (txtOT.Text != "") { OTHours = Convert.ToDecimal(txtOT.Text); } if (txtOTMinutes.Text != "") { OTMinutes = Convert.ToDecimal(txtOTMinutes.Text); } BatchLabourDetails obj = new BatchLabourDetails(); obj.BatchAct = objBatchActivity; obj.OTHours = Calculate.CalOTHours(OTHours, OTMinutes); obj.WorkStart = txtFrom.Text; obj.WorkStop = txtTo.Text; int count = 0; if (objBatchActivity.ActType == "Packing_Secondary") { for (int i = 0; i < dgvEmployeeList.Rows.Count; i++) { if (Convert.ToBoolean(dgvEmployeeList.Rows[i].Cells["Select"].Value) == true) { obj.Emp = objEmployee_DL.Get(dgvEmployeeList.Rows[i].Cells["EmpID"].Value.ToString()); count++; objBatchLabourDetails_DL.Add_Secondary(obj); } } } else { for (int i = 0; i < dgvEmployeeList.Rows.Count; i++) { if (Convert.ToBoolean(dgvEmployeeList.Rows[i].Cells["Select"].Value) == true) { obj.Emp = objEmployee_DL.Get(dgvEmployeeList.Rows[i].Cells["EmpID"].Value.ToString()); count++; objBatchLabourDetails_DL.Add(obj); } } } Clear_Labour(); this.Close(); } catch (Exception) { MessageBox.Show(this, "Error occured while loading Labour Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } }