private static void SetDM_USER(DbDataReader reader, ref DM_USER dm_user) { dm_user.IDUSER = int.Parse("0" + reader[FIELD_IDUSER]); dm_user.IDMA_DVIQLY = int.Parse("0" + reader[FIELD_IDMA_DVIQLY]); dm_user.USERNAME = "" + reader[FIELD_USERNAME]; dm_user.PASSWORD = "" + reader[FIELD_PASSWORD]; dm_user.HOTEN = "" + reader[FIELD_HOTEN]; dm_user.DIACHI = "" + reader[FIELD_DIACHI]; dm_user.SODT = "" + reader[FIELD_SODT]; dm_user.EMAIL = "" + reader[FIELD_EMAIL]; DateTime NGAYSINH = (DateTime)reader[FIELD_NGAYSINH]; dm_user.NGAYSINH = NGAYSINH != null ? (DateTime)NGAYSINH : DateTime.Now; DateTime NGAYTAO = (DateTime)reader[FIELD_NGAYTAO]; dm_user.NGAYTAO = NGAYTAO != null ? (DateTime)NGAYTAO : DateTime.Now; dm_user.IS_ADMIN = int.Parse("0" + reader[FIELD_IS_ADMIN]); dm_user.XACNHAN = bool.Parse("" + reader[FIELD_XACNHAN]); dm_user.strDonVi = "" + reader["strDonVi"]; SYS_RolesDataAccess sysRoleDataAccess = new SYS_RolesDataAccess(); dm_user.Roles = sysRoleDataAccess.GetRolesByUser(dm_user.IDUSER); dm_user.RoleGroup = dm_user.Roles.Name; dm_user.CHUCDANH = "" + reader[FIELD_CHUCDANH]; }
public List <SYS_Roles> SelectAllSYS_Roles() { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); List <SYS_Roles> sys_roles = new List <SYS_Roles>(); DbDataReader reader = null; try { reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Roles_SelectAll]", (DbParameter[])null); if (reader.HasRows) { SYS_RolesDataAccess.SetListSYS_RolesInfoAll(ref reader, ref sys_roles); } return(sys_roles); } catch (Exception ex) { throw new Exception(String.Format(" SYS_RolesDataAccess.SelectAll: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
public SYS_Roles SelectSYS_Roles(int ID) { DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); SYS_Roles sys_roles = new SYS_Roles(); DbDataReader reader = null; try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Role_GetByID]", para.ToArray()); if (reader.HasRows && reader.Read()) { SYS_RolesDataAccess.SetSYS_RolesInfo(reader, ref sys_roles); } return(sys_roles); } catch (Exception ex) { throw new Exception(String.Format("SYS_RolesDataAccess.SelectById: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
private static void SetListSYS_RolesInfo(ref DbDataReader reader, ref List <SYS_Roles> sys_roless) { SYS_Roles sys_roles = null; while (reader.Read()) { sys_roles = new SYS_Roles(); SYS_RolesDataAccess.SetSYS_RolesInfo(reader, ref sys_roles); sys_roless.Add(sys_roles); } }
private static void SetListSYS_UserInfoAll(ref DbDataReader reader, ref List <SYS_User> sys_users) { SYS_User sys_user; SYS_RolesDataAccess sysRolesDataAccess = new SYS_RolesDataAccess(); while (reader.Read()) { sys_user = new SYS_User(); SYS_UserDataAccess.SetSYS_UserInfo(reader, ref sys_user); sys_user.Roles = sysRolesDataAccess.GetRolesByUser(sys_user.ID); sys_users.Add(sys_user); } }
private static void SetListSYS_RolesInfoAll(ref DbDataReader reader, ref List <SYS_Roles> sys_roless) { SYS_Roles sys_roles = null; SYS_RightDataAccess sysRightDataAccess = new SYS_RightDataAccess(); while (reader.Read()) { sys_roles = new SYS_Roles(); SYS_RolesDataAccess.SetSYS_RolesInfo(reader, ref sys_roles); sys_roles.Right = sysRightDataAccess.GetRightsByRole(sys_roles); sys_roless.Add(sys_roles); } }
private static void SetSYS_UserInfo(DbDataReader reader, ref SYS_User sys_user) { sys_user.ID = int.Parse("0" + reader[FIELD_ID]); sys_user.UserName = "" + reader[FIELD_USERNAME]; sys_user.Password = "" + reader[FIELD_PASSWORD]; sys_user.FirstName = "" + reader[FIELD_FIRSTNAME]; sys_user.MidName = "" + reader[FIELD_MIDNAME]; sys_user.LastName = "" + reader[FIELD_LASTNAME]; sys_user.NumberPhone = "" + reader[FIELD_NUMBERPHONE]; sys_user.Email = "" + reader[FIELD_EMAIL]; sys_user.IsActive = reader[FIELD_ISACTIVE] != DBNull.Value ? Convert.ToBoolean(reader[FIELD_ISACTIVE]) : false; sys_user.IDOrganization = int.Parse("0" + reader[FIELD_IDORGANIZATION]); SYS_RolesDataAccess sysRoleDataAccess = new SYS_RolesDataAccess(); sys_user.Roles = sysRoleDataAccess.GetRolesByUser(sys_user.ID); sys_user.RoleGroup = sys_user.Roles.Name; }