Esempio n. 1
0
        private void btnAddFinishProduct_Click(object sender, EventArgs e)
        {
            if (txtFinishProductAvgCost.Text.Equals("") || txtProductCode.Text.Equals("") || txtFinishProductDescription.Text.Equals(""))
            {
                MessageBox.Show(this, "Please Fill all Fields", "Blank Fields", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                try
                {
                    objFinishProduct.FinishProductCode        = txtProductCode.Text;
                    objFinishProduct.BasicProduct             = objbasicProductDL.Get(cmbBasicProduct.SelectedValue.ToString());
                    objFinishProduct.FinishProductPackingType = objPackingTypeDL.Get(Convert.ToInt64(cmbPackType.SelectedValue));
                    objFinishProduct.FinishProductDescription = txtFinishProductDescription.Text;
                    objFinishProduct.BasicProductQty          = Convert.ToDecimal(txtBasicProductQty.Text);
                    objFinishProduct.FinishProductAvgCost     = Convert.ToDecimal(txtFinishProductAvgCost.Text);
                    if (chkEnablePr.Checked == true)
                    {
                        objFinishProduct.FinishProductStatus = true;
                    }
                    else
                    {
                        objFinishProduct.FinishProductStatus = false;
                    }
                    objFinishProduct.PrimaryFinishProductCode = txtProductCode.Text;
                    objFinishProduct.PrimaryFinishProductQty  = 1;
                    objFinishProduct.FinishProductType        = "Primary";

                    int x;
                    x = objFinishProductDL.Add(objFinishProduct);
                    gvFinishProduct.DataSource = objFinishProductDL.GetDataView("Primary", cmbBasicProduct.SelectedValue.ToString());

                    if (x > 0)
                    {
                        MessageBox.Show(this, "Succesfully Added to Database", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        this.ClearFinishProduct();
                    }
                    else if (x == -1)
                    {
                        MessageBox.Show(this, "Product Code already in the Database,Please enter another Product Code", "Problem with Product Code", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (FormatException)
                {
                    MessageBox.Show(this, "Please enter valid data", "Input Data Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                }
            }
        }
Esempio n. 2
0
 private void LoadMaterial()
 {
     if (cmbGRNType.SelectedIndex + 1 == Convert.ToInt32(GRN.Type.Material))
     {
         cmbMaterial.DataSource = null;
         cmbMaterial.Items.Clear();
         bsMaterialList.DataSource  = objMaterial_DL.GetDataView();
         cmbMaterial.DataSource     = bsMaterialList;
         cmbMaterial.BindingContext = this.BindingContext;
         cmbMaterial.DisplayMember  = "Material";
         cmbMaterial.ValueMember    = "MaterialCode";
     }
     else if (cmbGRNType.SelectedIndex + 1 == Convert.ToInt32(GRN.Type.BasicProduct))
     {
         cmbMaterial.DataSource = null;
         cmbMaterial.Items.Clear();
         bsMaterialList.DataSource  = objBasicProduct_DL.GetDataView();
         cmbMaterial.DataSource     = bsMaterialList;
         cmbMaterial.BindingContext = this.BindingContext;
         cmbMaterial.DisplayMember  = "BasicProduct";
         cmbMaterial.ValueMember    = "BasicProductCode";
     }
     else if (cmbGRNType.SelectedIndex + 1 == Convert.ToInt32(GRN.Type.FinishProduct))
     {
         cmbMaterial.DataSource = null;
         cmbMaterial.Items.Clear();
         bsMaterialList.DataSource  = objFinishProduct_DL.GetDataView(1);
         cmbMaterial.DataSource     = bsMaterialList;
         cmbMaterial.BindingContext = this.BindingContext;
         cmbMaterial.DisplayMember  = "FinishProduct";
         cmbMaterial.ValueMember    = "FinishProductCode";
     }
 }
Esempio n. 3
0
        private void cmbMRType_SelectedIndexChanged(object sender, EventArgs e)
        {
            Material      objMat    = new Material();
            BasicProduct  objBasic  = new BasicProduct();
            FinishProduct objFinish = new FinishProduct();

            bindItemList.DataSource = null;
            objMRFinishhProductCollec.Clear();
            objMRMaterialCollec.Clear();
            objMRBasicProductCollec.Clear();

            try
            {
                if (cmbMRType.SelectedItem.Equals("Material"))
                {
                    cmbItem.DataSource    = objMaterialDL.GetDataView();
                    cmbItem.DisplayMember = "Material";
                    cmbItem.ValueMember   = "MaterialCode";



                    objMat = objMaterialDL.Get(cmbItem.SelectedValue.ToString());
                    if (objMat != null)
                    {
                        lblUnit.Text = objMat.MatUnit.UnitCode;
                    }
                }
                else if (cmbMRType.SelectedItem.Equals("Basic Products"))
                {
                    cmbItem.DataSource    = objBasicProductDL.GetDataView(true);
                    cmbItem.DisplayMember = "Code";
                    cmbItem.ValueMember   = "BasicProductCode";



                    objBasic = objBasicProductDL.Get(cmbItem.SelectedValue.ToString());
                    if (objBasic != null)
                    {
                        lblUnit.Text = objBasic.BasicProductUnit.UnitCode;
                    }
                }
                else if (cmbMRType.SelectedItem.Equals("Finish Products"))
                {
                    cmbItem.DataSource    = objFinishProductDL.GetDataView(1);
                    cmbItem.DisplayMember = "Code";
                    cmbItem.ValueMember   = "FinishProductCode";


                    objFinish = objFinishProductDL.Get(cmbItem.SelectedValue.ToString());
                    if (objFinish != null)
                    {
                        lblUnit.Text = objFinish.FinishProductPackingType.PackingTitle;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 4
0
        //--------------- Methods --------------------

        public void LoadDirect()
        {
            try
            {
                if (cmbGRNType.SelectedItem.Equals("Material"))
                {
                    cmbItem.DataSource    = objMaterialDL.GetDataView();
                    cmbItem.DisplayMember = "Material";
                    cmbItem.ValueMember   = "MaterialCode";
                    objGRN.GRNType        = GRN.Type.Material;
                }
                else if (cmbGRNType.SelectedItem.Equals("Basic Product"))
                {
                    cmbItem.DataSource    = objBasicProductDL.GetDataView();
                    cmbItem.DisplayMember = "BasicProduct";
                    cmbItem.ValueMember   = "BasicProductCode";
                    objGRN.GRNType        = GRN.Type.BasicProduct;
                }
                else if (cmbGRNType.SelectedItem.Equals("Finish Product"))
                {
                    cmbItem.DataSource    = objFinishProductDL.GetDataView(1);
                    cmbItem.DisplayMember = "FinishProduct";
                    cmbItem.ValueMember   = "FinishProductCode";
                    objGRN.GRNType        = GRN.Type.FinishProduct;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 5
0
 //----------------------- Methods ----------------------------
 public void LoadItems()
 {
     try
     {
         cmbFinishProduct.DataSource = objFinishProductDL.GetDataView(1);
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 6
0
        private void Load_Products()
        {
            try
            {
                dtStartProduct = objFinishProduct_DL.GetDataView(objBasicProduct.BasicProductCode);

                objSourceFinishProductStart.DataSource = dtStartProduct;
                cmbStartProduct.DataSource             = objSourceFinishProductStart;


                dtEndProduct = objFinishProduct_DL.GetDataView(objBasicProduct.BasicProductCode);

                objSourceFinishProductStop.DataSource = dtEndProduct;
                cmbEndProduct.DataSource = objSourceFinishProductStop;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Esempio n. 7
0
        private void frmFormula_Load(object sender, EventArgs e)
        {
            try
            {
                cmbMaterials.DataSource    = objMaterialDL.GetDataView();
                cmbMaterials.DisplayMember = "Material";
                cmbMaterials.ValueMember   = "MaterialCode";


                cmbBasicProducts.DataSource    = objBasicProductDL.GetDataView(true);
                cmbBasicProducts.DisplayMember = "BasicProduct";
                cmbBasicProducts.ValueMember   = "BasicProductCode";

                cmbFinishProducts.DataSource    = objFinishProductDL.GetDataView(1);
                cmbFinishProducts.DisplayMember = "FinishProduct";
                cmbFinishProducts.ValueMember   = "FinishProductCode";
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 8
0
        private void Load_ProductList()
        {
            try
            {
                if (lstBasicProductList.SelectedValue != null)
                {
                    FinishProduct_DL objFinishProduct_DL = new FinishProduct_DL(ConnectionStringClass.GetConnection());

                    DataTable dtStart = objFinishProduct_DL.GetDataView(lstBasicProductList.SelectedValue.ToString());
                    DataTable dtStop  = objFinishProduct_DL.GetDataView(lstBasicProductList.SelectedValue.ToString());

                    objSourceFinishProductStart.DataSource = dtStart;
                    objSourceFinishProductStop.DataSource  = dtStop;

                    cmbStartProduct.DataSource = objSourceFinishProductStart;
                    cmbEndProduct.DataSource   = objSourceFinishProductStop;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Esempio n. 9
0
        private void Load_Products()
        {
            try
            {
                if ((cmbProductType.Text == "Semi Processed Product") | (cmbProductType.Text == "Basic Product"))
                {
                    if (cmbProductType.Text == "Semi Processed Product")
                    {
                        dtProducts = objBasicProductDL.GetDataView("Semi Processed Product", true);

                        cmbProductCode.DisplayMember = "BasicProductDescription";
                        cmbProductCode.ValueMember   = "BasicProductCode";
                    }
                    else
                    {
                        dtProducts = objBasicProductDL.GetDataView("Product", true);

                        cmbProductCode.DisplayMember = "BasicProductDescription";
                        cmbProductCode.ValueMember   = "BasicProductCode";
                    }
                }
                else if (cmbProductType.Text == "Finish Product")
                {
                    dtProducts = objFinishProductDL.GetDataView(true);

                    cmbProductCode.DisplayMember = "FinishProdutDescription";
                    cmbProductCode.ValueMember   = "FinishProductCode";
                }


                objSourceProducts.DataSource = dtProducts;
                cmbProductCode.DataSource    = objSourceProducts;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }