/// <summary>
 /// Constructor that takes a MySQLDatabase instance 
 /// </summary>
 /// <param name="database"></param>
 public UserRolesTableRepository(MySQLDatabase database)
 {
     _database = database;
     //_database.Set(typeof(UserRolesTable));
     this.dbSet = database.Set<UserRolesTable>();
     this.dbSetRoles = database.Set<IdentityRole>();
 }
Пример #2
0
 public UserBll()
 {
     this.Database = (MySQLDatabase)OwinContextExtensions.Get<ApplicationDbContext>(HttpContextExtensions.GetOwinContext(HttpContext.Current.Request));
     this._userTable = (IUserTable)new UserTable(this.Database);
     this._groupTable = (IGroupTable)new GroupTable(this.Database);
     this._permissionTable = (IPermissionTable)new PermissionTable(this.Database);
     this._termTable = (ITermTable)new TermTable(this.Database);
 }
Пример #3
0
 public GroupBll()
 {
     Database = HttpContext.Current.Request.GetOwinContext().Get<ApplicationDbContext>();
     _groupTable = new GroupTable(Database);
     _userTable = new UserTable(Database);
     _permissionTable = new PermissionTable(Database);
     _termTable = new TermTable(Database);
 }
Пример #4
0
        /// <summary>
        /// Metodo que carga los permisos de un usuario dependiendo del establecimiento
        /// </summary>
        /// <param name="username"></param>
        /// <param name="uorgId"></param>
        private static void GetPermisosUsuario(string username)
        {
            // Get Session
            var session = HttpContext.Current.Session;

            // Access to Database
            var db = new MySQLDatabase();
            //MySqlCommand cmd = db.Connection.CreateCommand();

            /////

            MySqlCommand cmd = new MySqlCommand("SELECT p.`Codigo`,p.`Nombre` FROM cif_bd.Usuariospermisos u  INNER JOIN cif_bd.usuarios u1 ON(u.`IdUsuario` = u1.`Id`  ) INNER JOIN cif_bd.permisos p ON(u.`IdPermiso` = p.`Id`  ) where u1.`UserName` = @UserName UNION select per.Codigo, per.Nombre from rolespermisos rp INNER JOIN cif_bd.permisos per on (rp.IdPermiso = per.Id) where IdRole in (SELECT u.`idrole` FROM cif_bd.usuariosroles u INNER JOIN cif_bd.usuarios u1 ON(u.`Idusuario` = u1.`Id`  )  where u1.`UserName` = @UserName ) ; ", db.Connection);

            /////

            try {

                // Procedure and Params

                cmd.Parameters.AddWithValue("@username", username);

                // Execute
                db.Open();
                MySqlDataReader reader = cmd.ExecuteReader();

                // Read
                var permissions = session["permissions"] as IDictionary<string, Permission>;
                string permissionCode, permissionName;

                Debug.WriteLine("----- Permisos -----");
                while (reader.Read()) {
                    permissionName = reader["NOMBRE"].ToString();
                    permissionCode = reader["CODIGO"].ToString();

                    permissions.Add(permissionCode, new Permission {
                        Code = permissionCode,
                        Name = permissionName
                    });
                    Debug.WriteLine("Codigo: {0}, Nombre: {1}", permissionCode, permissionName);
                }

                reader.Dispose();

            } catch (MySqlException) {
                throw;

            } catch (FormatException) {
                throw;

            } finally {
                // Free memory
                db.Close();
                cmd.Dispose();
                db.Dispose();
            }
        }
Пример #5
0
 public TermTable(MySQLDatabase database)
 {
     _database = database;
 }
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance 
 /// </summary>
 /// <param name="database"></param>
 public UserLoginsTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #7
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance
 /// </summary>
 /// <param name="database"></param>
 public UserTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #8
0
 public RefreshTokenBll()
 {
     Database = HttpContext.Current.Request.GetOwinContext().Get<ApplicationDbContext>();
     _refreshTokenTable = new RefreshTokenTable(Database);
 }
