Esempio n. 1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (checkBox1.Checked == false)
     {
         MessageBox.Show("Please check search");
     }
     else
     {
         HQ_Product obj = new HQ_Product();
         obj.Productid = Convert.ToInt32(comboBox1.SelectedValue);
         bool a = obj.ptype();
         if (a == true)
         {
             pnametextBox.Text           = obj.ProductName;
             expdatetextBox6.Text        = obj.ProductExpdate;
             mfgdatetextBox7.Text        = obj.ProductMfgdate;
             supplieridtextBox12.Text    = obj.SupplierId.ToString();
             quantitytextBox3.Text       = obj.Quantity.ToString();
             purchasepricetextBox13.Text = obj.PurchasePrice.ToString();
             salespricetextBox4.Text     = obj.SalesPrice.ToString();
             pnametextBox.Text           = obj.ProductName;
             purchaseddatetextBox8.Text  = obj.PurchasedDate;
             producttypetextBox2.Text    = obj.ProductType;
         }
         else
         {
             MessageBox.Show("Please enter Valid ID");
             comboBox1.Focus();
         }
     }
 }
Esempio n. 2
0
        public void LoadAll2()
        {
            string sql = "SELECT * FROM HQ_Product_Inventory";

            this.dt    = DataAccess.GetDataTable(sql);
            this.count = dt.Rows.Count;
            this.arr   = new HQ_Product[this.count];

            for (int i = 0; i < this.count; i++)
            {
                HQ_Product p = new HQ_Product();
                p.Productid   = (int)dt.Rows[i]["Product_ID"];
                p.ProductType = dt.Rows[i]["Product_Type"].ToString();

                p.ProductName = dt.Rows[i]["Product_Name"].ToString();

                this.arr[i] = p;
            }
        }
