Exemplo n.º 1
0
        public static bool ActivateValueListItem(this SystemAdminBaseController controller, int valueListItemId)
        {
            ValueListItem valueListItem = controller.GStoreDb.ValueListItems.FindById(valueListItemId);

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

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

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

            return(true);
        }
Exemplo n.º 2
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 ValueListItem valueListItem)
        {
            if (valueListItem == null)
            {
                throw new ArgumentNullException("valueListItem");
            }

            return(valueListItem.IsActiveDirect() && valueListItem.ValueList.IsActiveBubble());
        }
Exemplo n.º 3
0
		public ValueListItemEditAdminViewModel(ValueListEditAdminViewModel valueListViewModel, ValueListItem valueListItem, int index)
		{
			if (valueListViewModel == null)
			{
				throw new ArgumentNullException("valueListViewModel");
			}

			if (valueListViewModel.ValueList == null)
			{
				throw new ArgumentNullException("valueListViewModel.ValueList", "valueListViewModel.ValueList cannot be null. make sure edit page sets this after post");
			}

			this.Index = index;

			this.ValueListEditAdminViewModel = valueListViewModel;
			this.ValueList = valueListViewModel.ValueList;
			this.ValueListId = valueListViewModel.ValueList.ValueListId;

			this.IsStoreAdminEdit = valueListViewModel.IsStoreAdminEdit;
			this.IsReadOnly = valueListViewModel.IsReadOnly;
			this.IsDeletePage = valueListViewModel.IsDeletePage;
			this.IsCreatePage = valueListViewModel.IsCreatePage;
			this.ActiveTab = valueListViewModel.ActiveTab;

			FillListsIfEmpty(valueListItem.Client);

			if (valueListItem == null)
			{
				SetDefaults(valueListViewModel);
			}
			else
			if (valueListItem != null)
			{
				this.Name = valueListItem.Name;
				this.Order = valueListItem.Order;
				this.Description = valueListItem.Description;
				this.IsInteger = valueListItem.IsInteger;
				this.IntegerValue = valueListItem.IntegerValue;
				this.IsString = valueListItem.IsString;
				this.StringValue = valueListItem.StringValue;
				this.ValueListItemId = valueListItem.ValueListItemId;

				this.IsPending = valueListItem.IsPending;
				this.StartDateTimeUtc = valueListItem.StartDateTimeUtc;
				this.EndDateTimeUtc = valueListItem.EndDateTimeUtc;
				this.IsActiveDirect = valueListItem.IsActiveDirect();
				this.IsActiveBubble = valueListItem.IsActiveBubble();
			}
		}