コード例 #1
0
ファイル: EmployeeService.cs プロジェクト: tsubik/SFASystem
 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();
 }
コード例 #2
0
ファイル: EmployeeService.cs プロジェクト: tsubik/SFASystem
 public static void SaveEmployee(Employee emp)
 {
     employeeRepository.SaveOrUpdate(emp);
 }
コード例 #3
0
ファイル: EmployeeService.cs プロジェクト: tsubik/SFASystem
 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();
 }
コード例 #4
0
ファイル: EmployeeService.cs プロジェクト: tsubik/SFASystem
        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();
        }
コード例 #5
0
 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;
 }
コード例 #6
0
ファイル: SalesService.cs プロジェクト: tsubik/SFASystem
        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();
        }