Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string strID = Request.QueryString["id"];
         if ((strID == null) || (strID == "0"))
         {
             MySqlConnection  conn = CMain.GetConnection(ApplicationSession.DBName);
             List <CCategory> lst  = CCategory.ListOfCategoryZero(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
             lvwCategory.DataSource = lst;
             lvwCategory.DataBind();
         }
         else
         {
             bool isNumeric = int.TryParse(strID, out int iCategoryID);
             if (isNumeric)
             {
                 MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                 CCategory       cat  = new CCategory(iCategoryID, conn);
                 lblTitle.Text = cat.Caption;
                 List <CCategory> lst = cat.ListOfChildren(conn);
                 lvwCategory.DataSource = lst;
                 lvwCategory.DataBind();
             }
         }
     }
 }
Пример #2
0
        public void DisplayDropdownMenu()
        {
            MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);

            if (ApplicationSession.SalesType.IsCatering())
            {
                //Category:
                List <CCategory> lst = CCategory.ListOfCategoryZero(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                foreach (CCategory cat in lst)
                {
                    HtmlGenericControl li = new HtmlGenericControl("li");
                    tabs.Controls.Add(li);
                    HtmlGenericControl anchor = new HtmlGenericControl("a");
                    string             url    = "CategoryPage.aspx?id=" + cat.ID.ToString();
                    anchor.Attributes.Add("href", url);
                    //anchor.Attributes.Add("runat", "server");
                    //anchor.Attributes.Add("onclick", "return MyFunction();");
                    anchor.InnerText = cat.Caption;
                    li.Controls.Add(anchor);
                }
            }
            else
            {
                //ItemGroups:
                List <CItemGroup> lst = COutlet.ListOfItemGroups(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                foreach (CItemGroup ig in lst)
                {
                    HtmlGenericControl li = new HtmlGenericControl("li");
                    tabs.Controls.Add(li);
                    HtmlGenericControl anchor = new HtmlGenericControl("a");
                    string             url    = "MenuItemPage.aspx?id=" + ig.ID.ToString();
                    anchor.Attributes.Add("href", url);
                    //anchor.Attributes.Add("runat", "server");
                    //anchor.Attributes.Add("onclick", "return MyFunction();");
                    anchor.InnerText = ig.Name;
                    li.Controls.Add(anchor);
                }
            }

            //DeliveryMethods:
            List <CDeliveryMode> lstDelMode = COutlet.ListOfDeliveryModes(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);

            foreach (CDeliveryMode delMode in lstDelMode)
            {
                HtmlGenericControl li = new HtmlGenericControl("li");
                delTabs.Controls.Add(li);
                HtmlGenericControl anchor = new HtmlGenericControl("a");
                //string url = "MenuItemPage.aspx?id=" + ig.ID.ToString();
                //anchor.Attributes.Add("href", url);
                //anchor.Attributes.Add("runat", "server");
                //anchor.Attributes.Add("onclick", "return MyFunction();");
                anchor.InnerText = delMode.Name;
                li.Controls.Add(anchor);
            }
        }