示例#1
0
    public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
    {
		field = currentField;
        value = currentValue;

		if (field == null)
			return;

		string fieldName = currentField.EditFormLabel;

		BXParamsBag<object> settings = new BXParamsBag<object>(currentField.Settings);
		ValueRequired.Enabled = currentField.Mandatory;
		if (ValueRequired.Enabled)
			ValueRequired.ErrorMessage = GetMessageFormat("FieldMustBeFilled", fieldName);
		ValueMask.ErrorMessage = GetMessageFormat("ValueMustBeGuid", fieldName);

		string v = null;

        if (value != null && value.Values.Count > 0)
		{
			object val = value.Value;
			if (val != null)
			{
				if (val is SqlGuid)
					v = ((SqlGuid)val).Value.ToString();
				else if (val is Guid)
					v = ((Guid)val).ToString();
			}
		}
		else if (settings.GetBool("GenerateDefault"))
			v = Guid.NewGuid().ToString();
		ValueTextBox.Text = v ?? "";
    }
示例#2
0
	public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
	{
		field = currentField;
		value = currentValue;
		if (currentField == null)
			return;

		string fieldName = currentField.EditFormLabel;
		string errorMessage = currentField.ErrorMessage;
		if (string.IsNullOrEmpty(errorMessage))
			errorMessage = GetMessageFormat("Error.RegexInvalid", fieldName);

		BXParamsBag<object> settings = new BXParamsBag<object>(currentField.Settings);
		ValueRequired.Enabled = currentField.Mandatory;
		if (ValueRequired.Enabled)
			ValueRequired.ErrorMessage = GetMessageFormat("Error.Required", fieldName);

		int i = settings.ContainsKey("RowsCount") ? settings.GetInt("RowsCount") : 1;
		ValueTextBox.TextMode = (i > 1) ? TextBoxMode.MultiLine : TextBoxMode.SingleLine;
		if (ValueTextBox.TextMode == TextBoxMode.MultiLine)
			ValueTextBox.Rows = i;



		ValueTextBox.Columns = settings.ContainsKey("TextBoxSize") ? settings.GetInt("TextBoxSize") : 20;

		minLength = null;
		if (settings.ContainsKey("MinLength"))
			minLength = settings.GetInt("MinLength");
		maxLength = null;
		if (settings.ContainsKey("MaxLength"))
			maxLength = settings.GetInt("MaxLength");

		ValueMinLength.Enabled = minLength.HasValue && minLength > 0;
		ValueMaxLength.Enabled = maxLength.HasValue && maxLength > 0;
		minValidationScript = null;
		maxValidationScript = null;
		if (ValueMinLength.Enabled)
		{
			minValidationScript = string.Format("if(!args.Value||args.Value.length<{0})return;", minLength.Value);
			ValueMinLength.ErrorMessage = GetMessageFormat("Error.MinLength", fieldName, minLength.Value);
		}
		if (ValueMaxLength.Enabled)
		{
			maxValidationScript = string.Format("if(args.Value&&args.Value.length>{0})return;", maxLength.Value);
			ValueMaxLength.ErrorMessage = GetMessageFormat("Error.MaxLength", fieldName, maxLength.Value);
		}

		ValueRegex.Enabled = settings.ContainsKey("ValidationRegex") && !String.IsNullOrEmpty((string)settings["ValidationRegex"]);
		if (ValueRegex.Enabled)
		{
			ValueRegex.ValidationExpression = (string)settings["ValidationRegex"];
			ValueRegex.ErrorMessage = errorMessage;
		}

		if (value != null && value.Value is string)
			ValueTextBox.Text = value.Value.ToString();
		else
			ValueTextBox.Text = settings.ContainsKey("DefaultValue") ? (string)settings["DefaultValue"] : String.Empty;
	}
示例#3
0
    public void Save(BXCustomPropertyCollection storage)
    {
        if (field == null)
            return;

        object value = null;
        switch (MultiView1.ActiveViewIndex)
        {
            case 0:
                value = chValue.Checked;
                break;
            case 1:
                if (Yes.Checked)
                    value = true;
                else if (No.Checked)
                    value = false;
                break;
            case 2:
                if (ddValue.SelectedIndex == 0)
                    value = true;
                else if (ddValue.SelectedIndex == 1)
                    value = false;
                break;
        }
        BXCustomType t = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
        storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, value);
    }
