Beispiel #1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public GetCompanyInvolve(IEmployee mockIEmployee, IAccountBll mockIAccountBll,
                          IDepartmentBll mockIDepartmentBll)
 {
     _dalEmployee    = mockIEmployee;
     _IAccountBll    = mockIAccountBll;
     _IDepartmentBll = mockIDepartmentBll;
 }
Beispiel #2
0
 /// <summary>
 /// 构造函数,为测试
 /// </summary>
 /// <param name="currDate"></param>
 /// <param name="days"></param>
 /// <param name="iAccountBll"></param>
 /// <param name="iVacationmock"></param>
 public AutoRemindVacation(DateTime currDate, int days, IAccountBll iAccountBll, IVacation iVacationmock)
 {
     _Days        = days;
     _CurrDate    = currDate;
     _IAccountBll = iAccountBll;
     _Dal         = iVacationmock;
 }
Beispiel #3
0
 private void BindBll()
 {
     _IPosition   = BllInstance.PositionBllInstance;
     _IDepartment = BllInstance.DepartmentBllInstance;
     _IAccount    = BllInstance.AccountBllInstance;
     _IBulletin   = BllInstance.BulletinBllInstance;
 }
 /// <summary>
 /// 测试专用
 /// </summary>
 public AttendanceOutInRecord(IEmployee mockEmployee, IAttendanceInAndOutRecord dalAttendanceInAndOutRecord, IAccountBll mockAccountBll, Account loginUser)
 {
     _dalEmployee = mockEmployee;
     _LoginUser   = loginUser;
     _dalAttendanceInAndOutRecord = dalAttendanceInAndOutRecord;
     _IAccountBll = mockAccountBll;
 }
        protected override void Validation()
        {
            if (_IAccountBll == null)
            {
                _IAccountBll = BllInstance.AccountBllInstance;
            }
            _ItsAccount = _IAccountBll.GetAccountByName(_EmpName);
            // _ItsEmployee = _EmployeeDal.GetEmployeeByAccountID(account.Id);

            //_ItsEmployee = _EmployeeDal.GetEmployeeByAccountID(_EmpName);
            if (_EmpName == null || _ItsAccount == null)
            {
                BllUtility.ThrowException(BllExceptionConst._Employee_Not_Found);
            }
            if (!IsLoginUserManage(_ItsAccount, _LoginAccount))
            {
                throw new ApplicationException("没有权限访问");
            }
            List <AttendanceBase> allAttendances = _AttendanceDal.GetAttendanceByEmpId(_ItsAccount.Id);

            foreach (AttendanceBase attendance in allAttendances)
            {
                if (IsTheSameAttendanceType(attendance) && AlreadyHaveTheSameDay(attendance))
                {
                    BllUtility.ThrowException(RepetExceptions());
                }
            }
        }
Beispiel #6
0
 /// <summary>
 /// 为AddEmployeeProxy调用
 /// </summary>
 /// <param name="employee"></param>
 /// <param name="operatoraccount"></param>
 public AddEmployee(Employee employee, Account operatoraccount)
 {
     _IAccountBll     = BllInstance.AccountBllInstance;
     _IDepartmentBll  = BllInstance.DepartmentBllInstance;
     _Employee        = employee;
     _Operatoraccount = operatoraccount;
 }
Beispiel #7
0
 /// <summary>
 /// 构造函数 为测试
 /// </summary>
 /// <param name="mockIDiyProcessDal"></param>
 /// <param name="mockIEmployeeDiyProcessDal"></param>
 /// <param name="mockIAccountBll"></param>
 /// <param name="mockIDepartmentBll"></param>
 public GetDiyProcess(IDiyProcessDal mockIDiyProcessDal, IEmployeeDiyProcessDal mockIEmployeeDiyProcessDal,
                      IAccountBll mockIAccountBll, IDepartmentBll mockIDepartmentBll)
 {
     _DiyProcessDal         = mockIDiyProcessDal;
     _DiyEmployeeProcessDal = mockIEmployeeDiyProcessDal;
     _IAccountBll           = mockIAccountBll;
     _IDepartmentBll        = mockIDepartmentBll;
 }