Esempio n. 3
0
        public void LoadAll()
        {
            string sql = "SELECT * FROM HQ_Product_Inventory";

            this.dt    = DataAccess.GetDataTable(sql);
            this.count = dt.Rows.Count;
            this.arr   = new HQ_Product[this.count];

            for (int i = 0; i < this.count; i++)
            {
                HQ_Product p = new HQ_Product();
                p.Productid      = (int)dt.Rows[i]["Product_ID"];
                p.ProductType    = dt.Rows[i]["Product_Type"].ToString();
                p.ProductExpdate = dt.Rows[i]["Product_EXP_Date"].ToString();
                p.ProductMfgdate = dt.Rows[i]["Product_MFG_Date"].ToString();
                p.SupplierId     = Convert.ToInt16(dt.Rows[i]["Supplier_ID"]);
                p.Quantity       = Convert.ToInt32(dt.Rows[i]["Product_Quantity"]);
                p.PurchasePrice  = Convert.ToInt32(dt.Rows[i]["Product_Purchase_Price"]);
                p.SalesPrice     = Convert.ToInt32(dt.Rows[i]["Product_Sales_Price"]);
                p.ProductName    = dt.Rows[i]["Product_Name"].ToString();
                p.PurchasedDate  = dt.Rows[i]["Purchased_Date"].ToString();
                this.arr[i]      = p;
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (pnametextBox.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Product Nmae");
            }
            else if (supplieridtextBox12.Text.Trim() == "")
            {
                MessageBox.Show("Please enter supplier ID");
            }
            else if (producttypetextBox2.Text.Trim() == "")
            {
                MessageBox.Show("Please enter Product Type=");
            }

            else if (purchasepricetextBox13.Text.Trim() == "")
            {
                MessageBox.Show("Please enter Purchase price");
            }
            else if (quantitytextBox3.Text.Trim() == "")
            {
                MessageBox.Show("Please enter quantity");
            }
            else if (salespricetextBox4.Text.Trim() == "")
            {
                MessageBox.Show("Please enter sales price");
            }
            else if (expdatetextBox6.Text.Trim() == "")
            {
                MessageBox.Show("Please enter exp date");
            }
            else if (mfgdatetextBox7.Text.Trim() == "")
            {
                MessageBox.Show("Please enter mfg date");
            }
            else if (purchasepricetextBox13.Text.Trim() == "")
            {
                MessageBox.Show("Please enter purchase price ");
            }
            else
            {
                if (checkBox1.Checked == false)
                {
                    HQ_Product obj1 = new HQ_Product();
                    obj1.ProductType    = producttypetextBox2.Text;
                    obj1.ProductExpdate = expdatetextBox6.Text;
                    obj1.ProductMfgdate = mfgdatetextBox7.Text;
                    obj1.SupplierId     = Convert.ToInt32(supplieridtextBox12.Text);
                    obj1.Quantity       = Convert.ToInt32(quantitytextBox3.Text);
                    obj1.PurchasePrice  = Convert.ToInt32(purchasepricetextBox13.Text);
                    obj1.SalesPrice     = Convert.ToInt32(salespricetextBox4.Text);
                    obj1.ProductName    = pnametextBox.Text;
                    obj1.PurchasedDate  = purchaseddatetextBox8.Text;
                    bool b = obj1.newentry();
                    if (b == true)
                    {
                        MessageBox.Show(" New Product Information listed Sucessfully");
                    }
                    else
                    {
                        MessageBox.Show("This product is already inlisted");
                    }
                }
                else
                {
                    HQ_Product obj11 = new HQ_Product();

                    obj11.ProductExpdate = expdatetextBox6.Text;
                    obj11.ProductMfgdate = mfgdatetextBox7.Text;

                    obj11.Quantity      = Convert.ToInt32(quantitytextBox3.Text);
                    obj11.PurchasePrice = Convert.ToInt32(purchasepricetextBox13.Text);
                    obj11.SalesPrice    = Convert.ToInt32(salespricetextBox4.Text);

                    obj11.PurchasedDate = purchaseddatetextBox8.Text;
                    obj11.Productid     = Convert.ToInt32(comboBox1.SelectedValue);
                    obj11.proupdate();
                    MessageBox.Show("Product information updated");
                }
            }
        }
        private void Savebutton_Click(object sender, EventArgs e)
        {
            if (ProductnametextBox1.Text == "")
            {
                MessageBox.Show("Please Enter Product Nmae");
            }

            else if (ProductTypetextBox.Text.Trim() == "")
            {
                MessageBox.Show("Please enter Priduct Type");
            }

            else if (QuantityTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Please enter Product Quantity");
            }

            else if (SalespricetextBox4.Text.Trim() == "")
            {
                MessageBox.Show("Please enter Sales price");
            }

            else if (ExpdatetextBox2.Text.Trim() == "")
            {
                MessageBox.Show("Please enter expiry date");
            }

            else if (MfgdatetextBox3.Text.Trim() == "")
            {
                MessageBox.Show("Please enter mfg date");
            }

            else if (CheckindatetextBox4.Text.Trim() == "")
            {
                MessageBox.Show("Please enter Check in date");
            }

            else if (RequestedQuantitytextBox5.Text.Trim() == "")
            {
                MessageBox.Show("Please enter mfg date");
            }

            else
            {
                if (checkBox1.Checked == false)
                {
                    Branch_Product obj1 = new Branch_Product();
                    obj1.ProductType    = ProductTypetextBox.Text;
                    obj1.ProductExpdate = ExpdatetextBox2.Text;
                    obj1.ProductMfgdate = MfgdatetextBox3.Text;
                    if (LoginForm.USERTYPE == "hqmanager")
                    {
                        obj1.BranchId = Convert.ToInt32(comboBox1.SelectedValue);
                    }
                    else
                    {
                        obj1.BranchId = LoginForm.BRCHID;
                    }
                    obj1.Quantity    = Convert.ToInt32(QuantityTextBox.Text);
                    obj1.ReqQuantity = Convert.ToInt32(RequestedQuantitytextBox5.Text);
                    obj1.SalesPrice  = Convert.ToInt32(SalespricetextBox4.Text);
                    obj1.ProductName = ProductnametextBox1.Text;
                    obj1.CheckInDate = CheckindatetextBox4.Text;
                    HQ_Product hp = new HQ_Product();
                    hp.ProductName = obj1.ProductName;
                    hp.ProductType = obj1.ProductType;

                    obj1.Productid = hp.pid();
                    if (obj1.Productid == 0)
                    {
                        MessageBox.Show("Product is not listed in HQ");
                    }
                    else
                    {
                        bool b = obj1.newentry();

                        MessageBox.Show("  Product Information listed Sucessfully");
                    }
                }
                else
                {
                    if (LoginForm.USERTYPE == "hqmanager")
                    {
                        MessageBox.Show("You can Only view");
                    }
                    else
                    {
                        Branch_Product obj11 = new Branch_Product();
                        obj11.ProductName    = ProductnametextBox1.Text;
                        obj11.ProductType    = ProductTypetextBox.Text;
                        obj11.SalesPrice     = Convert.ToInt32(SalespricetextBox4.Text);
                        obj11.ProductMfgdate = MfgdatetextBox3.Text;
                        obj11.ProductExpdate = ExpdatetextBox2.Text;
                        obj11.Quantity       = Convert.ToInt32(QuantityTextBox.Text);
                        obj11.ReqQuantity    = Convert.ToInt32(RequestedQuantitytextBox5.Text);
                        obj11.CheckInDate    = CheckindatetextBox4.Text;
                        HQ_Product hp1 = new HQ_Product();
                        hp1.ProductName = obj11.ProductName;
                        hp1.ProductType = obj11.ProductType;
                        obj11.Productid = hp1.pid();
                        obj11.proupdate();


                        MessageBox.Show("Product information updated");
                    }
                }
            }
        }