/// <summary> /// Called when the purchase order payment is captured, we want to update the notification description and created date /// </summary> /// <param name="purchOrder"></param> /// <returns></returns> public static bool ProcessPurchaseOrderPaymentCaptured(PurchaseOrderDetails purchOrder) { try { Notification Notif = DashboardNotificationDAO.Load(purchOrder.Id); string UpdateText = String.Format("Purchase order shipment needs updated in order to notify customer. Order placed on {0} UTC with a total of {1} spent.", purchOrder.PayPalOrderDetails.OrderPlacedDateUtc.ToString("g"), (purchOrder.PayPalOrderDetails.BaseAmount + purchOrder.PayPalOrderDetails.TaxAmount + purchOrder.PayPalOrderDetails.ShippingAmount).ToString("C")); //arleady exists if (Notif != null && !string.IsNullOrWhiteSpace(Notif.Id)) { return(DashboardNotificationDAO.Update(purchOrder.Id, UpdateText)); } //else save a new one else { Notification NewNotification = GenerateNewNotification(purchOrder.Id, UpdateText); return(DashboardNotificationDAO.Save(NewNotification)); } } catch (Exception e) { CompanyCommons.Logging.WriteLog("Chimera.Core.Notifications.PurchaseOrder.ProcessPurchaseOrderPaymentCaptured()" + e.Message); } return(false); }
/// <summary> /// Called whenever the admin user updates the product to remove the notification /// </summary> /// <param name="product"></param> /// <returns></returns> public static bool ProductStockUpdated(Product product) { try { return(DashboardNotificationDAO.Delete(product.Id)); } catch (Exception e) { CompanyCommons.Logging.WriteLog("Chimera.Core.Notifications.ProductStock.ProductStockUpdated()" + e.Message); } return(false); }
/// <summary> /// The purchase order has shipped, delete the notification. /// </summary> /// <param name="purchOrder"></param> /// <returns></returns> public static bool ProcessPurchaseOrderShipped(PurchaseOrderDetails purchOrder) { try { return(DashboardNotificationDAO.Delete(purchOrder.Id)); } catch (Exception e) { CompanyCommons.Logging.WriteLog("Chimera.Core.Notifications.PurchaseOrder.ProcessPurchaseOrderShipped()" + e.Message); } return(false); }
/// <summary> /// Called when a new purchase order is added to the system /// </summary> /// <param name="purchOrder"></param> /// <returns></returns> public static bool ProcessNewPurchaseOrder(PurchaseOrderDetails purchOrder) { try { Notification NewNotification = GenerateNewNotification(purchOrder.Id, String.Format("New purchase order requires PayPal payment captured. Order placed on {0} UTC with a total of {1} spent.", purchOrder.PayPalOrderDetails.OrderPlacedDateUtc.ToString("g"), (purchOrder.PayPalOrderDetails.BaseAmount + purchOrder.PayPalOrderDetails.TaxAmount + purchOrder.PayPalOrderDetails.ShippingAmount).ToString("C"))); return(DashboardNotificationDAO.Save(NewNotification)); } catch (Exception e) { CompanyCommons.Logging.WriteLog("Chimera.Core.Notifications.PurchaseOrder.ProcessNewPurchaseOrder()" + e.Message); } return(false); }
private static void Ntofication() { Notification NewNotification = new Notification(); NewNotification.EntityId = ""; NewNotification.MvcUrl.Action = "Edit"; NewNotification.MvcUrl.Controller = "PurchaseOrders"; NewNotification.Description = "New Notification"; NewNotification.NotificationType = NotificationType.NEW_PURCHASE_ORDER; NewNotification.WarningLevel = WarningLevelType.NEUTRAL; NewNotification.ViewAdminUserRolesRequired.Add(PurchaseOrderRoles.VIEW); NewNotification.ViewAdminUserRolesRequired.Add(PurchaseOrderRoles.EDIT); NewNotification.ActionList.Insert(0, new NotificationAction("Edit", "glyphicon glyphicon-pencil", "Edit", "PurchaseOrders")); DashboardNotificationDAO.Save(NewNotification); }
public ActionResult Index(string selectedPageType, PageReportType?pageReportType, DateTime?dateFrom, DateTime?dateTo) { try { if (selectedPageType == null) { selectedPageType = string.Empty; } if (pageReportType == null) { pageReportType = PageReportType.DAY; } if (dateFrom == null) { dateFrom = DateTime.UtcNow.AddDays(-7); } if (dateTo == null) { dateTo = DateTime.UtcNow; } if (ChimeraWebsite.Helpers.AppSettings.AllowPageReportRecording) { ViewBag.PageReportSummary = ChimeraWebsite.Helpers.AppCache.GetPageReportSummary(selectedPageType, pageReportType.Value, dateFrom.Value, dateTo.Value); ViewBag.UniquePageTypes = Chimera.DataAccess.ReportDAO.LoadUniquePageTypes(); } ViewBag.NotificationList = DashboardNotificationDAO.LoadDashboardList(SiteContext.User.RoleList); } catch (Exception e) { CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.Dashboard() ", e); } ViewBag.selectedPageType = selectedPageType; ViewBag.pageReportType = pageReportType.Value; ViewBag.dateFrom = dateFrom.Value; ViewBag.dateTo = dateTo.Value; return(View()); }
/// <summary> /// Process a purchased product after the stock level has been altered from the purchase order /// </summary> /// <param name="product"></param> /// <returns></returns> public static bool ProcessPurchasedProduct(SettingGroup paypalSettings, Product product) { try { string StockLevelWarningString = paypalSettings.GetSettingVal(PayPalSettingKeys.StockLevelWarning); int StockLevelWarning = Int32.Parse(!string.IsNullOrWhiteSpace(StockLevelWarningString) ? StockLevelWarningString : "0"); if (product.PurchaseSettings.StockLevel <= StockLevelWarning) { Notification NewNotification = GenerateNewNotification(product.Name, product.Id, product.PurchaseSettings.StockLevel); DashboardNotificationDAO.Save(NewNotification); } if (product.CheckoutPropertySettingsList != null && product.CheckoutPropertySettingsList.Count > 0) { foreach (var CheckPropSetting in product.CheckoutPropertySettingsList) { if (CheckPropSetting.PurchaseSettings.StockLevel <= StockLevelWarning) { Notification NewNotification = GenerateNewNotification(product.Name, product.Id, product.PurchaseSettings.StockLevel, CheckPropSetting.CheckoutPropertySettingKeys); DashboardNotificationDAO.Save(NewNotification); } } } return(true); } catch (Exception e) { CompanyCommons.Logging.WriteLog("Chimera.Core.Notifications.ProductStock.ProcessPurchasedProduct()" + e.Message); } return(false); }
public ActionResult DismissNotification(string id) { DashboardNotificationDAO.Delete(id); return(RedirectToAction("Index", "Dashboard")); }