コード例 #1
0
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            if (state == "add")
            {
                MemoryStream ms = new MemoryStream();
                pictureBoxProduct.Image.Save(ms, pictureBoxProduct.Image.RawFormat);
                byte[] byteImage = ms.ToArray();
                int    CAT_ID    = Convert.ToInt32(cmbCategories.SelectedValue);
                int    xQty      = Convert.ToInt32(txtProductQty.Text);
                prd.ADD_PRODUCT(CAT_ID, txtDescription.Text, txtRef.Text, xQty, txtProductPrice.Text, byteImage);
                MessageBox.Show("Product Added Successfully", "Add Product", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MemoryStream ms = new MemoryStream();
                pictureBoxProduct.Image.Save(ms, pictureBoxProduct.Image.RawFormat);
                byte[] byteImage = ms.ToArray();
                int    CAT_ID    = Convert.ToInt32(cmbCategories.SelectedValue);
                int    xQty      = Convert.ToInt32(txtProductQty.Text);
                prd.UpdateProduct(CAT_ID, txtDescription.Text, txtRef.Text, xQty, txtProductPrice.Text, byteImage);
                MessageBox.Show("Product Updated Successfully", "Edit Product", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            FRM_PRODUCTS.getMainForm.dataGridView1.DataSource = prd.GetAllProducts();
        }
コード例 #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (state == "add")
            {
                MemoryStream ms = new MemoryStream();
                pbox.Image.Save(ms, pbox.Image.RawFormat);
                byte[] byteImage = ms.ToArray();

                prd.ADD_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text
                                , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage);

                MessageBox.Show("تمت الإضافة بنجاح", "عملية الإضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MemoryStream ms = new MemoryStream();
                pbox.Image.Save(ms, pbox.Image.RawFormat);
                byte[] byteImage = ms.ToArray();

                prd.UPDATE_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text
                                   , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage);

                MessageBox.Show("تم التعديل بنجاح", "عملية التعديل", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            FRM_PRODUCTS.getMainForm.dataGridView1.DataSource = prd.GET_ALL_PRODUCTS();
        }
コード例 #3
0
        private void btn_SAVE_PRODUCT_Click(object sender, EventArgs e)
        {
            var EXPIRE_DATE = dateTimePicker_EXPIREDATE.Value;

            if (CheckInputs())
            {
                if (stat == "add")
                {
                    MemoryStream ms = new MemoryStream();
                    pictureBox_PRODUCTS.Image.Save(ms, pictureBox_PRODUCTS.Image.RawFormat);
                    byte[] ImageByte = ms.ToArray();

                    prd.ADD_PRODUCT(int.Parse(ID_PRODUCT.Text), int.Parse(comboBox_CATEGORIES.SelectedValue.ToString()), textBox_BARCODE.Text, textBox_LABEL.Text, ImageByte, EXPIRE_DATE);
                    MessageBox.Show("تمت عملية الحفظ بنجاح", "SAVE");
                    Clear_Function();
                }
                else
                {
                    MemoryStream ms = new MemoryStream();
                    pictureBox_PRODUCTS.Image.Save(ms, pictureBox_PRODUCTS.Image.RawFormat);
                    byte[] ImageByte = ms.ToArray();
                    prd.UPDATE_PRODCUT(int.Parse(comboBox_CATEGORIES.SelectedValue.ToString()), textBox_BARCODE.Text, textBox_LABEL.Text, ImageByte, ID_PRODUCT.Text, EXPIRE_DATE);
                    MessageBox.Show("تمت عملية التعديل بنجاح", "UPDATE");
                    FORM_MNG_PRODUCTS.getMainForm.GridControl_PRODUCTS.DataSource = prd.GET_ALL_PRODUCTS();

                    this.Close();
                }
            }
        }
コード例 #4
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (state == "add")
            {
                if (txtDes.Text == "" || txtRef.Text == "" || txtQte.Text == "" || txtPrice.Text == "")
                {
                    MessageBox.Show("Entrer Tous Les Information", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    try
                    {
                        MemoryStream ms = new MemoryStream();
                        pbox.Image.Save(ms, pbox.Image.RawFormat);
                        byte[] byteImage = ms.ToArray();

                        prd.ADD_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text
                                        , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage);

                        MessageBox.Show("Ajouté Avec Succée", "L'ajout", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch
                    {
                        byte[] byteImage;
                        byteImage = new byte[0];
                        prd.ADD_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text
                                        , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage);

                        MessageBox.Show("Ajouté Avec Succée", "L'ajout", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            else
            {
                MemoryStream ms = new MemoryStream();
                pbox.Image.Save(ms, pbox.Image.RawFormat);
                byte[] byteImage = ms.ToArray();

                prd.UPDATE_PRODUCT(Convert.ToInt32(cmbCategories.SelectedValue), txtDes.Text
                                   , txtRef.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage);

                MessageBox.Show("Modifié", " Modification", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            A1_form refrch = new A1_form();

            refrch.button12_Click(sender, e);
        }
コード例 #5
0
        /* private void button1_Click(object sender, EventArgs e)
         * {
         *   OpenFileDialog OFD = new OpenFileDialog();
         *   OFD.Filter = "SAWIRADA |*.jpg;*.png;*.gif;*.bmp";
         *   if (OFD.ShowDialog() == DialogResult.OK)
         *   {
         *       pbox.Image = Image.FromFile(OFD.FileName);
         *   }
         * }
         */
        private void btnOk_Click(object sender, EventArgs e)
        {
            try{
                if (txtCost.Text == string.Empty || txtPrice.Text == string.Empty || txtCode.Text == string.Empty)
                {
                    MessageBox.Show("BUUXI XOGTA MUHIMKA AH", "ISKA JIR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (State == "add")
                {
                    MemoryStream ms = new MemoryStream();
                    // pbox.Image.Save(ms, pbox.Image.RawFormat);
                    // byte[] byteImage = ms.ToArray();
                    // prd.ADD_PRODUCT(Convert.ToInt32(cmbcategories.SelectedValue), txtDec.Text, txtID.Text, Convert.ToInt32(txtQte.Text), txtPrice.Text, byteImage);
                    prd.ADD_PRODUCT(txtCode.Text, txtName.Text, txtDec.Text, txtCost.Text, txtPrice.Text, txtQte.Text, txtCat.Text);


                    MessageBox.Show("WAA LAGU GUULEESTAY KU DARIDA", "KU DARID", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                { /*
                   * MemoryStream ms = new MemoryStream();
                   * pbox.Image.Save(ms, pbox.Image.RawFormat);
                   * byte[] byteImage = ms.ToArray();*/
                    prd.UPDATE_PRDUCT(txtCode.Text, txtName.Text, txtDec.Text, txtCost.Text, txtPrice.Text, txtQte.Text, txtCat.Text);

                    MessageBox.Show("WAA LAGU GUULEESTAY BADALIDA", "BADALID", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                if (fl == 2)
                {
                    FRM_PRODUCTS.getMainForm.dataGridView1.DataSource = prd.GET_ALL_PRODUCTS();
                }
                clearData();
            }
            catch
            {
                return;
            }
        }
コード例 #6
0
        private void ok_Click(object sender, EventArgs e)
        {
            if (state == "add")
            {
                if (txtref.Text == string.Empty)
                {
                    MessageBox.Show("يرجي التاكد من كتابه اسم الصنف ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (txtdes.Text == string.Empty)
                {
                    MessageBox.Show("يرجي التاكد من كتابه وصف الصنف ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (txtqte.Text == string.Empty)
                {
                    MessageBox.Show("يرجي التاكد من كتابه كميه الصنف الموجوده ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (txtprice.Text == string.Empty)
                {
                    MessageBox.Show("يرجي التاكد من كتابه سعر الصنف الحالي ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                byte[] byteImage;
                if (pictureBox1.Image == null)
                {
                    byteImage = new byte[0];
                    prd.ADD_PRODUCT(
                        Convert.ToInt32(cmbcategories.SelectedValue)
                        , txtdes.Text
                        , txtref.Text
                        , txtqte.Text
                        , txtprice.Text
                        , byteImage
                        , "withoutimage");
                    MessageBox.Show("تمت الاضافه بنجاح", "عمليه الاضافه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MemoryStream ms = new MemoryStream();
                    pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
                    byteImage = ms.ToArray();
                    prd.ADD_PRODUCT(
                        Convert.ToInt32(cmbcategories.SelectedValue)
                        , txtdes.Text
                        , txtref.Text
                        , txtqte.Text
                        , txtprice.Text
                        , byteImage
                        , "withimage");
                    MessageBox.Show("تمت الاضافه بنجاح", "عمليه الاضافه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                if (txtdes.Text == string.Empty || txtprice.Text == string.Empty || txtqte.Text == string.Empty || txtref.Text == string.Empty)
                {
                    MessageBox.Show("ينبغي تسجيل المعلومات المطلوبه ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                byte[] byteImage;
                if (pictureBox1.Image == null)
                {
                    byteImage = new byte[0];
                    prd.UPDATE_PRODUCT(
                        Convert.ToInt32(cmbcategories.SelectedValue)
                        , txtref.Text
                        , txtdes.Text
                        , txtqte.Text
                        , txtprice.Text
                        , byteImage
                        , "withoutimage");
                    MessageBox.Show("تمت التعديل بنجاح", "عمليه التعديل", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MemoryStream ms = new MemoryStream();
                    pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
                    byteImage = ms.ToArray();
                    prd.UPDATE_PRODUCT(
                        Convert.ToInt32(cmbcategories.SelectedValue)
                        , txtref.Text
                        , txtdes.Text
                        , txtqte.Text
                        , txtprice.Text
                        , byteImage
                        , "withimage");
                    MessageBox.Show("تمت التعديل بنجاح", "عمليه التعديل", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            txtref.Clear();
            txtqte.Clear();
            txtdes.Clear();
            txtprice.Clear();
            pictureBox1.Image = null;
            txtref.Focus();

            FRM_PRODUCTS.getmainform.dataGridView1.DataSource = prd.GET_ALL_PRODUCT();
        }
コード例 #7
0
 private void btnAddProd_Click(object sender, EventArgs e)
 {
     if (
         String.IsNullOrEmpty(txtPName.Text) ||
         String.IsNullOrEmpty(txtPPrice.Text) ||
         String.IsNullOrEmpty(txtPQuant.Text) ||
         String.IsNullOrEmpty(txtSELL_PRICE.Text) ||
         String.IsNullOrEmpty(txtProdCode.Text)
         )
     {
         MessageBox.Show("رجاء اضافة كل الحقول");
     }
     else
     {
         //MessageBox.Show("now can ADD or update ");
         if (form_state == "add")
         {
             DataTable Dt = new DataTable();
             Dt = prod.CHECK_IS_PRODUCT_TYPE(Convert.ToString(txtPName.Text), Convert.ToString(txtProdCode.Text), is_item_inner_add_prod);
             if (Dt.Rows.Count > 0)
             {
                 MessageBox.Show(" المنتج موجود...");
             }
             else
             {
                 DataTable nameDt = new DataTable();
                 nameDt = prod.CHECK_IS_PRODUCT_TYPE_AND_NAME(Convert.ToString(txtPName.Text), is_item_inner_add_prod);
                 if (nameDt.Rows.Count > 0)
                 {
                     MessageBox.Show(" اسم الصنف موجود");
                     txtPName.Focus();
                     txtPName.SelectionStart  = 0;
                     txtPName.SelectionLength = txtPName.TextLength;
                 }
                 else
                 {
                     DataTable codeDt = new DataTable();
                     codeDt = prod.CHECK_IS_PRODUCT_TYPE_AND_CODE(Convert.ToString(txtProdCode.Text), is_item_inner_add_prod);
                     if (codeDt.Rows.Count > 0)
                     {
                         MessageBox.Show("كود الصنف موجود");
                         txtProdCode.Focus();
                         txtProdCode.SelectionStart  = 0;
                         txtProdCode.SelectionLength = txtProdCode.TextLength;
                     }
                     else
                     {
                         // add product method
                         prod.ADD_PRODUCT(
                             Convert.ToString(txtPName.Text),              //name
                             Convert.ToDouble(txtPPrice.Text),             // price
                             Convert.ToDouble(txtSELL_PRICE.Text),         //s_price
                             Convert.ToInt32(txtPQuant.Text),              // quantatiy
                             Convert.ToString(txtDesk.Text),               // deskreption
                             Convert.ToString(txtProdCode.Text),           // barcode
                             Convert.ToInt32(comCategory.SelectedValue),   // category id
                             Convert.ToBoolean(rdoBTN_INNER.Checked)       // boolean value
                             );
                         this.Close();
                         MessageBox.Show("تمت اضافه الصنف  بنجاح....");
                         DASHBOARD.getDASHBOARD.dataGridViewProdsStats.DataSource = prod.GET_PRODUCTS_STATISTICS();
                         DASHBOARD.getDASHBOARD.is_item_inner = Convert.ToBoolean(rdoBTN_INNER.Checked);
                         DASHBOARD.getDASHBOARD.dataGridViewPROD.DataSource = prod.GET_ALL_PRODUCTS(is_item_inner_add_prod);
                     } // end of CHECK_IS_PRODUCT_TYPE_AND_CODE
                 }     // end of CHECK_IS_PRODUCT_TYPE_AND_NAME
             }         // end of CHECK_IS_PRODUCT_TYPE
         }
         else
         {
             DataTable nameDt = new DataTable();
             nameDt = prod.CHECK_IS_PRODUCT_TYPE_AND_NAME(Convert.ToString(txtPName.Text), is_item_inner_add_prod);
             if (nameDt.Rows.Count > 0 && product_id != 0 && Convert.ToUInt32(nameDt.Rows[0][0]) != product_id)
             {
                 MessageBox.Show(" اسم الصنف موجود");
                 txtPName.Focus();
                 txtPName.SelectionStart  = 0;
                 txtPName.SelectionLength = txtPName.TextLength;
             }
             else
             {
                 DataTable codeDt = new DataTable();
                 codeDt = prod.CHECK_IS_PRODUCT_TYPE_AND_CODE(Convert.ToString(txtProdCode.Text), is_item_inner_add_prod);
                 if (codeDt.Rows.Count > 0 && product_id != 0 && Convert.ToUInt32(codeDt.Rows[0][0]) != product_id)
                 {
                     MessageBox.Show("كود الصنف موجود");
                     txtProdCode.Focus();
                     txtProdCode.SelectionStart  = 0;
                     txtProdCode.SelectionLength = txtProdCode.TextLength;
                 }
                 else
                 {
                     prod.UPDATE_PRODUCT(
                         Convert.ToInt32(product_id),
                         Convert.ToString(txtPName.Text),
                         Convert.ToDouble(txtPPrice.Text),
                         Convert.ToDouble(txtSELL_PRICE.Text),
                         Convert.ToInt32(txtPQuant.Text),
                         Convert.ToString(txtDesk.Text),
                         Convert.ToString(txtProdCode.Text),
                         Convert.ToInt32(comCategory.SelectedValue),
                         Convert.ToBoolean(rdoBTN_INNER.Checked));
                     this.Close();
                     MessageBox.Show("تمت تعديل الصنف  بنجاح....");
                     DASHBOARD.getDASHBOARD.dataGridViewProdsStats.DataSource = prod.GET_PRODUCTS_STATISTICS();
                     DASHBOARD.getDASHBOARD.is_item_inner = Convert.ToBoolean(rdoBTN_INNER.Checked);
                     DASHBOARD.getDASHBOARD.dataGridViewPROD.DataSource = prod.GET_ALL_PRODUCTS(is_item_inner_add_prod);
                 }
             }
         }
     }       // end of all txtbox have value
 }