示例#4
0
	public void Initialize(BXCustomField currentField,BXCustomProperty value)
    {
        field = currentField;
        this.value = value;
		if (field == null)
			return;

		IBXCalendar cal = Calendar1 as IBXCalendar;

        valDate.Enabled = currentField.Mandatory;
		DateTime? dateTime = null;

		BXParamsBag<object> settings = new BXParamsBag<object>(currentField.Settings);
		showTime = settings.ContainsKey("showTime") ? (bool)settings["showTime"] : true;

        if (value == null)
        {
            if (cal != null)
            {
                if (settings.ContainsKey("default"))
					dateTime = (DateTime)settings["default"];

                if (settings.ContainsKey("current"))
					dateTime = DateTime.Now;				
            }
        }
        else
        {
            if (value.Value is DateTime)
				dateTime = (DateTime)value.Value;
        }

		if (dateTime.HasValue)
			txtDate.Text = showTime ? dateTime.Value.ToString() : dateTime.Value.ToString("d");
    }
示例#5
0
	public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
	{
		field = currentField;
		value = currentValue;

		if (field == null)
			return;

		string fieldName = currentField.EditFormLabel;


		ValueRequired.Enabled = currentField.Mandatory;
		if (ValueRequired.Enabled)
			ValueRequired.ErrorMessage = GetMessageFormat("Error.Required", fieldName);

		//Инициализируем только текстбокс
		if (value != null && value.Value != null)
		{
			int elId;
			if (int.TryParse(value.Value.ToString(), out elId) && elId > 0)
				tbValue.Text = elId.ToString();
		}

		BXParamsBag<object> settings = new BXParamsBag<object>(field.Settings);
		iblockId = settings.ContainsKey("IBlockId") ? (int)settings["IBlockId"] : 0;

	}
示例#6
0
	public void Save(BXCustomPropertyCollection storage)
    {
		if (field == null)
			return;

		double d;
		object value = null;
		if (double.TryParse(ValueTextBox.Text, out d))
			value = d;
		BXCustomType t = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
        storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, value);
    }
示例#7
0
	public void Save(BXCustomPropertyCollection storage)
    {
		if (field == null)
			return;

		IBXCalendar cal = Calendar1 as IBXCalendar;
		object value = null;
		if (cal != null && cal.Date != DateTime.MinValue)
			value = showTime ? cal.Date : cal.Date.Date;

		BXCustomType t = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
        storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, value);
    }
示例#8
0
	public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
	{
		field = currentField;
        value = currentValue;

		if (field == null)
			return;

		string fieldName = currentField.EditFormLabel;

		BXParamsBag<object> settings = new BXParamsBag<object>(currentField.Settings);
		ValueRequired.Enabled = currentField.Mandatory;
		if (ValueRequired.Enabled)
			ValueRequired.ErrorMessage = GetMessageFormat("Error.Required", fieldName);

		ValueList.Rows = settings.ContainsKey("TextBoxSize") ? (int)settings["TextBoxSize"] : 5;
		ValueList.SelectionMode = (currentField.Multiple ? ListSelectionMode.Multiple : ListSelectionMode.Single);

		List<string> selectedValues = new List<string>();
		if (value != null)
		{
			foreach (object v in value.Values)
				selectedValues.Add(v.ToString());
		}

		ValueList.Items.Clear();

		int iblockId = 0;
		if (!settings.ContainsKey("IBlockId"))
		{
			BXInfoBlockCollectionOld c = BXInfoBlockManagerOld.GetList(null, null);
			if (c.Count > 0)
				iblockId = c[0].IBlockId;
		}
		else
			iblockId = (int)settings["IBlockId"];


		BXInfoBlockSectionCollectionOld sectionCollection = BXInfoBlockSectionManagerOld.GetTree(iblockId, 0);
		foreach (BXInfoBlockSectionOld section in sectionCollection)
		{
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < section.DepthLevel; i++)
				sb.Append(" . ");
			sb.Append(section.Name);
			ListItem l = new ListItem(sb.ToString(), section.SectionId.ToString());
			if (value != null && selectedValues.Contains(section.SectionId.ToString()))
				l.Selected = true;
			ValueList.Items.Add(l);
		}
    }
示例#9
0
	public void Save(BXCustomPropertyCollection storage)
    {
		if (field == null)
			return;
		
		object value;
		try
		{
			value = new SqlGuid(ValueTextBox.Text.Trim().TrimStart('{').TrimEnd('}').Replace("-", ""));
		}
		catch
		{
			value = null;
		}

		BXCustomType t = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
        storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, value);
    }
