/// <summary> Retrieves in this ShiftCollection object all ShiftEntity objects which are related via a relation of type 'm:n' with the passed in DepartmentEntity. /// All current elements in the collection are removed from the collection.</summary> /// <param name="departmentInstance">DepartmentEntity object to be used as a filter in the m:n relation</param> /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param> /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param> /// <param name="pageNumber">The page number to retrieve.</param> /// <param name="pageSize">The page size of the page to retrieve.</param> /// <returns>true if the retrieval succeeded, false otherwise</returns> public virtual bool GetMultiManyToManyUsingDepartmentCollectionViaEmployeeDepartmentHistory(IEntity departmentInstance, long maxNumberOfItemsToReturn, ISortExpression sortClauses, int pageNumber, int pageSize) { if (!base.SuppressClearInGetMulti) { this.Clear(); } ShiftDAO dao = DAOFactory.CreateShiftDAO(); return(dao.GetMultiUsingDepartmentCollectionViaEmployeeDepartmentHistory(base.Transaction, this, maxNumberOfItemsToReturn, sortClauses, base.EntityFactoryToUse, departmentInstance, pageNumber, pageSize)); }
/// <summary> Retrieves in this ShiftCollection object all ShiftEntity objects which are related via a relation of type 'm:n' with the passed in EmployeeEntity. /// All current elements in the collection are removed from the collection.</summary> /// <param name="employeeInstance">EmployeeEntity object to be used as a filter in the m:n relation</param> /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param> /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param> /// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch.</param> /// <returns>true if the retrieval succeeded, false otherwise</returns> public bool GetMultiManyToManyUsingEmployeeCollectionViaEmployeeDepartmentHistory(IEntity employeeInstance, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IPrefetchPath prefetchPathToUse) { if (!base.SuppressClearInGetMulti) { this.Clear(); } ShiftDAO dao = DAOFactory.CreateShiftDAO(); return(dao.GetMultiUsingEmployeeCollectionViaEmployeeDepartmentHistory(base.Transaction, this, maxNumberOfItemsToReturn, sortClauses, base.EntityFactoryToUse, employeeInstance, prefetchPathToUse)); }
private void Add_btn_Click(object sender, RoutedEventArgs e) { UserEntity curCashier = comboBox.SelectedItem as UserEntity; UserShiftEntity temp = new UserShiftEntity(); temp.CashierID = curCashier.UserID; temp.Shift = int.Parse(textBlock_Shift.Text[5].ToString()); temp.Week = DateTime.Today.DayOfYear / 7; temp.WeekDay = textBlock_WeekDay.Text; ShiftDAO dao = new ShiftDAO(); dao.insert(temp); this.Close(); }
/// <summary> Gets a scalar value, calculated with the aggregate and expression specified. the field index specified is the field the expression and aggregate are applied on.</summary> /// <param name="fieldIndex">Field index of field to which to apply the aggregate function and expression</param> /// <param name="expressionToExecute">The expression to execute. Can be null</param> /// <param name="aggregateToApply">Aggregate function to apply. </param> /// <param name="filter">The filter to apply to retrieve the scalar</param> /// <param name="relations">The relations to walk</param> /// <param name="groupByClause">The groupby clause to apply to retrieve the scalar</param> /// <returns>the scalar value requested</returns> public virtual object GetScalar(ShiftFieldIndex fieldIndex, IExpression expressionToExecute, AggregateFunction aggregateToApply, IPredicate filter, IRelationCollection relations, IGroupByCollection groupByClause) { EntityFields fields = new EntityFields(1); fields[0] = EntityFieldFactory.Create(fieldIndex); if ((fields[0].ExpressionToApply == null) || (expressionToExecute != null)) { fields[0].ExpressionToApply = expressionToExecute; } if ((fields[0].AggregateFunctionToApply == AggregateFunction.None) || (aggregateToApply != AggregateFunction.None)) { fields[0].AggregateFunctionToApply = aggregateToApply; } ShiftDAO dao = DAOFactory.CreateShiftDAO(); return(dao.GetScalar(fields, base.Transaction, filter, relations, groupByClause)); }
private void Add_btn_Click(object sender, RoutedEventArgs e) { UserEntity curCashier = comboBox.SelectedItem as UserEntity; UserShiftEntity temp = new UserShiftEntity { CashierID = curCashier.UserID, Shift = int.Parse(textBlock_Shift.Text[5].ToString()), Week = DateTime.Today.DayOfYear / 7, WeekDay = textBlock_WeekDay.Text }; ShiftDAO dao = new ShiftDAO(); dao.insert(temp); Manage_Shift_Admin.isUpdate = true; Close(); }
//async thì c# tự hiểu là tạo thread mới private async Task LoadShift(ShiftMapping map) { //tạo kiểu task await Task.Run(() => { //có cập nhật UI thì phải xài hàm này để đảm bảo không conflict UI this.Dispatcher.Invoke(() => { //đoạn này của m if (map.shift.Status == 0) { Object Id = new { Week = DateTime.Today.DayOfYear / 7, WeekDay = map.shift.WeekDay, Shift = map.shift.Shift }; ShiftDAO dao = new ShiftDAO(); UserShiftEntity sample = dao.get(Id, typeof(UserShiftEntity)) as UserShiftEntity; map.button.Visibility = Visibility.Hidden; BrushConverter bc = new BrushConverter(); map.textBlock.Background = (Brush)bc.ConvertFrom("#DCDCDC"); map.textBlock.Text = (new UserDAO().get(sample.CashierID) as UserEntity) .FullName.Trim(); map.textBlock.Visibility = Visibility.Visible; } else { map.button.Visibility = Visibility.Visible; map.textBlock.Visibility = Visibility.Hidden; } }); }); }
private async void Reset_Shift_btn_Click(object sender, RoutedEventArgs e) { Reset_Shift_btn.Visibility = Visibility.Hidden; //quăng phần update dưới db cho 1 thread khác, UI không quan tâm phần này Task t = Task.Run(() => { ShiftDAO dao = new ShiftDAO(); List <UserShiftEntity> data = dao.getAll() as List <UserShiftEntity>; List <UserShiftEntity> Weekdata = data.Where(x => x.Week == DateTime.Today.DayOfYear / 7).ToList(); foreach (var c in Weekdata) { dao.delete(c); } }); ShiftTime.resetShift(); Page_Loaded(null, null); MessageBox.Show("RESET DONE!", "INFO", MessageBoxButton.OK, MessageBoxImage.Information); await t; Reset_Shift_btn.Visibility = Visibility.Visible; }
private ShiftBLO() { baseDao = ShiftDAO.Current; dao = ShiftDAO.Current; }
/// <summary> Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary> /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param> /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param> /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param> /// <param name="relations">The set of relations to walk to construct to total query.</param> /// <param name="pageNumber">The page number to retrieve.</param> /// <param name="pageSize">The page size of the page to retrieve.</param> /// <returns>DataTable with the rows requested.</returns> public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, int pageNumber, int pageSize) { ShiftDAO dao = DAOFactory.CreateShiftDAO(); return(dao.GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize)); }
public Shift GetShift(int shiftID) { ShiftDAO sDAO = new ShiftDAO(); return(sDAO.GetShift(shiftID)); }
public List <Shift> GetAllShifts() { ShiftDAO sDAO = new ShiftDAO(); return(sDAO.GetAllShifts()); }