Beispiel #8
0
 /// <summary>
 /// 获取员工信息方法构造函数 测试
 /// </summary>
 public GetEmployee(IEmployee mockIEmployee, IAccountBll mockIAccountBll, IEmployeeSkill mockIEmployeeSkill,
                    IDepartmentBll mockIDepartmentBll, IEmployeeAdjustRule mockIEmployeeAdjustRule)
 {
     _dalEmployee           = mockIEmployee;
     _IAccountBll           = mockIAccountBll;
     _dalEmployeeSkill      = mockIEmployeeSkill;
     _IDepartmentBll        = mockIDepartmentBll;
     _EmployeeAdjustRuleDal = mockIEmployeeAdjustRule;
 }
        public IAccountDomain CreateDomainObj()
        {
            IAccountBllFactory                     accountBllFactory       = new AccountBllFactory();
            IAccountBll <AccountModel>             accountBll              = accountBllFactory.CreateBllObj();
            IAccountDetailBllFactory               accountDetailBllFactory = new AccountDetailBllFactory();
            IAccountDetailBll <AccountDetailModel> accountDetailBll        = accountDetailBllFactory.CreateBllObj();

            return(new AccountDomain(accountBll, accountDetailBll));
        }
 ///<summary>
 ///AddTrainCourse的构造函数,专为测试提供
 ///</summary>
 public UpdateTrainCourse(Course course, List <Skill> skills, List <Account> employees, ITrain iTrain, IEmployee iemployee, IAccountBll mockIAccountBll, Account loginUser)
 {
     _Course      = course;
     _Skills      = skills;
     _Employees   = employees;
     _DalTrain    = iTrain;
     _EmployeeDal = iemployee;
     _IAccountBll = mockIAccountBll;
     _LoginUser   = loginUser;
 }
Beispiel #11
0
 /// <summary>
 /// 获得请假的方法
 /// </summary>
 /// <param name="mockLeaveRequest"></param>
 /// <param name="mockLeaveRequestFlow"></param>
 /// <param name="mockILeaveRequestType"></param>
 /// <param name="mockIAccountBll"></param>
 /// <param name="mockIDepartmentBll"></param>
 public GetLeaveRequest(ILeaveRequestDal mockLeaveRequest, ILeaveRequestFlowDal mockLeaveRequestFlow,
                        ILeaveRequestType mockILeaveRequestType, IAccountBll mockIAccountBll,
                        IDepartmentBll mockIDepartmentBll)
 {
     _DalLeaveRequest     = mockLeaveRequest;
     _DalLeaveRequestFlow = mockLeaveRequestFlow;
     _DalLeaveRequestType = mockILeaveRequestType;
     _IAccountBll         = mockIAccountBll;
     _IDepartmentBll      = mockIDepartmentBll;
 }
 /// <summary>
 /// for test
 /// </summary>
 /// <param name="mockEmployee"></param>
 /// <param name="mockPlanDuty"></param>
 /// <param name="mockAccount"></param>
 /// <param name="mockInAndOut"></param>
 public GetEmployeeAttendanceStatistics(IEmployee mockEmployee, IPlanDutyDal mockPlanDuty, IAccountBll mockAccount, IAttendanceInAndOutRecord mockInAndOut)
 {
     _dalEmployee  = mockEmployee;
     _IPlanDutyDal = mockPlanDuty;
     _IAccountBll  = mockAccount;
     _dalAttendanceInAndOutRecord = mockInAndOut;
     _GetOutApplication           = new GetOutApplication();
     _GetLeaveRequest             = new GetLeaveRequest();
     _GetOverWork = new GetOverWork();
 }
 public AccountsController(IBllFactory bllFactory, IJwtFactory jwtFactory, IOptions <JwtIssuerOptions> jwtOptions, UserManager <AppUser> userManager) : base(bllFactory)
 {
     if (bllFactory == null)
     {
         throw new Exception("IBllFactory");
     }
     _accountBll  = bllFactory.AccountBll;
     _jwtFactory  = jwtFactory;
     _jwtOptions  = jwtOptions.Value;
     _userManager = userManager;
 }