示例#10
0
    public void Initialize(BXCustomField currentField,BXCustomProperty currentValue)
    {
		field = currentField;
        value = currentValue;

		if (field == null)
			return;

		string fieldName = currentField.EditFormLabel;

		BXParamsBag<object> settings = new BXParamsBag<object>(currentField.Settings);
		ValueRequired.Enabled = currentField.Mandatory;
		if (ValueRequired.Enabled)
			ValueRequired.ErrorMessage = GetMessageFormat("Error.Required", fieldName);


		ValueTextBox.Columns = settings.ContainsKey("TextBoxSize") ? settings.GetInt("TextBoxSize") : 20;

		ValueMin.Enabled = ValueMax.Enabled = false;
		ValueType.ErrorMessage = 
		ValueMax.ErrorMessage =
		ValueMin.ErrorMessage =
			GetMessageFormat("Error.DefaultRangeInvalid", fieldName);

		if (settings.ContainsKey("MinValue"))
		{
			double min = Convert.ToDouble(settings["MinValue"]);// is int ? (double)((int)settings["MinValue"]) : (double)settings["MinValue"];
			ValueMin.ValueToCompare = min.ToString();
			ValueMin.Enabled = true;
		}
		if (settings.ContainsKey("MaxValue"))
		{
			double max = Convert.ToDouble(settings["MaxValue"]); //is int ? (double)((int)settings["MaxValue"]) : (double)settings["MaxValue"];
			ValueMax.ValueToCompare = max.ToString();
			ValueMax.Enabled = true;
		}

		int precision = settings.ContainsKey("Precision") ? settings.GetInt("Precision") : 4;

        if (value != null)
			ValueTextBox.Text = string.Format("{0:F" + precision + "}", value.Value);
        else
			ValueTextBox.Text = settings.ContainsKey("DefaultValue") ? settings["DefaultValue"].ToString() : String.Empty;
    }
示例#11
0
    public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
    {
        field = currentField;
        value = currentValue;

		if (field == null)
			return;

		BXParamsBag<object> settings = new BXParamsBag<object>(field.Settings);

		MultiView1.ActiveViewIndex = settings.ContainsKey("view") ? (int)settings["view"] : 0;

		//BIND VALUE
		if (value != null)
		{
			if (value.Value != null && value.Value is bool)
			{
				bool flag = (bool)value.Value;
				chValue.Checked = flag;
				ddValue.SelectedIndex = flag ? 0 : 1;
				No.Checked = !flag;
				Yes.Checked = flag;

				return; //Skip default setup
			}
		}

		//BIND DEFAULT
		int defVal;
		if(settings.TryGetInt("default", out defVal))
			switch (defVal)
			{
				case 0: //True
					chValue.Checked = true;
					ddValue.SelectedIndex = 0;
					Yes.Checked = true;
					break;
				case 1: //False
					chValue.Checked = false;
					ddValue.SelectedIndex = 1;
					No.Checked = true;
					break;
			}
    }
示例#12
0
    public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
    {
		field = currentField;
        value = currentValue;

		if (field == null)
			return;

		string fieldName = currentField.EditFormLabel;

		BXParamsBag<object> settings = new BXParamsBag<object>(currentField.Settings);
		ValueRequired.Enabled = currentField.Mandatory;
		if (ValueRequired.Enabled)
			ValueRequired.ErrorMessage = GetMessageFormat("Error.Required", fieldName);

		ValueTextBox.Columns = settings.ContainsKey("TextBoxSize") ? (int)settings["TextBoxSize"] : 20;

		ValueRange.Enabled = true;
		ValueRange.MinimumValue = int.MinValue.ToString();
		ValueRange.MaximumValue = int.MaxValue.ToString();
		ValueRange.ErrorMessage = GetMessageFormat("Error.DefaultRangeInvalid", fieldName);
		if (settings.ContainsKey("MinValue"))
		{
			int min = (int)settings["MinValue"];
			ValueRange.MinimumValue = min.ToString();
		}
		if (settings.ContainsKey("MaxValue"))
		{
			int max = (int)settings["MaxValue"];
			ValueRange.MaximumValue = max.ToString();
		}

        if (value != null)
			ValueTextBox.Text = string.Format("{0}", value.Value);
        else
			ValueTextBox.Text = settings.ContainsKey("DefaultValue") ? settings["DefaultValue"].ToString() : String.Empty;
    }
		public Container(BXCustomType type, BXCustomField field, BXCustomProperty value)
		{
			editorRaw = type.Edit;
			editorRaw.ID = string.Format("ed");
			editor = (IBXCustomTypeEdit)editorRaw;
			editor.Initialize(field, value);
			Controls.Add(editorRaw);

			deleteButton = new ImageButton();
			deleteButton.ID = string.Format("bt");
			deleteButton.ImageUrl =  VirtualPathUtility.ToAbsolute("~/bitrix/images/delete_button.gif");
			deleteButton.ImageAlign = ImageAlign.AbsMiddle;
			deleteButton.CausesValidation = false;
			Controls.Add(deleteButton);
	
			Literal br = new Literal();
			br.Text = "<br/>";
			Controls.Add(br);
		}
示例#14
0
		public override void Load(BXCustomProperty currentProperty)
		{
			if (field == null)
				return;

			property = currentProperty;

			if (property == null || property.Values == null || property.Values.Count < 1)
				return;

			if (field.Multiple)
			{
				propertyValues = new string[property.Values.Count];
				int index = 0;
				foreach (object value in property.Values)
					propertyValues[index++] = (string)value;
			}
			else if (property.Value is string)
				propertyValues = new string[] { (string)property.Value };
		}
示例#15
0
	public void Save(BXCustomPropertyCollection storage)
	{
		if (field == null)
			return;

		object value = ValueTextBox.Text;
		if (string.IsNullOrEmpty(ValueTextBox.Text) && field.Multiple)
			value = null;
		
		BXCustomType t = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
		storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, value);
	}
示例#16
0
		public override void SaveDefault(BXCustomPropertyCollection storage)
		{
			if (field == null)
				return;

			property = new BXCustomProperty(field.Name, field.Id, type.DbType, field.Multiple, defaultValue);
			storage[field.Name] = property;
		}
示例#17
0
		public override void SaveDefault(BXCustomPropertyCollection storage)
		{
			if (field == null)
				return;

			var defaults = listValues.FindAll(x => x.Default).ConvertAll(x => x.Value).ToArray();
			if (defaults.Length == 0)
				return;
			
			property = new BXCustomProperty(field.Name, field.Id, type.DbType, field.Multiple, defaults);
			storage[field.Name] = property;
		}
示例#18
0
		public override void Load(BXCustomProperty property)
		{
			this.property = property;
			editor.Load();
		}
示例#19
0
		protected override void Save(string formFieldName, BXCustomPropertyCollection storage)
		{
			if (field == null)
				return;

			property = new BXCustomProperty(field.Name, field.Id, type.DbType, field.Multiple, propertyValue.Value);
			storage[field.Name] = property;
		}
示例#20
0
	public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
	{
		field = currentField;
		value = currentValue;
		if (field == null)
			return;

		settings = new BXParamsBag<object>(field.Settings);
		viewMode = settings.ContainsKey("ViewMode") && (string)settings["ViewMode"] == "list" ? ViewMode.List : ViewMode.Flag;

		BXCustomFieldEnumCollection values = BXCustomFieldEnum.GetList(field.Id, field.FieldType, BXTextEncoder.HtmlTextEncoder);

		valList.Enabled = false;
		valFlag.Enabled = false;
		valCheckbox.Enabled = false;

		if (viewMode == ViewMode.List)
		{
			View.ActiveViewIndex = 0;
			int listSize = settings.ContainsKey("ListSize") ? (int)settings["ListSize"] : 5;
			listSize = (listSize > values.Count) ? values.Count : listSize;
			if (listSize > 0)
			{
				List.Rows = listSize;
				List.DataSource = values.ConvertAll<ListItem>(delegate(BXCustomFieldEnum input) { return new ListItem(input.Value, input.TextEncoder.Decode(input.Value)); });
				List.SelectionMode = field.Multiple ? ListSelectionMode.Multiple : ListSelectionMode.Single;
				List.DataBind();
				valList.ValidationGroup = ValidationGroup;
				valList.Enabled = field.Mandatory;
			}
			else
				List.Visible = false;
		}
		else
		{
			if (field.Multiple)
			{
				View.ActiveViewIndex = 2;
				ChBox.DataSource = values.ConvertAll<ListItem>(delegate(BXCustomFieldEnum input) { return new ListItem(input.Value, input.TextEncoder.Decode(input.Value)); });
				ChBox.DataBind();
				valCheckbox.Enabled = field.Mandatory;
				valCheckbox.ValidationGroup = ValidationGroup;
			}
			else
			{
				View.ActiveViewIndex = 1;
				Flag.DataSource = values.ConvertAll<ListItem>(delegate(BXCustomFieldEnum input) { return new ListItem(input.Value, input.TextEncoder.Decode(input.Value)); });
				Flag.DataBind();
				valFlag.ValidationGroup = ValidationGroup;
				valFlag.Enabled = field.Mandatory;
			}
		}


		if (value != null)
		{
			ListControl listControl = viewMode == ViewMode.List ? (ListControl)List : field.Multiple ? (ListControl)ChBox : (ListControl)Flag;
			ListItemCollection items = listControl.Items;

			bool stop = false;
			foreach (ListItem item in items)
			{
				string itemValue = BXTextEncoder.HtmlTextEncoder.Decode(item.Value);
				foreach (string val in value.Values)
					if (itemValue.Equals(val, StringComparison.InvariantCulture))
					{
						item.Selected = true;
						if (!field.Multiple)
						{
							stop = true;
							break;
						}
					}
				if (stop)
					break;
			}
		}
		else
			//BIND DEFAULT
			foreach (BXCustomFieldEnum item in values)
			{
				if (item.Default)
				{
					if (viewMode == ViewMode.List)
						List.SelectedValue = item.Value;
					else if (field.Multiple)
						ChBox.SelectedValue = item.Value;
					else
						Flag.SelectedValue = item.Value;

					continue;
				}
			}
	}
示例#21
0
    public void SetData(BXCustomProperty prop)
    {

    }
示例#22
0
		public override void Load(BXCustomProperty currentProperty)
		{
			if (field == null)
				return;

			property = currentProperty;

			if (property == null || property.Values == null || property.Values.Count < 1)
				return;

			if (field.Multiple)
			{
				propertyValues = new List<int>();
				foreach (object value in property.Values)
				{
					if (value is int)
						propertyValues.Add((int)value);
				}
			}
			else if (property.Value is int)
			{
				propertyValues = new List<int>(1);
				propertyValues.Add((int)property.Value);
			}
		}
示例#23
0
	public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
	{
		field = currentField;
		if (field == null)
			return;

		BXParamsBag<object> settings = new BXParamsBag<object>(currentField.Settings);

		RequiredValidator.Enabled = currentField.Mandatory;
		if (RequiredValidator.Enabled)
			RequiredValidator.ErrorMessage = GetMessageFormat("Error.Required", field.EditFormLabel);

		SizeValidator.Enabled = settings.ContainsKey("MaxSize");
		if (SizeValidator.Enabled)
		{
			maxSize = (int)settings["MaxSize"];
			SizeValidator.ErrorMessage = GetMessageFormat("Error.IllegalSize", field.EditFormLabel, settings["MaxSize"]);
		}

		if (settings.ContainsKey("AllowedExtensions"))
			extensions = settings["AllowedExtensions"] as string[];
		ExtensionValidator.Enabled = (extensions != null && extensions.Length > 0);
		if (ExtensionValidator.Enabled)
			ExtensionValidator.ErrorMessage = GetMessageFormat("Error.IllegalExtension", field.EditFormLabel, string.Join(", ", extensions));
		value = currentValue;

		RequiredValidator.Enabled = field.Mandatory;
		if (RequiredValidator.Enabled)
			RequiredValidator.ErrorMessage = GetMessageFormat("Error.Required", field.EditFormLabel);

		addDescription = settings.GetBool("AddDescription");
		DescriptionBlock.Visible = addDescription;

		BXFile f = null;
		if (currentValue != null && (currentValue.Value != null && (int)currentValue.Value != 0) && (f = BXFile.GetById((int)currentValue.Value, BXTextEncoder.EmptyTextEncoder)) != null)
		{
			currentFile = originalFile = f;
			StoredId.Value = "Y";
			//DisplayName.Value = f.FileNameOriginal;
			//DisplaySize.Value = BXStringUtility.BytesToString(f.FileSize);
			//ContentType.Value = f.ContentType;
			if (addDescription)
				Description.Text = f.Description;
		}
	}
示例#24
0
	public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
	{
		field = currentField;
		value = currentValue;
		if (field == null)
			return;

		settings = new BXParamsBag<object>(field.Settings);
		viewMode = settings.ContainsKey("ViewMode") && (string)settings["ViewMode"] == "list" ? ViewMode.List : ViewMode.Flag;

		valDDList.Enabled = false;
		valList.Enabled = false;
		valFlag.Enabled = false;
		valCheckbox.Enabled = false;
		
		ListControl list;
		int listCount = Math.Max(settings.GetInt("ListSize", 5), 1);
		if (viewMode == ViewMode.List)
		{
			if (field.Multiple)
			{
				View.ActiveViewIndex = 0;
				list = List;
				validator = valList;
				List.Rows = Math.Min(listCount, Enums.Count + (!field.Multiple && !field.Mandatory ? 1 : 0));
			}
			else
			{
				View.ActiveViewIndex = 3;
				list = DDList;
				validator = valDDList;
			}
		}
		else
		{
			if (field.Multiple)
			{
				View.ActiveViewIndex = 2;
				list = ChBox;
				validator = valCheckbox;
			}
			else
			{
				View.ActiveViewIndex = 1;
				list = Flag;
				validator = valFlag;
			}
		}

		ListItem none = null;
		if (!field.Multiple && !field.Mandatory)
		{
			none = new ListItem(GetMessage("Option.NotSelected"), "");
			none.Selected = true;
			list.Items.Add(none);
		}

		validator.Enabled = field.Mandatory;
		validator.ValidationGroup = ValidationGroup;

		foreach (BXCustomFieldEnum e in Enums)
			list.Items.Add(new ListItem(e.Value, e.Id.ToString()));


		if (value != null)
		{
			bool stop = false;
			foreach (ListItem item in list.Items)
			{
				foreach (int val in value.Values)
					if (item.Value == val.ToString())
					{
						if (!field.Multiple)
						{
							if (none != null)
								none.Selected = false;
							stop = true;
						}
						
						item.Selected = true;
						break;
					}

				if (stop)
					break;
			}
		}
		else //BIND DEFAULT
		{
			bool stop = false;
			foreach (ListItem item in list.Items)
			{
				foreach (BXCustomFieldEnum val in Enums)
					if (item.Value == val.Id.ToString() && val.Default)
					{
						if (!field.Multiple)
						{
							if (none != null)
								none.Selected = false;
							stop = true;
						}
						
						item.Selected = true;
						break;
					}

				if (stop)
					break;
			}
		}
	}
	void AddNew(BXCustomProperty value, int index)
	{
		Container c = new Container(type, field, value);
		c.ID = "c" + index;
		c.DeleteButton.Click += imgBtn_Click;
		c.ValidationGroup = ValidationGroup;

		Editors.Controls.Add(c);
	}
示例#26
0
			public override void Save(string formFieldName, BXCustomPropertyCollection storage)
			{
				if (delete != null)
				{
					delete.Delete();
					delete = null;
				}

				file = store;

				if (save != null)
				{
					save.Save();

					if (file != null)
						file.Delete();
					file = save;
				}

				BXCustomProperty p = new BXCustomProperty(editor.field.Name, editor.field.Id, editor.type.DbType, false, null, true);
				if (file != null)
					p.Values.Add(file.Id);
				storage[editor.field.Name] = p;
			}
    public void Initialize(BXCustomField currentField, BXCustomProperty currentValue)
    {
        field = currentField;
        value = currentValue;
		type = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
		Bind();
    }
示例#28
0
		public override void Load(BXCustomProperty currentProperty)
		{
			if (field == null)
				return;

			property = currentProperty;

			if (property != null && property.Value != null && property.Value is bool)
				propertyValue = (bool)property.Value;			
		}
示例#29
0
			public override void Save(string formFieldName, BXCustomPropertyCollection storage)
			{
				foreach (BXFile d in delete)
					d.Delete();

				foreach (BXFile s in save)
					s.Save();

				files.Clear();
				files.AddRange(store);
				files.AddRange(save);

				save.Clear();

				BXCustomProperty p = new BXCustomProperty(editor.field.Name, editor.field.Id, editor.type.DbType, true, null, true);
				foreach (BXFile f in files)
					p.Values.Add(f.Id);
				storage[editor.field.Name] = p;
			}
示例#30
0
	public void Save(BXCustomPropertyCollection storage)
	{
		if (field == null)
			return;
		
		RaiseFile();

		object value = null;
		BXCustomType t = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
		
		if (currentFile != null)
		{
			value = currentFile.Id;
			
			if (addDescription)
				currentFile.Description = Description.Text;
			currentFile.TempGuid = "";
			currentFile.Save();
		}

		if (originalFile != null && (currentFile == null || originalFile.Id != currentFile.Id))
			originalFile.Delete();

		originalFile = currentFile;
		 
		if (value != null)
		{
			storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, value, true);			
		}
		else if (string.IsNullOrEmpty(StoredId.Value))
		{
			storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, null, true);			
		}
		else 
			storage[field.Name] = this.value;
	}