Пример #9
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance
 /// </summary>
 /// <param name="database"></param>
 public UserClaimsTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #10
0
 public StudentYearClassSectionRollTable(MySQLDatabase database)
 {
     db = database;
 }
Пример #11
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase as argument
 /// </summary>
 /// <param name="database"></param>
 public RoleStore(MySQLDatabase database)
 {
     Database  = database;
     roleTable = new RoleTable(database);
 }
Пример #12
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance
 /// </summary>
 /// <param name="database"></param>
 public UserLoginsTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #13
0
 public UserBranchStore(MySQLDatabase database)
 {
     Database        = database;
     userBranchTable = new UserBranchTable(database);
 }
Пример #14
0
 public YearClassSectionTable(MySQLDatabase database)
 {
     db = database;
 }
Пример #15
0
 public ClassTable(MySQLDatabase database)
 {
     db = database;
 }
 public TeacherSubjectTable(MySQLDatabase database)
 {
     db = database;
     yearClassSectionTable = new YearClassSectionTable(db);
 }
Пример #17
0
 public RequestDeviceTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #18
0
 public DeviceTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #19
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance
 /// </summary>
 /// <param name="database"></param>
 public BankGLAccountTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #20
0
 public PermissionTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #21
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance
 /// </summary>
 /// <param name="database"></param>
 public UploadTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #22
0
 public SectionTable(MySQLDatabase database)
 {
     db = database;
 }
Пример #23
0
 public GroupTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #24
0
 public SubjectYearTable(MySQLDatabase database)
 {
     db = database;
 }
Пример #25
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase as argument
 /// </summary>
 /// <param name="database"></param>
 public UploadStore(MySQLDatabase database)
 {
     Database    = database;
     uploadTable = new UploadTable(database);
 }
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance 
 /// </summary>
 /// <param name="database"></param>
 public UserClaimsTableRepository(MySQLDatabase database)
 {
     _database = database;
     this.dbSet = database.Set<UserClaims>();
 }
Пример #27
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance
 /// </summary>
 /// <param name="database"></param>
 public RoleTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #28
0
 public TermTable(MySQLDatabase database)
 {
     db = database;
 }
Пример #29
0
        /// <summary>
        /// Metodo que carga los detalles del usuario logueado para su posterior uso
        /// </summary>
        /// <param name="username">Nombre de usuario</param>
        /// <param name="uorgId">Id de unidad organizacional en logueada</param>
        private static void RegisterUserDetails(string username)
        {
            // Get Session
            var session = HttpContext.Current.Session;

            // Access to Database
            var db = new MySQLDatabase();
            MySqlCommand cmd = db.Connection.CreateCommand();

            try
            {
                // Procedure and Params
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "SEG.GetUserDetails";
                cmd.Parameters.Add("usuario_", MySqlDbType.VarChar, 4000).Value = username;
                cmd.Parameters.Add("uorg_id_", MySqlDbType.Int64, 4000).Value = 0;
                cmd.Parameters.Add("id_", MySqlDbType.VarChar, 4000).Direction = ParameterDirection.Output;
                cmd.Parameters.Add("email_", MySqlDbType.VarChar, 4000).Direction = ParameterDirection.Output;
                cmd.Parameters.Add("nombres_", MySqlDbType.VarChar, 4000).Direction = ParameterDirection.Output;
                cmd.Parameters.Add("apellidos_", MySqlDbType.VarChar, 4000).Direction = ParameterDirection.Output;
                cmd.Parameters.Add("entaportantes_id_", MySqlDbType.Int64).Direction = ParameterDirection.Output;

                // Execute
                db.Open();
                cmd.ExecuteNonQuery();

                // Read
                var user = session["user"] as IDictionary<string, object>;
                user.Add("UserName", username);
                user.Add("UorgId", 0);
                user.Add("UserId", cmd.Parameters["id_"].Value);
                user.Add("Email", cmd.Parameters["email_"].Value);
                user.Add("FirstNames", cmd.Parameters["nombres_"].Value);
                user.Add("LastNames", cmd.Parameters["apellidos_"].Value);
                user.Add("EntAportanteId", cmd.Parameters["entaportantes_id_"].Value);

            } catch (MySqlException) {
                throw;
            } catch (FormatException) {
                throw;
            } finally {
                db.Close();
                cmd.Dispose();
                db.Dispose();
            }
        }
Пример #30
0
        //public object Mapper { get; private set; }

        public DeviceBll()
        {
            Database = HttpContext.Current.Request.GetOwinContext().Get<ApplicationDbContext>();
            _deviceTable = new DeviceTable(Database);
            _requestDeviceTable = new RequestDeviceTable(Database);
        }
Пример #31
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance 
 /// </summary>
 /// <param name="database"></param>
 public UserRolesTable(MySQLDatabase database)
 {
     _database = database;
 }
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance 
 /// </summary>
 /// <param name="database"></param>
 public UserLoginsTableRepository(MySQLDatabase database)
 {
     _database = database;
     this.dbSet = database.Set<UserLoginTable>();
 }
Пример #33
0
 public RefreshTokenTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #34
0
        /// <summary>
        /// Metodo que carga los roles de un usuario dependiendo del establecimiento
        /// </summary>
        /// <param name="username"></param>
        /// <param name="uorgId"></param>
        private static void GetRolesUsuario(string username)
        {
            // Get Session
            var session = HttpContext.Current.Session;

            // Access to Database
            var db = new MySQLDatabase();
            //MySqlCommand cmd = db.Connection.CreateCommand();
            MySqlCommand cmd = new MySqlCommand("SELECT r.`Nombre`,r.`Codigo` FROM cif_bd.usuariosroles u INNER JOIN cif_bd.usuarios u1 ON(u.`Idusuario` = u1.`Id`  ) INNER JOIN cif_bd.roles r ON(u.`idrole` = r.`Id`  )  where u1.`UserName` = @UserName ; ", db.Connection);
            try {
                // Procedure and Params

                cmd.Parameters.AddWithValue("@username", username);
                // Execute
                db.Open();
                MySqlDataReader reader = cmd.ExecuteReader();

                // Read
                var roles = session["roles"] as IDictionary<string, Role>;
                string roleName, roleCode;

                Debug.WriteLine("----- Roles -----");
                while (reader.Read()) {
                    roleName = reader["NOMBRE"].ToString();
                    roleCode = reader["CODIGO"].ToString();
                    roles.Add(roleCode, new Role {
                        Code = roleCode,
                        Name = roleName
                    });

                    Debug.WriteLine("Codigo: {0}, Nombre: {1}", roleCode, roleName);
                }

                reader.Dispose();
                //p1.Dispose();

            } catch (MySqlException) {
                throw;

            } catch (FormatException) {
                throw;

            } finally {
                db.Close();
                cmd.Dispose();
                db.Dispose();
            }
        }
Пример #35
0
 public LoginHistoryTable(MySQLDatabase database)
 {
     this._database = database;
 }
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance 
 /// </summary>
 /// <param name="database"></param>
 public UserClaimsTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #37
0
 /// <summary>
 /// Constructor that takes a MySQLDatabase as argument
 /// </summary>
 /// <param name="database"></param>
 public BankStore(MySQLDatabase database)
 {
     Database  = database;
     bankTable = new BankTable(database);
 }
 /// <summary>
 /// Constructor that takes a MySQLDatabase instance 
 /// </summary>
 /// <param name="database"></param>
 public RoleTable(MySQLDatabase database)
 {
     _database = database;
 }
Пример #39
0
 public LoginHistoryBll()
 {
     Database = HttpContext.Current.Request.GetOwinContext().Get<ApplicationDbContext>();
     _loginHistoryTable = new LoginHistoryTable(Database);
 }