Exemplo n.º 1
0
 private void lvAccount_RightToLeftLayoutChanged(object sender, EventArgs e)
 {
     if (lvAccount.SelectedItems != null)
     {
         currAccount = (Class_Account)lvAccount.SelectedItems[0].Tag;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="user"></param>
        private void GetUserInfo(Class_User user)
        {
            Class_Account account = trvAccount.SelectedNode.Tag as Class_Account;
            // 查询用户信息
            string sql_userInfo = "select c.account_name,a.user_id,a.user_name," +
                                "a.gender_code,(select name from t_data_code bb where a.U_Position=bb.id) 职务," +
                                "(select name from t_data_code cc where a.u_tech_post=cc.id) 职称," +
                                "(select section_name from t_sectioninfo dd where a.section_id=dd.sid) 科室," +
                                "(select sick_area_name from t_sickareainfo ee where a.sickarea_id=ee.said) 病区," +
                                "to_char(a.in_time,'yyyy-MM-dd HH24:mi:ss') 入职时间 from t_userinfo a inner join " +
                                "t_account_user b on a.user_id=b.user_id " +
                                "inner join t_account c on b.account_id=c.account_id where c.account_id='" + account.Account_id + "'";
            DataSet ds_userInfo = App.GetDataSet(sql_userInfo);

            if (ds_userInfo != null)
            {
                DataTable dt = ds_userInfo.Tables[0];
                user.User_id = dt.Rows[0]["user_id"].ToString();
                user.User_name = dt.Rows[0]["user_name"].ToString();
                user.U_gender_code = dt.Rows[0]["gender_code"].ToString();
                user.U_tech_post_name = dt.Rows[0]["职称"].ToString();
                user.U_position_name = dt.Rows[0]["职务"].ToString();
                user.Section = new Class_Sections();
                user.Section.Section_Name = dt.Rows[0]["科室"].ToString();
                user.Sickarea_id = dt.Rows[0]["病区"].ToString();
                user.In_time = Convert.ToDateTime(dt.Rows[0]["入职时间"]);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param Name="sender"></param>
 /// <param Name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (currDiagnosisTreat != null)
         {
             //清空原有关系
             if (currDiagnosisTreat != null)
             {
                 App.ExecuteSQL("delete from T_TNG_ACCOUNT  where   TNG_ID=" + currDiagnosisTreat.Tng_id + "");
             }
             //设置现有关系
             for (int i = 0; i < lvRelation.Items.Count; i++)
             {
                 if (lvRelation.Items[i].Tag.GetType().ToString().Contains("Class_Account"))
                 {
                     Class_Account temp = (Class_Account)lvRelation.Items[i].Tag;
                     int           id   = App.GenId("T_TNG_ACCOUNT", "ID");
                     App.ExecuteSQL("insert into T_TNG_ACCOUNT(ID,TNG_ID,ACCOUNT_ID) values(" + id + "," + currDiagnosisTreat.Tng_id.ToString() + "," + temp.Account_id.ToString() + ")");
                 }
             }
             App.Msg("操作成功!");
         }
         else
         {
             App.Msg("请先选择病区!");
         }
     }
     catch (Exception ex)
     {
         App.Msg("操作失败,原因:" + ex.ToString() + "");
     }
 }
Exemplo n.º 4
0
        public Class_Account GetAccountInfo(string user_Number, string pass_World, string account_Type)
        {
            Class_Account accout = null;

            try
            {
                string password = Encrypt.EncryptStr(pass_World);
                string sql      = "select distinct(a.account_type),a.account_id,account_name from " + tableSpace + "t_account a" +
                                  //" inner join " + tableSpace + "t_acc_role b on a.account_id = b.account_id" +
                                  //" inner join " + tableSpace + "t_role c on b.role_id = c.role_id" +
                                  " where a.account_name='" + user_Number + "' and a.password='******'";
                DataSet ds_Accout = App.GetDataSet(sql);
                if (ds_Accout.Tables[0].Rows.Count > 0)
                {
                    accout              = new Class_Account();
                    accout.Account_id   = ds_Accout.Tables[0].Rows[0]["ACCOUNT_ID"].ToString();
                    accout.Account_type = ds_Accout.Tables[0].Rows[0]["account_type"].ToString();
                    accout.Account_name = ds_Accout.Tables[0].Rows[0]["ACCOUNT_NAME"].ToString();
                    accout.UserInfo     = GetUserByAccot(user_Number, password);
                    acountType          = accout.Account_type;
                    GetRolesByAccount(accout, user_Number, password);
                    //GetRangeByRole(user_Number, password, accout.Roles[0]);
                }
                else
                {
                    App.Msg("用户名或密码错误!");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(accout);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 实例化查询帐户结果
        /// </summary>
        /// <param Name="tempds"></param>
        /// <returns></returns>
        private Class_Account[] GetDirectionary(DataSet tempds)
        {
            if (tempds != null)
            {
                if (tempds.Tables[0].Rows.Count > 0)
                {
                    Class_Account[] Directionary = new Class_Account[tempds.Tables[0].Rows.Count];
                    for (int i = 0; i < tempds.Tables[0].Rows.Count; i++)
                    {
                        Directionary[i]              = new Class_Account();
                        Directionary[i].Account_id   = Convert.ToInt32(tempds.Tables[0].Rows[i]["ACCOUNT_ID"]).ToString();
                        Directionary[i].Account_type = tempds.Tables[0].Rows[i]["ACCOUNT_TYPE"].ToString();
                        Directionary[i].Account_name = tempds.Tables[0].Rows[i]["ACCOUNT_NAME"].ToString();
                        Directionary[i].Password     = tempds.Tables[0].Rows[i]["PASSWORD"].ToString();
                        Directionary[i].Enable       = tempds.Tables[0].Rows[i]["ENABLE"].ToString();
                        if (tempds.Tables[0].Rows[i]["ENABLE_START_TIME"].ToString().Trim() != "")
                        {
                            Directionary[i].Enable_start_time = DateTime.Parse(tempds.Tables[0].Rows[i]["ENABLE_START_TIME"].ToString());
                        }

                        if (tempds.Tables[0].Rows[i]["ENABLE_END_TIME"].ToString().Trim() != "")
                        {
                            Directionary[i].Enable_end_time = DateTime.Parse(tempds.Tables[0].Rows[i]["ENABLE_END_TIME"].ToString());
                        }
                        if (tempds.Tables[0].Rows[i]["ENABLE_END_TIME"].ToString().Trim() != "")
                        {
                            Directionary[i].Enable_end_time = DateTime.Parse(tempds.Tables[0].Rows[i]["ENABLE_END_TIME"].ToString());
                        }

                        Directionary[i].Last_login_ip = tempds.Tables[0].Rows[i]["LAST_LOGIN_IP"].ToString();
                        if (tempds.Tables[0].Rows[i]["LAST_LOGIN_TIME"].ToString().Trim() != "")
                        {
                            Directionary[i].Last_login_time = DateTime.Parse(tempds.Tables[0].Rows[i]["LAST_LOGIN_TIME"].ToString());
                        }
                        if (tempds.Tables[0].Rows[i]["LAST_EXIT_TIME"].ToString().Trim() != "")
                        {
                            Directionary[i].Last_exit_time = DateTime.Parse(tempds.Tables[0].Rows[i]["LAST_EXIT_TIME"].ToString());
                        }
                        if (App.IsNumeric(tempds.Tables[0].Rows[i]["KIND"].ToString()))
                        {
                            Directionary[i].Kind = Convert.ToInt32(tempds.Tables[0].Rows[i]["KIND"].ToString());
                        }
                    }
                    return(Directionary);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// 移除诊疗护理组与账户之间的关系
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (currDiagnosisTreat != null)
     {
         if (lvRelation.SelectedItems != null)
         {
             if (App.Ask("你是否要删除?"))
             {
                 Class_Account temp = (Class_Account)lvRelation.SelectedItems[0].Tag;
                 App.ExecuteSQL("delete from T_TNG_ACCOUNT where ACCOUNT_ID=" + temp.Account_id.ToString() + " and TNG_ID=" + currDiagnosisTreat.Tng_id + "");
                 lvRelation.Items.Remove(lvRelation.SelectedItems[0]);
             }
         }
     }
 }
Exemplo n.º 7
0
        private void GetRolesByAccount(Class_Account account, string user_Number, string pass_World)
        {
            string password = Encrypt.EncryptStr(pass_World);
            string sql      = string.Empty;

            if (string.IsNullOrEmpty(acountType))
            {
                sql = "select a.role_id,a.role_name,a.enable_flag,c.sickarea_id,e.sick_area_name,c.section_id," +
                      " d.section_name,a.role_type,b.account_id from " + tableSpace + "T_ROLE a" +
                      " inner join " + tableSpace + "T_ACC_ROLE b on a.role_id = b.role_id" +
                      " inner join " + tableSpace + "t_acc_role_range c on c.acc_role_id = b.id" +
                      " left join " + tableSpace + "t_sectioninfo d on c.section_id=d.sid" +
                      " left join " + tableSpace + "t_sickareainfo e on c.sickarea_id = e.said" +
                      " where b.account_id=" + account.Account_id + " and a.enable_flag='Y'";
            }
            else
            {
                sql = "select a.role_id,a.role_name,a.enable_flag," +
                      " a.role_type,b.account_id from newdoc.T_ROLE a " +
                      " inner join newdoc.T_ACC_ROLE b on a.role_id = b.role_id " +
                      " where b.account_id=" + account.Account_id + " and a.enable_flag='Y'";
            }
            try
            {
                DataSet ds = App.GetDataSet(sql);
                account.Roles = new Class_Role[ds.Tables[0].Rows.Count];
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    account.Roles[i]           = new Class_Role();
                    account.Roles[i].Role_id   = ds.Tables[0].Rows[i]["ROLE_ID"].ToString();
                    account.Roles[i].Role_name = ds.Tables[0].Rows[i]["ROLE_NAME"].ToString();
                    account.Roles[i].Enable    = ds.Tables[0].Rows[i]["ENABLE_FLAG"].ToString();
                    if (string.IsNullOrEmpty(acountType))
                    {
                        account.Roles[i].Section_Id    = ds.Tables[0].Rows[i]["SECTION_ID"].ToString();
                        account.Roles[i].Section_name  = ds.Tables[0].Rows[i]["section_name"].ToString();
                        account.Roles[i].Sickarea_Id   = ds.Tables[0].Rows[i]["SICKAREA_ID"].ToString();
                        account.Roles[i].Sickarea_name = ds.Tables[0].Rows[i]["sick_area_name"].ToString();
                    }
                    account.Roles[i].Role_type = ds.Tables[0].Rows[i]["ROLE_TYPE"].ToString();
                    GetRangeByRole(user_Number, password, account.Roles[i]);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 判断关系是否重复设置
        /// </summary>
        /// <param Name="Id"></param>
        /// <returns></returns>
        private bool isExist(int id)
        {
            bool flag = false;

            for (int i = 0; i < lvRelation.Items.Count; i++)
            {
                if (lvRelation.Items[i].Tag.GetType().ToString().Contains("Class_Account"))
                {
                    Class_Account temp = (Class_Account)lvRelation.Items[i].Tag;
                    if (temp.Account_id == id.ToString())
                    {
                        flag = true;
                    }
                }
            }
            return(flag);
        }
Exemplo n.º 9
0
 private void lvAccount_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (lvAccount.SelectedItems != null)
     {
         if (lvAccount.SelectedItems[0].Tag.GetType().ToString().Contains("Class_Account"))
         {
             Class_Account temp = (Class_Account)lvAccount.SelectedItems[0].Tag;
             if (!isExist(Convert.ToInt32(temp.Account_id)))
             {
                 ListViewItem tem = new ListViewItem();
                 tem.Tag        = temp;
                 tem.Text       = temp.Account_name;
                 tem.ImageIndex = 1;
                 lvRelation.Items.Add(tem);
             }
             else
             {
                 App.Msg("当前诊疗护理组已经存在相同的账户了!");
             }
         }
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// 刷新帐号列表,所有的用户信息刷新到树状控件。
        /// </summary>
        private void IniTrvAccount(string Accountname)
        {
            /*
             * 说明
             * 将T_ACCOUNT表的中的所有信息检索出来,然后再根据这些
             * 信息检索每个帐号所对应的角色,以及角色所对应的使用范围。
             */

            string Sql = "";
            trvAccount.Nodes.Clear();
            if (chkAll.Checked)
            {
                Sql = "select * from t_account a inner join t_account_user b on a.account_id=b.account_id inner join t_userinfo c on b.user_id = c.user_id where 1=1";
            }
            else
            {
                Sql = "select * from t_account a inner join t_account_user b on a.account_id=b.account_id inner join t_userinfo c on b.user_id = c.user_id where rownum <30";
            }
            if (cboSearchType.Text == "按姓名")
            {
                Sql += " and c.user_name like '%" + Accountname + "%'";
            }
            else if (cboSearchType.Text == "按工号")
            {
                Sql += " and a.account_name like '%" + Accountname + "%'";
            }
            Sql += " order by a.account_id";
            Bifrost.WebReference.Class_Table[] tabSqls = new Bifrost.WebReference.Class_Table[3];

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

            tabSqls[1] = new Bifrost.WebReference.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 Bifrost.WebReference.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.ToInt32(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();

        }
Exemplo n.º 11
0
        /// <summary>
        /// 浏览器直接登录
        /// </summary>
        /// <param name="user_Number"></param>
        /// <param name="section_Id"></param>
        /// <returns></returns>
        public Class_Account GetAccountInfoByBrowe(string user_Number, string section_Id, string account_Type)
        {
            Class_Account account = new Class_Account();

            try
            {
                //string password = App.EncryptStr(pass_World);
                string sql_Account = "select distinct(c.role_type),a.account_id,account_name from " + tableSpace + "t_account a" +
                                     " inner join " + tableSpace + "t_acc_role b on a.account_id = b.account_id" +
                                     " inner join " + tableSpace + "t_role c on b.role_id = c.role_id" +
                                     " where a.account_name='" + user_Number + "'";
                DataSet ds_Accout = App.GetDataSet(sql_Account);
                account.Account_id   = ds_Accout.Tables[0].Rows[0]["ACCOUNT_ID"].ToString();
                account.Account_type = ds_Accout.Tables[0].Rows[0]["role_type"].ToString();
                account.Account_name = ds_Accout.Tables[0].Rows[0]["ACCOUNT_NAME"].ToString();
                account.UserInfo     = GetUserByAccot(user_Number);
                string sql = string.Empty;
                if (account_Type != "N" || account_Type != "D")
                {
                    if (account_Type == "D")
                    {
                        sql = "select a.role_id,a.role_name,a.enable_flag,c.sickarea_id,e.sick_area_name,c.section_id," +
                              " d.section_name,a.role_type,b.account_id from " + tableSpace + "T_ROLE a" +
                              " inner join " + tableSpace + "T_ACC_ROLE b on a.role_id = b.role_id" +
                              " inner join " + tableSpace + "t_acc_role_range c on c.acc_role_id = b.id" +
                              " left join " + tableSpace + "t_sectioninfo d on c.section_id=d.sid" +
                              " left join " + tableSpace + "t_sickareainfo e on c.sickarea_id = e.said" +
                              " where b.account_id=" + account.Account_id + " and a.enable_flag='Y' and c.section_id='" + section_Id + "'";
                    }
                    else
                    {
                        sql = "select a.role_id,a.role_name,a.enable_flag,c.sickarea_id,e.sick_area_name,c.section_id," +
                              " d.section_name,a.role_type,b.account_id from " + tableSpace + "T_ROLE a" +
                              " inner join " + tableSpace + "T_ACC_ROLE b on a.role_id = b.role_id" +
                              " inner join " + tableSpace + "t_acc_role_range c on c.acc_role_id = b.id" +
                              " left join " + tableSpace + "t_sectioninfo d on c.section_id=d.sid" +
                              " left join " + tableSpace + "t_sickareainfo e on c.sickarea_id = e.said" +
                              " where b.account_id=" + account.Account_id + " and a.enable_flag='Y' and c.sickarea_id='" + section_Id + "'";
                    }
                }
                else
                {
                    sql = "select a.role_id,a.role_name,a.enable_flag," +
                          " a.role_type,b.account_id from newdoc.T_ROLE a " +
                          " inner join newdoc.T_ACC_ROLE b on a.role_id = b.role_id " +
                          " where b.account_id=" + account.Account_id + " and a.enable_flag='Y' and a.role_type='" + acountType + "'";
                }
                try
                {
                    DataSet ds = App.GetDataSet(sql);
                    account.Roles = new Class_Role[ds.Tables[0].Rows.Count];
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        account.Roles[i]           = new Class_Role();
                        account.Roles[i].Role_id   = ds.Tables[0].Rows[i]["ROLE_ID"].ToString();
                        account.Roles[i].Role_name = ds.Tables[0].Rows[i]["ROLE_NAME"].ToString();
                        account.Roles[i].Enable    = ds.Tables[0].Rows[i]["ENABLE_FLAG"].ToString();
                        if (account_Type != "N" || account_Type != "D")
                        {
                            account.Roles[i].Section_Id    = ds.Tables[0].Rows[i]["SECTION_ID"].ToString();
                            account.Roles[i].Section_name  = ds.Tables[0].Rows[i]["section_name"].ToString();
                            account.Roles[i].Sickarea_Id   = ds.Tables[0].Rows[i]["SICKAREA_ID"].ToString();
                            account.Roles[i].Sickarea_name = ds.Tables[0].Rows[i]["sick_area_name"].ToString();
                        }
                        account.Roles[i].Role_type = ds.Tables[0].Rows[i]["ROLE_TYPE"].ToString();
                        //GetRangeByRole(user_Number, password, account.Roles[i]);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(account);
        }