Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private void initForm()
        {
            //审批流程分类初始化
            var list = Utility.CreateComboboxList <BugsBox.Pharmacy.Models.ApprovalType>();

            list.Insert(0, new ListItem(null, "所有审批流程"));
            this.cmbApprovalFlowCat.DisplayMember = "Name";
            this.cmbApprovalFlowCat.ValueMember   = "ID";
            this.cmbApprovalFlowCat.DataSource    = list;

            //审批流程类型初始化
            initApprovalFlowTypeListBox(null);

            //审批人角色下拉框初始化
            string message;
            var    roles = PharmacyDatabaseService.AllRoles(out message).ToList();

            //增加一个空节点
            roles.Insert(0, new Role {
                Id   = Guid.Empty,
                Name = ""
            });
            this.roleBindingSource.DataSource = roles;
            this.审批人角色.DisplayMember          = "Name";
            this.审批人角色.ValueMember            = "Id";
        }
Exemplo n.º 2
0
 /// <summary>
 /// 从服务器获取所有角色
 /// </summary>
 /// <returns></returns>
 protected bool GetRoles()
 {
     Roles = null;
     try
     {
         string message;
         Roles = PharmacyDatabaseService.AllRoles(out message)
                 .OrderBy(r => r.Name)
                 .OrderBy(r => r.Code)
                 .ToList();
         if (!string.IsNullOrWhiteSpace(message))
         {
             throw new Exception(message);
         }
         SelectedRole = Roles.FirstOrDefault();//设置选择的默认
         return(true);
     }
     catch (Exception ex)
     {
         Roles = null;
         ex    = new Exception("从服务器获取所有角色失败", ex);
         Log.Error(ex);
         MessageBox.Show(this.Text + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         return(false);
     }
 }
Exemplo n.º 3
0
        private void Initial()
        {
            _currentUser = AppClientContext.CurrentUser.Id;
            listUser     = PharmacyDatabaseService.GetUser(out msg, _currentUser);
            listR        = PharmacyDatabaseService.AllRoles(out msg).Where(p => p.Name == "SystemRole" || p.Name == "信息管理员").FirstOrDefault();
            listRU       = PharmacyDatabaseService.GetRoleWithUserInfo(out msg, listUser.Id, listR.Id).FirstOrDefault();

            _tabPageEdit   = tabPageEdit;
            _tabPageSearch = tabPageSearch;
            DisplayTabPage(false);
            if (EnabledActions.Count > 0)
            {
                if (!EnabledActions.Contains("Search"))
                {
                    btnCancel.Visible  = false;
                    btnRefresh.Visible = false;
                    btnSearch.Visible  = false;
                }


                if (!EnabledActions.Contains("Add"))
                {
                    btnAdd.Visible = false;
                }

                if (!EnabledActions.Contains("Edit"))
                {
                    btnModify.Visible = false;
                }

                if (!EnabledActions.Contains("Edit") && !EnabledActions.Contains("Add"))
                {
                    btnSave.Visible   = false;
                    btnCancel.Visible = false;
                }
            }

            //用户修改自己密码
            if (listRU == null)
            {
                btnAdd.Visible     = false;
                btnDelete.Visible  = false;
                btnRefresh.Visible = false;
                btnSearch.Visible  = false;
            }

            HeaderTexts          = _headTexts;
            this.btnAdd.Click   += new System.EventHandler(this.OnButtonAddClick);
            this.btnClose.Click += new System.EventHandler(this.OnButtonCloseClick);
        }
Exemplo n.º 4
0
 private void LoadInitDataFromServer()
 {
     try
     {
         string message = string.Empty;
         UserList     = PharmacyDatabaseService.AllUsers(out message).OrderBy(r => r.Employee.Name).ToList();
         RoleList     = PharmacyDatabaseService.AllRoles(out message).ToList();
         SelectedUser = UserList.FirstOrDefault();//给个默认
     }
     catch (Exception ex)
     {
         ex = new Exception("获取用户或角色数据失败!", ex);
         Log.Error(ex);
         MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }