Ejemplo n.º 1
0
        public void AddProduct(int ProductId, int Quntity, float SellingPrice, float Price1, string Price2)
        {
            Product_Table Obj = BussinessObj.Product_tb_search_by_ID(ProductId);

            if (Obj != null)
            {
                total = Quntity * SellingPrice;
                if (dataGridView1.RowCount == 0)
                {
                    RowID = dataGridView1.RowCount + 1;
                    row   = new string[] { (RowID++).ToString(), Obj.Category_Table.Catagory_Name, Obj.Product_Name, ExpirDate, ExpireOrNot, SellingPrice.ToString(), Price1.ToString(), Price2.ToString(), Quantity.Text, total.ToString(), ProductId.ToString() };
                    dataGridView1.Rows.Add(row);
                    if (!ProductNames.Contains(comboBox1.Text))
                    {
                        ProductNames.Add(comboBox1.Text);
                    }
                }
                else
                {
                    if (ProductNames.Contains(comboBox1.Text))
                    {
                        for (int i = 0; i < ProductNames.Capacity; i++)
                        {
                            if (ProductNames[i] == comboBox1.Text)
                            {
                                dataGridView1[5, (i)].Value = SellingPrice.ToString();
                                dataGridView1[6, (i)].Value = Price1.ToString();
                                dataGridView1[7, (i)].Value = Price2.ToString();
                                dataGridView1[8, (i)].Value = (int.Parse(dataGridView1[8, (i)].Value.ToString()) + Quntity).ToString();
                                dataGridView1[9, (i)].Value = (int.Parse(dataGridView1[8, (i)].Value.ToString()) * float.Parse(dataGridView1[5, (i)].Value.ToString())).ToString();
                                break;
                            }
                        }
                    }
                    else
                    {
                        RowID = dataGridView1.RowCount + 1;
                        row   = new string[] { (RowID++).ToString(), Obj.Category_Table.Catagory_Name, Obj.Product_Name, ExpirDate, ExpireOrNot, SellingPrice.ToString(), Price1.ToString(), Price2.ToString(), Quantity.Text, total.ToString(), ProductId.ToString() };
                        dataGridView1.Rows.Add(row);
                        if (!ProductNames.Contains(comboBox1.Text))
                        {
                            ProductNames.Add(comboBox1.Text);
                        }
                    }
                }
            }


            orderTotal = 0;
            for (int r = 0; r < dataGridView1.RowCount; r++)
            {
                orderTotal = orderTotal + float.Parse((dataGridView1[9, r].Value.ToString()));
            }
            textEdit6.Text = orderTotal.ToString();
            if (ValidationClass.ISDigit(Pauid.Text))
            {
                float Paid = float.Parse(Pauid.Text);
                Remin.Text = (orderTotal - Paid).ToString();
            }
        }
Ejemplo n.º 2
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedValue != null)
     {
         if (ValidationClass.ISDigit(SellingPrice.Text) && ValidationClass.ISDigit(Quantity.Text) && ValidationClass.ISDigit(Pric1.Text))
         {
             AddProduct(int.Parse(comboBox1.SelectedValue.ToString()), int.Parse(Quantity.Text), float.Parse(SellingPrice.Text), float.Parse(Pric1.Text), Price2.Text);
         }
         else
         {
             XtraMessageBox.Show("يرجى اضافة بيانات الكمية والاسعار قبل محاولة الاضافة");
         }
     }
 }
Ejemplo n.º 3
0
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            if (simpleButton3.Text == "تعديل بيانات منتج ")
            {
                simpleButton3.Text = "حفظ البيانات";
                CQuen.Enabled      = true;
                CSel.Enabled       = true;
                CPrice1.Enabled    = true;
                Cpric2.Enabled     = true;
            }
            else if (simpleButton3.Text == "حفظ البيانات")
            {
                if (ValidationClass.ISDigit(CQuen.Text))
                {
                    dataGridView1[8, this.dataGridView1.SelectedRows[0].Index].Value = CQuen.Text;
                }
                if (ValidationClass.StringNotEmpty(CSel.Text))
                {
                    dataGridView1[5, this.dataGridView1.SelectedRows[0].Index].Value = CSel.Text;
                }
                if (ValidationClass.StringNotEmpty(CPrice1.Text))
                {
                    dataGridView1[6, this.dataGridView1.SelectedRows[0].Index].Value = CPrice1.Text;
                }
                if (ValidationClass.StringNotEmpty(Cpric2.Text))
                {
                    dataGridView1[7, this.dataGridView1.SelectedRows[0].Index].Value = Cpric2.Text;
                }
                CQuen.Enabled      = false;
                CSel.Enabled       = false;
                CPrice1.Enabled    = false;
                Cpric2.Enabled     = false;
                simpleButton3.Text = "تعديل بيانات منتج ";
            }
            dataGridView1[9, this.dataGridView1.SelectedRows[0].Index].Value = (int.Parse(dataGridView1[8, this.dataGridView1.SelectedRows[0].Index].Value.ToString()) * float.Parse(dataGridView1[5, this.dataGridView1.SelectedRows[0].Index].Value.ToString())).ToString();

            orderTotal = 0;
            for (int r = 0; r < dataGridView1.RowCount; r++)
            {
                orderTotal = orderTotal + float.Parse((dataGridView1[9, r].Value.ToString()));
            }
            textEdit6.Text = orderTotal.ToString();
            if (ValidationClass.ISDigit(Pauid.Text))
            {
                float Paid = float.Parse(Pauid.Text);
                Remin.Text = (orderTotal - Paid).ToString();
            }
        }
Ejemplo n.º 4
0
        private void Pauid_EditValueChanged(object sender, EventArgs e)
        {
            if (ValidationClass.ISDigit(Pauid.Text))
            {
                Remin.Text = (float.Parse(Pauid.Text) - orderTotal).ToString();

                if (float.Parse(Pauid.Text) > orderTotal)
                {
                    Remin.BackColor = Color.Green;
                }
                else if (float.Parse(Pauid.Text) < orderTotal)
                {
                    Remin.BackColor = Color.Red;
                }
                else
                {
                    Remin.BackColor = SystemColors.Control;
                }
            }
        }
Ejemplo n.º 5
0
        private void Barcode_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (ValidationClass.StringNotEmpty(Barcode.Text))
                {
                    Product_Table Ob = BussinessObj.Product_tb_search_by_Barecode(Barcode.Text);

                    if (ValidationClass.ISDigit(SellingPrice.Text) && ValidationClass.ISDigit(Quantity.Text) && ValidationClass.ISDigit(Pric1.Text))
                    {
                        AddProduct(Ob.Product_ID, int.Parse(Quantity.Text), float.Parse(SellingPrice.Text), float.Parse(Pric1.Text), Price2.Text);
                    }
                    else
                    {
                        XtraMessageBox.Show("يرجى اضافة بيانات الكمية والاسعار قبل محاولة الاضافة");
                    }
                }
                Barcode.Text = "";
            }
        }
Ejemplo n.º 6
0
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         if (this.dataGridView1.SelectedRows.Count > 0)
         {
             orderTotal     = orderTotal - float.Parse(dataGridView1[9, this.dataGridView1.SelectedRows[0].Index].Value.ToString());
             textEdit6.Text = orderTotal.ToString();
             ProductNames.Remove(dataGridView1[2, this.dataGridView1.SelectedRows[0].Index].Value.ToString());
             dataGridView1.Rows.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
         }
         if (ValidationClass.ISDigit(Pauid.Text))
         {
             float Paid = float.Parse(Pauid.Text);
             Remin.Text = (orderTotal - Paid).ToString();
         }
     }
     else
     {
         XtraMessageBox.Show("يرجى تحديد المنتج اولا");
     }
 }