private void btn_delete_Click(object sender, EventArgs e) { Toast toast = new Toast(); Dialog dialog = new Dialog(); id = Convert.ToInt32(tileView1.GetFocusedRowCellValue("ID")); if (id > 0) { try { var rs = MessageBox.Show("عملية حذف", "هل انت متاكد من هذه العملية", MessageBoxButtons.YesNo); if (rs == DialogResult.Yes) { tb_sup = db.TB_SUP.Where(x => x.ID == id).FirstOrDefault(); db.Entry(tb_sup).State = EntityState.Deleted; db.SaveChanges(); toast.txt_caption.Text = "تم حذف المورد"; toast.Show(); update_data(); } } catch { } } else { dialog.txt_caption.Text = "لا يوجد مورد لحذفه"; dialog.Width = this.Width; dialog.Show(); } }
// add or edit private void btn_add_Click(object sender, EventArgs e) { Toast toast = new Toast(); Dialog dialog = new Dialog(); // Check if add or edit if (edt_name.Text == "") { dialog.Width = this.Width; dialog.txt_caption.Text = "اسم الصنف المطلوب"; dialog.Show(); } else { //Check if add or edit if (id == 0) { //add tb_pur.Pur_Name = edt_name.Text; tb_pur.Pur_Type = edt_type.Text; tb_pur.Pur_Cat = edt_cat.Text; tb_pur.Pur_Sup = edt_sup.Text; tb_pur.Pur_Det = edt_det.Text; tb_pur.Pur_Buy = Convert.ToDouble(edt_buy.Text); tb_pur.Pur_Sell = Convert.ToDouble(edt_sell.Text); tb_pur.Pur_Qt = Convert.ToDouble(edt_qt.Text); tb_pur.Pur_Tbuy = Convert.ToDouble(edt_tbuy.Text); tb_pur.Pur_Tsell = Convert.ToDouble(edt_tsell.Text); tb_pur.Pur_TRev = Convert.ToDouble(edt_trev.Text); db.TB_PUR.Add(tb_pur); db.SaveChanges(); toast.txt_caption.Text = "تم اجراء عملية الشراء"; toast.Show(); this.Close(); } else { //Edit tb_pur.ID = id; tb_pur.Pur_Name = edt_name.Text; tb_pur.Pur_Type = edt_type.Text; tb_pur.Pur_Cat = edt_cat.Text; tb_pur.Pur_Sup = edt_sup.Text; tb_pur.Pur_Det = edt_det.Text; tb_pur.Pur_Buy = Convert.ToDouble(edt_buy.Text); tb_pur.Pur_Sell = Convert.ToDouble(edt_sell.Text); tb_pur.Pur_Qt = Convert.ToDouble(edt_qt.Text); tb_pur.Pur_Tbuy = Convert.ToDouble(edt_tbuy.Text); tb_pur.Pur_Tsell = Convert.ToDouble(edt_tsell.Text); tb_pur.Pur_TRev = Convert.ToDouble(edt_trev.Text); db.Entry(tb_pur).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); toast.txt_caption.Text = "تم تعديل عملية الشراء"; toast.Show(); this.Close(); } } }
private void btn_add_Click(object sender, EventArgs e) { if (txt_Name.Text == string.Empty) { MessageBox.Show("رجاء ادخل اسم العمیل"); txt_Name.Focus(); return; } if (txt_phone.Text == string.Empty) { MessageBox.Show("رجاء ادخل رقم الهاتف"); txt_phone.Focus(); return; } if (txt_email.Text == string.Empty) { MessageBox.Show("رجاء ادخل البريد الكتروني"); txt_email.Focus(); return; } else { if (id == 0) { //add FRM_CUST frm_cust = new FRM_CUST(); pic_cust.Image.Save(model_pic.ms, System.Drawing.Imaging.ImageFormat.Jpeg); tb_cust.CUST_NAME = txt_Name.Text; tb_cust.CUST_PHONE = txt_phone.Text; tb_cust.CUST_EMAIL = txt_email.Text; tb_cust.CUST_IMAGE = model_pic.Convert_Byte(); dbs.TB_CUST.Add(tb_cust); dbs.SaveChanges(); MessageBox.Show("تم الحفظ العمیل بالنجاح"); dbs = new DB_SMPEntities(); frm_cust.gridControl1.DataSource = dbs.TB_CUST.ToList(); this.Close(); } else { // Edit pic_cust.Image.Save(model_pic.ms, System.Drawing.Imaging.ImageFormat.Jpeg); tb_cust.CUST_NAME = txt_Name.Text; tb_cust.CUST_PHONE = txt_phone.Text; tb_cust.CUST_EMAIL = txt_email.Text; tb_cust.ID_CUST = id; tb_cust.CUST_IMAGE = model_pic.Convert_Byte(); dbs.Entry(tb_cust).State = System.Data.Entity.EntityState.Modified; dbs.SaveChanges(); MessageBox.Show("تم تعديل العمیل بالنجاح"); dbs = new DB_SMPEntities(); FRM_CUST frm_cust = new FRM_CUST(); frm_cust.gridControl1.DataSource = dbs.TB_CUST.ToList(); this.Close(); } } }
private void btn_add_Click(object sender, EventArgs e) { if (txt_Name.Text == string.Empty) { MessageBox.Show("رجاء ادخل اسم المسخدم"); txt_Name.Focus(); return; } if (txt_pass.Text == string.Empty) { MessageBox.Show("رجاء ادخل كلمه المرور"); txt_pass.Focus(); return; } if (txt_roll.Text == string.Empty) { MessageBox.Show("رجاء ادخل صلاحيات المستخدم"); txt_roll.Focus(); return; } else { if (id == 0) { //add tb_user.USER_NAME = txt_Name.Text; tb_user.USER_PASS = txt_pass.Text; tb_user.USER_ROLL = txt_roll.Text; tb_user.USER_STATE = "False"; dbs.TB_USERS.Add(tb_user); dbs.SaveChanges(); MessageBox.Show("تم الحفظ المستخدم بالنجاح"); dbs = new DB_SMPEntities(); this.Close(); } else { // Edit tb_user.USER_ID = id; tb_user.USER_NAME = txt_Name.Text; tb_user.USER_PASS = txt_pass.Text; tb_user.USER_ROLL = txt_roll.Text; tb_user.USER_STATE = "false"; dbs.Entry(tb_user).State = System.Data.Entity.EntityState.Modified; dbs.SaveChanges(); MessageBox.Show("تم تعديل المستخدم بالنجاح"); dbs = new DB_SMPEntities(); FRM_SUPP frm_user = new FRM_SUPP(); frm_user.gridControl1.DataSource = dbs.TB_USERS.ToList(); this.Close(); } } }
// add or edit private void btn_add_Click(object sender, EventArgs e) { Toast toast = new Toast(); Dialog dialog = new Dialog(); // Check if add or edit if (edt_name.Text == "") { dialog.Width = this.Width; dialog.txt_caption.Text = "اسم العميل المطلوب"; dialog.Show(); } else { //Check if add or edit if (id == 0) { //add pic_cover.Image.Save(methods.ma, System.Drawing.Imaging.ImageFormat.Png); tb_sup.Sup_Name = edt_name.Text; tb_sup.Sup_Phone = edt_phone.Text; tb_sup.Sup_Email = edt_email.Text; tb_sup.Sup_image = methods.convert_byte(); db.TB_CUS.Add(tb_sup); db.SaveChanges(); toast.txt_caption.Text = "تم اضافة عميل جديد"; toast.Show(); this.Close(); } else { //Edit pic_cover.Image.Save(methods.ma, System.Drawing.Imaging.ImageFormat.Png); tb_sup.ID = id; tb_sup.Sup_Name = edt_name.Text; tb_sup.Sup_Phone = edt_phone.Text; tb_sup.Sup_Email = edt_email.Text; tb_sup.Sup_image = methods.convert_byte(); db.Entry(tb_sup).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); toast.txt_caption.Text = "تم تعديل العميل"; toast.Show(); this.Close(); } } }
// add or edit private void btn_add_Click(object sender, EventArgs e) { Toast toast = new Toast(); Dialog dialog = new Dialog(); // Check if add or edit if (edt_name.Text == "") { dialog.Width = this.Width; dialog.txt_caption.Text = "اسم الصنف المطلوب"; dialog.Show(); } else { //Check if add or edit if (id == 0) { //add pic_cover.Image.Save(methods.ma, System.Drawing.Imaging.ImageFormat.Jpeg); tb_cat.CAT_Name = edt_name.Text; tb_cat.CAT_Cover = methods.convert_byte(); db.TB_CAT.Add(tb_cat); db.SaveChanges(); toast.txt_caption.Text = "تم اضافة صنف جديد"; toast.Show(); db = new DB_SMPEntities(); frm_cat.gridControl1.DataSource = db.TB_CAT.ToList(); this.Close(); } else { //Edit pic_cover.Image.Save(methods.ma, System.Drawing.Imaging.ImageFormat.Jpeg); tb_cat.CAT_Name = edt_name.Text; tb_cat.ID = id; tb_cat.CAT_Cover = methods.convert_byte(); db.Entry(tb_cat).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); toast.txt_caption.Text = "تم تعديل الصنف "; toast.Show(); db = new DB_SMPEntities(); frm_cat.gridControl1.DataSource = db.TB_CAT.ToList(); this.Close(); } } }
// add or edit private void btn_add_Click(object sender, EventArgs e) { Toast toast = new Toast(); Dialog dialog = new Dialog(); // Check if add or edit qtp = Convert.ToDouble(txt_qt.Text); qtn = Convert.ToDouble(edt_qt.Text); qtr = qtp - qtn; if (edt_name.Text == "") { dialog.Width = this.Width; dialog.txt_caption.Text = "اسم المادة المطلوب"; dialog.Show(); } else { //Check if add or edit if (id == 0) { if (qtr >= 0) { //add tb_sell.Sell_Name = edt_name.Text; tb_sell.Sell_Cus = edt_cus.Text; tb_sell.Sell_Price = Convert.ToDouble(edt_sell.Text); tb_sell.Sell_Qt = Convert.ToDouble(edt_qt.Text); tb_sell.Sell_TPrice = (Convert.ToDouble(edt_sell.Text)) * Convert.ToDouble(edt_qt.Text); tb_sell.Sell_Date = DateTime.Now; db.TB_SELL.Add(tb_sell); tb_pur.Pur_Qt = qtr; db.Entry(tb_pur).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); toast.txt_caption.Text = "تم اجراء عملية الشراء"; toast.Show(); this.Close(); } else { label14.Visible = true; } } } }
private void btn_delete_Click(object sender, EventArgs e) { id = Convert.ToInt32(gridView1.GetFocusedRowCellValue("ID_SELL")); var res = MessageBox.Show("هل انت متأكد من حذف البیع ؟؟", "عملية الحذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.Yes) { tb_sell = dbs.TB_SELL.Where(x => x.ID_SELL == id).FirstOrDefault(); dbs.Entry(tb_sell).State = System.Data.Entity.EntityState.Deleted; dbs.SaveChanges(); MessageBox.Show("تم عملية الحذف بالنجاح", " تم عملية الحذف", MessageBoxButtons.OK, MessageBoxIcon.Information); update_data(); } else { return; } }
private void btn_add_Click(object sender, EventArgs e) { if (txt_Name_Cat.Text == string.Empty) { MessageBox.Show("رجاء ادخل اسم الصنف"); txt_Name_Cat.Focus(); return; } else { if (id == 0) { //add pic_cover.Image.Save(model_pic.ms, System.Drawing.Imaging.ImageFormat.Jpeg); tb_cat.CAT_Name = txt_Name_Cat.Text; tb_cat.CAT_Cover = model_pic.Convert_Byte(); dbs.TB_CAT.Add(tb_cat); dbs.SaveChanges(); MessageBox.Show("تم الحفظ الصنف بالنجاح"); dbs = new DB_SMPEntities(); FRM_CAT frm_cat = new FRM_CAT(); frm_cat.gridControl1.DataSource = dbs.TB_CAT.ToList(); this.Close(); } else { // Edit pic_cover.Image.Save(model_pic.ms, System.Drawing.Imaging.ImageFormat.Jpeg); tb_cat.CAT_Name = txt_Name_Cat.Text; tb_cat.ID_CAT = id; tb_cat.CAT_Cover = model_pic.Convert_Byte(); dbs.Entry(tb_cat).State = System.Data.Entity.EntityState.Modified; dbs.SaveChanges(); MessageBox.Show("تم تعديل الصنف بالنجاح"); dbs = new DB_SMPEntities(); FRM_CAT frm_cat = new FRM_CAT(); frm_cat.gridControl1.DataSource = dbs.TB_CAT.ToList(); this.Close(); } } }
private void btn_add_Click(object sender, EventArgs e) { if (txt_name.Text == string.Empty) { MessageBox.Show("رجاء ادخل اسم المستخدم"); txt_name.Focus(); return; } if (txt_pass.Text == string.Empty) { MessageBox.Show("رجاء ادخل كلمة المرور"); txt_pass.Focus(); return; } else { tb_user = dbs.TB_USERS.Where(x => x.USER_NAME == txt_name.Text && x.USER_PASS == txt_pass.Text).FirstOrDefault(); if (tb_user != null) { tb_user.USER_STATE = "True"; dbs.Entry(tb_user).State = System.Data.Entity.EntityState.Modified; frm_main.lb_roll.Text = tb_user.USER_ROLL; frm_main.lb_user.Text = tb_user.USER_NAME; frm_main.Enabled = true; dbs.SaveChanges(); frm_main.Show(); this.Close(); } else { MessageBox.Show("اسم المسخدم او كلمة المرور غیر صیحیحة", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error);; return; } } }
private void btn_add_Click(object sender, EventArgs e) { if (txt_name.Text == string.Empty) { MessageBox.Show("رجاء ادخل اسم المادة"); txt_name.Focus(); return; } if (txt_type.Text == string.Empty) { MessageBox.Show("رجاء ادخل نوع المادة"); txt_type.Focus(); return; } if (add_cat.Text == string.Empty) { MessageBox.Show("رجاء اختر الصنف"); add_cat.Focus(); return; } if (add_supp.Text == string.Empty) { MessageBox.Show("رجاء اختر المورد"); add_supp.Focus(); return; } if (txt_det.Text == string.Empty) { MessageBox.Show("رجاء اكتب التفاصیل"); txt_det.Focus(); return; } else { if (id == 0) { //add tb_pur.PUR_NAME = txt_name.Text; tb_pur.PUR_TYPE = txt_type.Text; tb_pur.PUR_CAT = add_cat.Text; tb_pur.PUR_SUPP = add_supp.Text; tb_pur.PUR_DET = txt_det.Text; tb_pur.PUR_BUY = Convert.ToDouble(txt_buy.Text); tb_pur.PUR_SELL = Convert.ToDouble(txt_sell.Text); tb_pur.PUR_QT = Convert.ToDouble(txt_qt.Text); tb_pur.PUR_Tbuy = Convert.ToDouble(t_buy.Text); tb_pur.PUR_Tsell = Convert.ToDouble(t_sell.Text); tb_pur.PUR_TRev = Convert.ToDouble(t_all.Text); dbs.TB_PUR.Add(tb_pur); dbs.SaveChanges(); MessageBox.Show("تم الحفظ شراء بالنجاح"); dbs = new DB_SMPEntities(); this.Close(); } else { // Edit tb_pur.ID_PUR = id; tb_pur.PUR_NAME = txt_name.Text; tb_pur.PUR_TYPE = txt_type.Text; tb_pur.PUR_CAT = add_cat.Text; tb_pur.PUR_SUPP = add_supp.Text; tb_pur.PUR_DET = txt_det.Text; tb_pur.PUR_BUY = Convert.ToDouble(txt_buy.Text); tb_pur.PUR_SELL = Convert.ToDouble(txt_sell.Text); tb_pur.PUR_QT = Convert.ToDouble(txt_qt.Text); tb_pur.PUR_Tbuy = Convert.ToDouble(t_buy.Text); tb_pur.PUR_Tsell = Convert.ToDouble(t_sell.Text); tb_pur.PUR_TRev = Convert.ToDouble(t_all.Text); dbs.Entry(tb_pur).State = System.Data.Entity.EntityState.Modified; dbs.SaveChanges(); MessageBox.Show("تم تعدیل شراء بالنجاح"); this.Close(); } } }
private void btn_add_Click(object sender, EventArgs e) { //حساب من كمیه مطلوبه qtp = Convert.ToDouble(t_qt.Text); qtn = Convert.ToDouble(txt_qt.Text); qtr = qtp - qtn; if (txt_name.Text == string.Empty) { MessageBox.Show("رجاء ادخل اسم المادة"); txt_name.Focus(); return; } if (txt_cust.Text == string.Empty) { MessageBox.Show("رجاء ادخل اسم العمیل"); txt_cust.Focus(); return; } if (txt_sell.Text == string.Empty) { MessageBox.Show("رجاء ادخل سعر البیع"); txt_sell.Focus(); return; } if (txt_qt.Text == string.Empty) { MessageBox.Show("رجاء ادخل الكمیة"); txt_qt.Focus(); return; } else { if (id == 0) { ////add if (qtr >= 0) { tb_sell.SELL_NAME = txt_name.Text; tb_sell.SELL_CUST = txt_cust.Text; tb_sell.SELL_PRICE = Convert.ToDouble(txt_sell.Text); tb_sell.SELL_QT = Convert.ToDouble(txt_qt.Text); tb_sell.SELL_T_PRICE = (Convert.ToDouble(txt_qt.Value)) * Convert.ToDouble(txt_sell.Text); tb_sell.SELL_DATE = DateTime.Now; dbs.TB_SELL.Add(tb_sell); // تعدیل كمیه بعد بیع tb_pur.PUR_QT = qtr; dbs.Entry(tb_pur).State = System.Data.Entity.EntityState.Modified; dbs.SaveChanges(); MessageBox.Show("تم الحفظ البیع بالنجاح"); dbs = new DB_SMPEntities(); frm_sell.gridControl1.DataSource = dbs.TB_SELL.ToList(); this.Close(); } else { MessageBox.Show("كمية المطوبة غير موجود", "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error);; return; } } else { //// Edit //tb_pur.ID_PUR = id; //tb_pur.PUR_NAME = txt_name.Text; //tb_pur.PUR_TYPE = txt_type.Text; //tb_pur.PUR_CAT = txt_name.Text; //tb_pur.PUR_SUPP = txt_cust.Text; //tb_pur.PUR_DET = txt_det.Text; //tb_pur.PUR_BUY = Convert.ToDouble(txt_sell.Text); //tb_pur.PUR_SELL = Convert.ToDouble(txt_sell.Text); //tb_pur.PUR_QT = Convert.ToDouble(txt_qt.Text); //tb_pur.PUR_Tbuy = Convert.ToDouble(t_selll.Text); //tb_pur.PUR_Tsell = Convert.ToDouble(t_buy.Text); //tb_pur.PUR_TRev = Convert.ToDouble(t_qt.Text); //dbs.Entry(tb_pur).State = System.Data.Entity.EntityState.Modified; //dbs.SaveChanges(); //MessageBox.Show("تم تعدیل شراء بالنجاح"); //this.Close(); } } }