Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LabelHelper" /> class.
 /// </summary>
 /// <param name="strategy">The strategy.</param>
 /// <param name="text">The text.</param>
 /// <param name="status">The status.</param>
 /// <param name="htmlAttributes">The HTML attributes.</param>
 public LabelHelper(IStatusStrategy strategy, string text, BootstrapStatus status, object htmlAttributes)
 {
     this.strategy       = strategy;
     this.text           = text;
     this.status         = status;
     this.htmlAttributes = htmlAttributes;
 }
Exemple #2
0
        /// <summary>
        /// Renders a Twitter Bootstrap badge component
        /// </summary>
        /// <param name="helper">The html helper.</param>
        /// <param name="text">The text.</param>
        /// <param name="status">The status.</param>
        /// <param name="htmlAttributes">The HTML attributes.</param>
        /// <returns>Returns a badge html string</returns>
        public static MvcHtmlString Badge(this HtmlHelper helper, string text, BootstrapStatus status,
                                          object htmlAttributes)
        {
            BadgeHelper badgeHelper = new BadgeHelper(helper, GetStatusStrategy(status), text, status, htmlAttributes);

            return(MvcHtmlString.Create(badgeHelper.Render()));
        }
Exemple #3
0
        /// <summary>
        /// Renders a Twitter Bootstrap label component
        /// </summary>
        /// <param name="helper">The html helper.</param>
        /// <param name="text">The text.</param>
        /// <param name="status">The label status.</param>
        /// <param name="htmlAttributes">The HTML attributes.</param>
        /// <returns>Returns a label html string</returns>
        public static MvcHtmlString Label(this HtmlHelper helper, string text, BootstrapStatus status,
                                          object htmlAttributes)
        {
            LabelHelper labelHelper = new LabelHelper(GetStatusStrategy(status), text, status, htmlAttributes);

            return(MvcHtmlString.Create(labelHelper.Render()));
        }
