Exemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                PlanBatch obj = new PlanBatch();

                obj.BatchSize   = Convert.ToDecimal(txtBatchSize.Text);
                obj.WeekID      = Convert.ToInt32(dgvWeeks.CurrentRow.Cells["WeekIDD"].Value);
                obj.Month       = Convert.ToString(cmbMonth.Text);
                obj.Nos         = Convert.ToInt32(txtNos.Text);
                obj.ProductCode = lstBasicProductList.SelectedValue.ToString();
                obj.Year        = Convert.ToInt32(cmbYear.Text);
                obj.RevisionID  = Convert.ToInt32(dgvWeeks.CurrentRow.Cells["RevisionID"].Value);
                obj.Status      = 0;
                obj.BatchLevel  = 0;

                objPlanBatch_DL.Add(obj);
                Load_Data();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Exemplo n.º 2
0
        public long Add(PlanBatch objPlanBatch)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@Year", objPlanBatch.Year),
                    new SqlParameter("@Month", objPlanBatch.Month),
                    new SqlParameter("@RevisionID", objPlanBatch.RevisionID),
                    new SqlParameter("@ProductCode", objPlanBatch.ProductCode),
                    new SqlParameter("@WeekID", objPlanBatch.WeekID),
                    new SqlParameter("@BatchSize", objPlanBatch.BatchSize),
                    new SqlParameter("@Nos", objPlanBatch.Nos),
                    new SqlParameter("@Status", objPlanBatch.Status),
                    new SqlParameter("@BatchLevel", objPlanBatch.BatchLevel)
                };


                return(Execute.RunSP_RowsEffected(Connection, "SPADD_PlanBatch", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 3
0
        public int Update(PlanBatch objPlanBatch, int Original_RevisionID)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@Year", objPlanBatch.Year),
                    new SqlParameter("@Month", objPlanBatch.Month),
                    new SqlParameter("@RevisionID", objPlanBatch.RevisionID),
                    new SqlParameter("@ProductCode", objPlanBatch.ProductCode),
                    new SqlParameter("@WeekID", objPlanBatch.WeekID),
                    new SqlParameter("@BatchSize", objPlanBatch.BatchSize),
                    new SqlParameter("@Nos", objPlanBatch.Nos),
                    new SqlParameter("@Original_RevisionID", objPlanBatch.RevisionID)
                };



                return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_PlanBatch", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 4
0
        private void LoadData()
        {
            try
            {
                dt = objPlanMaterials_DL.GetRequirement(PlanType, Convert.ToInt32(cmbYear.Text), cmbMonth.Text);

                dgvTotal.AutoGenerateColumns      = false;
                objSourceWeeklyRunning.DataSource = dt;
                dgvTotal.DataSource = objSourceWeeklyRunning;
                objSourceWeeklyRunning.ResetBindings(true);

                if (dt.Rows.Count > 0)
                {
                    if (Convert.ToInt32(dt.Rows[0]["Status"]) == 1)
                    {
                        btnFix.Enabled      = false;
                        btnGenerate.Enabled = false;
                    }
                    else
                    {
                        btnFix.Enabled      = true;
                        btnGenerate.Enabled = true;

                        foreach (DataGridViewRow row2 in dgvTotal.Rows)
                        {
                            DataTable tempMaterial          = new DataTable();
                            String    tempWeekID            = row2.Cells[0].Value.ToString();
                            String    tempcheckBasicproduct = row2.Cells[1].Value.ToString();
                            String    tempQty = row2.Cells[2].Value.ToString();

                            tempMaterial = objPlanMaterials_DL.CkeckPrimaryBasicProductByBasicProductID(tempcheckBasicproduct);
                            if (tempMaterial.Rows.Count > 0)
                            {
                                PlanBatch obj = new PlanBatch();

                                obj.BatchSize   = Convert.ToDecimal(tempQty);
                                obj.WeekID      = Convert.ToInt32(tempWeekID);
                                obj.Month       = Convert.ToString(cmbMonth.Text);
                                obj.Nos         = 1;
                                obj.ProductCode = tempcheckBasicproduct;
                                obj.Year        = Convert.ToInt32(cmbYear.Text);
                                obj.RevisionID  = 0;
                                obj.Status      = 0;
                                obj.BatchLevel  = 1;

                                objPlanBatch_DL.Add(obj);
                            }
                            //if (tempcheckproduct == temptxtProduct)
                            // {
                            //    availability = true;
                            //break;
                            //  }
                        }
                    }
                }
                else
                {
                    btnFix.Enabled      = true;
                    btnGenerate.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }