public Table GetTableById(int tableId) { query = @"select table_id,table_status,table_name from Tables where table_id = " + tableId + " ;"; Table t = null; using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand command = new MySqlCommand(query, connection); using (reader = command.ExecuteReader()) { if (reader.Read()) { t = GetTable(reader); } reader.Close(); } } return(t); }
public Item CheckItemId(int itemid) { query = @"select * from Items where item_status =1 and item_id =" + itemid + " ;"; Item item = null; using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand command = new MySqlCommand(query, connection); using (reader = command.ExecuteReader()) { if (reader.Read()) { item = GetItem(reader); } reader.Close(); } } return(item); }
public Order GetOrderById(int OrderId) { query = @"select *from OrderDetails as od inner join Orders as o where o.order_id=" + OrderId + ";"; Order o = null; using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand command = new MySqlCommand(query, connection); using (reader = command.ExecuteReader()) { if (reader.Read()) { o = GetOrderForPay(reader); } reader.Close(); } } return(o); }
public Order GetAllOrder() { query = "select * from Orders inner join OrderDetails ;"; Order order = null; //List<Order> lod = new List<Order>(); using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand command = new MySqlCommand(query, connection); using (reader = command.ExecuteReader()) { while (reader.Read()) { order = GetOrder(reader); } reader.Close(); } } return(order); }
public List <Order> DisplayOrder() { query = @"select * from Orders as o inner join OrderDetails as od on o.order_id = od.order_id where o.table_id;"; List <Order> orderlist = new List <Order>(); using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand cmd = new MySqlCommand(query, connection); using (reader = cmd.ExecuteReader()) { while (reader.Read()) { Order i = new Order(); i = GetOrder(reader); orderlist.Add(i); } } } return(orderlist); }
public bool InputMoreOrder(int tableid) { query = @"select * from Tables as t inner join Orders as o on t.table_id = o.table_id where t.table_id =" + tableid + " and t.table_status=1 and o.order_status = 0;"; bool t = false; using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand cmd = new MySqlCommand(query, connection); using (reader = cmd.ExecuteReader()) { if (reader.Read()) { t = true; } reader.Close(); } } return(t); }
public List <Table> display() { query = @"select *from tables;"; List <Table> tablelist = new List <Table>(); using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand cmd = new MySqlCommand(query, connection); using (reader = cmd.ExecuteReader()) { while (reader.Read()) { Table i = new Table(); i = GetTable(reader); tablelist.Add(i); } } } return(tablelist); }
public List <Item> GetAllItem() { query = @"select *from Items;"; List <Item> itemlist = new List <Item>(); using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand cmd = new MySqlCommand(query, connection); using (reader = cmd.ExecuteReader()) { while (reader.Read()) { Item i = new Item(); i = GetItem(reader); itemlist.Add(i); } } } return(itemlist); }
public bool CheckOrderByTable(int table_id) { query = @"select * from Orders where table_id = " + table_id + " and order_status =0;"; bool t = false; using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand cmd = new MySqlCommand(query, connection); using (reader = cmd.ExecuteReader()) { if (reader.Read()) { t = true; } reader.Close(); } } return(t); }
public List <Order> GetListOrderById(int OrderId) { query = @"select *from Orders as o inner join OrderDetails as od on o.order_id = od.order_id where o.table_id=" + OrderId + ";"; List <Order> lod = new List <Order>(); using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand command = new MySqlCommand(query, connection); using (reader = command.ExecuteReader()) { if (reader.Read()) { Order order = new Order(); order = GetOrder(reader); lod.Add(order); } reader.Close(); } } return(lod); }
public Account CheckAccountById(int accountId) { query = @" select * from Account where account_id = " + accountId + ";"; Account a = null; using (connection = DbConfiguration.OpenDefaultConnection()) { MySqlCommand command = new MySqlCommand(query, connection); using (reader = command.ExecuteReader()) { if (reader.Read()) { a = GetAccount(reader); } // else // { // throw new Exception("This Amount is wrong"); // } } } return(a); }
public OrderDAL() { connection = DbConfiguration.OpenDefaultConnection(); }