public ValueListEditAdminViewModel(StoreFront storeFront, UserProfile userProfile, ValueList valueList, string activeTab, bool isStoreAdminEdit = false, bool isReadOnly = false, bool isDeletePage = false, bool isCreatePage = false, string sortBy = "", bool?sortAscending = true)
 {
     if (storeFront == null)
     {
         throw new ArgumentNullException("storeFront");
     }
     if (userProfile == null)
     {
         throw new ArgumentNullException("userProfile");
     }
     if (valueList == null)
     {
         throw new ArgumentNullException("valueList", "valueList cannot be null");
     }
     this.IsStoreAdminEdit = isStoreAdminEdit;
     this.IsActiveDirect   = valueList.IsActiveDirect();
     this.IsActiveBubble   = valueList.IsActiveBubble();
     this.IsReadOnly       = isReadOnly;
     this.IsDeletePage     = isDeletePage;
     this.IsCreatePage     = isCreatePage;
     this.ActiveTab        = activeTab;
     this.SortBy           = sortBy;
     this.SortAscending    = sortAscending;
     LoadValues(storeFront, userProfile, valueList);
 }
Exemple #2
0
        public static bool ActivateValueList(this SystemAdminBaseController controller, int valueListId)
        {
            ValueList valueList = controller.GStoreDb.ValueLists.FindById(valueListId);

            if (valueList == null)
            {
                controller.AddUserMessage("Activate Value List Failed!", "Value List not found by id: " + valueListId, AppHtmlHelpers.UserMessageType.Danger);
                return(false);
            }

            if (valueList.IsActiveDirect())
            {
                controller.AddUserMessage("Value List is already active.", "Value List is already active. id: " + valueListId, AppHtmlHelpers.UserMessageType.Info);
                return(false);
            }

            valueList.IsPending        = false;
            valueList.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
            valueList.EndDateTimeUtc   = DateTime.UtcNow.AddYears(100);
            controller.GStoreDb.ValueLists.Update(valueList);
            controller.GStoreDb.SaveChanges();
            controller.AddUserMessage("Activated Value List", "Activated Value List '" + valueList.Name.ToHtml() + "' [" + valueList.ValueListId + "]" + " - Client '" + valueList.Client.Name.ToHtml() + "' [" + valueList.Client.ClientId + "]", AppHtmlHelpers.UserMessageType.Info);

            return(true);
        }
Exemple #3
0
        /// <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 ValueList valueList)
        {
            if (valueList == null)
            {
                throw new ArgumentNullException("valueList");
            }

            return(valueList.IsActiveDirect() && valueList.Client.IsActiveDirect());
        }