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


TÜRKÇE Grid üzerinde görüntülenecek alan görünümüdür. Bu tipi karşılayan assembly bin klasöründe bulunmalı ve Netcad.SimpleThreading.ModulManagerAssemblyAttribute ile işaretlenmiş olmalıdır. ENGLISH It is the editor that will be shown in the result grid of a query 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 Netcad.Xml;
using System.Data;
using System.ComponentModel;
using System.Web.UI;
using Netcad.Web.Controls;
using System.Web;

namespace Netcad.Netigma.Web
{
    /// <summary>
    /// The <see cref="Netcad.Netigma.IViewPropertyEditor"/> implementation that interprets 
    /// the value from the datasource property as a boolean value. It is suitable to be used
    /// as the view editor of a CheckBox control.
    /// </summary>
    [Serializable]
    [DataSourcePropertyTypeTargetAttribute(DataSourcePropertyType.All)]
    [Netcad.Web.Controls.NetigmaHelpId(18)]
    public class BooleanViewPropertyEditor : ViewPropertyEditorBase, IStatisticalViewPropertyEditor
    {
        [NetigmaNonSerialized]
        [ml_DisplayName(2, "Adı")]
        [Browsable(false)]
        public override string Name { get { return "Bool"; } }

        [ml_DisplayName(3, "Gösterim Adı")]
        [NetigmaNonSerialized]
        public override string DisplayName { get { return ml.ml_string(392, "Doğru Yanlış"); } }

        [ml_DisplayName(196, "Doğru İkonu Yolu")]
        [WebEditor("Netcad.Netigma.Design.FileSelectionEditor, Netcad.Netigma.Design, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")]
        [FileDialogFilterAttribute("~/Images", "*.bmp|*.gif|*.jpg|*.jpeg|*.png|*.tif|*.tiff")]
        public string TrueImagePath
        {
            get
            {
                if (string.IsNullOrEmpty(_trueImagePath))
                    return "./NetcadUI.axd?.Type=UIResource&Image=true.gif";
                else
                    return _trueImagePath;
            }
            set { _trueImagePath = value; }
        }
        public string _trueImagePath;

        [ml_DisplayName(197, "Yanlış İkonu Yolu")]
        [WebEditor("Netcad.Netigma.Design.FileSelectionEditor, Netcad.Netigma.Design, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")]
        [FileDialogFilterAttribute("~/Images", "*.bmp|*.gif|*.jpg|*.jpeg|*.png|*.tif|*.tiff")]
        public string FalseImagePath
        {
            get
            {
                if (string.IsNullOrEmpty(_falseImagePath))
                    return "./NetcadUI.axd?.Type=UIResource&Image=false.gif";
                else
                    return _falseImagePath;
            }
            set { _falseImagePath = value; }
        }
        public string _falseImagePath;

        public BooleanViewPropertyEditor()
        {

        }

        private IViewResult GetResultInternal(IDataSourceProperty owner, INetigmaDomain netigmaDomain, bool IsStatistic)
        {
            ViewResult result = new ViewResult(owner.Path);
            //result.Viewer = this;
            result.DisplayName = owner.DisplayName;
            result.SelectedList.Add(new SelectProperty(owner.QueryName, owner.DisplayName));

            if (!IsStatistic)
            {
                INetigmaActionForView viewAction = this.Action as INetigmaActionForView;
                if (viewAction != null)
                    viewAction.UpdateView(owner, netigmaDomain, result);
            }
            return result;

        }

        public override IViewResult GetResult(IDataSourceProperty owner, INetigmaDomain netigmaDomain)
        {
            return this.GetResultInternal(owner, netigmaDomain, false);

        }

        public override object GetControl(IViewResult view, DataRow Row, IGUIState State)
        {
            if (view.SelectedList.Count == 0)
                return new LiteralControl("&nbsp;");

            object aObj = Row[view.SelectedList[0].AsName];

            if (aObj == null || aObj is System.DBNull)
                return new LiteralControl();
            System.Web.UI.WebControls.Image content = new System.Web.UI.WebControls.Image();

            if (aObj is bool)
            {
                content.ImageUrl = ((bool)aObj) ? TrueImagePath : FalseImagePath;
                //content.ImageUrl = string.Format("./NetcadUI.axd?.Type=UIResource&Image={0}.gif", ((bool)aObj) ? "true" : "false");
            }
            else
            {
                content.ImageUrl = (aObj.ToString().Trim() == "1") ? TrueImagePath : FalseImagePath;
                //content.ImageUrl = string.Format("./NetcadUI.axd?.Type=UIResource&Image={0}.gif", (aObj.ToString().Trim() == "1") ? "true" : "false");
            }

            if (System.Web.HttpContext.Current != null)
            {
                content.ImageUrl = new Uri(System.Web.HttpContext.Current.Request.Url, content.ImageUrl).AbsoluteUri;
            }

            Control control = this.AddActionFunctionality(content, view, Row, State);
            
            return control;
        }

        public override IViewPropertyEditor Clone()
        {
            BooleanViewPropertyEditor result = new BooleanViewPropertyEditor();
            if (this.Action != null)
                result.Action = this.Action.Clone();
            if (this.ColumnGroup != null)
                this.ColumnGroup.CopyTo(result.ColumnGroup);
            return result;
        }


        #region IStatisticalViewPropertyEditor Members

        public IViewResult GetStatisticGroupResult(IDataSourceProperty owner, INetigmaDomain netigmaDomain)
        {
            IViewResult r = this.GetResultInternal(owner, netigmaDomain, true);
            r.StatisticalType = StatisticsType.Group;
            foreach (ISelectProperty s in r.SelectedList)
                s.StatisticalType = StatisticsType.Group;
            return r;
        }

        public IViewResult GetStatisticFunctionResult(IDataSourceProperty owner, INetigmaDomain netigmaDomain, AggregateFunctionType aggregateFunctionType)
        {
            if (aggregateFunctionType == AggregateFunctionType.Notset)
                return null;

            ViewResult result = new ViewResult();
            //result.Viewer = this;

            //TODO: bunu nasıl yaparız???

            SelectProperty s = new SelectProperty(owner.QueryName, owner.DisplayName);
            s.StatisticAggregateFunctionCustom = owner.AggregateFunctionCustom;
            s.StatisticAggregateFunctionType = aggregateFunctionType;
            s.ForLookup = true;

            result.SelectedList.Add(s);

            s.StatisticalType =
                result.StatisticalType = StatisticsType.AggregateFunction;

            result.DisplayName =
                s.DisplayName = aggregateFunctionType.GetEnumInFormattedString(owner, netigmaDomain);

            return result;
        }

        #endregion

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

     
    }
}

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.