Exemple #1
0
        /// <summary>
        /// 帐号的选择操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trvAccount_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
        {
            if (trvAccount.SelectedNode != null)
            {
                CurrentAccount = (Class_Account)trvAccount.SelectedNode.Tag;

                txtAccount.Text = CurrentAccount.Account_name;

                if (CurrentAccount.Enable == "Y")
                {
                    rbtnUserful.Checked = true;
                }
                else
                {
                    rdtnUnUserful.Checked = true;
                }
                IniTrvRoles(CurrentAccount);
                IniTrvOwner(CurrentAccount);
                IniUserInfor(CurrentAccount.Account_id);
                if (cboAccountKind.Items.Count > 0)
                {
                    cboAccountKind.SelectedValue = CurrentAccount.Kind;
                }
                else
                {
                    string sql = "select * from t_data_code where id=" + CurrentAccount.Kind.ToString() + "";
                    cboAccountKind.DataSource    = App.GetDataSet(sql).Tables[0].DefaultView;
                    cboAccountKind.DisplayMember = "NAME";
                    cboAccountKind.ValueMember   = "ID";
                    cboAccountKind.SelectedIndex = 0;
                }

                lblPassVal.Text = "真实密码:" + Encrypt.DecryptStr(CurrentAccount.Password);
            }
        }
Exemple #2
0
        /// <summary>
        /// 帐号的选择操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trvAccount_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
        {
            if (trvAccount.SelectedNode != null)
            {
                CurrentAccount = (Class_Account)trvAccount.SelectedNode.Tag;

                txtAccount.Text = CurrentAccount.Account_name;
                IniTrvRoles(CurrentAccount);             //初始化可以选择的权限数
                IniTrvOwner(CurrentAccount);             //初始化已经拥有的权限树
                IniUserInfor(CurrentAccount.Account_id); //初始化用户信息
            }
        }
Exemple #3
0
 /// <summary>
 /// 初始化可以选择的权限树
 /// </summary>
 /// <param name="Account">当前帐号</param>
 private void IniTrvRoles(Class_Account Account)
 {
     lvRoles.Items.Clear();
     if (AllRoles != null)
     {
         if (Account != null)
         {
             for (int i = 0; i < AllRoles.Length; i++)
             {
                 bool flag = false;
                 if (Account.Roles != null)
                 {
                     for (int j = 0; j < Account.Roles.Length; j++)
                     {
                         if (Account.Roles[j].Role_id == AllRoles[i].Role_id)
                         {
                             flag = true;
                         }
                     }
                 }
                 if (!flag)
                 {
                     ListViewItem tempitem = new ListViewItem();
                     tempitem.Tag         = AllRoles[i];
                     tempitem.Text        = AllRoles[i].Role_name;
                     tempitem.ImageIndex  = 1;
                     tempitem.IndentCount = 0;
                     lvRoles.Items.Add(tempitem);
                 }
             }
         }
         else
         {
             for (int i = 0; i < AllRoles.Length; i++)
             {
                 ListViewItem tempitem = new ListViewItem();
                 tempitem.Tag         = AllRoles[i];
                 tempitem.Text        = AllRoles[i].Role_name;
                 tempitem.ImageIndex  = 1;
                 tempitem.IndentCount = 0;
                 lvRoles.Items.Add(tempitem);
             }
         }
     }
     lvRoles.Refresh();
 }
Exemple #4
0
 /// <summary>
 /// 初始化已经拥有的权限树
 /// </summary>
 /// <param name="Account">当前帐号</param>
 private void IniTrvOwner(Class_Account Account)
 {
     lvOwernRoles.Items.Clear();
     if (Account != null)
     {
         if (Account.Roles != null)
         {
             for (int i = 0; i < Account.Roles.Length; i++)
             {
                 Class_Role   temp     = (Class_Role)Account.Roles[i];
                 ListViewItem tempitem = new ListViewItem();
                 tempitem.Tag        = temp;
                 tempitem.Text       = temp.Role_name;
                 tempitem.ImageIndex = 1;
                 lvOwernRoles.Items.Add(tempitem);
             }
         }
     }
 }
Exemple #5
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();
        }