示例#1
0
文件: Class_Role.cs 项目: vaxtra/Toms
    public ReturnData AJAX_GetDetail(int idRole)
    {
        try
        {
            DataClassesDataContext       db          = new DataClassesDataContext();
            Class_Role                   role        = new Class_Role();
            Class_Menu                   menu        = new Class_Menu();
            Class_Order_Status           orderStatus = new Class_Order_Status();
            Dictionary <string, dynamic> data        = new Dictionary <string, dynamic>();
            data.Add("Role", Dynamic_GetDetail(db, idRole));
            data.Add("TreeMenus", role.GetTree_Menu(db, idRole));
            data.Add("SelectedMenus", role.Dynamic_GetData_Menu_ByIDRole(idRole));
            data.Add("TreeOrderStatus", GetTree_OrderStatus(db, idRole));
            data.Add("SelectedOrderStatus", Dynamic_GetData_OrderStatus_ByIDRole(idRole));
            data.Add("Notification", Dynamic_GetNotification_OrderStatus(db, idRole));
            return(ReturnData.MessageSuccess("OK", data));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
示例#2
0
        /// <summary>
        /// 选择角色
        /// </summary>
        private void RoleSelect()
        {
            try
            {
                if (lvRoles.SelectedItems[0] != null)
                {
                    //GListBoxItem tempItem = (GListBoxItem)lvRoles.SelectedItem;
                    Class_Role temp = (Class_Role)lvRoles.SelectedItems[0].Tag;

                    if (!IsIntimeSpan(temp.Role_id))
                    {
                        App.MsgWaring("该角色有使用时间的限制,当前已经超出有效时间范围!");
                        return;
                    }
                    App.UserAccount.CurrentSelectRole = temp;

                    if (lvRoles.SelectedItems[0].ToolTipText == "1" || lvRoles.SelectedItems[0].ToolTipText == "2")
                    {
                        App.CurrentHospitalId = 1;
                    }
                    else if (lvRoles.SelectedItems[0].ToolTipText == "201")
                    {
                        App.CurrentHospitalId = 201;
                    }

                    /*
                     * 获取当前角色所对应的权限
                     */
                    DataSet dsPerssions = App.GetDataSet("select * from T_PERMISSION where PERM_CODE in (select PERM_CODE from T_ROLE_PERMISSION where ROLE_ID=" + App.UserAccount.CurrentSelectRole.Role_id + ")");
                    App.UserAccount.CurrentSelectRole.Permissions = new Class_Permission[dsPerssions.Tables[0].Rows.Count];
                    for (int i = 0; i < dsPerssions.Tables[0].Rows.Count; i++)
                    {
                        App.UserAccount.CurrentSelectRole.Permissions[i]           = new Class_Permission();
                        App.UserAccount.CurrentSelectRole.Permissions[i].Id        = dsPerssions.Tables[0].Rows[i]["ID"].ToString();
                        App.UserAccount.CurrentSelectRole.Permissions[i].Perm_code = dsPerssions.Tables[0].Rows[i]["PERM_CODE"].ToString();
                        App.UserAccount.CurrentSelectRole.Permissions[i].Perm_name = dsPerssions.Tables[0].Rows[i]["PERM_NAME"].ToString();
                        App.UserAccount.CurrentSelectRole.Permissions[i].Perm_kind = dsPerssions.Tables[0].Rows[i]["PERM_KIND"].ToString();
                        App.UserAccount.CurrentSelectRole.Permissions[i].Num       = dsPerssions.Tables[0].Rows[i]["NUM"].ToString();
                    }
                    this.Hide();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                App.MsgWaring("请先选择要操作的角色!");
            }
        }
示例#3
0
    public ReturnData AJAX_GetDetail(int idEmployee)
    {
        try
        {
            DataClassesDataContext       db   = new DataClassesDataContext();
            Class_Role                   role = new Class_Role();
            Dictionary <string, dynamic> data = new Dictionary <string, dynamic>();
            data.Add("Employee", Dynamic_GetDetail(db, idEmployee));
            data.Add("Role", role.Dynamic_GetAll());
            return(ReturnData.MessageSuccess("OK", data));
        }
        catch (Exception ex)
        {
            Class_Log_Error log = new Class_Log_Error();
            log.Insert(ex.Message, ex.StackTrace);

            return(ReturnData.MessageFailed(ex.Message, null));
        }
    }
示例#4
0
        private void GetRangeByRole(string user_Number, string pass_World, Class_Role role)
        {
            string sql = "select a.id,a.acc_role_id,a.section_id,a.sickarea_id,a.isbelongto," +
                         " c.section_name,d.sick_area_name,b.role_id from " + tableSpace + "T_ACC_ROLE_RANGE a " +
                         " left join " + tableSpace + "T_ACC_ROLE b on a.acc_role_id=b.id left join " + tableSpace + "T_SECTIONINFO c " +
                         " on a.section_id=c.sid left join " + tableSpace + "T_SICKAREAINFO d on a.sickarea_id=d.said" +
                         " where b.account_id in (select ACCOUNT_ID from " + tableSpace + "T_ACCOUNT " +
                         " where ACCOUNT_NAME='" + user_Number + "' and PASSWORD='******') ";

            try
            {
                DataSet ds = App.GetDataSet(sql);

                /*
                 * 获取每个权限所对应的适用范围
                 */
                DataRow[] rows = ds.Tables[0].Select("role_id=" + role.Role_id + "");
                role.Rnages = new Class_Rnage[rows.Length];
                for (int j1 = 0; j1 < rows.Length; j1++)
                {
                    role.Rnages[j1]             = new Class_Rnage();
                    role.Rnages[j1].Id          = rows[j1]["id"].ToString();
                    role.Rnages[j1].Section_id  = rows[j1]["section_id"].ToString();
                    role.Rnages[j1].Sickarea_id = rows[j1]["sickarea_id"].ToString();
                    role.Rnages[j1].Acc_role_id = rows[j1]["acc_role_id"].ToString();
                    role.Rnages[j1].Isbelonge   = rows[j1]["isbelongto"].ToString();
                    //0科室 1病区
                    if (role.Rnages[j1].Isbelonge == "0")
                    {
                        role.Rnages[j1].Rnagename = rows[j1]["section_name"].ToString();
                    }
                    else
                    {
                        role.Rnages[j1].Rnagename = rows[j1]["sick_area_name"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        private void frmRoleChose_Load(object sender, EventArgs e)
        {
            if (App.UserAccount != null)
            {
                if (App.UserAccount.Roles.Length > 0)
                {
                    for (int i = 0; i < App.UserAccount.Roles.Length; i++)
                    {
                        if (App.UserAccount.Roles[i].Rnages.Length > 0)
                        {
                            for (int j = 0; j < App.UserAccount.Roles[i].Rnages.Length; j++)
                            {
                                ListViewItem tn       = new ListViewItem();
                                Class_Role   temprole = new Class_Role();
                                temprole.Role_id        = App.UserAccount.Roles[i].Role_id;
                                temprole.Role_name      = App.UserAccount.Roles[i].Role_name;
                                temprole.Permissions    = App.UserAccount.Roles[i].Permissions;
                                temprole.Rnages         = App.UserAccount.Roles[i].Rnages;
                                temprole.CanSelectRange = App.UserAccount.Roles[i].CanSelectRange;
                                temprole.Section_Id     = App.UserAccount.Roles[i].Section_Id;
                                //temprole.Section_name = App.UserAccount.Roles[i].Section_name;
                                temprole.Sickarea_Id = App.UserAccount.Roles[i].Sickarea_Id;
                                //temprole.Sickarea_name = App.UserAccount.Roles[i].Sickarea_name;
                                temprole.Role_type = App.UserAccount.Roles[i].Role_type;
                                if (temprole.Rnages[j].Isbelonge == "0")
                                {
                                    temprole.Section_Id   = temprole.Rnages[j].Section_id;
                                    temprole.Section_name = temprole.Rnages[j].Rnagename;
                                }
                                else
                                {
                                    temprole.Sickarea_Id   = temprole.Rnages[j].Sickarea_id;
                                    temprole.Sickarea_name = temprole.Rnages[j].Rnagename;
                                }
                                temprole.Sub_hospital = temprole.Rnages[j].Shid;

                                tn.Tag         = temprole;
                                tn.Text        = temprole.Role_name + "--" + temprole.Rnages[j].Rnagename;
                                tn.ImageIndex  = 0;
                                tn.ToolTipText = temprole.Rnages[j].Shid;
                                lvRoles.Items.Add(tn);
                            }
                        }
                        else
                        {
                            ListViewItem tn = new ListViewItem();
                            tn.Tag         = App.UserAccount.Roles[i];
                            tn.Text        = App.UserAccount.Roles[i].Role_name;
                            tn.ToolTipText = App.UserAccount.Roles[i].Sub_hospital;
                            tn.ImageIndex  = 0;
                            lvRoles.Items.Add(tn);
                        }
                    }
                }
            }
            lvRoles.Select();
            if (lvRoles.Items.Count > 0)
            {
                lvRoles.Items[0].Selected = true;
            }
        }