private void SaveBtn_Click(object sender, EventArgs e) { if (txtName.Text == "" || txtSalary.Text == "") { Alert.Attention("تنبـــــيه", "أدخـــــل الاســــم والراتب للضرورة"); return; } //=================================================================================== Db.EmployeesRow x = DbManager.ShopData.Employees.NewEmployeesRow(); x = DbManager.ShopData.Employees.Where(c => c.ID == TargetEmployee.ID).Single(); x.EmployeeName = txtName.Text; x.Address = txtAddess.Text; x.Phone = txtPhone.Text; x.Salary = Convert.ToDouble(txtSalary.Text); x.StartWorkAt = WorkPicker.Value; DbManager.SaveChanges(); x = null; //================================================================================== // AccountsCmd.ChangeAccountName(TargetEmployee.AccountID, txtName.Text); //--------------------------------------------------------------------------------- try { Db.PhonesRow ph = DbManager.ShopData.Phones.NewPhonesRow(); ph = DbManager.ShopData.Phones.Where(p => p.PName == TargetEmployee.EmployeeName).SingleOrDefault(); ph.Phone = txtPhone.Text; ph.PName = txtName.Text; DbManager.SaveChanges(); ph = null; } catch (Exception) { } //================================================================================== this.Hide(); }
private void SaveBtn_Click(object sender, EventArgs e) { if (txtSupplierName.Text == "") { MessageBox.Show("لا يجوز ترك الاسم فارغ", "تنبيه"); return; } ChangeAccountName(TargetSupplier.AccountID, txtSupplierName.Text); TargetSupplier.SupplierName = txtSupplierName.Text; TargetSupplier.Address = txtAddress.Text; TargetSupplier.Phone = txtPhone.Text; EditSupplier(TargetSupplier); //======================================================= try { // Edit Phone Db.PhonesRow ph = DbManager.ShopData.Phones.NewPhonesRow(); ph = DbManager.ShopData.Phones.Where(i => i.PersonID == TargetSupplier.AccountID).Single(); ph.PName = txtSupplierName.Text; ph.Phone = txtPhone.Text; DbManager.SaveChanges(); } catch (Exception) { } //================================================= ChangeAccountName(TargetSupplier.AccountID, txtSupplierName.Text); Alert.Information("تــم الحــــــفظ بنجــاح"); //================================================= this.Hide(); }
private void SaveBtn_Click(object sender, EventArgs e) { if (txtName.Text == "") { Alert.Warning("لايجــوز ترك الاسم فارغ"); return; } else { ChangeAccountName(TargetCustomer.AccountID, txtName.Text); //===================================================================== Db.CustomersRow c = DbManager.ShopData.Customers.Where(b => b.ID == TargetCustomer.ID).Single(); c.Address = txtAddress.Text; c.CustomerName = txtName.Text; c.Phone = txtPhone.Text; DbManager.SaveChanges(); //--------------------------------------------------------------------------------- try { Db.PhonesRow ph = DbManager.ShopData.Phones.NewPhonesRow(); ph = DbManager.ShopData.Phones.Where(p => p.PersonID == TargetCustomer.AccountID).Single(); ph.Phone = txtPhone.Text; ph.PName = txtName.Text; DbManager.SaveChanges(); } catch (Exception) { } this.Hide(); } }