Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="RoleID">    </param>
        /// <returns></returns>
        public static Entity.Role GetRole(int RoleID)
        {
            Entity.Role           entity    = null;
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();

            try
            {
                IDbDataParameter[] prams =
                {
                    dbFactory.MakeInParam("@RoleID", DBTypeConverter.ConvertCsTypeToOriginDBType(RoleID.GetType().ToString()), RoleID, 32)
                };
                IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.StoredProcedure, "proc_Role_Get", prams);
                while (dataReader.Read())
                {
                    entity = new Entity.Role();
                    //entity.RoleID = DataHelper.ParseToInt(dataReader["RoleID"].ToString());
                    entity.RoleName = dataReader["RoleName"].ToString();
                    //entity.RoleDescription = dataReader["RoleDescription"].ToString();
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                db.Conn.Close();
            }
            return(entity);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static List <Entity.Role> GetAllRole()
        {
            List <Entity.Role>    list      = new List <Entity.Role>();
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();

            try
            {
                IDbDataParameter[] prams =
                {
                };
                IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "select * from Role", prams);
                while (dataReader.Read())
                {
                    Entity.Role entity = new Entity.Role();
                    entity.ID          = DataHelper.ParseToInt(dataReader["ID"].ToString());
                    entity.RoleName    = dataReader["RoleName"].ToString();
                    entity.Description = dataReader["Description"].ToString();
                    //entity.IsAudit = DataHelper.ParseToBoolean(dataReader["IsAudit"].ToString());
                    list.Add(entity);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                db.Conn.Close();
            }
            return(list);
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ID">    </param>
        /// <returns></returns>
        public static List <Entity.Role> GetUserRole(string GUID)
        {
            List <Entity.Role>    list      = new List <Entity.Role>();
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();

            try
            {
                IDataReader dataReader = db.ExecuteReader(Config.con, CommandType.Text, "Select * from vUserRole where GUID='" + GUID + "'", null);
                while (dataReader.Read())
                {
                    Entity.Role entity = new Entity.Role();
                    entity.ID          = DataHelper.ParseToInt(dataReader["RoleID"].ToString());
                    entity.RoleName    = dataReader["RoleName"].ToString();
                    entity.Description = dataReader["Description"].ToString();
                    list.Add(entity);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                db.Conn.Close();
            }
            return(list);
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="UserID">    </param>
        /// <returns></returns>
        public static Entity.UserRole GetUserRoleByGUID(string GUID)
        {
            Entity.UserRole       entity    = new Entity.UserRole();
            DBOperatorBase        db        = new DataBase();
            IDBTypeElementFactory dbFactory = db.GetDBTypeElementFactory();

            try
            {
                List <Entity.Role> Roles      = new List <Entity.Role>();
                IDataReader        dataReader = db.ExecuteReader(Config.con, CommandType.Text, "select * from vUserRole where GUID='" + GUID + "'", null);
                if (dataReader.Read())
                {
                    //Entity.UserRole entity = new Entity.UserRole();
                    //entity.UserID = DataHelper.ParseToInt(dataReader["UserID"].ToString());
                    //entity.RoleID = DataHelper.ParseToInt(dataReader["RoleID"].ToString());
                    //list.Add(entity);
                    entity.user.ID       = DataHelper.ParseToInt(dataReader["UserID"].ToString());
                    entity.user.UserName = dataReader["UserName"].ToString();
                    entity.user.PassWord = dataReader["PassWord"].ToString();
                    entity.user.GUID     = dataReader["GUID"].ToString();
                    entity.user.RealName = dataReader["RealName"].ToString();
                    entity.user.IsStop   = DataHelper.ParseToBoolean(dataReader["IsStop"].ToString());


                    //entity.role.ID = DataHelper.ParseToInt(dataReader["RoleID"].ToString());
                    //entity.role.RoleName = dataReader["RoleName"].ToString();
                    //entity.role.Description = dataReader["Description"].ToString();
                    //entity.role.IsAudit = DataHelper.ParseToBoolean(dataReader["IsAudit"].ToString());
                }
                dataReader = db.ExecuteReader(Config.con, CommandType.Text, "select * from vUserRole where GUID='" + GUID + "'", null);
                while (dataReader.Read())
                {
                    Entity.Role role = new Entity.Role();
                    role.ID          = DataHelper.ParseToInt(dataReader["RoleID"].ToString());
                    role.RoleName    = dataReader["RoleName"].ToString();
                    role.Description = dataReader["Description"].ToString();
                    Roles.Add(role);
                    //entity.role.IsAudit = DataHelper.ParseToBoolean(dataReader["IsAudit"].ToString());
                }
                entity.role = Roles;
            }
            catch (Exception ex)
            {
            }
            finally
            {
                db.Conn.Close();
            }
            return(entity);
        }