Netcad Netigma API Reference
IQueryPropertyEditor Interface
Members  Example  See Also  Send Feedback
Netcad.Netigma Namespace : IQueryPropertyEditor Interface


TÜRKÇE Sorgu editörüdür. Sorgu sayfalarına gelecek alanlar en az bu arayüzü karşılamalıdır. Bu tipi karşılayan assembly bin klasöründe bulunmalı ve Netcad.SimpleThreading.ModulManagerAssemblyAttribute ile işaretlenmiş olmalıdır. ENGLISH /// The editors that will be used/shown in query pages should implement at least this interface. In order to use an editor from an external assembly(dll) that implements this interface, the assembly should be marked with Netcad.SimpleThreading.ModulManagerAssemblyAttribute and shold be placed in bin folder.

Syntax

 
Visual Basic
C#
 
 

Example

C#Copy Code
using Netcad.Netigma.Web.MultiLang;
using System;
using System.Data;
using Netcad.Data.Filtering;
using Netcad.Web.UI.StringParser;
using Netcad.Xml;
using System.ComponentModel;
using Netcad.Netigma.Web.Controls.BasicControls;
using System.Web;
using System.Web.UI;
using Netcad.Web.Controls;
using System.Text;

namespace Netcad.Netigma.Web
{

    [PropertyApplicationType(AppType = ApplicationType.Web)]
    [DataSourcePropertyTypeTargetAttribute(DataSourcePropertyType.AllDb)]
    [Netcad.Web.Controls.NetigmaHelpId(12)]
    public class CheckBoxQueryPropertyEditor : QueryPropertyEditorBase, INetigma1ControlPropertyReader, ISupportClientSideScripts
    {
        [ml_DisplayName(2, "Adı")]
        [NetigmaNonSerialized]
        [Browsable(false)]
        public override string Name { get { return "CheckBox"; } }

        [ml_DisplayName(3, "Gösterim Adı")]
        [NetigmaNonSerialized]
        public override string DisplayName { get { return ml.ml_string(309, "Seçim Kutusu"); } }

        [ml_DisplayName(5, "Varsayılan Değer")]
        [WebEditor("Netcad.Netigma.Design.NetigmaEnumSelectEditor, Netcad.Netigma.Design, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")]
        public CheckState DefaultChecked { get; set; }

        public enum CheckState
        {
            [ml_Description(386, "Seçili")]
            Checked = 0,
            [ml_Description(387, "Seçili Değil")]
            Unchecked = 1,
            [ml_Description(388, "Boş")]
            Indeterminate = 2
        }

        public CheckBoxQueryPropertyEditor()
        {
            this.DefaultChecked = CheckState.Checked;
        }

        [NonSerialized]
        private StandartControlProperties _ControlPropertiesObject = null;
        [ml_DisplayName(120, "Kontrol Özellikleri Nesnesi")]
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public StandartControlProperties ControlPropertiesObject
        {
            get { if (_ControlPropertiesObject == null) _ControlPropertiesObject = new StandartControlProperties(); return _ControlPropertiesObject; }
        }

        public void UpdatePropertiesFromNetigma1Meta(string ControlProperties)
        {
            ControlPropertiesObject.UpdateFromOldNetigmaString(ControlProperties);

            if (!string.IsNullOrWhiteSpace(ControlProperties))
            {
                Netcad.Web.UI.StringParser.ParameterParser parser = new Netcad.Web.UI.StringParser.ParameterParser(ControlProperties);
                if (!string.IsNullOrWhiteSpace(parser["Checked"]))
                {
                    this.DefaultChecked = parser["Checked"] == "1" || "true".Equals(parser["Checked"]) ? CheckState.Checked : CheckState.Unchecked;
                }
            }
        }


        public override object CreateControl(IDataSourceProperty owner, INetigmaDomain netigmaDomain, IGUIState state)
        {
            NetigmaTristateCheckbox result = new NetigmaTristateCheckbox();
            result.TriState = true;
            result.ID = owner.Path.GetIdString();

            if (this.DefaultChecked == CheckState.Checked)
                result.CheckState = true;
            else if (this.DefaultChecked == CheckState.Unchecked)
                result.CheckState = false;
            else
                result.CheckState = null;

            ControlPropertiesObject.UpdateControl(result);
            result.Readonly = ControlPropertiesObject.ReadOnly;

            return result;
        }

        public override OgcCriteriaOperator GetCriteria(object control, IDataSourceProperty owner, INetigmaDomain netigmaDomain)
        {
            NetigmaTristateCheckbox cb = control as NetigmaTristateCheckbox;
            if (cb.CheckState.HasValue == false)//indeterminate
                return null;

            OgcBinaryOperator result = new OgcBinaryOperator();
            result.LeftOperand.PropertyName = owner.QueryName;
            result.RightOperand.Value = cb.CheckState.Value;
            result.OperatorType = OgcBinaryOperatorType.PropertyIsEqualTo;

            return result;
        }

        public override OgcCriteriaOperator GetCriteria(IDataSourceProperty owner, INetigmaDomain netigmaDomain, ParameterParser templateValue)
        {
            if (templateValue == null ||
                string.IsNullOrEmpty(templateValue["VALUE_1"]))
                return null;

            OgcBinaryOperator result = new OgcBinaryOperator();
            result.LeftOperand.PropertyName = owner.QueryName;
            result.OperatorType = OgcBinaryOperatorType.PropertyIsEqualTo;
            result.RightOperand.Value = (templateValue["VALUE_1"] == "1");

            return result;
        }