Beispiel #14
0
        /// <summary>
        /// 为InitEmployeeProxy调用
        /// </summary>
        /// <param name="newEmployeeAccountID"></param>
        /// <param name="operatoraccount"></param>
        public AddEmployee(int newEmployeeAccountID, Account operatoraccount)
        {
            _IAccountBll     = BllInstance.AccountBllInstance;
            _IDepartmentBll  = BllInstance.DepartmentBllInstance;
            _Operatoraccount = operatoraccount;

            _Employee = new Employee(newEmployeeAccountID, EmployeeTypeEnum.All);
            #region default EmployeeDetails

            _Employee.EmployeeDetails = null;
            #endregion
        }
Beispiel #15
0
 ///<summary>
 ///AddTrainCourse的构造函数,专为测试提供
 ///</summary>
 public AddTrainCourse(Course course, List <Skill> skills, List <Account> employees, ITrain iTrain, IFeedBackPaper ipaper, IEmployee iemployee, IAccountBll mockIAccountBll, Account loginUser)
 {
     _Course    = course;
     _Skills    = skills;
     _Employees = employees;
     _DalTrain  = iTrain;
     //_DalFBQues = iQues;
     _IFeedBackPaper = ipaper;
     _EmployeeDal    = iemployee;
     _IAccountBll    = mockIAccountBll;
     _LoginUser      = loginUser;
 }
Beispiel #16
0
 /// <summary>
 /// 获取员工合同信息构造函数
 /// </summary>
 public GetEmployeeContract(IEmployee mockIEmployee, IAccountBll mockIAccountBll, IContract mockIContract,
                            IContractBookMark mockIContractBookMark, IEmployeeContractBookMark mockIEmployeeContractBookMark,
                            IEmployeeSkill mockIEmployeeSkill, IDepartmentBll mockIDepartmentBll, IEmployeeAdjustRule mockIEmployeeAdjustRule)
 {
     _dalEmployee                 = mockIEmployee;
     _IAccountBll                 = mockIAccountBll;
     _dalContract                 = mockIContract;
     _dalContractBookMark         = mockIContractBookMark;
     _dalEmployeeContractBookMark = mockIEmployeeContractBookMark;
     _dalEmployeeSkill            = mockIEmployeeSkill;
     _IDepartmentBll              = mockIDepartmentBll;
     _EmployeeAdjustRuleDal       = mockIEmployeeAdjustRule;
 }
Beispiel #17
0
        public static void Run()
        {
            ContainerBuilder cb = new ContainerBuilder();

            cb.RegisterType <AccountBll>().As <IAccountBll>();
            cb.RegisterType <AccountDal>().As <IAccountDal>();
            cb.RegisterType <ConsoleLogger>().As <ILogger>().InstancePerLifetimeScope();
            IContainer container = cb.Build();

            //using (ILifetimeScope beginLifetimeScope = container.BeginLifetimeScope())
            //{

            //    IAccountBll accountBll = beginLifetimeScope.Resolve<IAccountBll>();
            //    accountBll.Transfer("yueluo", "newbe", 333);
            //    accountBll.Transfer("yueluo", "newbe", 333);
            //}

            /*
             * IContainer inherits ILifetimeScope, and function BeginLifetimeScope is to begin a new nested scope.
             * Component instances created via the new scope will  be disposed along with it.
             * So I think this is a better demo.
             *
             * Here have three situations:
             * 1. Single Instance in every lifetime
             * The ILoggers that AccountBll and AccountDal depend on in every lifetime are the same,
             * but in different lifetime are different
             *  cb.RegisterType<ConsoleLogger>().As<ILogger>().InstancePerLifetimeScope();
             * 2. Single Instance in entire project
             * The ILoggers that AccountBll and AccountDal depend on in every lifetime are the same,
             * and in different lifetime are the also the same
             *  cb.RegisterType<ConsoleLogger>().As<ILogger>().SingleInstance();
             * 3. Different instance in every step
             * The ILoggers that AccountBll and AccountDal depend on in every lifetime are different,
             * and in different lifetime are also different.
             *  cb.RegisterType<ConsoleLogger>().As<ILogger>();
             * We can have a try for every situation. The outputs are different:
             * Maybe the "输出日志" is the same, but the logger hashcode in every function is different.
             */

            using (ILifetimeScope beginLifetimeScope = container.BeginLifetimeScope())
            {
                IAccountBll accountBll = beginLifetimeScope.Resolve <IAccountBll>();
                accountBll.Transfer("yueluo", "newbe", 333);
            }

            using (ILifetimeScope beginLifetimeScope = container.BeginLifetimeScope())
            {
                IAccountBll accountBll = beginLifetimeScope.Resolve <IAccountBll>();
                accountBll.Transfer("yueluo", "newbe", 333);
            }
        }
