Beispiel #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 ?? "";
    }
Beispiel #2
0
	public void SetSettings(BXParamsBag<object> settings)
	{
		if (settings.ContainsKey("TextBoxSize"))
			TextBoxSize.Text = settings["TextBoxSize"].ToString();
		if (settings.ContainsKey("MaxSize"))
			MaxSize.Text = settings["MaxSize"].ToString();
		if (settings.ContainsKey("AllowedExtensions"))
			AllowedExtensions.Text = string.Join(" ", (string[])settings["AllowedExtensions"]);
		AddDescription.Checked = settings.GetBool("AddDescription");
	}
		private static string BuildAdminConnectionString(BXParamsBag<object> data)
		{
			SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder();
			sb.DataSource = data.GetString("ServerName");
			sb.ConnectTimeout = 1000;
			if (data.GetBool("AdminWindows"))
				sb.IntegratedSecurity = true;
			else
			{
				sb.UserID = data.GetString("AdminLogin", "");
				sb.Password = data.GetString("AdminPassword", "");
			}
			return sb.ConnectionString;
		}
		public void LoadConfig(BXParamsBag<object> config)
		{			
			IsLocal.Checked = config == null || config.GetBool("isLocal", true);
		}
Beispiel #5
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;
		}
	}
		public EnumerationItem(BXParamsBag<object> data)
		{
			Id = data.GetInt("Id");
			Title = data.GetString("Title");
			XmlId = data.GetString("XmlId");
			IsDefault = data.GetBool("Default");
			IsNew = data.GetBool("New");
			Sort = data.GetInt("Sort");
			Delete = data.GetBool("Delete");
		}
Beispiel #7
0
	public void SetSettings(BXParamsBag<object> settings)
	{
		GenerateDefault.Checked = settings.GetBool("GenerateDefault");
	}