private void AddProduct()
 {
     this.Products.Insert(0, new Product {
         ProductName = "TestProduct", UnitsInStock = 10, Discontinued = false
     });
     _serviceAgent.Flush(this.Products, (error) => ProductsFlushed(error));
 }
Exemple #2
0
 private void AddProduct()
 {
     this.Customers.Insert(0, new Customer {
         Name = "TestProduct", Email = "asd", Phone = "asd", Address = "asd"
     });
     _serviceAgent.Flush(this.Customers, (error) => CustomersFlushed(error));
 }
Exemple #3
0
        private void AddPerson()
        {
            Boolean isValid = ValidateInput();

            if (isValid && UserId == 0)
            {
                if (IsMale)
                {
                    this.Gender = 'M';
                }
                else if (this.IsFemale)
                {
                    this.Gender = 'F';
                }
                this.People.Insert(0, new Person {
                    FirstName = FirstName, LastName = LastName, Birthdate = Birthdate, Birthplace = Birthplace, Gender = Gender, Phone = Phone, MartialStatus = MartialStatus, Employed = Employed
                });
                _serviceAgent.Flush(this.People, (error) => PeopleFlushed(error));
                Message = "";
                this.CloseWindow();
            }
            else if (isValid)
            {
                if (IsMale)
                {
                    this.Gender = 'M';
                }
                else if (this.IsFemale)
                {
                    this.Gender = 'F';
                }
                Person person = new Person {
                    Mode = emMode.update, UserId = this.UserId, FirstName = FirstName, LastName = LastName, Birthdate = Birthdate, Birthplace = Birthplace, Gender = Gender, Phone = Phone, MartialStatus = MartialStatus, Employed = Employed
                };
                var found = People.FirstOrDefault(x => x.UserId == this.UserId);
                int i     = People.IndexOf(found);
                People[i] = person;
                _serviceAgent.Flush(this.People, (error) => PeopleFlushed(error));
                this.CloseWindow();
            }
        }