Exemplo n.º 1
0
        public List <OrderView> GetOrderDetail(string orderID)
        {
            DbConnection connection = DatabaseUtil.GetConnection();
            DbCommand    command    = DatabaseUtil.GetCommand();

            List <OrderView> list = new List <OrderView>();

            using (connection)
            {
                connection.Open();
                command.Connection = connection;
                string commandString = "select order_id,status, order_time,ipad_id,description,quantity from order_list where order_id = '" + orderID + "'";

                command.CommandText = commandString;

                DbDataReader reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrderView row = new OrderView();
                        row.OrderID     = reader["order_id"].ToString().Trim();
                        row.Status      = reader["status"].ToString().Trim();
                        row.OrderTime   = reader["order_time"].ToString().Trim();
                        row.IpadID      = reader["ipad_id"].ToString().Trim();
                        row.Description = reader["description"].ToString().Trim();
                        row.Quantity    = reader["quantity"].ToString().Trim();

                        list.Add(row);
                    }
                }

                reader.Close();
            }


            return(list);
        }
Exemplo n.º 2
0
        public List <OrderView> GetOrderList()
        {
            DbConnection connection = DatabaseUtil.GetConnection();
            DbCommand    command    = DatabaseUtil.GetCommand();

            List <OrderView> list = new List <OrderView>();

            using (connection)
            {
                connection.Open();
                command.Connection = connection;
                string commandString = "select distinct order_id,status,order_time,ipad_id from order_list order by order_time ASC";

                command.CommandText = commandString;

                DbDataReader reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrderView row = new OrderView();
                        row.OrderID   = reader["order_id"].ToString().Trim();
                        row.Status    = reader["status"].ToString().Trim();
                        row.OrderTime = reader["order_time"].ToString().Trim();
                        row.IpadID    = reader["ipad_id"].ToString().Trim();

                        list.Add(row);
                    }
                }

                reader.Close();
            }


            return(list);
        }