public jsResponse <EmployeesCollection, Employees> EmployeesCollection_LoadAll() { jsResponse <EmployeesCollection, Employees> response = new jsResponse <EmployeesCollection, Employees>(); try { EmployeesQuery q = new EmployeesQuery(); q.Select(q.EmployeeID, q.FirstName, q.LastName); EmployeesCollection collection = new EmployeesCollection(); collection.Load(q); if (collection.Count == 0) { EnsureData(); collection = new EmployeesCollection(); collection.LoadAll(); } response.collection = collection; } catch (Exception ex) { response.exception = ex.Message; } return(response); }
static private dynamic GetEmployees(int skip, int take) { EmployeesCollection coll = null; int count = 0; Parallel.Invoke( () => { // Get the total count count = new EmployeesQuery("e", out var q) .Select(q.Count()) .ExecuteScalar <int>(); }, () => { // Get "paged" list, must order by when paging coll = new EmployeesQuery("e", out var q) .Select(q.EmployeeID, q.LastName).Skip(skip).Take(take) .OrderBy(q.LastName.Ascending) .ToCollection <EmployeesCollection>(); }); return(new { hasMore = count > (skip + take), totalCount = count, totalReturned = coll.Count, data = coll }); }
private void Form1_Load(object sender, EventArgs e) { coll = new EmployeesCollection(); coll.LoadAll(); _bindingSource.DataSource = coll; }
protected void EsDataSource1_esSelect(object sender, EntitySpaces.Web.esDataSourceSelectEventArgs e) { EmployeesCollection coll = new EmployeesCollection(); // Assign the esDataSourcSelectEvenArgs Collection property e.Collection = coll; }
public EmployeesCollection Employees_LoadAll() { EmployeesCollection coll = new EmployeesCollection(); coll.es.IsLazyLoadDisabled = true; coll.LoadAll(); return(coll); }
private async Task OnDelete(Employee emp) { if (await _messenger.Send(new AsyncYesNoMessage($"Delete {emp.Name}?"))) { _logger.Log($"Delete: {emp.Name}"); EmployeesCollection.Remove(emp); } }
protected void Page_Load(object sender, EventArgs e) { EmployeesCollection collection = new EmployeesCollection(); Label1.Text = collection.getCountOfEmployees().ToString(); Label2.Text = "$" + EmployeesIncome.getALLMontly().ToString(); Label3.Text = "$" + EmployeesIncome.getALLAn().ToString(); }
public EmployeesCollection.EmployeesCollectionWCFPacket Employees_LoadAll() { EmployeesCollection coll = new EmployeesCollection(); if (coll.LoadAll()) { return(coll); } return(null); }
static private void CollectionLoadAll() { EmployeesCollection coll = new EmployeesCollection(); if (coll.LoadAll()) { foreach (Employees emp in coll) { } } }
private void btnRefresh_Click(object sender, EventArgs e) { btnAdd.Enabled = true; btnDelete.Enabled = true; btnSave.Enabled = true; coll = new EmployeesCollection(); coll.LoadAll(); _bindingSource.DataSource = coll; }
public EmployeesCollection Employees_LoadByDynamic(string serializedQuery) { EmployeesQuery query = EmployeesQuery.SerializeHelper.FromXml( serializedQuery, typeof(EmployeesQuery), AllKnownTypes) as EmployeesQuery; EmployeesCollection coll = new EmployeesCollection(); coll.es.IsLazyLoadDisabled = true; coll.Load(query); return(coll); }
public EmployeesCollectionProxyStub Employees_LoadAll() { EmployeesCollection coll = new EmployeesCollection(); if (coll.LoadAll()) { return(coll); } return(null); }
public EmployeesCollectionProxyStub Employees_SaveCollection(EmployeesCollectionProxyStub collection) { if (collection != null) { EmployeesCollection c = collection.GetCollection(); c.Save(); return(c); } return(null); }
public EmployeesCollection Employees_Prefetch() { // Very simplistic prefetch .. EmployeesCollection coll = new EmployeesCollection(); coll.Query.Prefetch(Employees.Prefetch_OrdersCollectionByEmployeeID); coll.Query.Prefetch(Employees.Prefetch_OrdersCollectionByEmployeeID, Orders.Prefetch_OrderDetailsCollectionByOrderID); coll.Query.Load(); return(coll); }
public EmployeesCollectionProxyStub Employees_QueryForCollection(string serializedQuery) { EmployeesQuery query = EmployeesQuery.SerializeHelper.FromXml( serializedQuery, typeof(EmployeesQuery), AllKnownTypes) as EmployeesQuery; EmployeesCollection coll = new EmployeesCollection(); if (coll.Load(query)) { return(coll); } return(null); }
protected void Button1_Click(object sender, EventArgs ea) { string Name = NameTextBox.Text; string phone = PhoneNumberTextBox.Text; int department_id = int.Parse(DepartmentDropDown.SelectedItem.Value); EmployeesCollection employeesCollectionHandler = new EmployeesCollection(); ArrayList employees; employees = employeesCollectionHandler.getApproved(); foreach (Employee e in employees) { if (e.FullName.Contains(Name) || e.Phone.Contains(phone) || e.OwnDepartment.ID == department_id) { // Creating the objects that we are going to fill in the Table TableRow row = new TableRow(); TableCell id = new TableCell(); TableCell name = new TableCell(); TableCell department = new TableCell(); TableCell position = new TableCell(); TableCell view = new TableCell(); // Fill The cells id.Text = e.Id.ToString(); name.Text = e.FullName; department.Text = e.Job.Position.Department.Name; position.Text = e.Job.Position.Name; view.Text = @"<a class='btn btn-info btn-small' href=EmployeeView.aspx?id=" + e.Id + ">View</a>" + "<a class='btn btn-warning btn-small' href=EmployeeView.aspx?id=" + e.Id + ">Edit</a>"; // Add the cells to the row row.Cells.Add(id); row.Cells.Add(name); row.Cells.Add(department); row.Cells.Add(position); row.Cells.Add(view); // FOR ADMIN DELETE if (Session["admin"].ToString() == "True") { TableCell delete = new TableCell(); delete.Text = "<a href='deleteEmployee.aspx?id=" + e.Id.ToString() + "' class='btn btn-small btn-danger'>Retire Employee</a>"; row.Cells.Add(delete); } Table1.Rows.Add(row); } } }
public Hierarchical() { InitializeComponent(); EmployeesQuery q = new EmployeesQuery(); q.es.Top = 15; q.Select(q.EmployeeID, q.FirstName, q.LastName, q.BirthDate.As("ExtraColumn")); EmployeesCollection coll = new EmployeesCollection(); coll.Load(q); dataGrid1.DataSource = coll; }
static private void CollectionSave_BulkInsert() { EmployeesCollection coll = new EmployeesCollection(); Employees emp1 = coll.AddNew(); emp1.FirstName = "Cindi"; emp1.LastName = "Griffin"; Employees emp2 = coll.AddNew(); emp2.FirstName = "Frank"; emp2.LastName = "Smith"; coll.BulkInsert(); }
public jsResponse <EmployeesCollection, Employees> EmployeesCollection_Save(EmployeesCollection collection) { jsResponse <EmployeesCollection, Employees> response = new jsResponse <EmployeesCollection, Employees>(); try { collection.Save(); response.collection = collection; } catch (Exception ex) { response.exception = ex.Message; } return(response); }
private void LoadGrid() { try { coll = new EmployeesCollection(); if (coll.LoadAll()) { grid.DataSource = coll; } } catch (Exception ex) { throw; //string error = ex.Message; } }
private void btnDynamicQuery_Click(object sender, EventArgs e) { btnAdd.Enabled = false; btnDelete.Enabled = false; btnSave.Enabled = false; EmployeesQuery eq = new EmployeesQuery("eq"); OrdersQuery oq = new OrdersQuery("oq"); eq.Select(eq.EmployeeID, eq.LastName, eq.FirstName, oq.OrderID, oq.ShipCity); eq.InnerJoin(oq).On(eq.EmployeeID == oq.EmployeeID); coll = new EmployeesCollection(); coll.Load(eq); _bindingSource.DataSource = coll; }
static private void CollectionSave() { EmployeesCollection coll = new EmployeesCollection(); Employees emp1 = coll.AddNew(); emp1.FirstName = "Cindi"; emp1.LastName = "Griffin"; Employees emp2 = new Employees(); emp2.FirstName = "Frank"; emp2.LastName = "Smith"; emp2.HireDate = DateTime.Now; coll.Add(emp2); coll.Save(); }
protected void FillEmployees(ArrayList employees = null) { EmployeesCollection employeesCollectionHandler = new EmployeesCollection(); //ArrayList employees; if (employees == null) { employees = employeesCollectionHandler.getApproved(); } foreach (Employee e in employees) { // Creating the objects that we are going to fill in the Table TableRow row = new TableRow(); TableCell id = new TableCell(); TableCell name = new TableCell(); TableCell department = new TableCell(); TableCell position = new TableCell(); TableCell view = new TableCell(); // Fill The cells id.Text = e.Id.ToString(); name.Text = e.FullName; department.Text = e.Job.Position.Department.Name; position.Text = e.Job.Position.Name; view.Text = @"<a class='btn btn-info btn-small' href=EmployeeView.aspx?id=" + e.Id + ">View</a>" + "<a class='btn btn-warning btn-small' href=EmployeeView.aspx?id=" + e.Id + ">Edit</a>"; // Add the cells to the row row.Cells.Add(id); row.Cells.Add(name); row.Cells.Add(department); row.Cells.Add(position); row.Cells.Add(view); // FOR ADMIN DELETE if (Session["admin"].ToString() == "True") { TableCell delete = new TableCell(); delete.Text = "<a href='deleteEmployee.aspx?id=" + e.Id.ToString() + "' class='btn btn-small btn-danger'>Retire Employee</a>"; row.Cells.Add(delete); } Table1.Rows.Add(row); } }
public MainViewModel(ILogger logger, IMessenger messenger) { _logger = logger; this._messenger = messenger; EmployeesCollection.Add(new Employee { Name = "Fons", Salary = 2000 }); EmployeesCollection.Add(new Employee { Name = "Jim", Salary = 5000 }); EmployeesCollection.Add(new Employee { Name = "Ellen", Salary = 3000 }); Employees = new ReadOnlyObservableCollection <Employee>(this.EmployeesCollection); RaiseSalaryCommand = new RelayCommand <Employee>(OnRaiseSalary, emp => emp is object && emp.Salary < 5500); DeleteCommand = new AsyncRelayCommand <Employee>(OnDelete, emp => emp is object); }
public jsResponse <EmployeesCollection, Employees> Employees_LoadHierarchical() { jsResponse <EmployeesCollection, Employees> response = new jsResponse <EmployeesCollection, Employees>(); try { // The Main Query EmployeesQuery q = new EmployeesQuery("e"); q.Select(q.EmployeeID, q.FirstName, q.LastName, q.City, q.Country, q.HomePhone, q.Region, q.PostalCode, q.Title); q.Where(q.EmployeeID < 7); // The OrdersCollection OrdersQuery o1 = q.Prefetch <OrdersQuery>(Employees.Prefetch_OrdersCollectionByEmployeeID); EmployeesQuery emp1 = o1.GetQuery <EmployeesQuery>(); o1.Where(emp1.EmployeeID < 7); // The OrdersDetailsCollection OrderDetailsQuery od = q.Prefetch <OrderDetailsQuery>(Employees.Prefetch_OrdersCollectionByEmployeeID, Orders.Prefetch_OrderDetailsCollectionByOrderID); EmployeesQuery emp2 = od.GetQuery <EmployeesQuery>(); OrdersQuery o2 = od.GetQuery <OrdersQuery>(); od.Where(emp2.EmployeeID < 7); // Load It EmployeesCollection coll = new EmployeesCollection(); if (coll.Load(q)) { response.collection = coll; response.columnCollection["Employees"] = jsColumn.PopulateColumns(coll[0]); response.columnCollection["Orders"] = jsColumn.PopulateColumns(coll[0].OrdersCollectionByEmployeeID[0]); response.columnCollection["OrderDetails"] = jsColumn.PopulateColumns(coll[0].OrdersCollectionByEmployeeID[0].OrderDetailsCollectionByOrderID[0]); } } catch (Exception ex) { response.exception = ex.Message; } return(response); }
public EmployeesCollection Employees_PrefetchSophisticated() { // EmployeeID = "1" EmployeesCollection coll = new EmployeesCollection(); coll.Query.Where(coll.Query.EmployeeID == 1); // Orders Query (nothing fancy, just ensure we're only getting Orders for EmployeeID = 1 OrdersQuery o = coll.Query.Prefetch <OrdersQuery>(Employees.Prefetch_OrdersCollectionByEmployeeID); EmployeesQuery e1 = o.GetQuery <EmployeesQuery>(); o.Where(e1.EmployeeID == 1); // OrderDetailsQuery (here we even limit the Select in addition to EmployeeID = 1) notice the "false" OrderDetailsQuery od = coll.Query.Prefetch <OrderDetailsQuery>(false, Employees.Prefetch_OrdersCollectionByEmployeeID, Orders.Prefetch_OrderDetailsCollectionByOrderID); EmployeesQuery e2 = od.GetQuery <EmployeesQuery>(); od.Where(e2.EmployeeID == 1); od.Select(od.OrderID, od.ProductID, od.UnitPrice); coll.Query.Load(); return(coll); }
static private void Filter() { EmployeesCollection coll = new EmployeesCollection(); if (coll.LoadAll()) { // Filter on FirstName containing an "a" coll.Filter = coll.AsQueryable().Where(d => d.FirstName.Contains("a")); foreach (Employees employee in coll) { // Each employee's FirstName has an 'a' in } // Clear the filter coll.Filter = null; foreach (Employees employee in coll) { // All employees are now back in the list } } }
public ViewModel() { EmployeesCollection = new EmployeesCollection(); GroupDescriptions = new ObservableCollection <GroupDescription>(); }
protected void fillUnApprovedEmployees() { // Creating a row TableRow row = new TableRow(); // Creating the cells TableHeaderCell id = new TableHeaderCell(); TableHeaderCell name = new TableHeaderCell(); TableHeaderCell department = new TableHeaderCell(); TableHeaderCell position = new TableHeaderCell(); TableHeaderCell view = new TableHeaderCell(); TableHeaderCell approveHeader = new TableHeaderCell(); // Adding the text to each cell id.Text = "ID#"; name.Text = "Name"; department.Text = "Department"; position.Text = "Position"; view.Text = "Options"; approveHeader.Text = "Approve"; // add the cells to the row row.Cells.Add(id); row.Cells.Add(name); row.Cells.Add(department); row.Cells.Add(position); row.Cells.Add(view); row.Cells.Add(approveHeader); TableHeaderCell deleteHeader = new TableHeaderCell(); deleteHeader.Text = "Delete"; row.Cells.Add(deleteHeader); // Add the row to the table Table2.Rows.Add(row); EmployeesCollection employeesCollectionHandler = new EmployeesCollection(); ArrayList employees; employees = employeesCollectionHandler.getUnApproved(); if (employees.Count == 0) { panel1.Visible = false; } foreach (Employee e in employees) { // Creating the objects that we are going to fill in the Table TableRow valuesRow = new TableRow(); TableCell idvalue = new TableCell(); TableCell namevalue = new TableCell(); TableCell departmentvalue = new TableCell(); TableCell positionvalue = new TableCell(); TableCell viewvalue = new TableCell(); TableCell approve = new TableCell(); // Fill The cells idvalue.Text = e.Id.ToString(); namevalue.Text = e.FullName; departmentvalue.Text = e.Job.Position.Department.Name; positionvalue.Text = e.Job.Position.Name; viewvalue.Text = @"<a class='btn btn-info btn-small' href=EmployeeView.aspx?id=" + e.Id + ">View</a>"; approve.Text = @"<a class='btn btn-warning btn-small' href=approveEmployee.aspx?id=" + e.Id + "><i class='icon-ok icon-white'></i> Approve</a>"; // Add the cells to the row valuesRow.Cells.Add(idvalue); valuesRow.Cells.Add(namevalue); valuesRow.Cells.Add(departmentvalue); valuesRow.Cells.Add(positionvalue); valuesRow.Cells.Add(viewvalue); valuesRow.Cells.Add(approve); TableCell delete = new TableCell(); delete.Text = "<a href='deleteEmployee.aspx?id=" + e.Id.ToString() + "' class='btn btn-small btn-danger'>Delete</a>"; valuesRow.Cells.Add(delete); Table2.Rows.Add(valuesRow); } }
public jsResponse <EmployeesCollection, Employees> Employees_Pager(jsPagerRequest request) { jsResponse <EmployeesCollection, Employees> response = new jsResponse <EmployeesCollection, Employees>(); try { // We send the the same data they sent us back response.pagerRequest = request; EmployeesQuery q = null; if (response.pagerRequest.getTotalRows == true) { // Get the total count of rows in the Employee table q = new EmployeesQuery(); q.es.CountAll = true; response.pagerRequest.totalRows = q.ExecuteScalar <int>(); } q = new EmployeesQuery(); q.Select(q.EmployeeID, q.FirstName, q.LastName, q.Title); if (request.sortCriteria != null && request.sortCriteria.Length > 0) { for (int i = 0; i < request.sortCriteria.Length; i++) { jsPagerSortCriteria sort = request.sortCriteria[i]; q.OrderBy(sort.column, sort.direction.ToUpper().StartsWith("A") ? esOrderByDirection.Ascending : esOrderByDirection.Descending); } } else { // Default sort if none is specified q.OrderBy(q.EmployeeID.Ascending); } if (request.filterCriteria != null && request.filterCriteria.Length > 0) { esComparison comp = null; for (int i = 0; i < request.filterCriteria.Length; i++) { jsPagerFilterCriteria filter = request.filterCriteria[i]; comp = q.ManualWhere(filter.column, filter.operation, filter.criteria1, filter.criteria2, filter.conjuction); } q.Where(comp); } // Set the paging indicators up q.es.PageNumber = request.pageNumber; q.es.PageSize = request.pageSize; EmployeesCollection coll = new EmployeesCollection(); coll.Load(q); response.pagerRequest.getTotalRows = false; response.collection = coll; } catch (Exception ex) { response.exception = ex.Message; } return(response); }