private void dgvProduct_Click(object sender, EventArgs e)
 {
     try
     {
         dt = ClassManagmentReport.displayAllIMGForPro(int.Parse(dgvProduct.CurrentRow.Cells[0].Value.ToString()));
         byte[]       arr = (byte[])(dt.Rows[0][1]);
         MemoryStream ms  = new MemoryStream(arr);
         pic1.Image = Image.FromStream(ms);
     }
     catch (Exception) { pic1.Image = null; }
 }
Beispiel #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtIMGid.Text.Equals("") && picImage.Image != null)
                {
                    int addIMG = ClassProduct.insertIMG(arr, int.Parse(ProID));
                    dt = ClassManagmentReport.displayAllIMGForPro(int.Parse(ProID));

                    MessageBox.Show("Done . .");
                    numOfImag = dt.Rows.Count;
                    btnFirstIMG_Click(null, null);
                }
            }
            catch (Exception) { }
        }
Beispiel #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (txtIMGid.Text.Equals(""))
            {
                picImage.Image = null;
            }
            else
            {
                int delImage = ClassManagmentReport.deleteIMG(int.Parse(txtIMGid.Text));
                dt = ClassManagmentReport.displayAllIMGForPro(int.Parse(ProID));

                MessageBox.Show("Done . .");
                txtIMGid.Text  = "";
                picImage.Image = null;
            }
            numOfImag = dt.Rows.Count;
            btnFirstIMG_Click(null, null);
        }
        public FRM_UpdateProduct(string s)
        {
            InitializeComponent();
            ProID = int.Parse(s);
            DataTable dt = ClassManagmentReport.selectOneProID(int.Parse(s));

            txtname.Text     = dt.Rows[0][1].ToString();
            txtbarcode.Text  = dt.Rows[0][2].ToString();
            txtCategory.Text = dt.Rows[0][3].ToString();
            txtCountry.Text  = dt.Rows[0][4].ToString();
            txtcity.Text     = dt.Rows[0][5].ToString();
            txtCompany.Text  = dt.Rows[0][6].ToString();
            //txtcost.Text = dt.Rows[0][7].ToString();
            //txtgroup.Text = dt.Rows[0][8].ToString();
            //txtone.Text = dt.Rows[0][9].ToString();
            rtxtdiscrp.Text = dt.Rows[0][10].ToString();
            rtxtnote.Text   = dt.Rows[0][11].ToString();
        }
Beispiel #5
0
 public Frm_ProductImage(string s, string rep)
 {
     InitializeComponent();
     ProID = s;
     if (rep.Equals("Normal"))
     {
         btnExport.Visible = btnSave.Visible = btnSelectOne.Visible = btnDelete.Visible = false;
     }
     dt        = ClassManagmentReport.displayAllIMGForPro(int.Parse(s));
     numOfImag = dt.Rows.Count;
     try
     {
         txtIMGid.Text = dt.Rows[0][0].ToString();
         byte[]       arr = (byte[])(dt.Rows[0][1]);
         MemoryStream ms  = new MemoryStream(arr);
         picImage.Image = Image.FromStream(ms);
     }
     catch (Exception) { MessageBox.Show("No Image Found !!!"); }
 }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (txtID.Text.Equals(""))
     {
         MessageBox.Show("Please Select One By Double Click. .");
     }
     else
     {
         string       proDI  = txtID.Text;
         DialogResult result = MessageBox.Show("Are You Sure IF You Want To Delete This Product ?", "Warnning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
         if (result == DialogResult.Yes)
         {
             int delImg = ClassManagmentReport.deleteAllIMGProduct(int.Parse(proDI));
             int delPro = ClassManagmentReport.deletePro(int.Parse(proDI));
             txtID.Text = txtName.Text = txtBarcode.Text = "";
             displayPro();
             MessageBox.Show("Done ...");
         }
         else
         {
             return;
         }
     }
 }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int found = 0;

            if (txtname.Text.Equals(""))
            {
                MessageBox.Show("Please insert product name .");
            }
            else
            {
                DataTable ProName = ClassProduct.selectOnePro(txtbarcode.Text);
                if (ProName.Rows.Count > 0 && !ProName.Rows[0][0].ToString().Equals(ProID.ToString()))
                {
                    found = 1; MessageBox.Show("This Product or Barcode Already Exist . .");
                }
            }
            if (found == 0)
            {
                int i = ClassManagmentReport.updatePro(ProID, txtname.Text, txtbarcode.Text, txtCategory.Text, txtCountry.Text, txtcity.Text, txtCompany.Text, "0", "0", "0", rtxtdiscrp.Text, rtxtnote.Text);
                txtname.Text = txtbarcode.Text = txtCategory.Text = txtCountry.Text = txtcity.Text = txtCompany.Text = rtxtdiscrp.Text = rtxtnote.Text = "";
                MessageBox.Show("Done. .");
            }
            this.Close();
        }
 private void txtSearch_TextChanged(object sender, EventArgs e)
 {
     dgvProduct.DataSource = ClassManagmentReport.searchForPro(txtSearch.Text);
 }
 void displayPro()
 {
     dgvProduct.DataSource = ClassManagmentReport.displayAllPro();
 }