コード例 #1
0
 public Employees Employees_GetByPrimaryKey(System.Int32 employeeID)
 {
     Employees obj = new Employees();
     if (obj.LoadByPrimaryKey(employeeID))
     {
         return obj;
     }
     return null;
 }
コード例 #2
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            // Create a new Employee
            Employees emp = new Employees();
            emp.FirstName = "David";
            emp.LastName = "Parsons";

            // Add it to the context so RIA knows about it
            employeesDomainDataSource.DataView.Add(emp);
        }
コード例 #3
0
        public Employees Employees_QueryForEntity(string serializedQuery)
        {
            EmployeesQuery query = EmployeesQuery.SerializeHelper.FromXml(
                serializedQuery, typeof(EmployeesQuery), AllKnownTypes) as EmployeesQuery;

            Employees obj = new Employees();
            if (obj.Load(query))
            {
                return obj;
            }

            return null;
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: BrewDawg/Tiraggo
        private void Form1_Load(object sender, EventArgs e)
        {
            Employees emp = new Employees();
            emp.EmployeeID = 44;

            string ln = emp.LastName;

            emp.LastName = "Griffin";
            emp.FirstName = "Mike";

            emp.Save();
            LoadGrid();
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: HoosierMike/Tiraggo
 private void Form1_Load(object sender, EventArgs e)
 {
     try
     {
         Employees emp = new Employees();
         if (emp.LoadByPrimaryKey(3))
         {
             this.textBox1.Text = emp.LastName + ", " + emp.FirstName;
         }
     }
     catch (Exception ex)
     {
         string error = ex.Message;
     }
 }
コード例 #6
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                DataGridViewSelectedRowCollection selectedRows = dataGrid.SelectedRows;

                foreach (DataGridViewRow row in selectedRows)
                {
                    BusinessObjects.Employees emp = row.DataBoundItem as BusinessObjects.Employees;
                    emp.FirstName = "Changed";
                    emp.LastName  = "Changed";
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
コード例 #7
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DataGridViewSelectedRowCollection selectedRows = dataGrid.SelectedRows;

                foreach (DataGridViewRow row in selectedRows)
                {
                    BusinessObjects.Employees emp = row.DataBoundItem as BusinessObjects.Employees;

                    if (emp == null)
                    {
                        continue;              // they tried to delete the "New Record Row"
                    }
                    emp.MarkAsDeleted();
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
コード例 #8
0
        public jsResponse<EmployeesCollection, Employees> Employees_Save(Employees entity)
        {
            jsResponse<EmployeesCollection, Employees> response = new jsResponse<EmployeesCollection, Employees>();

            try
            {
                entity.Save();
                response.entity = entity;
            }
            catch (Exception ex)
            {
                response.exception = ex.Message;
            }

            return response;
        }
コード例 #9
0
 public void UpdateEmployees(BusinessObjects.Employees obj)
 {
     obj.AcceptChanges();
     obj.MarkAllColumnsAsDirty(EntitySpaces.Interfaces.esDataRowState.Modified);
     obj.Save();
 }
コード例 #10
0
        public Employees Employees_SaveEntity(Employees entity)
        {
            if (entity != null)
            {
                entity.Save();

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

            return null;
        }
コード例 #11
0
        public jsResponse<EmployeesCollection, Employees> Employees_LoadByPrimaryKeyHierarchical(int primaryKey)
        {
            jsResponse<EmployeesCollection, Employees> response = new jsResponse<EmployeesCollection, Employees>();

            EmployeesQuery q = new EmployeesQuery();
            q.Select(q.EmployeeID, q.FirstName, q.LastName, q.LastName.As("ExtraColumn"), q.EmployeeID.As("IDasExtraColumn"));
            q.Where(q.EmployeeID == primaryKey);

            Employees emp = new Employees();
            emp.Load(q);

            int count1 = emp.OrdersCollectionByEmployeeID.Count;
            int count2 = emp.OrdersCollectionByEmployeeID[0].OrderDetailsCollectionByOrderID.Count;

            response.entity = emp;

            return response;
        }
コード例 #12
0
 public void DeleteEmployees(BusinessObjects.Employees obj)
 {
     BusinessObjects.Employees.Delete(obj.EmployeeID.Value);
 }
コード例 #13
0
		public jsResponse<OrdersCollection, Orders> Employees_OrdersCollectionByEmployeeID(System.Int32 employeeID)
		{
			jsResponse<OrdersCollection, Orders> response = new jsResponse<OrdersCollection, Orders>();

			try
			{
				Employees entity = new Employees();
				entity.EmployeeID = employeeID;
				response.collection = entity.OrdersCollectionByEmployeeID;
			}
			catch (Exception ex)
			{
				response.exception = ex.Message;
			}

			return response;		
		}
コード例 #14
0
		public jsResponse<TerritoriesCollection, Territories> Employees_UpToTerritoriesCollection(System.Int32 employeeID)
		{
			jsResponse<TerritoriesCollection, Territories> response = new jsResponse<TerritoriesCollection, Territories>();

			try
			{
				Employees entity = new Employees();
				entity.EmployeeID = employeeID;
				response.collection = entity.UpToTerritoriesCollection;
			}
			catch (Exception ex)
			{
				response.exception = ex.Message;
			}

			return response;		
		}
コード例 #15
0
 public void InsertEmployees(BusinessObjects.Employees obj)
 {
     obj.RowState = EntitySpaces.Interfaces.esDataRowState.Added;
     obj.Save();
 }
コード例 #16
0
        private void EnsureData()
        {
            EmployeesQuery q = new EmployeesQuery();
            q.tg.CountAll = true;

            int i = q.ExecuteScalar<int>();

            if (i == 0)
            {
                Employees emp = new Employees();
                emp.FirstName = "Mike";
                emp.LastName = "Griffin";
                emp.Save();
            }
        }
コード例 #17
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     BusinessObjects.Employees emp = coll.AddNew();
     emp.FirstName = "Mr.";
     emp.LastName  = "EntitySpaces";
 }
コード例 #18
0
        public jsResponse<EmployeesCollection, Employees> Employees_LoadByPrimaryKey(System.Int32 employeeID)
        {
            jsResponse<EmployeesCollection, Employees> response = new jsResponse<EmployeesCollection, Employees>();

            try
            {
                Employees entity = new Employees();
                if (entity.LoadByPrimaryKey(employeeID))
                {
                    response.entity = entity;
                }
            }
            catch (Exception ex)
            {
                response.exception = ex.Message;
            }

            return response;
        }
コード例 #19
0
		public jsResponse<EmployeesCollection, Employees> Employees_UpToEmployeesByReportsTo(System.Int32 employeeID)
		{
			jsResponse<EmployeesCollection, Employees> response = new jsResponse<EmployeesCollection, Employees>();

			try
			{
				Employees entity = new Employees();
				entity.EmployeeID = employeeID;
				response.entity = entity.UpToEmployeesByReportsTo;
			}
			catch (Exception ex)
			{
				response.exception = ex.Message;
			}

			return response;		
		}