public PRPDActivityDetailsLabour GetByDetailID(long DetailID) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@BatchActID", DetailID) }; DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_PRPDActivityDetailsLabourByDetailID", paramList); PRPDActivityDetailsLabour obj = new PRPDActivityDetailsLabour(); if (dt.Rows.Count > 0) { obj.ActivityDetailsLabourID = Convert.ToInt64(dt.Rows[0]["ActivityDetailsLabourID"]); obj.PRPDBatchActivityDetails = Convert.ToInt64(dt.Rows[0]["BatchActID"]); obj.Helper = objEmployee_DL.Get(Convert.ToString(dt.Rows[0]["Helper"])); obj.StartTime_D = Convert.ToDateTime(dt.Rows[0]["StartTime"]); obj.StopTime_D = Convert.ToDateTime(dt.Rows[0]["StopTime"]); obj.OTHours = Convert.ToDecimal(dt.Rows[0]["OTHours"]); obj.Remarks = Convert.ToString(dt.Rows[0]["Remarks"]); obj.HourlyRate = Convert.ToDecimal(dt.Rows[0]["HourlyRate"]); obj.OTRate = Convert.ToDecimal(dt.Rows[0]["OTRate"]); } return(obj); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public int Add(PRPDActivityDetailsLabour obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@BatchActID", obj.PRPDBatchActivityDetails), new SqlParameter("@Helper", obj.Helper.EmployeeID), new SqlParameter("@StartTime", obj.StartTime), new SqlParameter("@StopTime", obj.StopTime), new SqlParameter("@OTHours", obj.OTHours), new SqlParameter("@Remarks", obj.Remarks) }; return(Execute.RunSP_Int(Connection, "SPADD_PRPDActivityDetailsLabour", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public int Update(PRPDActivityDetailsLabour obj, long Original_ActivityDetailsLabourID) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@BatchActID", obj.PRPDBatchActivityDetails), new SqlParameter("@Helper", obj.Helper.EmployeeID), new SqlParameter("@StartTime", obj.StartTime), new SqlParameter("@StopTime", obj.StopTime), new SqlParameter("@OTHours", obj.OTHours), new SqlParameter("@Remarks", obj.Remarks), new SqlParameter("@Original_ActivityDetailsLabourID", obj.ActivityDetailsLabourID) }; return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_PRPDActivityDetailsLabour", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void ClearForm() { objPRPDActivityDetailsLabour = null; txtDescription.Text = ""; txtFinalQty.Text = "0.00"; txtNoofPackets.Text = "0"; txtOT.Text = "0.00"; txtPacketSize.Text = "0.00"; txtStartQty.Text = "0.00"; txtStopQty.Text = "0.00"; dtpStartTime.Value = Convert.ToDateTime("7/15/2009 8:00 AM");; dtpStopTime.Value = Convert.ToDateTime("7/15/2009 5:00 PM");; btnDelete.Enabled = false; ucEmployeeSelect1.Clear(); bindLabours.DataSource = objPRPDActivityDetailsLabourDL.GetDataView(objPRPDBatchActivityDetails.PRPDBatchActDetailsID); dtStopDate.Value = DateTime.Now; dtStartDate.Value = DateTime.Now; dtStopDate.Visible = false; dtpStopTime.Visible = false; lblStopDate.Visible = false; lblStopTime.Visible = false; txtStopQty.Visible = false; lblStopQty.Visible = false; lblOT.Visible = false; txtOT.Visible = false; cbMultiple.Visible = false; lblNoofRec.Visible = false; txtNoofRec.Visible = false; txtNoofRec.Text = "0"; ucEmployeeSelect1_EmployeeSelectedIndexChanged_1(this, new EventArgs()); }
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); } } } } }
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 = objPRPDBatchActivity.PRPDBatchActivityID; obj.OTHours = Calculate.CalOTHours(OTHours, OTMinutes); obj.StartTime = txtFrom.Text; obj.StopTime = txtTo.Text; obj.Remarks = "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 = objEmployee_DL.Get(dgvEmployeeList.Rows[i].Cells["EmpID"].Value.ToString()); count++; objPRPDActivityDetailsLabour_DL.Add(obj); } } Clear_Labour(); this.Close(); } catch (Exception) { MessageBox.Show(this, "Error occured while loading Labour Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } }