Ejemplo n.º 1
0
        public List <MenuLine> GetMenuLinesByStoreIdCustomerId(string connectionString, string CustomerId, string StoreId, string MenuId)
        {
            List <MenuLine> lm  = new List <MenuLine>();
            string          sql = "";

            #region SQL
            sql += "select Bootstrap_Button,Colour,[Description],Html_Colour,ImagePath,";
            sql += "ISImage,Key_Command,[Key_ID],Key_Value,Menu_ID ";
            sql += "from " + CustomerId + "_" + StoreId + "_" + "Menu_Line ";
            sql += "where Menu_ID=@Menu_ID ";
            sql += "order by [Key_ID] ";
            #endregion SQL
            #region Execute SQL
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    #region Param
                    SqlParameter param = new SqlParameter();
                    param.ParameterName = "@Menu_ID";
                    param.Value         = MenuId;
                    param.DbType        = DbType.String;
                    param.Size          = 20;
                    command.Parameters.Add(param);
                    #endregion Param
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        MenuLine m = new MenuLine();
                        #region Fill Model
                        m.BootstrapButton = reader.GetString(0);
                        m.Colour          = reader.GetString(1);
                        m.Description     = reader.GetString(2);
                        m.HtmlColour      = reader.GetString(3);
                        m.ImagePath       = reader.GetString(4);
                        m.IsImage         = reader.GetBoolean(5);
                        m.KeyCommand      = reader.GetInt32(6);
                        m.KeyId           = reader.GetInt32(7);
                        m.KeyValue        = reader.GetString(8);
                        m.MenuId          = reader.GetString(9);
                        #endregion Fill Model
                        lm.Add(m);
                    }
                }
            }
            #endregion Execute SQL
            return(lm);
        }
        protected virtual void SetupHeaderView()
        {
            MenuLine?.SetBackgroundColor(ColorConstants.BackgroundGray);
            BottomHeaderLine?.SetBackgroundColor(ColorConstants.BlackColor);
            HeaderRootView?.SetBackgroundColor(ColorConstants.BlackColor);
            ContentView?.SetBackgroundColor(ColorConstants.BackroundContent);
            HeaderLeftImageView?.SetSelected(ColorConstants.BlackColor);
            HeaderRightImageView?.SetSelected(ColorConstants.BlackColor);

            HeaderLine?.SetBackgroundColor(ColorConstants.BlackColor);

            if (CounterTextView != null)
            {
                CounterTextView.Visibility = ViewState.Invisible;
            }

            switch (HeaderAreaAction)
            {
            case HeaderAreaActionType.Nothing:

                HeaderLeftImageView?.SetImageFromResource(null);
                HeaderRightImageView?.SetImageFromResource(null);
                if (!HeaderLeftTouchArea.IsNull())
                {
                    HeaderLeftTouchArea.Click  -= BackAction;
                    HeaderRightTouchArea.Click -= Shop;
                }

                break;

            case HeaderAreaActionType.Back:

                HeaderLeftImageView?.SetImageFromResource(DrawableConstants.BackIcon);
                HeaderLeftImageView?.SetSelected(ColorConstants.SelectorHome);

                if (HeaderLeftImageView != null)
                {
                    HeaderLeftImageView.Click -= BackAction;
                    HeaderLeftImageView.Click += BackAction;
                }

                HeaderRightImageView?.SetImageFromResource(null);

                if (!HeaderTextView.IsNull())
                {
                    HeaderTextView.Text = HeaderText;
                    HeaderTextView.SetTextColor(ColorConstants.WhiteColor);
                    HeaderTextView.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size18);
                }
                if (!HeaderLeftTouchArea.IsNull() && !HeaderRightTouchArea.IsNull())
                {
                    HeaderLeftTouchArea.Click  -= BackAction;
                    HeaderLeftTouchArea.Click  += BackAction;
                    HeaderRightTouchArea.Click -= Shop;
                }
                break;

            case HeaderAreaActionType.Menu:

                if (!HeaderLeftImageView.IsNull())
                {
                    HeaderLeftImageView?.SetImageFromResource(DrawableConstants.MenuIcon);
                    HeaderLeftImageView?.SetSelected(ColorConstants.SelectorHome);
                    if (HeaderLeftImageView != null)
                    {
                        HeaderLeftImageView.Click -= MenuAction;
                        HeaderLeftImageView.Click += MenuAction;
                    }
                }

                HeaderRightImageView?.SetImageFromResource(null);

                if (!HeaderTextView.IsNull())
                {
                    HeaderTextView.Text = HeaderText;
                    HeaderTextView.SetTextColor(ColorConstants.WhiteColor);
                    HeaderTextView.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size18);
                }

                break;

            case HeaderAreaActionType.Shop:

                HeaderLeftImageView?.SetImageFromResource(DrawableConstants.MenuIcon);
                HeaderLeftImageView?.SetSelected(ColorConstants.SelectorHome);
                if (HeaderLeftImageView != null)
                {
                    HeaderLeftImageView.Click -= MenuAction;
                    HeaderLeftImageView.Click += MenuAction;
                }


                HeaderRightImageView?.SetImageFromResource(DrawableConstants.ShopIcon);
                HeaderRightImageView?.SetSelected(ColorConstants.SelectorHome);

                HeaderRightImageView.Click -= Shop;
                HeaderRightImageView.Click += Shop;

                if (!CounterTextView.IsNull())
                {
                    CounterTextView.Visibility = ViewState.Visible;
                    CounterTextView.Text       = OrderManager.Instance.CurrentOrderCount.ToString();

                    OrderManager.Instance.ChangeOrder -= Instance_ChangeOrder;
                    OrderManager.Instance.ChangeOrder += Instance_ChangeOrder;
                    CounterTextView.SetTextColor(ColorConstants.WhiteColor);

                    CounterTextView.SetBackgroundColor(ColorConstants.SelectorHome, 8);
                }

                if (!HeaderTextView.IsNull())
                {
                    HeaderTextView.Text = HeaderText;
                    HeaderTextView.SetTextColor(ColorConstants.WhiteColor);
                    HeaderTextView.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size18);
                }

                if (!HeaderLeftTouchArea.IsNull() && !HeaderRightTouchArea.IsNull())
                {
                    HeaderLeftTouchArea.Click -= MenuAction;
                    HeaderLeftTouchArea.Click += MenuAction;

                    HeaderRightTouchArea.Click -= Shop;
                    HeaderRightTouchArea.Click += Shop;
                }

                break;
            }
        }
Ejemplo n.º 3
0
 public string[] Render()
 {
     MenuLine[] menuPrint = new MenuLine[_height];
     RenderMenuItems(menuPrint);
     return(MenuPrintToStr(menuPrint));
 }