コード例 #1
0
ファイル: search.aspx.cs プロジェクト: mknight95/TableTech
        public static List<Restaurant> SearchText(string search)
        {
            List<Restaurant> restaurants = new List<Restaurant>();
            string[] searchList = { "Rest_Name", "Address", "email", "Phone" };
            DataSet1TableAdapters.RestaurantTableAdapter adapter = new DataSet1TableAdapters.RestaurantTableAdapter();

            // Check search is valid
            if (search != "")
            {
                orders = adapter.GetRestByName("%" + search + "%");

                for (int i = 0; i < orders.Rows.Count; i++)
                {
                    Restaurant menuObj = new Restaurant((int)orders[i][0], (string)orders[i][1], (string)orders[i][2], (string)orders[i][3], (string)orders[i][4], (string)orders[i][5]);
                    restaurants.Add(menuObj);
                }
            }

            return restaurants;
        }
コード例 #2
0
ファイル: menu.aspx.cs プロジェクト: mknight95/TableTech
        protected void Page_Load(object sender, EventArgs e)
        {
            //creating table in ASP, really should create it in JS to stop the double query, but I'll do it l8r coz im lazy
            int rest = Convert.ToInt32(Request.QueryString["rest"]);
            DataSet1.MenuDataTable orders;
            //The query returns every column, but I only wanna use a few, so I declare those here
            DataSet1TableAdapters.MenuTableAdapter adapter = new DataSet1TableAdapters.MenuTableAdapter();
            orders = adapter.GetMenuById(rest);

            // Get groups
            List<string> tabs = new List<string>();

            for (int i = 0; i < orders.Rows.Count; i++)
            {
                // orders[i]["Category"];
                // Does item belong to new category
                if (!tabs.Contains(orders[i]["Category"]))
                {
                    // Add tab
                    tabs.Add(orders[i]["Category"].ToString());
                    tabsLit.Text += "<paper-tab>" + orders[i]["Category"] + "</paper-tab>";

                   // Add iron page div
                    HtmlGenericControl newDiv = new HtmlGenericControl("div");
                    newDiv.ID = orders[i]["Category"].ToString();
                    newDiv.Attributes["class"] += "menu-cat";
                    menuPH.Controls.Add(newDiv);
                }

                // Locate appropriate iron page div
                HtmlGenericControl foundDiv = (HtmlGenericControl)menuPH.FindControl(orders[i]["Category"].ToString());
                if (foundDiv != null)
                {
                    // Add menu item to div
                    foundDiv.InnerHtml += "<paper-card class=\"menu-item\" heading=\"" + orders[i]["Item_Name"] + "\" onclick=\"AddItem(" + i + ");\"><paper-ripple></paper-ripple><div class=\"card-content\">$" + String.Format("{0:0.00}", orders[i]["Price"]) + "</div></paper-card>";
                }
            }

            // Set title to current Restaurant name
            DataSet1TableAdapters.RestaurantTableAdapter nameLoader = new DataSet1TableAdapters.RestaurantTableAdapter();
            string restName = nameLoader.GetRestNameByID(rest);
            Master.restaurantNameBox.Text = restName;
        }