示例#1
0
        // GET: Button
        public ActionResult Index()
        {
            Models.ButtonModel button1 = new Models.ButtonModel(false);
            Models.ButtonModel button2 = new Models.ButtonModel(false);

            ButtonController.buttons.Add(button1);
            ButtonController.buttons.Add(button2);

            return(View("Button", buttons));
        }
示例#2
0
        private static void addButton(List <Models.ButtonModel> buttonlist, string text, string name, string cssClass, string AppUrl, int GridRow = 1, int GridCol = 1, int ColSpan = 1, string section = "")
        {
            Models.ButtonModel button = new Models.ButtonModel();
            if (string.IsNullOrEmpty(text) == false)
            {
                button.text = text;
            }
            else
            {
                throw new Exception("button text cannot be null or empty");
            }

            if (GridRow > 0)
            {
                button.GridRow = GridRow;
            }
            else
            {
                button.GridRow = 1;
            }

            if (GridCol > 0)
            {
                button.GridCol = GridCol;
            }
            else
            {
                button.GridCol = 1;
            }

            if (ColSpan > 0)
            {
                button.ColSpan = ColSpan;
            }
            else
            {
                button.ColSpan = 1;
            }

            if (string.IsNullOrEmpty(name) == false)
            {
                button.Name = name;
                button.Id   = name;
            }
            else
            {
                throw new Exception("button name cannot be null or empty");
            }

            if (string.IsNullOrEmpty(cssClass) == false)
            {
                button.cssClass = cssClass;
            }
            else
            {
                throw new Exception("button picture url cannot be null or empty");
            }

            if (string.IsNullOrEmpty(AppUrl) == false)
            {
                button.AppUrl = AppUrl;
            }
            else
            {
                throw new Exception("button app url cannot be null or empty");
            }
            if (section.Trim().Length > 0)
            {
                button.section = section.Trim();
            }
            else
            {
                button.section = "QA";
            }

            buttonlist.Add(button);
        }