Exemplo n.º 1
0
        public void ShowAlert(AlertType type, string message)
        {
            HtmlGenericControl h4AlertHeading = (HtmlGenericControl)(this.Master).FindControl("h4AlertHeading");
            Label lblErrorMessage = (Label)(this.Master).FindControl("lblErrorMessage");
            Panel pnlAlert = (Panel)(this.Master).FindControl("pnlAlert");

            h4AlertHeading.Visible = false;
            lblErrorMessage.Text = message;
            switch (type)
            {
                case AlertType.Error:
                    pnlAlert.CssClass = BootstrapStyleConstant.AlertError;
                    break;
                case AlertType.Information:
                    pnlAlert.CssClass = BootstrapStyleConstant.AlertInfo;
                    break;
                case AlertType.Success:
                    pnlAlert.CssClass = BootstrapStyleConstant.AlertSuccess;
                    break;
                default:
                    pnlAlert.CssClass = BootstrapStyleConstant.AlertWarning;
                    break;
            }

            pnlAlert.Visible = true;
        }
Exemplo n.º 2
0
        public static SetAlert Set(string message, string strongMessage, AlertType typeOfAlert)
        {
            SetAlert alert = new SetAlert();

            alert.Message = message;
            alert.StrongMessage = strongMessage;

            switch (typeOfAlert)
            {
                case AlertType.Success:
                    alert.TypeOfAlert = "alert-success";
                    break;

                case AlertType.Danger:
                    alert.TypeOfAlert = "alert-danger";
                    break;

                case AlertType.Info:
                    alert.TypeOfAlert = "alert-info";
                    break;

                case AlertType.Warning:
                    alert.TypeOfAlert = "alert-warning";
                    break;
            }

            return alert;
        }
        /// <summary>
        /// Creates a list of AlertModels with a single item.
        /// </summary>
        /// <param name="type">The alert type.</param>
        /// <param name="message">The message.</param>
        /// <returns>A single item list of an AlertModel.</returns>
        public static List<AlertModel> CreateSingle(AlertType type, string message)
        {
            Guard.NotNull(() => type);
            Guard.NotNullOrEmpty(() => message);

            return new List<AlertModel> { new AlertModel(type, message) };
        }
Exemplo n.º 4
0
 private SettingManager() {
     this.alertType = AlertType.LatestOnly;
     this.alertAfterDate = DateTime.MinValue;
     this.svnUserName = "";
     this.svnPassword = "";
     this.listOfTrackingTarget = new List<TrackingTargetEntity>();
 }
Exemplo n.º 5
0
 public void Add(String message, AlertType alerttype)
 {
     if (frm != null)
     {
         frm.AddAlert(message, alerttype, scriptname);
     }                
 }
Exemplo n.º 6
0
        public static MvcHtmlString GetAlerts(this HtmlHelper helper, AlertType alertType, AlertLocation alertLocation)
        {
            var alertData = helper.ViewContext.TempData.InitializeAlertData();

            List<string> messages = alertData[alertLocation][alertType];
            if (messages.Count > 0)
            {
                var outerBuilder = new TagBuilder("div");
                outerBuilder.AddCssClass("container-fluid");
                foreach (var message in messages)
                {
                    var builder = new TagBuilder("div");
                    builder.AddCssClass("alert");
                    builder.AddCssClass("in");
                    builder.AddCssClass("fade");
                    builder.AddCssClass(alertType.GetDescription());

                    builder.SetInnerText(message);

                    var closeButton = new TagBuilder("a");
                    closeButton.AddCssClass("close");
                    closeButton.MergeAttribute("data-dismiss", "alert");
                    closeButton.MergeAttribute("href", "#");
                    closeButton.InnerHtml += "&times;";

                    builder.InnerHtml += closeButton.ToString(TagRenderMode.Normal);

                    outerBuilder.InnerHtml += builder.ToString(TagRenderMode.Normal);
                }
                return outerBuilder.ToString(TagRenderMode.Normal).ToMvcHtmlString();
            }

            return string.Empty.ToMvcHtmlString();
        }