Beispiel #18
0
 /// <summary>
 /// AddEmployee的构造函数,专为测试提供
 /// </summary>
 public AddEmployee(Employee employee, Account operatoraccount, IEmployee mockDalEmployee,
                    IAccountBll mockDalAccounts,
                    IEmployeeHistory mochEmployeeHistory, IEmployeeSkill mockEmployeeSkill,
                    IDepartmentBll mockDepartments, IEmployeeWelfare mockEmployeeWelfare,
                    IEmployeeWelfareHistory mockEmployeeWelfareHistory)
 {
     _Employee                  = employee;
     _Operatoraccount           = operatoraccount;
     _DalEmployee               = mockDalEmployee;
     _DalEmployeeHistory        = mochEmployeeHistory;
     _IAccountBll               = mockDalAccounts;
     _DalEmployeeSkill          = mockEmployeeSkill;
     _IDepartmentBll            = mockDepartments;
     _DalEmployeeWelfare        = mockEmployeeWelfare;
     _DalEmployeeWelfareHistory = mockEmployeeWelfareHistory;
 }
Beispiel #19
0
        private static Share SqlGetShare(int pkid)
        {
            Share share = new Share();

            share.NoteID   = pkid;
            share.Accounts = new List <Account>();
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(Params.NoteID, SqlDbType.Int).Value = pkid;
            IAccountBll accountBll = BllInstance.AccountBllInstance;

            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetShare", cmd))
            {
                while (sdr.Read())
                {
                    share.Accounts.Add(accountBll.GetAccountById(Convert.ToInt32(sdr[Params.DBAccountID])));
                }
            }
            return(share);
        }
Beispiel #20
0
        public static List <Account> toAccountList(string s)
        {
            List <Account> accounts = new List <Account>();

            if (!string.IsNullOrEmpty(s))
            {
                s.Replace(":", ";");
                s.Replace("£»", ";");
                s.Replace("£º", ";");
                string[] names = s.Split(';');
                if (names.Length > 0)
                {
                    IAccountBll   accountBll = BllInstance.AccountBllInstance;
                    List <string> temp       = new List <string>();
                    for (int i = 0; i < names.Length; i++)
                    {
                        if (!temp.Contains(names[i]))
                        {
                            temp.Add(names[i]);
                        }
                    }
                    foreach (string name in temp)
                    {
                        Account account = accountBll.GetAccountByName(name);
                        if (account == null)
                        {
                            throw new ApplicationException(string.Format("{0}²»´æÔÚ", name));
                        }
                        if (account.Id != Utility.LoginUser.Id)
                        {
                            accounts.Add(account);
                        }
                    }
                }
            }
            return(accounts);
        }
Beispiel #21
0
        /// <summary>
        /// 为employee填充account的信息,其中包括account中的dept
        /// </summary>
        /// <param name="accountID"></param>
        /// <param name="employee"></param>
        /// <param name="_IAccountBll"></param>
        /// <returns></returns>
        /// <param name="_IDepartmentBll"></param>
        public static Employee SetEmployeeAccountInfo(int accountID, Employee employee, IAccountBll _IAccountBll,
                                                      IDepartmentBll _IDepartmentBll)
        {
            PositionGrade grade = null;

            if (employee.Account != null && employee.Account.Position != null &&
                employee.Account.Position.Grade != null)
            {
                grade = employee.Account.Position.Grade;
            }
            employee.Account = _IAccountBll.GetAccountById(accountID);
            if (grade != null)
            {
                employee.Account.Position.Grade = grade;
            }
            employee.Account.Dept = _IDepartmentBll.GetDepartmentById(employee.Account.Dept.Id, null);

            return(employee);
        }