        public override ParameterParser GetValue(object control, IDataSourceProperty owner, INetigmaDomain netigmaDomain)
        {
            NetigmaTristateCheckbox cb = control as NetigmaTristateCheckbox;
            if (cb.CheckState.HasValue == false)
                return null;

            ParameterParser result = new ParameterParser(string.Empty);

            result["VALUE_1"] = cb.CheckState.Value ? "1" : "0";
            return result;
        }

        public override void SetValue(object control, IDataSourceProperty owner, INetigmaDomain netigmaDomain, ParameterParser templateValue)
        {
            NetigmaTristateCheckbox cb = control as NetigmaTristateCheckbox;
            cb.CheckState = null;

            if (templateValue == null)
                return;
            if (templateValue["VALUE_1"] == "1")
                cb.CheckState = true;
            else if (templateValue["VALUE_1"] == "0")
                cb.CheckState = false;
        }



        public override IPropertyEditor Clone()
        {
            return new CheckBoxQueryPropertyEditor();
        }

        
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public override IValidation Validator
        {
            get { return null; /* a checkbox requires no validation*/ }
        }

        [Browsable(false)]
        public override string IconResourcePath
        {
            get
            {
                return "Netcad.Netigma.Web.EmbededResource.Images.editorIcons.CheckBoxQueryEditor.png";
            }
        }

        #region ISupportClientSideScripts

        public override ClientSideProperties ScriptOptions
        {
            get
            {
                return base.ScriptOptions;
            }

            set
            {
                base.ScriptOptions = value;
            }
        }

        public string ChangeValueScript(object control)
        {
            NetigmaTristateCheckbox cb = control as NetigmaTristateCheckbox;
            return string.Format("$('#{0}').change({1}.ValueChanged);", cb.ClientID, this.ScriptOptions.ClientInstanceName);
        }

        public string GetValueScript(object control)
        {
            NetigmaTristateCheckbox cb = control as NetigmaTristateCheckbox;
            return string.Format("function(){{ return $('#{0}').find('input[type=checkbox]').val() === '' ? '' : $('#{0}').find('input[type=checkbox]').val() === '1'; }}", cb.ClientID);
        }

        public string SetValueScript(object control)
        {
            NetigmaTristateCheckbox cb = control as NetigmaTristateCheckbox;
            StringBuilder sb = new StringBuilder();
            sb.Append("function(value){");

            sb.Append("if(value===true) {");
            sb.AppendFormat("$('#{0}').find('input').val('1');", cb.ClientID);
            sb.AppendFormat("$('#{0}').find('div.cbx').html($('#{0}').find('input[type=checkbox]').data('checkboxX').options.iconChecked);", cb.ClientID);
            sb.Append("}");
            sb.Append("else if(value===false) {");
            sb.AppendFormat("$('#{0}').find('input').val('0');", cb.ClientID);
            sb.AppendFormat("$('#{0}').find('div.cbx').html($('#{0}').find('input[type=checkbox]').data('checkboxX').options.iconUnchecked);", cb.ClientID);
            sb.Append("}");
            sb.Append("else {");
            sb.AppendFormat("$('#{0}').find('input').val();", cb.ClientID);
            sb.AppendFormat("$('#{0}').find('div.cbx').html($('#{0}').find('input[type=checkbox]').data('checkboxX').options.iconNull);", cb.ClientID);
            sb.Append("}");

            sb.Append("}");
            return sb.ToString();
        }

        public string ChangeEnableScript(object control)
        {
            NetigmaTristateCheckbox cb = control as NetigmaTristateCheckbox;
            StringBuilder sb = new StringBuilder();
            sb.Append("function(value){");

            sb.Append("if(value===true) {");
            sb.AppendFormat("$('#{0}').find('input[type=checkbox]').data('checkboxX').disabled = false;", cb.ClientID);
            sb.AppendFormat("$('#{0}').find('div.cbx').attr('tabindex', 1000);", cb.ClientID);
            sb.AppendFormat("$('#{0}').find('div.cbx').addClass('cbx-active');", cb.ClientID);
            sb.AppendFormat("$('#{0}').find('div.cbx').removeClass('cbx-disabled');", cb.ClientID);
            sb.Append("}");
            sb.Append("else {");
            sb.AppendFormat("$('#{0}').find('input[type=checkbox]').data('checkboxX').disabled = true;", cb.ClientID);
            sb.AppendFormat("$('#{0}').find('div.cbx').removeAttr('tabindex');", cb.ClientID);
            sb.AppendFormat("$('#{0}').find('div.cbx').removeClass('cbx-active');", cb.ClientID);
            sb.AppendFormat("$('#{0}').find('div.cbx').addClass('cbx-disabled');", cb.ClientID);
            sb.Append("}");

            sb.Append("}");
            return sb.ToString();
            

        }

        public string JqueryObjectScript(object control)
        {
            NetigmaTristateCheckbox cb = control as NetigmaTristateCheckbox;
            return string.Format("function(){{ return $('#{0}'); }}", cb.ClientID);
        }

        #endregion

    }
}

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2016 All Rights Reserved.