Пример #1
0
        /// <summary>
        /// 获取页签数据
        /// </summary>
        private void getTabData()
        {
            Class_Table[] tabsqls = new Class_Table[2];
            tabsqls[0]           = new Class_Table();
            tabsqls[0].Sql       = "select * from t_permission where PERM_KIND='3' order by num asc";
            tabsqls[0].Tablename = "permission";

            tabsqls[1]           = new Class_Table();
            tabsqls[1].Sql       = "select id,PERM_CODE,FUNCTION,VERSION,DLLNAME,FUNCTIONIMAGE from t_permission_fuctions";
            tabsqls[1].Tablename = "fuctions";
            ds = App.GetDataSet(tabsqls);
        }
Пример #2
0
        /// <summary>
        /// 更新菜单树结点
        /// </summary>
        private void UpdateMenuTreeview()
        {
            trvPerssions.Nodes.Clear();

            Class_Table[] tabSqls = new Class_Table[2];

            tabSqls[0]           = new Class_Table();
            tabSqls[0].Sql       = "select * from t_permission where PERM_KIND='1' order by num asc";
            tabSqls[0].Tablename = "permission";

            tabSqls[1]           = new Class_Table();
            tabSqls[1].Sql       = "select id,PERM_CODE,FUNCTION,VERSION,DLLNAME,FUNCTIONIMAGE from t_permission_fuctions";
            tabSqls[1].Tablename = "fuctions";

            DataSet ds = App.GetDataSet(tabSqls);

            Class_Permission[] MenuPermissions = new Class_Permission[ds.Tables[0].Rows.Count];
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                //菜单项
                MenuPermissions[i]           = new Class_Permission();
                MenuPermissions[i].Id        = ds.Tables["permission"].Rows[i]["id"].ToString();
                MenuPermissions[i].Perm_code = ds.Tables["permission"].Rows[i]["PERM_CODE"].ToString();
                MenuPermissions[i].Perm_name = ds.Tables["permission"].Rows[i]["PERM_NAME"].ToString();
                MenuPermissions[i].Perm_kind = ds.Tables["permission"].Rows[i]["PERM_KIND"].ToString();
                MenuPermissions[i].Num       = ds.Tables["permission"].Rows[i]["NUM"].ToString();

                //菜单项详细信息
                MenuPermissions[i].Permission_Info = new Class_Permission_Info();
                DataRow[] rows = ds.Tables["fuctions"].Select("PERM_CODE='" + MenuPermissions[i].Perm_code + "'");
                if (rows.Length > 0)
                {
                    MenuPermissions[i].Permission_Info.Id            = Convert.ToInt32(rows[0]["id"]);
                    MenuPermissions[i].Permission_Info.Perm_code     = rows[0]["PERM_CODE"].ToString();
                    MenuPermissions[i].Permission_Info.Function      = rows[0]["FUNCTION"].ToString();
                    MenuPermissions[i].Permission_Info.Version       = rows[0]["VERSION"].ToString();
                    MenuPermissions[i].Permission_Info.DllName       = rows[0]["DLLNAME"].ToString();
                    MenuPermissions[i].Permission_Info.FunctionImage = (byte[])rows[0]["FUNCTIONIMAGE"];
                }
            }

            //刷新树结点
            IniMenuTreeview(MenuPermissions, trvPerssions);
            for (int i = 0; i < trvPerssions.Nodes.Count; i++)
            {
                IniMenuTrvNode(MenuPermissions, trvPerssions.Nodes[i]);
            }
            trvPerssions.ExpandAll();
        }
