Exemplo n.º 1
0
        /// <summary>
        /// Extension method to create toolbar based on action methods in controller
        /// </summary>
        /// <param name="helper">Reference to HtmlHelper</param>
        /// <param name="controllerType">Type of controller, This type is used to retieve action methods with attribut ToolBarItem</param>
        /// <param name="formName">Auto generate form name</param>
        /// <param name="alignment">Alignment of Toolbar on page</param>
        /// <returns>Return Toolbar object</returns>
        //public static IHtmlString  ToolBarControl(this HtmlHelper helper, Type controllerType, string formName)
        //{
        //    //return new ToolBar(helper, controllerType, formName);
        //    StringBuilder sb = new StringBuilder();

        //    sb.AppendFormat(@"<span data-toggle=""tooltip"" class=""tooltipLink"" data-original-title=""資料查詢"">{0}", Environment.NewLine);

        //    sb.AppendFormat(@"<button type=""button"" class=""btn btn-default"">{0}", Environment.NewLine);
        //    sb.AppendFormat(@"<span class=""glyphicon""><img src=""../Images/ToolBar/glyphicons-529-database-search.png"" width=""15"" height=""15"" title=""資料查詢"" /></span>{0}", Environment.NewLine);
        //    sb.AppendFormat(@"</button>{0}", Environment.NewLine);
        //    sb.AppendFormat(@"</span>{0}", Environment.NewLine);
        //    return new HtmlString(sb.ToString());
        //}


        public static IHtmlString ToolBarControl(this HtmlHelper helper, SSoft.Enum.PatternType type)
        {
            StringBuilder sb = new StringBuilder();

            switch (type)
            {
            case Enum.PatternType.CFG:
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.Save));
                break;

            case Enum.PatternType.Query:
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.Query));
                break;

            case  Enum.PatternType.MSS:
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.Add));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.Save));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.Delete));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.FirstRow));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.PreviousRow));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.NextRow));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.LastRow));
                //sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.OnlineHelp));
                //sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.Exit));
                break;

            case Enum.PatternType.MMD:
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.Add));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.DetailAdd));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.Save));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.Delete));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.FirstRow));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.PreviousRow));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.NextRow));
                sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.LastRow));
                //sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.OnlineHelp));
                //sb.Append(ToolBar.ToolBarItem.GetItemHtmlString(helper, ToolBar.ToolBarItemType.Exit));
                break;
            }

            return(new HtmlString(sb.ToString()));
        }
Exemplo n.º 2
0
        public static dynamic GetStandTab(SSoft.Enum.PatternType type, string programNo)
        {
            switch (type)
            {
            case  Enum.PatternType.MSS:
                dynamic tabWrapperMSS = new
                {
                    MainTabs = new List <Tab>()
                    {
                        new Tab()
                        {
                            Title = "資料維護", URL = string.Format("/api/{0}/GetPartialView/_{0}_Master01", programNo)
                        },
                        new Tab()
                        {
                            Title = "查詢條件", URL = string.Format("/api/{0}/GetPartialView/_{0}_Condition", programNo)
                        },
                        new Tab()
                        {
                            Title = "查詢輸出", URL = string.Format("/api/{0}/GetPartialView/_{0}_Query", programNo)
                        }
                    }
                };
                return(tabWrapperMSS);

            case Enum.PatternType.MMD:
                dynamic tabWrapperMMD = new
                {
                    MainTabs = new List <Tab>()
                    {
                        new Tab()
                        {
                            Title      = "資料維護", URL = string.Format("/api/{0}/GetPartialView/_{0}_Master01", programNo),
                            TabDetails = new List <Tab>()
                            {
                                new Tab()
                                {
                                    Title = "明細資料", URL = string.Format("/api/{0}/GetPartialView/_{0}_Detail01", programNo)
                                }
                            }
                        },
                        new Tab()
                        {
                            Title = "查詢條件", URL = string.Format("/api/{0}/GetPartialView/_{0}_Condition", programNo)
                        },
                        new Tab()
                        {
                            Title = "查詢輸出", URL = string.Format("/api/{0}/GetPartialView/_{0}_Query", programNo)
                        }
                    }
                };

                return(tabWrapperMMD);

            case Enum.PatternType.CFG:
                dynamic tabWrapperCFG = new
                {
                    MainTabs = new List <Tab>()
                    {
                        new Tab()
                        {
                            Title = "資料維護", URL = string.Format("/api/{0}/GetPartialView/_{0}_Master01", programNo)
                        }
                    }
                };
                return(tabWrapperCFG);
            }

            return(null);
        }