示例#1
0
        /// <summary>
        /// 初始化数据
        /// </summary>
        public void InitData()
        {
            //获取当前管理员角色
            IAccountRoleService accountRole     = IoC.Resolve <IAccountRoleService>();
            List <AccountRole>  accountRoleList = accountRole.GetAccountRoleList(userId);


            //获取角色列表
            IRoleService roleService            = IoC.Resolve <IRoleService>();
            List <Ytg.BasicModel.Role> roleList = roleService.GetAll().ToList();

            if (roleList != null && roleList.Count > 0)
            {
                List <AccountRoleModel> dataSource = new List <AccountRoleModel>();
                foreach (var item in roleList)
                {
                    AccountRoleModel model = new AccountRoleModel();
                    model.RoleId    = item.Id;
                    model.RoleName  = item.Name;
                    model.Descript  = item.Descript;
                    model.IsChecked = false;
                    if (null != accountRoleList.Where(m => m.RoleId == item.Id).FirstOrDefault())
                    {
                        model.IsChecked = true;
                    }
                    dataSource.Add(model);
                }

                this.repList.DataSource = dataSource;
                this.repList.DataBind();
            }
        }
        public string mStatDataStr = string.Empty;//统计图

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //this.txtBeginDate.Text = Utils.GetNowBeginDateStr();
                //this.txtEndDate.Text = Utils.GetNowEndDateStr();
                BindData();
                this.ltLoginCode.Text = LoginUser.Code;
                //显示IP
                if (!string.IsNullOrEmpty(LoginUser.NikeName))
                {
                    //curLoginIp+","+preLoginIp,
                    var array = LoginUser.NikeName.Split(',');
                    if (array.Length == 2)
                    {
                        this.lbIp.Text    = array[0];
                        this.lbPreIp.Text = array[1];
                    }
                }
                this.lbPreLoginTime.Text = LoginUser.Sex;


                //设置用户角色
                IAccountRoleService accountRoleService = IoC.Resolve <IAccountRoleService>();
                var item = accountRoleService.GetUserRoleName(this.LoginUser.Code).FirstOrDefault();
                if (null != item)
                {
                    ltRole.Text = item.Name;
                }
            }
        }
示例#3
0
 public UsersController(IAccountRoleService accountRoleService, IAccountService accountService, IRoleService roleService, IMapper mapper, IUserService userService)
 {
     _accountRoleService = accountRoleService;
     _accountService     = accountService;
     _roleService        = roleService;
     _mapper             = mapper;
     _userSerivce        = userService;
 }
示例#4
0
 public VerifiersController(IAccountRoleService accountRoleService, IAccountService accountService, IRoleService roleService, IMapper mapper, IVerifierService verifierSerivce)
 {
     _accountRoleService = accountRoleService;
     _accountService     = accountService;
     _roleService        = roleService;
     _mapper             = mapper;
     _verifierSerivce    = verifierSerivce;
 }
示例#5
0
 public AdvisorsController(IAccountRoleService accountRoleService, IAccountService accountService, IRoleService roleService, IMapper mapper, IAdvisorService advisorService)
 {
     _accountRoleService = accountRoleService;
     _accountService     = accountService;
     _roleService        = roleService;
     _mapper             = mapper;
     _advisorSerivce     = advisorService;
 }
示例#6
0
 public AgencysController(IAccountRoleService accountRoleService, IAccountService accountService, IRoleService roleService, IMapper mapper, IAgencyService agnecySerivce)
 {
     _accountRoleService = accountRoleService;
     _accountService     = accountService;
     _roleService        = roleService;
     _mapper             = mapper;
     _agencySerivce      = agnecySerivce;
 }
示例#7
0
 public CustomersController(IAccountRoleService accountRoleService, IAccountService accountService, IRoleService roleService, IMapper mapper, ICustomerService customerService)
 {
     _accountRoleService = accountRoleService;
     _accountService     = accountService;
     _roleService        = roleService;
     _mapper             = mapper;
     _customerSerivce    = customerService;
 }
示例#8
0
 public AccountsController(IAccountService accountservice, IRoleService roleservice, IAccountRoleService acountroleservice, IConfiguration config, IMapper mapper, IAdvisorService advisorService, IAgencyService agencyService, IVerifierService verifierService, IUserService userService, IEmailSender emailSender, ICompanyService companyService, ICustomerService customerService)
 {
     this._accountservice     = accountservice;
     this._roleservice        = roleservice;
     this._accountroleservice = acountroleservice;
     this._config             = config;
     this._mapper             = mapper;
     this._advisorService     = advisorService;
     this._agencyService      = agencyService;
     this._verifierService    = verifierService;
     this._userService        = userService;
     this._emailSender        = emailSender;
     this._companyService     = companyService;
     this._customerService    = customerService;
 }
示例#9
0
        //设置角色
        protected void btnSetRole_Click(object sender, EventArgs e)
        {
            userId = Convert.ToInt32(this.txtUserId.Value);
            IAccountRoleService accountRole = IoC.Resolve <IAccountRoleService>();
            List <int>          roleIds     = new List <int>();

            foreach (RepeaterItem item in repList.Items)
            {
                CheckBox cBox = (CheckBox)item.FindControl("cBox");
                if (cBox.Checked == true)
                {
                    roleIds.Add(Convert.ToInt32(cBox.ToolTip));
                }
            }

            if (accountRole.SetAccountRole(userId, roleIds))
            {
                JsAlert("设置成功!", true);
            }
            else
            {
                JsAlert("设置失败,请稍后再试!");
            }
        }
示例#10
0
        public override void RegisterServices(Castle.Windsor.IWindsorContainer container)
        {
            base.RegisterServices(container);
            mockRoles = MockRepository.GenerateMock<IAccountRoleService>();
            mockForms = MockRepository.GenerateMock<IFormsAuthenticationService>();
            mockMembership = MockRepository.GenerateMock<IMembershipService>();

            container.Register(Component.For<IAccountRoleService>().Instance(mockRoles),
                               Component.For<IFormsAuthenticationService>().Instance(mockForms),
                               Component.For<IMembershipService>().Instance(mockMembership),
                               Component.For<AccountController>().ImplementedBy<AccountController>());
        }
示例#11
0
 public AccountController(IFormsAuthenticationService formsService, IMembershipService membershipService, IAccountRoleService accountRoleService)
 {
     this.FormsService = formsService;
     this.MembershipService = membershipService;
     this.AccountRoleService = accountRoleService;
 }