Exemple #4
0
        /// <summary>
        /// Gets the status strategy.
        /// </summary>
        /// <param name="status">The status.</param>
        private static IStatusStrategy GetStatusStrategy(BootstrapStatus status)
        {
            IStatusStrategy strategy;

            switch (status)
            {
            case BootstrapStatus.Success:
                strategy = new SuccessStatusStrategy();
                break;

            case BootstrapStatus.Warning:
                strategy = new WarningStatusStrategy();
                break;

            case BootstrapStatus.Important:
                strategy = new ImportantStatusStrategy();
                break;

            case BootstrapStatus.Info:
                strategy = new InfoStatusStrategy();
                break;

            case BootstrapStatus.Inverse:
                strategy = new InverseStatusStragety();
                break;

            default:
                strategy = new DefaultStatusStrategy();
                break;
            }

            return(strategy);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BadgeHelper" /> class.
 /// </summary>
 /// <param name="helper">The helper.</param>
 /// <param name="strategy">The strategy.</param>
 /// <param name="text">The text.</param>
 /// <param name="status">The status.</param>
 /// <param name="htmlAttributes">The HTML attributes.</param>
 public BadgeHelper(HtmlHelper helper, IStatusStrategy strategy, string text, BootstrapStatus status, object htmlAttributes)
 {
     this.helper = helper;
     this.strategy = strategy;
     this.status = status;
     this.htmlAttributes = htmlAttributes;
     this.text = text;
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BadgeHelper" /> class.
 /// </summary>
 /// <param name="helper">The helper.</param>
 /// <param name="strategy">The strategy.</param>
 /// <param name="text">The text.</param>
 /// <param name="status">The status.</param>
 /// <param name="htmlAttributes">The HTML attributes.</param>
 public BadgeHelper(HtmlHelper helper, IStatusStrategy strategy, string text, BootstrapStatus status, object htmlAttributes)
 {
     this.helper         = helper;
     this.strategy       = strategy;
     this.status         = status;
     this.htmlAttributes = htmlAttributes;
     this.text           = text;
 }
        public ActionResult ImportReport(ImportSyncStatus? sync, BootstrapStatus? import, int? page)
        {
            ImportTextFile<DirectoryMember> importFile = (ImportTextFile<DirectoryMember>)Session[varName];

            ViewBag.Total = importFile.Items.Count();
            
            ViewBag.InsertSuccess = importFile.Items.Where(x => x.SyncStatus == ImportSyncStatus.Insert & x.ImportStatus == BootstrapStatus.success).Count();
            ViewBag.InsertErrors = importFile.Items.Where(x => x.SyncStatus == ImportSyncStatus.Insert & x.ImportStatus == BootstrapStatus.danger).Count();

            ViewBag.UpdateSuccess = importFile.Items.Where(x => x.SyncStatus == ImportSyncStatus.Update & x.ImportStatus == BootstrapStatus.success).Count();
            ViewBag.UpdateErrors = importFile.Items.Where(x => x.SyncStatus == ImportSyncStatus.Update & x.ImportStatus == BootstrapStatus.danger).Count();

            ViewBag.Errors = importFile.Items.Where(x => x.ImportStatus == BootstrapStatus.danger).Count();

            List<DirectoryMember> members = null;

            if(sync == null & import == null)
            {
                members = importFile.Items;
            }

            if (sync != null & import == null)
            {
                members = importFile.Items.Where(x => x.SyncStatus == sync).ToList();
            }

            if (sync == null & import != null)
            {
                members = importFile.Items.Where(x => x.ImportStatus == import).ToList();
            }

            if (sync != null & import != null)
            {
                members = importFile.Items.Where(x => x.SyncStatus == sync & x.ImportStatus == import).ToList();
            }

            ViewBag.Page = (page == null) ? 1 : page;

            PagedList<DirectoryMember> pg = new PagedList<DirectoryMember>(members, ViewBag.Page, 12);

            return View(pg);



        }
 /// <summary>
 /// Renders a Twitter Bootstrap label component
 /// </summary>
 /// <param name="helper">The html helper.</param>
 /// <param name="text">The text.</param>
 /// <param name="status">The label status.</param>
 /// <param name="htmlAttributes">The HTML attributes.</param>
 /// <returns>Returns a label html string</returns>
 public static MvcHtmlString Label(this HtmlHelper helper, string text, BootstrapStatus status, object htmlAttributes)
 {
     LabelHelper labelHelper = new LabelHelper(GetStatusStrategy(status), text, status, htmlAttributes);
     return new MvcHtmlString(labelHelper.Render());
 }
 /// <summary>
 /// Renders a Twitter Bootstrap badge component
 /// </summary>
 /// <param name="helper">The html helper.</param>
 /// <param name="text">The text.</param>
 /// <param name="status">The status.</param>
 /// <param name="htmlAttributes">The HTML attributes.</param>
 /// <returns>Returns a badge html string</returns>
 public static MvcHtmlString Badge(this HtmlHelper helper, string text, BootstrapStatus status, object htmlAttributes)
 {
     BadgeHelper badgeHelper = new BadgeHelper(helper, GetStatusStrategy(status), text, status, htmlAttributes);
     return new MvcHtmlString(badgeHelper.Render());
 }
        /// <summary>
        /// Gets the status strategy.
        /// </summary>
        /// <param name="status">The status.</param>
        private static IStatusStrategy GetStatusStrategy(BootstrapStatus status)
        {
            IStatusStrategy strategy;
            switch (status)
            {
                case BootstrapStatus.Success:
                    strategy = new SuccessStatusStrategy();
                    break;
                case BootstrapStatus.Warning:
                    strategy = new WarningStatusStrategy();
                    break;
                case BootstrapStatus.Important:
                    strategy = new ImportantStatusStrategy();
                    break;
                case BootstrapStatus.Info:
                    strategy = new InfoStatusStrategy();
                    break;
                case BootstrapStatus.Inverse:
                    strategy = new InverseStatusStragety();
                    break;
                default:
                    strategy = new DefaultStatusStrategy();
                    break;
            }

            return strategy;
        }