Beispiel #1
0
 public static IList<Task> GetNewestTaskForEmployee(Employee emp, int howMany)
 {
     Repository<Task, Guid> rep = new Repository<Task, Guid>();
     var result = from t in rep.GetQueryable()
                  where t.AssignedTo == emp && t.TaskStatus.DictionaryNumber != (byte)TaskStatusEnum.Zakonczone
                  orderby t.DateCreated ascending
                  select t;
     return result.Take(howMany).ToList();
 }
Beispiel #2
0
 public static void SaveEmployee(Employee emp)
 {
     employeeRepository.SaveOrUpdate(emp);
 }
Beispiel #3
0
 public static IList<Task> GetTaskToApprove(Employee emp, int howMany)
 {
     Repository<Task, Guid> rep = new Repository<Task, Guid>();
     var result = from t in rep.GetQueryable()
                  where t.GivenBy == emp && t.DateExecuted != null
                  orderby t.DateExecuted ascending
                  select t;
     return result.Take(howMany).ToList();
 }
Beispiel #4
0
        public static IList<Task> GetTasks(Employee assignedTo, Employee givenBy, Employee createdBy, Dictionary taskStatus,
            bool showOnlyApproved, DateTime? dateCreatedFrom, DateTime? dateCreatedTo)
        {
            Repository<Task, Guid> rep = new Repository<Task, Guid>();
            var result = from t in rep.GetQueryable() select t;
            if (assignedTo != null)
                result = result.Where(t => t.AssignedTo == assignedTo);
            if (givenBy != null)
                result = result.Where(t => t.GivenBy == givenBy);
            if (createdBy != null)
                result = result.Where(t => t.CreatedBy == createdBy);
            if (taskStatus != null)
                result = result.Where(t => t.TaskStatus == taskStatus);
            if (dateCreatedFrom.HasValue)
                result = result.Where(t => t.DateCreated > dateCreatedFrom.Value);
            if (dateCreatedTo.HasValue)
                result = result.Where(t => t.DateCreated < dateCreatedTo.Value);
            if (showOnlyApproved)
                result = result.Where(t => t.IsApproved == true);

            return result.ToList();
        }
 public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
 {
     MembershipUser user = null;
     Employee employee = new Employee();
     employee.Login = username;
     employee.PasswordSalt = CreateSalt(5);
     employee.PasswordHash = CreatePasswordHash(password, employee.PasswordSalt);
     employee.Active = true;
     employee.CreationDate = DateTime.Now;
     employee.LastActivityDate = DateTime.Now;
     EmployeeService.SaveEmployee(employee);
     status = MembershipCreateStatus.Success;
     user = new MembershipUser(this.Name, employee.Login, null, string.Empty, string.Empty, string.Empty, true, false, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now);
     return user;
 }
Beispiel #6
0
        public static IList<Order> GetOrders(Customer customer, Employee emp, Territory terr,
            DateTime? startDate, DateTime? endDate, Dictionary orderStatus)
        {
            Repository<Order, Guid> rep = new Repository<Order, Guid>();
            var result = from o in rep.GetQueryable() select o;
            if (customer != null)
                result = result.Where(o => o.CustomerFacility.Customer == customer);
            if (emp != null)
                result = result.Where(o => o.Employee == emp);
            if (terr != null)
                result = result.Where(o => o.Territory == terr);
            if (orderStatus != null)
                result = result.Where(o => o.OrderStatus == orderStatus);
            if (startDate.HasValue)
                result = result.Where(o => o.OrderDate > startDate.Value);
            if (endDate.HasValue)
                result = result.Where(o => o.OrderDate < endDate.Value);

            return result.ToList();
        }