Пример #3
0
        /// <summary>
        /// 初始化角色树结点
        /// </summary>
        private void IniRoles()
        {
            trvRoles.Nodes.Clear();

            Class_Table[] tabSqls = new Class_Table[2];

            tabSqls[0]           = new Class_Table();
            tabSqls[0].Sql       = "select * from t_role";
            tabSqls[0].Tablename = "role";

            tabSqls[1]           = new Class_Table();
            tabSqls[1].Sql       = "select * from T_PERMISSION a inner join T_ROLE_PERMISSION b on a.perm_code=b.perm_code";
            tabSqls[1].Tablename = "permission";

            DataSet ds = App.GetDataSet(tabSqls);

            if (ds != null)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    TreeNode   tn       = new TreeNode();
                    Class_Role tempRole = new Class_Role();
                    tempRole.Role_id     = ds.Tables["role"].Rows[i]["ROLE_ID"].ToString();//App.GenId("t_role", "ROLE_ID")
                    tempRole.Role_name   = ds.Tables["role"].Rows[i]["ROLE_NAME"].ToString();
                    tempRole.Enable      = ds.Tables["role"].Rows[i]["ENABLE_FLAG"].ToString();
                    tempRole.Section_Id  = ds.Tables["role"].Rows[i]["SECTION_ID"].ToString();
                    tempRole.Sickarea_Id = ds.Tables["role"].Rows[i]["SICKAREA_ID"].ToString();
                    tempRole.Role_type   = ds.Tables["role"].Rows[i]["ROLE_TYPE"].ToString();
                    //绑定角色所对应的权限
                    DataRow[] rows = ds.Tables["permission"].Select("ROLE_ID = " + tempRole.Role_id + "");

                    if (rows != null)
                    {
                        tempRole.Permissions = new Class_Permission[rows.Length];
                        for (int j = 0; j < rows.Length; j++)
                        {
                            tempRole.Permissions[j]           = new Class_Permission();
                            tempRole.Permissions[j].Id        = rows[j]["ID"].ToString();
                            tempRole.Permissions[j].Perm_code = rows[j]["PERM_CODE"].ToString();
                            tempRole.Permissions[j].Perm_name = rows[j]["PERM_NAME"].ToString();
                            tempRole.Permissions[j].Perm_kind = rows[j]["PERM_KIND"].ToString();
                            tempRole.Permissions[j].Num       = rows[j]["NUM"].ToString();
                        }
                    }

                    //绑定角色所对应的文书权限
                    DataSet ds_textrole = App.GetDataSet("select * from t_text where id in(select text_id from t_role_text where role_id=" + tempRole.Role_id + ") ");
                    if (ds_textrole != null)
                    {
                        tempRole.Texts = GetTextDs(ds_textrole.Tables[0]);
                    }

                    tn.Tag  = tempRole;
                    tn.Text = tempRole.Role_name;
                    if (tempRole.Enable == "Y")
                    {
                        tn.ForeColor = Color.Black;
                    }
                    else
                    {
                        tn.ForeColor = Color.Red;
                    }
                    trvRoles.Nodes.Add(tn);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 刷新帐号列表,所有的用户信息刷新到树状控件。
        /// </summary>
        private void IniTrvAccount(string Accountname)
        {
            /*
             * 说明
             * 将T_ACCOUNT表的中的所有信息检索出来,然后再根据这些
             * 信息检索每个帐号所对应的角色,以及角色所对应的使用范围。
             */

            string Sql = "";

            trvAccount.Nodes.Clear();

            if (chkAll.Checked)
            {
                //select a.* from T_ACCOUNT a where a.account_id not in (select c.account_id from t_acc_role c)
                Sql = "select a.* from T_ACCOUNT a where a.ACCOUNT_NAME like '%" + Accountname + "%' and a.account_id not in (select c.account_id from t_acc_role c) order by a.ACCOUNT_ID desc";
            }
            else
            {
                Sql = "select a.* from T_ACCOUNT a where ACCOUNT_NAME like '%" + Accountname + "%' and  a.account_id not in (select c.account_id from t_acc_role c) and rownum<30 order by a.ACCOUNT_ID desc";
            }
            Class_Table[] tabSqls = new Class_Table[3];

            tabSqls[0]           = new Class_Table();
            tabSqls[0].Sql       = Sql;
            tabSqls[0].Tablename = "account";

            tabSqls[1]           = new Class_Table();
            tabSqls[1].Sql       = "select a.role_id,a.role_name,a.enable_flag,b.account_id,a.role_type from T_ROLE a inner join T_ACC_ROLE b on a.role_id=b.role_id";
            tabSqls[1].Tablename = "acc_role";

            tabSqls[2]           = new Class_Table();
            tabSqls[2].Sql       = "select a.id,b.account_id,a.acc_role_id,a.section_id,a.sickarea_id,a.isbelongto,c.section_name,d.sick_area_name,b.role_id from T_ACC_ROLE_RANGE a left join T_ACC_ROLE b on a.acc_role_id=b.id left join T_SECTIONINFO c on a.section_id=c.sid left join T_SICKAREAINFO d on a.sickarea_id=d.said"; //inner join T_SUB_HOSPITALINFO e on c.shid=e.shid";
            tabSqls[2].Tablename = "range";

            DataSet ds = App.GetDataSet(tabSqls);

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                Class_Account account = new Class_Account();
                account.Account_id   = ds.Tables["account"].Rows[i]["ACCOUNT_ID"].ToString();
                account.Account_type = ds.Tables["account"].Rows[i]["ACCOUNT_TYPE"].ToString();
                account.Account_name = ds.Tables["account"].Rows[i]["ACCOUNT_NAME"].ToString();
                account.Password     = ds.Tables["account"].Rows[i]["PASSWORD"].ToString();
                account.Enable       = ds.Tables["account"].Rows[i]["ENABLE"].ToString();
                if (App.isNumval(ds.Tables["account"].Rows[i]["KIND"].ToString()))
                {
                    account.Kind = Convert.ToInt16(ds.Tables["account"].Rows[i]["KIND"].ToString());
                }
                DataRow[] rolerows = ds.Tables["acc_role"].Select("ACCOUNT_ID='" + account.Account_id + "'");
                account.Roles = new Class_Role[rolerows.Length];
                for (int j = 0; j < rolerows.Length; j++)
                {
                    account.Roles[j]           = new Class_Role();
                    account.Roles[j].Role_id   = rolerows[j]["ROLE_ID"].ToString();
                    account.Roles[j].Role_name = rolerows[j]["ROLE_NAME"].ToString();
                    account.Roles[j].Enable    = rolerows[j]["ENABLE_FLAG"].ToString();
                    account.Roles[j].Role_type = rolerows[j]["ROLE_TYPE"].ToString();

                    DataRow[] rows = ds.Tables["range"].Select("account_id='" + account.Account_id + "' and role_id='" + account.Roles[j].Role_id + "'");
                    account.Roles[j].Rnages = new Class_Rnage[rows.Length];
                    for (int j1 = 0; j1 < rows.Length; j1++)
                    {
                        account.Roles[j].Rnages[j1]             = new Class_Rnage();
                        account.Roles[j].Rnages[j1].Id          = rows[j1]["id"].ToString();
                        account.Roles[j].Rnages[j1].Section_id  = rows[j1]["section_id"].ToString();
                        account.Roles[j].Rnages[j1].Sickarea_id = rows[j1]["sickarea_id"].ToString();
                        account.Roles[j].Rnages[j1].Acc_role_id = rows[j1]["acc_role_id"].ToString();
                        account.Roles[j].Rnages[j1].Isbelonge   = rows[j1]["isbelongto"].ToString();
                        //0科室 1病区 --sub_hospital_name
                        if (account.Roles[j].Rnages[j1].Isbelonge == "0")
                        {
                            string HospitalName = App.ReadSqlVal("select a.sub_hospital_name from t_sub_hospitalinfo a inner join T_SECTIONINFO b on a.shid=b.shid where b.sid=" + rows[j1]["section_id"].ToString() + "", 0, "sub_hospital_name");
                            account.Roles[j].Rnages[j1].Rnagename = HospitalName + "-" + rows[j1]["section_name"].ToString();
                        }
                        else
                        {
                            string HospitalName = App.ReadSqlVal("select a.sub_hospital_name from t_sub_hospitalinfo a inner join T_SICKAREAINFO b on a.shid=b.shid where b.said=" + rows[j1]["sickarea_id"].ToString() + "", 0, "sub_hospital_name");
                            account.Roles[j].Rnages[j1].Rnagename = HospitalName + "-" + rows[j1]["sick_area_name"].ToString();
                        }
                    }
                }
                Node tn = new Node();
                tn.Tag        = account;
                tn.Text       = account.Account_name;
                tn.ImageIndex = 0;
                trvAccount.Nodes.Add(tn);
            }
            trvAccount.Refresh();
        }