private void txtOTMinutes_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (e.KeyCode == Keys.Enter) { 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.Emp = objEmployee_DL.Get(cmbEmployee.SelectedValue.ToString()); obj.OTHours = Calculate.CalOTHours(OTHours, OTMinutes); obj.WorkStart = txtFrom.Text; obj.WorkStop = txtTo.Text; if (rdbOutsource.Checked == true) { int theCount = Convert.ToInt32(txtNos.Text); for (int i = 0; i < theCount; i++) { objBatchLabourDetails_DL.Add(obj); } } else { objBatchLabourDetails_DL.Add(obj); } Load_BatchLabourDetails(); Clear_Labour(); // Load_Activity_List(); } catch (Exception) { MessageBox.Show(this, "Error occured while loading Labour Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } }
private void SaveRecord() { 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.Emp = objEmployee_DL.Get(cmbEmployee.SelectedValue.ToString()); obj.OTHours = Calculate.CalOTHours(OTHours, OTMinutes); obj.WorkStart = txtFrom.Text; obj.WorkStop = txtTo.Text; if (rdbOutsource.Checked == true) { int theCount = Convert.ToInt32(txtNos.Text); for (int i = 0; i < theCount; i++) { objBatchLabourDetails_DL.Add(obj); } } else { objBatchLabourDetails_DL.Add(obj); } } catch (Exception) { MessageBox.Show(this, "Error occured while loading Batch List", "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 { if (!DataValidation.IsTimeShift(txtFrom.Text, txtTo.Text)) { MessageBox.Show(this, "please enter valid time period", "MRP System", MessageBoxButtons.OK); } else if (!DataValidation.IsHours(txtOT.Text) || !DataValidation.IsMinutes(txtOTMinutes.Text)) { MessageBox.Show(this, "please enter valid OT Details", "MRP System", MessageBoxButtons.OK); } 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.Emp = objEmployee_DL.Get(cmbEmployee.SelectedValue.ToString()); obj.OTHours = Calculate.CalOTHours(OTHours, OTMinutes); obj.WorkStart = txtFrom.Text; obj.WorkStop = txtTo.Text; if (rdbOutsource.Checked == true) { int theCount = Convert.ToInt32(txtNos.Text); for (int i = 0; i < theCount; i++) { objBatchLabourDetails_DL.Add(obj); } } else { objBatchLabourDetails_DL.Add(obj); } Load_BatchLabourDetails(); Clear_Labour(); } 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 (objPRPDBatchActivity.State == PRPDBatchActivity.ActStatus.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); } PRPDActivityDetailsLabour obj = new PRPDActivityDetailsLabour(); obj.PRPDBatchActivityDetails = PRPDBatchActivityID; obj.Helper = objEmployee_DL.Get(cmbEmployee.SelectedValue.ToString()); obj.OTHours = Calculate.CalOTHours(OTHours, OTMinutes); obj.StartTime = txtFrom.Text; obj.StopTime = txtTo.Text; obj.Remarks = "No"; if (rdbOutsource.Checked == true) { int theCount = Convert.ToInt32(txtNos.Text); for (int i = 0; i < theCount; i++) { objPRPDActivityDetailsLabour_DL.Add(obj); } } else { objPRPDActivityDetailsLabour_DL.Add(obj); } Load_Labour_List(); Clear_Labour(); // Load_Activity_List(); } catch (Exception) { MessageBox.Show(this, "Error occured while loading Labour Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } }