Esempio n. 1
0
        private void btn_edit_Click(object sender, EventArgs e)
        {
            FRM_SUPP_ADD frm_supp_add = new FRM_SUPP_ADD();

            id      = Convert.ToInt32(tileView1.GetFocusedRowCellValue("ID_SUPP"));
            tb_supp = dbs.TB_SUPP.Where(x => x.ID_SUPP == id).FirstOrDefault();
            frm_supp_add.txt_Name.Text  = tb_supp.SUPP_NAME.ToString();
            frm_supp_add.txt_phone.Text = tb_supp.SUPP_PHONE.ToString();
            frm_supp_add.txt_email.Text = tb_supp.SUPP_EMAIL.ToString();
            model_pic.by = tb_supp.SUPP_IMAGE;
            frm_supp_add.pic_supp.Image = Image.FromStream(model_pic.Convert_Img());
            frm_supp_add.id             = id;
            frm_supp_add.btn_add.Text   = "التعديل";
            frm_supp_add.Show();
        }
Esempio n. 2
0
        private void btn_delete_Click(object sender, EventArgs e)
        {
            id = Convert.ToInt32(tileView1.GetFocusedRowCellValue("ID_SUPP"));

            var res = MessageBox.Show("هل انت متأكد من حذف المورد ؟؟", "عملية الحذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                tb_supp = dbs.TB_SUPP.Where(x => x.ID_SUPP == id).FirstOrDefault();
                dbs.Entry(tb_supp).State = System.Data.Entity.EntityState.Deleted;
                dbs.SaveChanges();
                MessageBox.Show("تم عملية الحذف بالنجاح", " تم عملية الحذف", MessageBoxButtons.OK, MessageBoxIcon.Information);
                update_data();
            }
            else
            {
                return;
            }
        }