Exemplo n.º 7
0
 public AlertMsg(AlertType alertType, string title, string body)
     : base(typeof(AlertViewModel))
 {
     AlertType = alertType;
     Title = title;
     Body = body;
 }
Exemplo n.º 8
0
 public Alert(AlertType type, AlertDirection direction, int? trigger, string queue)
 {
     Type = type;
     Direction = direction;
     Trigger = trigger;
     Queue = queue;
 }
Exemplo n.º 9
0
 public void OnSaved(WpfConfiguration configurationControl)
 {
     ACPowerMonitorConfig config = configurationControl as ACPowerMonitorConfig;
     lock (Lock) {
         AlertWhen = config.AlertWhen;
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AlertModel" /> class.
        /// </summary>
        /// <param name="type">The type of the alert.</param>
        /// <param name="message">The message.</param>
        public AlertModel(AlertType type, string message)
        {
            Guard.NotNull(() => type);
            Guard.NotNullOrEmpty(() => message);

            this.Type = type;
            this.Message = message;
        }
Exemplo n.º 11
0
        public void ShowAlert(AlertType type, string header, string message)
        {
            ShowAlert(type, message);

            HtmlGenericControl h4AlertHeading = (HtmlGenericControl)(this.Master).FindControl("h4AlertHeading");
            h4AlertHeading.InnerText = header;
            h4AlertHeading.Visible = true;
        }
        private static void AddMessage(TempDataDictionary tempData, AlertType type, string message,
            AlertLocation location)
        {
            var alertData = tempData.InitializeAlertData();

            alertData[location][type].Add(message);

            tempData["AlertData"] = alertData;
        }
Exemplo n.º 13
0
        /// <summary>
        ///     Adds an alert of the specified type with the specified message
        /// </summary>
        /// <param name="controller">
        ///     The <see cref="Controller"/> to use to add the alert
        /// </param>
        /// <param name="type">
        ///     The <see cref="AlertType"/> for the alert
        /// </param>
        /// <param name="message">
        ///     The message for the alert
        /// </param>
        public static void AddAlert(
            this Controller controller, AlertType type, string message)
        {
            List<AlertMessage> alerts = controller.TempData[ALERT_MESSAGE_KEY] as List<AlertMessage> ??
                new List<AlertMessage>();

            alerts.Add(new AlertMessage() { Type = type, Message = message});
            controller.TempData["AlertMessages"] = alerts;
        }
 /// <summary>
 /// Create an alert box of the specified type
 /// </summary>
 /// <param name="html">The current HtmlHelper instance</param>
 /// <param name="message">The message to show</param>
 /// <param name="alertType">The type of alert to show.</param>
 public static MvcHtmlString Alert(this HtmlHelper html, string message, AlertType alertType)
 {
     var div = new TagBuilder("div");
     div.AddCssClass("alert-box");
     div.AddCssClass(alertType.GetStringValue());
     div.InnerHtml = message;
     div.InnerHtml += "<a href=\"#\" class=\"close\">&times;</a>";
     return new MvcHtmlString(div.ToString(TagRenderMode.Normal));
 }
Exemplo n.º 15
0
			public MessageBoxForm (IWin32Window owner, string text, string caption,
					       MessageBoxButtons buttons, MessageBoxIcon icon,
					       bool displayHelpButton)
			{
				show_help = displayHelpButton;

				switch (icon) {
					case MessageBoxIcon.None: {
						icon_image = null;
						alert_type = AlertType.Default;
						break;
					}

					case MessageBoxIcon.Error: {		// Same as MessageBoxIcon.Hand and MessageBoxIcon.Stop
						icon_image = SystemIcons.Error;
						alert_type = AlertType.Error;
						break;
					}

					case MessageBoxIcon.Question: {
 						icon_image = SystemIcons.Question;
						alert_type = AlertType.Question;
						break;
					}

					case MessageBoxIcon.Asterisk: {		// Same as MessageBoxIcon.Information
						icon_image = SystemIcons.Information;
						alert_type = AlertType.Information;
						break;
					}

					case MessageBoxIcon.Warning: {		// Same as MessageBoxIcon.Exclamation:
						icon_image = SystemIcons.Warning;
						alert_type = AlertType.Warning;
						break;
					}
				}

				msgbox_text = text;
				msgbox_buttons = buttons;
				msgbox_default = MessageBoxDefaultButton.Button1;

				if (owner != null) {
					Owner = Control.FromHandle(owner.Handle).FindForm();
				} else {
					if (Application.MWFThread.Current.Context != null) {
						Owner = Application.MWFThread.Current.Context.MainForm;
					}
				}
				this.Text = caption;
				this.ControlBox = true;
				this.MinimizeBox = false;
				this.MaximizeBox = false;
				this.ShowInTaskbar = (Owner == null);
				this.FormBorderStyle = FormBorderStyle.FixedDialog;
			}
Exemplo n.º 16
0
        private void CreateMemberSearchAlert(MemberSearch search, AlertType alertType)
        {
            var alert = new MemberSearchAlert {
                MemberSearchId = search.Id, AlertType = alertType
            };

            alert.Prepare();
            alert.Validate();
            _repository.CreateMemberSearchAlert(alert);
        }
Exemplo n.º 17
0
 internal Alert(int id, int code, string message) : base(message)
 {
     RequestId = OrderId = id; // id refers to either a requestId or an orderId.
     Code      = code;
     if (string.IsNullOrWhiteSpace(message))
     {
         throw new ArgumentException(nameof(message));
     }
     AlertType = GetAlertTypeFromCode(code, id);
 }
Exemplo n.º 18
0
 public static void Show(string message, AlertType type, bool off_soud = true)
 {
     if (off_soud == true)
     {
         System.IO.Stream         str = CCMS.Properties.Resources.notification;
         System.Media.SoundPlayer snd = new System.Media.SoundPlayer(str);
         snd.Play();
     }
     new CCMS.view.alert(message, type).Show();
 }
Exemplo n.º 19
0
 protected void AddAlert(AlertType type, TitleType titleType, string title, string content)
 {
     AddAlert(new Alert
     {
         Type      = type,
         TitleType = titleType,
         Title     = title,
         Content   = content
     });
 }
Exemplo n.º 20
0
        /// <summary>
        /// Dto for deleting from IContentJobScheduler
        /// </summary>
        /// <param name="contentId"></param>
        /// <param name="contentType"></param>
        public ContentJobDto(long contentId, AlertType contentType)
        {
            if (contentId <= 0 || contentType == AlertType.Undefined)
            {
                throw new ArgumentException();
            }

            ContentId   = contentId;
            ContentType = contentType;
        }
Exemplo n.º 21
0
        public static void AddAlert(this TempDataDictionary tempData, AlertType alertType, string message)
        {
            var alerts = tempData.GetAllAlerts();

            alerts.Add(new Alert()
            {
                AllertType = alertType,
                Message    = message
            });
        }
 //initialize the object of this form and show it
 public static void ShowDialog(string message, AlertType type, bool autoclose)
 {
     if (alt != null)
     {
         alt.Dispose();
     }
     alt           = new AlertBox(message, type, autoclose);
     alt.AutoClose = autoclose;
     alt.ShowDialog();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="HighlightModel" /> class.
        /// </summary>
        /// <param name="style">The row style.</param>
        /// <param name="partition">The items partition.</param>
        /// <param name="row">The items row key.</param>
        public HighlightModel(AlertType style, string partition, string row)
        {
            Guard.NotNull(() => style);
            Guard.NotNullOrEmpty(() => row);
            Guard.NotNullOrEmpty(() => partition);

            this.Style = style;
            this.Partition = partition;
            this.Row = row;
        }
Exemplo n.º 24
0
 public static void ShowAlert(
     this HtmlGenericControl control
     , string msg
     , AlertType alertType
     )
 {
     control.Visible = true;
     control.Attributes.Add("class", $"alert alert-{GetAlert(alertType)}");
     control.InnerHtml = msg;
 }
Exemplo n.º 25
0
 public Message(AlertType alertType, string line, string objectType, string objName, string message, string userName, DateTime eventTime)
 {
     AlertType     = alertType;
     Line          = line;
     ObjectType    = objectType;
     ObjName       = objName;
     MessageString = message;
     UserName      = userName;
     EventTime     = eventTime;
 }
Exemplo n.º 26
0
        private void SendEmail()
        {
            Email.BreachEnd        = EndEventTime;
            Email.BreachStart      = StartEventTime;
            Email.Percentage       = NotificationSettings.PercentageLimit;
            Email.TimeThresholdSec = NotificationSettings.ThresholdTime;
            Email.BreachType       = AlertType.ToString();

            Sendy.SendEmail(Email);
        }
Exemplo n.º 27
0
 /// <summary>
 /// Save settings.
 /// </summary>
 /// <param name="storage">Settings storage.</param>
 public void Save(SettingsStorage storage)
 {
     storage.SetValue(nameof(Rules), Rules.Select(r => r.Save()).ToArray());
     storage.SetValue(nameof(AlertType), AlertType.To <string>());
     storage.SetValue(nameof(Caption), Caption);
     storage.SetValue(nameof(Message), Message);
     storage.SetValue(nameof(IsEnabled), IsEnabled);
     storage.SetValue(nameof(Id), Id);
     storage.SetValue(nameof(MessageType), MessageType.GetTypeName(false));
 }
Exemplo n.º 28
0
        /// <summary>
        /// Create a new alert.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="emailTo">The email to.</param>
        /// <param name="frequency">The frequency.</param>
        /// <param name="percentage">The percentage.</param>
        /// <param name="cancellationToken">Cancellation token</param>
        /// <returns>
        /// The <see cref="Alert" />.
        /// </returns>
        public Task <Alert> CreateAsync(AlertType type, Parameter <string> emailTo = default(Parameter <string>), Parameter <Frequency?> frequency = default(Parameter <Frequency?>), Parameter <int?> percentage = default(Parameter <int?>), CancellationToken cancellationToken = default(CancellationToken))
        {
            var data = CreateJObject(type, emailTo, frequency, percentage);

            return(_client
                   .PostAsync(_endpoint)
                   .WithJsonBody(data)
                   .WithCancellationToken(cancellationToken)
                   .AsSendGridObject <Alert>());
        }
Exemplo n.º 29
0
        public Alert(AlertType type, params BodyElement[] content) : base(content)
        {
            this.Class("alert");
            this.Class("alert-" + type.AsKebab());
            this.Attr("role", "alert");

            // add alert-link class to all links
            content.Where(x => x is Anchor).ToList()
            .ForEach(x => ((Anchor)x).Class("alert-link"));
        }
Exemplo n.º 30
0
 public static Alert Create(string message, AlertType type)
 {
     return(new Alert
     {
         Id = Guid.NewGuid(),
         Date = DateTime.Now,
         Message = message,
         Type = type
     });
 }
 public void ClearAlert(AlertType type)
 {
     if (runtimeCacheRepository.ConfigurationAlertExists(type))
     {
         foreach (ConfigurationAlert alert in runtimeCacheRepository.GetConfigurationAlerts(type))
         {
             runtimeCacheRepository.DeleteConfigurationAlert(alert);
         }
     }
 }
Exemplo n.º 32
0
        ///<summary>Returns a list of AlertItems for the given cinicNum.</summary>
        public static List <AlertItem> RefreshForType(AlertType alertType)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <AlertItem> >(MethodBase.GetCurrentMethod(), alertType));
            }
            string command = "SELECT * FROM alertitem WHERE Type = " + POut.Int((int)alertType) + " ";

            return(Crud.AlertItemCrud.SelectMany(command));
        }
Exemplo n.º 33
0
        public void Play(AlertType at)
        {
            if (at == AlertType.None)
            {
                return;
            }

            m_player.Source = m_mpAlertMedia[at];
            m_player.Play();
        }
Exemplo n.º 34
0
        protected void showAccountBannedPrompt(AlertType category = AlertType.Unknown, DateTime?expirationDate = null)
        {
            PromptDefinition promptDefinition = Service.Get <PromptManager>().GetPromptDefinition("ModerationCriticalPrompt");
            PromptLoaderCMD  promptLoaderCMD  = new PromptLoaderCMD(this, promptDefinition, delegate(PromptLoaderCMD loader)
            {
                onAccountBannedPromptLoaded(loader, category, expirationDate);
            });

            promptLoaderCMD.Execute();
        }
Exemplo n.º 35
0
 protected ResumeSearchAlertsTask(IExecuteMemberSearchCommand executeMemberSearchCommand, IMemberSearchesQuery memberSearchesQuery, IMemberSearchAlertsCommand memberSearchAlertsCommand, IMemberSearchAlertsQuery memberSearchAlertsQuery, IEmployersQuery employersQuery, AlertType alertType)
     : base(EventSource)
 {
     _executeMemberSearchCommand = executeMemberSearchCommand;
     _memberSearchesQuery        = memberSearchesQuery;
     _memberSearchAlertsCommand  = memberSearchAlertsCommand;
     _memberSearchAlertsQuery    = memberSearchAlertsQuery;
     _employersQuery             = employersQuery;
     _alertType = alertType;
 }
Exemplo n.º 36
0
 public Alarm(string name, AlertType alertType, bool playSound, bool focusClient, bool pauseBot, bool disconnect)
 {
     this._name = name;
     this._alertType = alertType;
     this._playSound = playSound;
     this._focusClient = focusClient;
     this._pauseBot = pauseBot;
     this._disconnect = disconnect;
     this._buttonVisibility = Visibility.Hidden;
 }
Exemplo n.º 37
0
        public async Task <IActionResult> CreateProduct(ProductModel model, IFormFile file)
        {
            ViewBag.ürünler = "active";
            if (ModelState.IsValid)
            {
                var entity = new Product()
                {
                    name        = model.Name,
                    price       = (double)model.Price,
                    description = model.Description,
                    url         = model.CreateUrl(),
                    isApproved  = model.IsApproved
                };
                if (file != null)
                {
                    var    extension  = Path.GetExtension(file.FileName);
                    string randomname = string.Format($"{Guid.NewGuid()}{extension}");
                    entity.imageUrl = randomname;
                    var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\img\\products", randomname);
                    using (var stream = new FileStream(path, FileMode.Create))
                    {
                        await file.CopyToAsync(stream);
                    }
                }
                try
                {
                    _productService.Create(entity);
                    var msg = new AlertType()
                    {
                        Message = $"{entity.name} isimli ürün başarıyla eklendi",
                        Alert   = "success"
                    };
                    TempData["message"] = JsonConvert.SerializeObject(msg);
                    return(RedirectToAction("ProductList"));
                }
                catch (System.Exception)
                {
                    var msg = new AlertType()
                    {
                        Message = $"{entity.name} isimli ürün eklenirken bir hata oluştu!",
                        Alert   = "warning"
                    };
                    TempData["message"] = JsonConvert.SerializeObject(msg);
                    return(View(model));
                }
            }
            var msg1 = new AlertType()
            {
                Message = "Oluşturmaya çalıştığınız ürün kriterlere uymuyor!",
                Alert   = "warning"
            };

            TempData["message"] = JsonConvert.SerializeObject(msg1);
            return(View(model));
        }
