Exemplo n.º 1
0
        public string Add_Basic(STDBatch obj)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@STDBatchDescription", obj.STDBatchDescription),
                    new SqlParameter("@STDBasicProductCode", obj.STDBatchBasicProduct.BasicProductCode),
                    new SqlParameter("@STDBatchSize", obj.STDBatchSize),
                    new SqlParameter("@STDInstructedBy", obj.STDBatchInstructedBy.EmployeeID),
                    new SqlParameter("@STDBatchType", obj.STDBatchType),
                    new SqlParameter("@STDDuration", obj.STDDuration),
                    new SqlParameter("@EditableBatch", obj.EditableBatch),
                    new SqlParameter("@LabourHours", obj.LabourHours),
                    new SqlParameter("@MachineHours", obj.MachineHours),
                    new SqlParameter("@OutputQty", obj.OutputQty),
                    new SqlParameter("@InputQty", obj.InputQty),
                    new SqlParameter("@SpecificGravity", obj.SpecificGravity),
                    new SqlParameter("@Water", obj.Water),
                    new SqlParameter("@outParam", SqlDbType.VarChar, 50)
                    {
                        Direction = ParameterDirection.Output
                    }
                };

                return(Execute.RunSP_Output_String(Connection, "SPADD_STDBatch_BasicProduct", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 2
0
        private void gvSTDBatch_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                bindActivity.DataSource = null;

                bindMachines.DataSource        = null;
                bindSubInstructions.DataSource = null;
                string ID = Convert.ToString(gvSTDBatch.Rows[e.RowIndex].Cells["ColBatchID"].Value);
                bindActivity.DataSource = objActivityDL.Get_DataView(ID);
                STDBatch obj = objSTDBatchDL.Get(ID);
                //if (e.ColumnIndex == 0)
                //{
                //    //frmStandardBatch objFrm = new frmStandardBatch(CurrentUser, obj);

                //    frmStandardBatch objFrm = new  frmStandardBatch(obj, CurrentUser);
                //    objFrm.MdiParent = this.MdiParent;
                //    objFrm.Show();
                //    this.Close();
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbProductCode.SelectedValue != null)
                {
                    if (objActivityCollec.Count > 0)
                    {
                        if (objSTDBatchDL.Get_Count(cmbProductCode.SelectedValue.ToString(), Convert.ToInt32(txtBatchSize.Text)) == 0)
                        {
                            string TheBatchID = Save_STDBatch();

                            objStdBatch = objSTDBatchDL.Get(TheBatchID);



                            foreach (Activity obj in objActivityCollec)
                            {
                                obj.ActSTDBatch = objStdBatch;

                                objActivityDL.Add(obj);
                            }

                            MessageBox.Show(TheBatchID + "  is Created");

                            objActivityCollec = null;
                            //objSourceActivity = null;


                            gvActivityList.AutoGenerateColumns = false;
                            objSourceActivity.DataSource       = objActivityCollec;
                            gvActivityList.DataSource          = objSourceActivity;
                            objSourceActivity.ResetBindings(true);
                        }
                        else
                        {
                            MessageBox.Show(this, "There is a Standard Batch already with the same size", "Duplicate Found", MessageBoxButtons.OK);
                        }
                    }
                    else
                    {
                        MessageBox.Show(this, "No Activities are assigned to STD Batch", "Missing Info", MessageBoxButtons.OK);
                    }
                }

                else
                {
                    MessageBox.Show(this, "Please select a Product", "Missing Info", MessageBoxButtons.OK);
                }
            }
            catch (FormatException fex)
            {
                MessageBox.Show(this, "Invalid Data type, Please check Standard Batch Size", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        public DataTable Get_DataView()
        {
            try
            {
                STDBatch obj = new STDBatch();

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

                return(dt);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 5
0
        public STDBatch Get(string STDBatchID)
        {
            BasicProduct_DL  objBasicProductDL  = new BasicProduct_DL(Connection);
            FinishProduct_DL objFinishProductDL = new FinishProduct_DL(Connection);
            STDBatch         objSTDBatch        = new STDBatch();
            Employee_DL      objEmpDL           = new Employee_DL(Connection);


            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@STDBatchID", STDBatchID)
                };

                STDBatch obj = new STDBatch();

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

                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["STDBatchID"] != null)
                    {
                        obj.STDBatchID = Convert.ToString(dt.Rows[0]["STDBatchID"]);
                    }

                    if (dt.Rows[0]["STDBatchDescription"] != null)
                    {
                        obj.STDBatchDescription = Convert.ToString(dt.Rows[0]["STDBatchDescription"]);
                    }

                    if (dt.Rows[0]["STDBasicProductCode"] != null)
                    {
                        obj.STDBatchBasicProduct = objBasicProductDL.Get(Convert.ToString(dt.Rows[0]["STDBasicProductCode"]));
                    }

                    if (dt.Rows[0]["STDFinishProductCode"] != null)
                    {
                        obj.STDBatchFinishProduct = objFinishProductDL.Get(Convert.ToString(dt.Rows[0]["STDFinishProductCode"]));
                    }

                    obj.STDBatchSize         = Convert.ToDecimal(dt.Rows[0]["STDBatchSize"]);
                    obj.STDBatchInstructedBy = objEmpDL.Get(Convert.ToString(dt.Rows[0]["STDInstructedBy"]));
                    obj.STDInstructedDate    = Convert.ToDateTime(dt.Rows[0]["STDInstructedDate"]);


                    obj.STDBatchType  = Convert.ToString(dt.Rows[0]["STDBatchType"]);
                    obj.STDDuration   = Convert.ToDecimal(dt.Rows[0]["STDDuration"]);
                    obj.EditableBatch = Convert.ToBoolean(dt.Rows[0]["EditableBatch"]);
                    obj.LabourHours   = Convert.ToDecimal(dt.Rows[0]["LabourHours"]);
                    obj.MachineHours  = Convert.ToDecimal(dt.Rows[0]["MachineHours"]);
                    obj.InputQty      = Convert.ToDecimal(dt.Rows[0]["InputQty"]);
                    obj.OutputQty     = Convert.ToDecimal(dt.Rows[0]["OutputQty"]);

                    if (dt.Rows[0]["SpecificGravity"] != DBNull.Value)
                    {
                        obj.SpecificGravity = Convert.ToBoolean(dt.Rows[0]["SpecificGravity"]);
                    }

                    if (dt.Rows[0]["Water"] != DBNull.Value)
                    {
                        obj.Water = Convert.ToDecimal(dt.Rows[0]["Water"]);
                    }
                }


                return(obj);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }