Beispiel #1
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);
    }
Beispiel #2
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);
    }
Beispiel #3
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);
    }
Beispiel #4
0
	public void Save(BXCustomPropertyCollection storage)
    {
		if (field == null)
			return;

		List<int> selectedValues = new List<int>();
		foreach (ListItem item in ValueList.Items)
		{
			int i;
			if (item.Selected && int.TryParse(item.Value, out i))
				selectedValues.Add(i);
		}
		
		BXCustomType t = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
		storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, selectedValues.ToArray());
	}
Beispiel #5
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);
    }
		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;
		}
		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;
		}
 public new void Load(BXCustomPropertyCollection properties)
 {
     fieldsValue = properties;
 }
 public BXCustomPropertyCollection Save()
 {
     BXCustomPropertyCollection result = new BXCustomPropertyCollection();
     foreach (IBXCustomTypeEdit edit in edits)
         edit.Save(result);
     return result;
 }
Beispiel #10
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);
	}
Beispiel #11
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;
			}
Beispiel #12
0
			public abstract void Save(string formFieldName, BXCustomPropertyCollection storage);
Beispiel #13
0
		protected override void Save(string formFieldName, BXCustomPropertyCollection storage)
		{
			editor.Save(formFieldName, storage);
		}
Beispiel #14
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;
	}
Beispiel #15
0
	public void Save(BXCustomPropertyCollection storage)
	{
		if (field == null)
			return;


		List<object> values = new List<object>();

		if (viewMode == ViewMode.List)
		{
			foreach (ListItem item in List.Items)
			{
				if (item.Selected)
					values.Add(item.Value);
			}
		}
		else
		{
			ListItemCollection listCollection = field.Multiple ? ChBox.Items : Flag.Items;
			foreach (ListItem item in listCollection)
			{
				if (item.Selected)
					values.Add(item.Value);
			}
		}

		BXCustomType t = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
		storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, values.ToArray());
	}
Beispiel #16
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;
		}
Beispiel #17
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;
			}
Beispiel #18
0
	public void Save(BXCustomPropertyCollection storage)
	{
		if (field == null)
			return;

		List<object> values = new List<object>();
		ListControl list;
		if (viewMode == ViewMode.List)
			list = field.Multiple ? (ListControl)List : (ListControl)DDList;
		else 
			list = field.Multiple ? (ListControl)ChBox : (ListControl)Flag;

		foreach (ListItem item in list.Items)
			if (item.Selected)
			{
				int id;
				if (int.TryParse(item.Value, out id) && Enums.Exists(delegate(BXCustomFieldEnum input)
				{
					return input.Id == id;
				}))
					values.Add(id);
			}

		BXCustomType t = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
		storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, values.ToArray());
	}
Beispiel #19
0
	public void Save(BXCustomPropertyCollection storage)
	{
		if (field == null)
			return;

		int elementId;
		int.TryParse(tbValue.Text, out elementId);

        BXFilter f = new BXFilter();
        f.Add(new BXFilterItem(BXIBlockElement.Fields.ID, BXSqlFilterOperators.Equal, elementId));
        if (iblockId > 0)
            f.Add(new BXFilterItem(BXIBlockElement.Fields.IBlock.ID, BXSqlFilterOperators.Equal, iblockId));
        BXIBlockElementCollection element = BXIBlockElement.GetList(f, null);

		if (element == null || element.Count != 1)
			elementId = 0;

		BXCustomType t = BXCustomTypeManager.GetCustomType(field.CustomTypeId);
		storage[field.Name] = new BXCustomProperty(field.Name, field.Id, t.DbType, t.IsClonable ? false : field.Multiple, elementId);
	}
    public void Save(BXCustomPropertyCollection storage)
    {
        if (field == null)
            return;

        List<object> values = new List<object>();

        BXCustomPropertyCollection tempStorage = new BXCustomPropertyCollection();
		bool allOriginal = true;
        for(int i = 0; i < Editors.Controls.Count; i++)
        {
			Container c = (Container)Editors.Controls[i];
						
			object originalValue = (value != null && i < value.Values.Count) ? value.Values[i] : null;
			if (!c.ContentVisible)
			{
				if (originalValue != null)
					allOriginal = false;
				continue;
			}

			tempStorage.Clear();
            c.Editor.Save(tempStorage);
			if (tempStorage.ContainsKey(field.Name))
			{
				values.AddRange(tempStorage[field.Name].Values);
				allOriginal = false;
			}
			else
				values.Add(originalValue);
        }

		if (allOriginal)
			return;

		List<object> filteredValues = new List<object>();
		foreach (object value in values)
		{
			if (value != null && !filteredValues.Contains(value))
				filteredValues.Add(value);
		}

		storage[field.Name] = new BXCustomProperty(field.Name, field.Id, type.DbType, true, filteredValues.ToArray(), type.IsFile);
    }