Exemplo n.º 38
0
 /// <summary>
 ///     计时器提醒
 /// </summary>
 /// <param name="type"></param>
 private void ExamClock_TimeAlert(AlertType type)
 {
     switch (type)
     {
     case AlertType.ExamOver:     //考试结束通知
     {
         SubmitPaper(true);       //考试时间到强制交卷
     }
     break;
     }
 }
Exemplo n.º 39
0
        private static void AddMessageToTempData(ControllerBase controller, AlertType type, string title, string message, string tempData)
        {
            var alertMessage = new AlertMessage
            {
                Title    = title,
                Message  = message,
                CssClass = type.CssClass
            };

            controller.TempData[tempData] = alertMessage.AsJson();
        }
Exemplo n.º 40
0
 internal static DialogResult Alert(string title, string message,
                                    AlertType alertType,
                                    AlertButtons alertButtons)
 {
     using (var alertForm = AlertFormFactory.CreateAlertForm(title, message,
                                                             alertType, alertButtons))
     {
         alertForm.ShowDialog();
         return(alertForm.DialogResult);
     }
 }
Exemplo n.º 41
0
 public IEnumerable <SelectListItem> GetAlertTypeSelectList(AlertType alertType)
 {
     foreach (AlertType item in typeof(AlertType).GetEnumValues())
     {
         yield return new SelectListItem()
                {
                    Text = item.GetDisplayName(), Value = item.ToString(), Selected = item == alertType
                }
     }
     ;
 }