Beispiel #22
0
        public static void SendEmailForEmployees(int bulletinID, List <Account> employeeRight, IAccountBll account)
        {
            try
            {
                IBulletinBll bulletinBll = BllInstance.BulletinBllInstance;
                foreach (Account tempEmployee in employeeRight)
                {
                    Account employee = account.GetAccountById(tempEmployee.Id);

                    if (employee.AccountType == VisibleType.None || !employee.IsAcceptEmail)
                    {
                        continue;
                    }

                    string to = employee.Email1;
                    bulletinBll.SendEmailForBulletin(bulletinID, to, null);
                    if (!string.IsNullOrEmpty(employee.Email2))
                    {
                        to = employee.Email2;
                        bulletinBll.SendEmailForBulletin(bulletinID, to, null);
                    }
                }
            }
            catch (Exception ex)
            {
                try
                {
                    StreamWriter sw = new StreamWriter(@"c:\faildMails.txt", true);
                    sw.WriteLine(ex.Message);
                    if (ex.InnerException != null)
                    {
                        sw.WriteLine(ex.InnerException.Message);
                    }
                    sw.Flush();
                    sw.Close();
                }
                catch
                {
                }
            }
        }
Beispiel #23
0
 /// <summary>
 ///
 /// </summary>
 public AddCourseSendMail(List <Account> accounts, Course course, IMailGateWay mailGateWay, IAccountBll iAccountBll) : this(accounts, course)
 {
     _MailGateWay = mailGateWay;
     _AccountBll  = iAccountBll;
 }
Beispiel #24
0
 /// <summary>
 /// </summary>
 public GetEmployee(IEmployee mockIEmployee, IAccountBll mockIAccountBll, IEmployeeSkill mockIEmployeeSkill,
                    IDepartmentBll mockIDepartmentBll, IEmployeeAdjustRule mockIEmployeeAdjustRule, IPositionBll mockIPositionBll)
     : this(mockIEmployee, mockIAccountBll, mockIEmployeeSkill, mockIDepartmentBll, mockIEmployeeAdjustRule)
 {
     _IPositionBll = mockIPositionBll;
 }
Beispiel #25
0
 ///<summary>
 ///  获取员工打卡修改日志信息
 ///</summary>
 public GetInAndOutRecordLog(Account loginUser)
 {
     _LoginUser   = loginUser;
     _IAccountBll = BllInstance.AccountBllInstance;
     _DalLog      = new AttendanceInAndOutRecordLogDal();
 }
Beispiel #26
0
 /// <summary>
 ///  Initializes a new instance of the <see cref="AccountController" /> class.
 /// </summary>
 /// <param name="account"></param>
 public AccountController(IAccountBll account)
 {
     _account = account;
 }
 /// <summary>
 ///
 /// </summary>
 public AttendanceOutInRecord(Account loginUser)
 {
     _LoginUser   = loginUser;
     _IAccountBll = BllInstance.AccountBllInstance;
 }
Beispiel #28
0
        ///<summary>
        ///</summary>
        ///<param name="accountID"></param>
        ///<param name="employee"></param>
        ///<param name="_IAccountBll"></param>
        ///<param name="_IDepartmentBll"></param>
        ///<param name="_IPositionBll"></param>
        ///<returns></returns>
        public static Employee SetEmployeeAccountInfo(int accountID, Employee employee, IAccountBll _IAccountBll,
                                                      IDepartmentBll _IDepartmentBll, IPositionBll _IPositionBll)
        {
            int gradeID = -1;

            if (employee.Account.Position != null && employee.Account.Position.Grade != null)
            {
                gradeID = employee.Account.Position.Grade.Id;
            }

            employee.Account = _IAccountBll.GetAccountById(accountID);
            if (employee.Account.Position != null)
            {
                employee.Account.Position = _IPositionBll.GetPositionById(employee.Account.Position.Id, null);

                employee.Account.Position.Grade =
                    _IPositionBll.GetPositionGradeById(gradeID, null);
            }
            employee.Account.Dept = _IDepartmentBll.GetDepartmentById(employee.Account.Dept.Id, null);

            return(employee);
        }
Beispiel #29
0
 public AccountDomain(IAccountBll <AccountModel> accountBll, IAccountDetailBll <AccountDetailModel> accountDetailBll)
 {
     _accountBll       = accountBll;
     _accountDetailBll = accountDetailBll;
 }
Beispiel #30
0
 public AccountController(IAccountBll accountBll)
 {
     _accountBll = accountBll;
 }