public static bool ActivateStoreFrontOnly(this SystemAdminBaseController controller, int storeFrontId) { StoreFront storeFront = controller.GStoreDb.StoreFronts.FindById(storeFrontId); if (storeFront == null) { controller.AddUserMessage("Activate Store Front Failed!", "Store Front not found by id: " + storeFrontId, AppHtmlHelpers.UserMessageType.Danger); return(false); } if (storeFront.IsActiveDirect()) { controller.AddUserMessage("Store Front is already active.", "Store Front is already active. id: " + storeFrontId, AppHtmlHelpers.UserMessageType.Info); return(false); } storeFront.IsPending = false; storeFront.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1); storeFront.EndDateTimeUtc = DateTime.UtcNow.AddYears(100); controller.GStoreDb.StoreFronts.Update(storeFront); controller.GStoreDb.SaveChanges(); controller.AddUserMessage("Activated Store Front", "Activated Store Front '" + (storeFront.CurrentConfig() == null ? "" : storeFront.CurrentConfig().Name.ToHtml()) + "' [" + storeFront.ClientId + "]" + " - Client '" + storeFront.Client.Name.ToHtml() + "' [" + storeFront.Client.ClientId + "]", AppHtmlHelpers.UserMessageType.Info); return(true); }
/// <summary> /// Returns true if store front and client (parent record) are both active /// </summary> /// <param name="storeFront"></param> /// <returns></returns> public static bool IsActiveBubble(this StoreFront storeFront) { if (storeFront == null) { throw new ArgumentNullException("storeFront"); } return(storeFront.IsActiveDirect() && storeFront.Client.IsActiveDirect()); }