Exemplo n.º 42
0
        /// <summary>
        ///     添加提醒
        /// </summary>
        public void AddAlert(AlertType type, DateTime datetime)
        {
            TimeSpan timespan = currentTime - datetime;

            if (timespan.Seconds < 0)
            {
                return;
            }

            AlertList.Add(type, datetime);
        }
Exemplo n.º 43
0
        /// <summary>
        /// Tries to get the alert of the indicated type
        /// </summary>
        /// <returns>true if found</returns>
        public bool TryGet(AlertType alertType, out AlertPrototype alert)
        {
            if (_typeToIndex.TryGetValue(alertType, out var idx))
            {
                alert = _orderedAlerts[idx];
                return(true);
            }

            alert = null;
            return(false);
        }
Exemplo n.º 44
0
        /// <summary>
        /// Tries to get the compact encoded representation of the alert with
        /// the indicated id
        /// </summary>
        /// <returns>true if successful</returns>
        public bool TryEncode(AlertType alertType, out byte encoded)
        {
            if (_typeToIndex.TryGetValue(alertType, out var idx))
            {
                encoded = idx;
                return(true);
            }

            encoded = 0;
            return(false);
        }
Exemplo n.º 45
0
        public static void Add(string logText, AlertType alertType, string specialMark = "")
        {
            if (string.IsNullOrEmpty(specialMark) == false)
            {
                logText = string.Format($"{specialMark} => {logText}");
            }

            string logLineText = string.Format($"{alertType} \t {DateTime.Now} \t {logText}");

            WriteToTxtFile(logLineText);
        }
Exemplo n.º 46
0
        /// <summary>
        /// Create a new alert.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="emailTo">The email to.</param>
        /// <param name="frequency">The frequency.</param>
        /// <param name="percentage">The percentage.</param>
        /// <param name="onBehalfOf">The user to impersonate.</param>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns>
        /// The <see cref="Alert" />.
        /// </returns>
        public Task <Alert> CreateAsync(AlertType type, Parameter <string> emailTo = default, Parameter <Frequency?> frequency = default, Parameter <int?> percentage = default, string onBehalfOf = null, CancellationToken cancellationToken = default)
        {
            var data = ConvertToJson(type, emailTo, frequency, percentage);

            return(_client
                   .PostAsync(_endpoint)
                   .OnBehalfOf(onBehalfOf)
                   .WithJsonBody(data)
                   .WithCancellationToken(cancellationToken)
                   .AsObject <Alert>());
        }
Exemplo n.º 47
0
 public WithNotificationResult(System.Web.Mvc.ActionResult result,
                               String message, Position position, AlertType alertType, int timeOut, bool animation, bool modal)
 {
     this._result    = result;
     this._message   = message;
     this._position  = position;
     this._animation = animation;
     this._modal     = modal;
     this._alertType = alertType;
     this._timeout   = timeOut;
 }
Exemplo n.º 48
0
        private static void AddMessageToTempData(ControllerBase controller, AlertType type, string title, string message)
        {
            var alertMessage = new AlertMessage
            {
                Title = title,
                Message = message,
                CssClass = type.CssClass
            };

            controller.TempData["alert"] = alertMessage.AsJson();
        }
Exemplo n.º 49
0
        public static MvcHtmlString Alert(this HtmlHelper html, string shortTitle, string message, AlertType alertType)
        {
            var div = new TagBuilder("div");
            var alertTypeCSS = string.Format("alert-{0}", alertType.ToString().ToLower());
            div.AddCssClass("alert");
            div.AddCssClass(alertTypeCSS);

            var a = new TagBuilder("a");
            a.AddCssClass("close");
            a.Attributes.Add("data-dismiss", "alert");
            a.InnerHtml = "&times;";

            div.InnerHtml = string.Format("{0}<strong>{1} </strong>{2}", a.ToString(), shortTitle, message);
            return new MvcHtmlString(div.ToString());
        }
Exemplo n.º 50
0
        public static void SetAlert(
            this NancyContext context,
            string message,
            AlertType? type = null)
        {
            var hash = MD5(message);

            context.Request.Session[String.Concat("alert-", hash)] = new Alert
            {
                Message = message,
                Type = type ?? AlertType.NotSpecified
            };

            context.Items["alert-hash"] = hash;
        }
        public static ICollection<Alert> GetAlerts(this TempDataDictionary tempData, AlertType? type = null)
        {
            if (!tempData.ContainsKey(AlertsKey))
            {
                tempData[AlertsKey] = new List<Alert>();
            }

            var alerts = (ICollection<Alert>)tempData[AlertsKey];

            if (type.HasValue)
            {
                alerts = alerts.Where(a => a.Type == type.Value).ToList();
            }

            return alerts;
        }
Exemplo n.º 52
0
        private static string convertTypeToString(AlertType a)
        {
            switch (a)
            {
                case AlertType.Danger:
                    return "danger";
                case AlertType.Warning:
                    return "warning";
                case AlertType.Info:
                    return "info";
                case AlertType.Success:
                    return "success";
            }

            return "";
        }
Exemplo n.º 53
0
			public MessageBoxForm (IWin32Window owner, string text, string caption,
					       MessageBoxButtons buttons, MessageBoxIcon icon,
					       bool displayHelpButton)
			{
				show_help = displayHelpButton;
			
				Icon = icon;
				switch (icon) {
					case MessageBoxIcon.None: {
						icon_image = null;
						alert_type = AlertType.Default;
						break;
					}

					case MessageBoxIcon.Error: {		// Same as MessageBoxIcon.Hand and MessageBoxIcon.Stop
						icon_image = SystemIcons.Error;
						alert_type = AlertType.Error;
						break;
					}

					case MessageBoxIcon.Question: {
 						icon_image = SystemIcons.Question;
						alert_type = AlertType.Question;
						break;
					}

					case MessageBoxIcon.Asterisk: {		// Same as MessageBoxIcon.Information
						icon_image = SystemIcons.Information;
						alert_type = AlertType.Information;
						break;
					}

					case MessageBoxIcon.Warning: {		// Same as MessageBoxIcon.Exclamation:
						icon_image = SystemIcons.Warning;
						alert_type = AlertType.Warning;
						break;
					}
				}

				msgbox_text = text;
				msgbox_buttons = buttons;
				msgbox_default = MessageBoxDefaultButton.Button1;

				this.Text = caption;
			}
Exemplo n.º 54
0
 public AlertMessage(string header, string body, AlertType type, bool enableClose = true)
     : this(header, body, enableClose)
 {
     switch (type)
     {
         case AlertType.Block:
             CssClass = "alert-block";
             break;
         case AlertType.Info:
             CssClass = "alert-info";
             break;
         case AlertType.Success:
             CssClass = "alert-success";
             break;
         case AlertType.Error:
             CssClass = "alert-error";
             break;
     }
 }
