コード例 #1
0
ファイル: CrmTest1.cs プロジェクト: ssjylsg/crm
        public void AddAdmin()
        {
            var admin = _userInfoService.FindByUserName("ADMIN");

            if (admin == null)
            {
                // 员工信息基本信息
                Staff staff = new Staff();
                staff.Sex = Sex.Male;
                staff.Specialty = "admin";
                staff.Tel = "0571-";
                staff.Titles = " ";
                staff.WageBooksId = 0;
                staff.WorkAge = 25;

                this._userInfoService.SaveStaff(staff);

                OperatorUser operatorUser = new OperatorUser();
                operatorUser.OperatorName = "管理员";
                operatorUser.OperatorCode = "ADMIN";
                operatorUser.OperatorPass = ("admin").Md5();
                operatorUser.IsCrm = true;
                operatorUser.SetId(staff.Id);
                _userInfoService.Save(operatorUser);
                _userInfoService.Save(operatorUser);
            }
            else
            {
                admin.IsCrm = true;
                admin.UseFlag = 1;
                this._userInfoService.Update(admin);
            }
        }
コード例 #2
0
ファイル: CrmTest1.cs プロジェクト: ssjylsg/crm
        public void UserInfoAddLeader()
        {
            // 员工信息基本信息
            Staff staff = new Staff();
            staff.Sex = Sex.Male;
            staff.Specialty = "sadf";
            staff.Tel = "74546456456";
            staff.Titles = "中国人民";
            staff.WageBooksId = 1123123;
            staff.WorkAge = 25;
            staff.Company = DependencyResolver.Resolver<ICompanyService>().FindById(1);

            this._userInfoService.SaveStaff(staff);

            OperatorUser operatorUser = new OperatorUser();
            operatorUser.OperatorName = "李世岗";
            operatorUser.OperatorCode = this._loginName;
            operatorUser.OperatorPass = (_loginName).Md5();
            operatorUser.SetId(staff.Id);
            _userInfoService.Save(operatorUser);
            _userInfoService.Save(operatorUser);

            Assert.IsNotNull(_userInfoService.FindById(operatorUser.Id));
        }
コード例 #3
0
ファイル: CrmTest1.cs プロジェクト: ssjylsg/crm
 public override void MyTestInitialize()
 {
     _userInfoService = DependencyResolver.Resolver<IUserInfoService>();
     _departmentService = DependencyResolver.Resolver<IDeptService>();
     _categoryService = DependencyResolver.Resolver<ICategoryService>();
     _categoryItemService = DependencyResolver.Resolver<ICategoryItemService>();
     _operatorUser = _userInfoService.FindByUserName(this._loginName);
     _staff = _userInfoService.FindStaffById(1);
     _customerService = DependencyResolver.Resolver<ICustomerService>();
     base.MyTestInitialize();
 }