Ejemplo n.º 1
0
        public BatchLabourDetails Get(long LabourActID)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@LabourRecID", LabourActID)
                };

                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_BatchLaourDetails", paramList);

                BatchLabourDetails obj = new BatchLabourDetails();
                BatchActivity_DL   objBatchActivity_DL = new BatchActivity_DL(ConnectionStringClass.GetConnection());
                Employee_DL        objEmployee_DL      = new Employee_DL(ConnectionStringClass.GetConnection());

                if (dt.Rows.Count != 0)
                {
                    obj.BatchAct       = objBatchActivity_DL.GetByID(Convert.ToInt32(dt.Rows[0]["BatchActID"]));
                    obj.Emp            = objEmployee_DL.Get(Convert.ToString(dt.Rows[0]["EmployeeID"]));
                    obj.HourlyRate     = Convert.ToDecimal(dt.Rows[0]["HourlyRate"]);
                    obj.LabourRecID    = Convert.ToInt32(dt.Rows[0]["LabourRecID"]);
                    obj.OTHours        = Convert.ToDecimal(dt.Rows[0]["OTHours"]);
                    obj.OTRate         = Convert.ToDecimal(dt.Rows[0]["OTRate"]);
                    obj.WorkStart_Date = Convert.ToDateTime(dt.Rows[0]["WorkStart"]);
                    obj.WorkStop_Date  = Convert.ToDateTime(dt.Rows[0]["WorkStop"]);
                }



                return(obj);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Ejemplo n.º 2
0
        private void dgvBatchLabourDetails_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                DialogResult theResult = new DialogResult();

                theResult = MessageBox.Show(this, "Do you Want to Delete this Record", "Confirmation", MessageBoxButtons.YesNo);

                if (theResult == System.Windows.Forms.DialogResult.Yes)
                {
                    if (objPRPDBatchActivity.State == PRPDBatchActivity.ActStatus.Finished)
                    {
                        MessageBox.Show(this, "This Activity Is Finished.", "Wrong Attempt", MessageBoxButtons.OK);
                    }
                    else
                    {
                        BatchLabourDetails obj = new BatchLabourDetails();

                        objPRPDActivityDetailsLabour_DL.Delete(Convert.ToInt32(dgvBatchLabourDetails.CurrentRow.Cells["LabourRecID"].Value));

                        Load_Labour_List();
                    }
                }
            }
        }
Ejemplo n.º 3
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void dgvBatchLabourDetails_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                BatchLabourDetails obj = new BatchLabourDetails();

                objBatchLabourDetails_DL.Delete(Convert.ToInt32(dgvBatchLabourDetails.CurrentRow.Cells["LabourRecID"].Value));

                Load_BatchLabourDetails();
            }
        }
Ejemplo n.º 5
0
        private void dgvBatchLabourDetails_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                if (objBatchActivity.BatchActStatus == BatchActivity.Status.Finished)
                {
                    MessageBox.Show(this, "This Activity Is Finished.", "Wrong Attempt", MessageBoxButtons.OK);
                }
                else
                {
                    BatchLabourDetails obj = new BatchLabourDetails();

                    objBatchLabourDetails_DL.Delete(Convert.ToInt32(dgvBatchLabourDetails.CurrentRow.Cells["LabourRecID"].Value));

                    Load_BatchLabourDetails();
                }
            }
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        public long Add_Secondary(BatchLabourDetails objBatchLabourDetails)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@BatchActID", objBatchLabourDetails.BatchAct.BatchActID),
                    new SqlParameter("@EmployeeID", objBatchLabourDetails.Emp.EmployeeID),
                    new SqlParameter("@WorkStart", objBatchLabourDetails.WorkStart),
                    new SqlParameter("@WorkStop", objBatchLabourDetails.WorkStop),
                    new SqlParameter("@OTHours", objBatchLabourDetails.OTHours)
                };

                return(Execute.RunSP_Int(Connection, "SPADD_BatchLabourDetails_Secondary", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Ejemplo n.º 8
0
        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);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
        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);
                        }
                    }
                }
            }
        }