Exemplo n.º 55
0
        public RCAlert(string message, AlertType type)
        {
            this.Message = message;
            this.Type = type;

            switch (this.Type)
            {
                case AlertType.Warning:
                    this.HTMLClass = "";
                    break;
                case AlertType.Error:
                    this.HTMLClass = "alert-danger";
                    break;
                case AlertType.Success:
                    this.HTMLClass = "alert-success";
                    break;
                case AlertType.Info:
                    this.HTMLClass = "alert-info";
                    break;
            }
        }
 public PMAMailController(string message, AlertType alertType, string user)
 {
     this.alertType = alertType;
     _emailSubscribers = new List<string>();
     switch (alertType)
     {
         case AlertType.EVENT_ALERT:
             _alertType = "Event";
             _emailSubscribers = configManager.SystemAnalyzerInfo.ListAlertMailSubscription;
             break;
         case AlertType.GENERAL_ALERT:
             _alertType = "General";
             _emailSubscribers = configManager.SystemAnalyzerInfo.ListAlertMailSubscription;
             break;
         case AlertType.USER_ALERT :
             _alertType = "PMA User Login";
             _emailSubscribers.AddRange(configManager.PMAServerManagerInfo.EmailActionServicesSubsubscribers);
             _emailSubscribers.AddRange(configManager.PMAServerManagerInfo.EmailSqlRemoteActivitySubscribers);
             break;
         case AlertType.SQL_ALERT :
             _alertType = "SQL Remote Action";
             _emailSubscribers.AddRange(configManager.PMAServerManagerInfo.EmailSqlRemoteActivitySubscribers);
             break;
         case AlertType.SERVICE_ALERT :
             _alertType = "Remote Service Action";
             _emailSubscribers.AddRange(configManager.PMAServerManagerInfo.EmailActionServicesSubsubscribers);
             break;
         case AlertType.ACTION_ALERT:
             _alertType = "Remote Command Action";
             _emailSubscribers.AddRange(configManager.PMAServerManagerInfo.EmailActionServicesSubsubscribers);
             break;
     }
     if (user == null || user == string.Empty)
     {
         user = "******";
     }
     _user = user;
     _message = message;
 }
        public static MvcHtmlString Alert(this HtmlHelper helper, AlertType type, string text, string header, ButtonTag? closeButton, bool block)
        {
            var builder = new TagBuilder("div");

            if (block) builder.AddCssClass("alert-block");
            builder.AddCssClass(type.ToCssClass());
            builder.AddCssClass("alert");

            if (closeButton.HasValue)
            {
                builder.InnerHtml += DismissButton(helper, closeButton.Value);
            }

            if (!string.IsNullOrEmpty(header))
            {
                var headerTag = new TagBuilder("h4");
                headerTag.SetInnerText(header);
                builder.InnerHtml = headerTag.ToString();
            }

            builder.InnerHtml += text;
            return new MvcHtmlString(builder.ToString());
        }
Exemplo n.º 58
0
        public RCAlert(string message, AlertType type, string urlHelp, string urlName)
        {
            this.Message = message;
            this.Type = type;
            this.UrlHelp = urlHelp;
            this.UrlName = urlName;

            switch (this.Type)
            {
                case AlertType.Warning:
                    this.HTMLClass = "";
                    break;
                case AlertType.Error:
                    this.HTMLClass = "alert-error";
                    break;
                case AlertType.Success:
                    this.HTMLClass = "alert-success";
                    break;
                case AlertType.Info:
                    this.HTMLClass = "alert-info";
                    break;
            }
        }
Exemplo n.º 59
0
 internal static Boolean IsAlertFiredByHandINT(IntPtr instance, AlertType alertEvent, Int32 handID, out AlertData alertData)
 {
     alertData = new AlertData();
     return PXCMHandData_IsAlertFiredByHand(instance, alertEvent, handID, alertData);
 }
Exemplo n.º 60
0
 private static extern Boolean PXCMHandData_IsAlertFiredByHand(IntPtr instance, AlertType alertEvent, Int32 handID, [Out] AlertData alertData);