/// <summary> /// Gets all of the Person registers on the Person table. /// </summary> public static IEnumerable <Person> GetPerson() { var sqlQuery = "select * from Person"; var db = new DbGateway(); var table = db.Read(sqlQuery); return(table.Rows.Cast <DataRow>().Select(x => (Person)x)); }
/// <summary> /// Gets the first transaction with a certain message. /// </summary> /// <param name="msg">Message to find</param> public static Transaction GetTransactionByMessage(string msg) { var sqlQuery = $@"select * from [Transaction] where Message = '{msg}'"; var db = new DbGateway(); var table = db.Read(sqlQuery); return((Transaction)table.Rows.Cast <DataRow>().FirstOrDefault()); }
/// <summary> /// Gets all anti-fraud records associated to a given store. /// </summary> /// <param name="id">Store identifier</param> public static AntiFraudInfo GetStoreAntiFraudInfo(int id) { var sqlQuery = $@"select * from AssociationStoreAntiFraud where IdStore = {id}"; var db = new DbGateway(); var table = db.Read(sqlQuery); return((AntiFraudInfo)table.Rows.Cast <DataRow>().FirstOrDefault()); }
/// <summary> /// Gets all of the Operator registers on the Operator table. /// </summary> public static IEnumerable <Operator> GetOperator() { var sqlQuery = "select * from Operator"; var db = new DbGateway(); var table = db.Read(sqlQuery); return(table.Rows.Cast <DataRow>().Select(x => (Operator)x)); }
/// <summary> /// Gets a CreditCard register based on the number. /// </summary> /// <param name="id">Id of the person being searched</param> public static CreditCard GetCard(string number) { var sqlQuery = $"select * from CreditCard where Number = '{number}'"; var db = new DbGateway(); var table = db.Read(sqlQuery); var person = (CreditCard)table.Rows.Cast <DataRow>().FirstOrDefault(); return(person); }
/// <summary> /// Gets a specific Person register based on the id. /// </summary> /// <param name="id">Id of the person being searched</param> public static Person GetPerson(string id) { var sqlQuery = $"select * from Person where Id = '{id}'"; var db = new DbGateway(); var table = db.Read(sqlQuery); var person = (Person)table.Rows.Cast <DataRow>().FirstOrDefault(); return(person); }
/// <summary> /// Gets a specific Store register based on the id. /// </summary> /// <param name="id">Id of the store being searched</param> public static Store GetStore(int id) { var sqlQuery = $"select * from Store where Id = {id}"; var db = new DbGateway(); var table = db.Read(sqlQuery); var store = (Store)table.Rows.Cast <DataRow>().FirstOrDefault(); return(store); }
/// <summary> /// Gets all operators associated to a given store. /// </summary> /// <param name="id">Store identifier</param> public static IEnumerable <Operator> GetStoreOperators(int id) { var sqlQuery = $@"select o.* from Operator o inner join AssociationStoreOperator a on a.IdOperator = o.Id inner join Store s on s.Id = a.IdStore where s.Id = {id}"; var db = new DbGateway(); var table = db.Read(sqlQuery); return(table.Rows.Cast <DataRow>().Select(x => (Operator)x)); }