Ejemplo n.º 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            EmployeesProxyStub emp = new EmployeesProxyStub();

            emp.FirstName = "Mr.";
            emp.LastName  = "EntitySpaces";
            coll.Collection.Add(emp);
        }
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            EmployeesProxyStub emp = EmployeesDataGrid.SelectedItem as EmployeesProxyStub;

            employees.Collection.Remove(emp);

            emp.MarkAsDeleted();
            service.Employees_SaveEntityAsync(emp);
        }
Ejemplo n.º 3
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection selectedRows = dataGrid.SelectedRows;

            foreach (DataGridViewRow row in selectedRows)
            {
                EmployeesProxyStub emp = row.DataBoundItem as EmployeesProxyStub;
                emp.FirstName = "Changed";
                emp.LastName  = "Changed";
            }
        }
Ejemplo n.º 4
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection selectedRows = dataGrid.SelectedRows;

            foreach (DataGridViewRow row in selectedRows)
            {
                EmployeesProxyStub emp = row.DataBoundItem as EmployeesProxyStub;
                emp.MarkAsDeleted();
            }

            coll = svc.Employees_SaveCollection(coll);
            this.dataGrid.DataSource = coll.Collection;
        }
        public EmployeesProxyStub Employees_SaveEntity(EmployeesProxyStub entity)
        {
            if (entity != null)
            {
                entity.Entity.Save();

                if (entity.Entity.RowState != esDataRowState.Deleted && entity.Entity.RowState != esDataRowState.Invalid)
                {
                    return(entity);
                }
            }

            return(null);
        }
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            if (employees == null)
            {
                employees = new EmployeesCollectionProxyStub();
                EmployeesDataGrid.ItemsSource = employees.Collection;
            }

            if (RecordsAdded++ < 5)
            {
                EmployeesProxyStub newEmp = new EmployeesProxyStub();
                newEmp.FirstName = "Scott";
                newEmp.LastName  = "Schecter";

                employees.Collection.Add(newEmp);
            }
        }
		public EmployeesProxyStub Employees_SaveEntity(EmployeesProxyStub entity)
		{
			if (entity != null)
			{
				entity.Entity.Save();

				if (entity.Entity.RowState != esDataRowState.Deleted && entity.Entity.RowState != esDataRowState.Invalid)
				{
					return entity;
				}
			}

			return null;
		}