public static void Notify(Page Page, int NotificationID, String UserID, String Text, String Title, int SecondsToShow, int Height, int Width) { RadNotification rnf = (RadNotification)Page.Master.FindControl("rnf"); if (rnf != null) { rnf.ContentIcon = "info"; rnf.Title = HttpContext.Current.Server.HtmlEncode(Title); rnf.Text = HttpContext.Current.Server.HtmlEncode(Text.Replace("<br/>", Environment.NewLine)).Replace(Environment.NewLine, "<br/>"); int AutoCloseDelay = SecondsToShow * 1000; if (AutoCloseDelay != 0) { rnf.AutoCloseDelay = AutoCloseDelay; } else { rnf.AutoCloseDelay = 999999; } rnf.Height = Height; rnf.Width = Width; rnf.Show(); String iqry = "INSERT IGNORE INTO dbl_viewed_notifications (NotificationID, ViewedByUserId, ViewedAt) VALUES (@NotificationID, @ViewedByUserID, CURRENT_TIMESTAMP);"; SQL.Insert(iqry, new String[] { "@NotificationID", "@ViewedByUserID" }, new Object[] { NotificationID, UserID }); } }
public static void Notificar(RadNotification ntfGeral, string msg, Enums.TipoNotificacao notifyType) { ntfGeral.Position = NotificationPosition.TopRight; ntfGeral.Width = Unit.Pixel(330); ntfGeral.Height = Unit.Pixel(200); ntfGeral.CssClass = "WelcomeNotification"; ntfGeral.Title = "SIGMEH"; //Mudar depois para os parâmetros de sistema ou web.config ntfGeral.ShowCloseButton = true; ntfGeral.Animation = NotificationAnimation.Fade; ntfGeral.AnimationDuration = 500; ntfGeral.AutoCloseDelay = 3000; ntfGeral.Pinned = true; ntfGeral.EnableRoundedCorners = true; ntfGeral.EnableShadow = true; ntfGeral.KeepOnMouseOver = true; ntfGeral.VisibleTitlebar = true; //ntfGeral.Opacity = 95; switch (notifyType) { case Enums.TipoNotificacao.Informacao: ntfGeral.Text = msg; ntfGeral.TitleIcon = "../../Images/sigmeh_icon.png"; ntfGeral.ContentIcon = "info"; //ntfGeral.ShowSound = "../../Sounds/notify.wav"; break; case Enums.TipoNotificacao.Alerta: ntfGeral.Text = msg; ntfGeral.TitleIcon = "warning"; ntfGeral.ContentIcon = "warning"; //ntfGeral.ShowSound = "warning"; break; case Enums.TipoNotificacao.Erro: ntfGeral.Text = msg; ntfGeral.TitleIcon = "delete"; ntfGeral.ContentIcon = "delete"; //ntfGeral.ShowSound = "warning"; break; default: break; } ntfGeral.Show(); }
protected void rgManufacturers_DeleteCommand(object sender, GridCommandEventArgs e) { GridDataItem item = (GridDataItem)e.Item; int ID = (int)item.GetDataKeyValue("ID"); using (var context = new cathlabEntities()) { Manufacturer m = context.Manufacturers.Find(ID); try { context.Manufacturers.Remove(m); context.SaveChanges(); } catch (DbUpdateException) { rnLabel.Text = "ERROR! Can't delete manufacturer. Products in database rely on this entry."; RadNotification.Show(); } } }
protected void rgPartNumbers_DeleteCommand(object sender, GridCommandEventArgs e) { GridDataItem item = (GridDataItem)e.Item; string PartNum = item.GetDataKeyValue("PartNum").ToString(); using (var context = new cathlabEntities()) { PartNumber pn = context.PartNumbers.Find(PartNum); try { context.PartNumbers.Remove(pn); context.SaveChanges(); } catch (DbUpdateException) { rnLabel.Text = "ERROR! Cannot delete, there are products<br/> in the database of that part number."; RadNotification.Show(); } } }
protected void rgProdType_DeleteCommand(object sender, GridCommandEventArgs e) { GridDataItem item = (GridDataItem)e.Item; int ID = (int)item.GetDataKeyValue("ID"); using (var context = new cathlabEntities()) { ProductType pt = context.ProductTypes.Find(ID); var temp = (from prod in context.Products where prod.PartNumber1.ProductTypeID == pt.ID select prod).FirstOrDefault(); if (temp == null) { context.ProductTypes.Remove(pt); context.SaveChanges(); rgProdType.Rebind(); } else { rnLabel.Text = "ERROR! Can't delete product type. Products in database rely on this entry."; RadNotification.Show(); } //try //{ // context.ProductTypes.Remove(pt); // context.SaveChanges(); //} //catch (Exception) //{ // rnLabel.Text = "ERROR! Can't delete product type. Products in database rely on this entry."; // RadNotification.Show(); //} } }