コード例 #1
0
ファイル: TableDAL.cs プロジェクト: tungproz/testprj
        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);
        }
コード例 #2
0
ファイル: ItemDAL.cs プロジェクト: tungproz/testprj
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: TableDAL.cs プロジェクト: tungproz/testprj
        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);
        }
コード例 #7
0
ファイル: TableDAL.cs プロジェクト: tungproz/testprj
        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);
        }
コード例 #8
0
ファイル: ItemDAL.cs プロジェクト: tungproz/testprj
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
 public OrderDAL()
 {
     connection = DbConfiguration.OpenDefaultConnection();
 }