コード例 #1
0
        private void update_Click(object sender, EventArgs e)
        {
            Add_cat   w  = new Add_cat();
            DataTable dd = cm.get_full_cate(this.category_dgv.CurrentRow.Cells[1].Value.ToString());

            w.check               = "edite";
            w.cate_name.Text      = dd.Rows[0].ItemArray[1].ToString();
            w.cate_name.ReadOnly  = true;
            w.description.Text    = dd.Rows[0].ItemArray[2].ToString();
            w.sell_price.Text     = dd.Rows[0].ItemArray[3].ToString();
            w.discount.Text       = dd.Rows[0].ItemArray[4].ToString();
            w.less_price.Text     = dd.Rows[0].ItemArray[5].ToString();
            w.classification.Text = dd.Rows[0].ItemArray[6].ToString();
            w.barcode.Text        = dd.Rows[0].ItemArray[7].ToString();
            w.cate_code.Text      = dd.Rows[0].ItemArray[8].ToString();
            w.another_code.Text   = dd.Rows[0].ItemArray[9].ToString();
            w.less_quantity.Text  = dd.Rows[0].ItemArray[10].ToString();
            w.unit.Text           = dd.Rows[0].ItemArray[15].ToString();
            if (dd.Rows[0].ItemArray[12].ToString().Contains("1"))
            {
                w.checkBox3.Checked = true;
            }
            if (dd.Rows[0].ItemArray[13].ToString().Contains("1"))
            {
                w.checkBox1.Checked = true;
            }
            if (dd.Rows[0].ItemArray[14].ToString().Contains("1"))
            {
                w.checkBox2.Checked = true;
            }
            w.cate_unite.DataSource = cm.get_cate_unit(this.category_dgv.CurrentRow.Cells[1].Value.ToString());

            w.cate_warehouses.DataSource = cm.get_ware_quant(this.category_dgv.CurrentRow.Cells[1].Value.ToString());
            if (w.cate_warehouses.Rows.Count < 0)
            {
                w.cate_warehouses.Columns.RemoveAt(1);
                w.cate_warehouses.Columns.RemoveAt(2);
            }

            /* byte[] image = (byte[])cm.get_cate_image(this.category_dgv.CurrentRow.Cells[1].Value.ToString()).Rows[0][0];
             * MemoryStream ms = new MemoryStream(image);
             * w.cat_image.Image = Image.FromStream(ms);*/
            w.save.Text        = "تعديل";
            w.save_new.Visible = false;
            w.ShowDialog();
        }
コード例 #2
0
        private void add_cat_btn_Click(object sender, EventArgs e)
        {
            Add_cat adc = new Add_cat();

            adc.ShowDialog();
        }