Exemple #1
0
 public bool EditCustomer(Db.CustomersRow cst)
 {
     Db.CustomersRow c = DbManager.ShopData.Customers.Where(b => b.ID == cst.ID && b.Status == "Active").Single();
     c.CustomerName = cst.CustomerName;
     c.Address      = cst.Address;
     c.Phone        = cst.Phone;
     c.Status       = cst.Status;
     DbManager.SaveChanges();
     return(true);
 }
Exemple #2
0
        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();
            }
        }