public Statistics_Page_Builder(Page sbp, ListControl control)
 {
     //CHANGES
     _myControls.Add(control.ID, control);
     control.Items.Clear();
     control.Items.Insert(0, ConfigurationManager.AppSettings.Get("DDLDefaultValue"));
 }
 protected void BindUsers(ListControl lc)
 {
     MembershipUserCollection muc = Membership.GetAllUsers();
     lc.DataSource = muc;
     lc.DataValueField = "UserName";
     lc.DataBind();
 }
Beispiel #3
0
 private static void BindList(ListControl listControl, Common.Data.Table.MDataTable source)
 {
     listControl.DataSource = source;
     listControl.DataTextField = source.Columns[0].ColumnName;
     listControl.DataValueField = source.Columns[1].ColumnName;
     listControl.DataBind();
 }
 public CustomiseListSection(ListControl listControl)
     : base(listControl)
 {
     _customiseGroupingSection = listControl.SectionFactory.CreateCustomiseGroupingSection(listControl, listControl.Columns.GroupedItems);
     _optionsToolbarSection = listControl.SectionFactory.CreateOptionsToolbarSection(listControl);
     Children.Add(_customiseGroupingSection);
     Children.Add(_optionsToolbarSection);
 }
Beispiel #5
0
 public RowSection( ListControl listControl, RowIdentifier rowIdentifier, HeaderSection headerSection, int position )
     : base(listControl)
 {
     _headerSection = headerSection;
     _rowIdentifier = rowIdentifier;
     _position = position;
     _seperatorColor = listControl.SeparatorColor;
     _indentColor = listControl.IndentColor;
 }
 /// <summary>
 /// 绑定城市
 /// <param name="id">上级节点Id</param>
 /// <param name="ddl">绑定的控件</param>
 /// </summary>
 private void Bind(int id, ListControl ddl)
 {
     IList<Owen.Model.Model_Infinite> list = new Owen.BLL.BLL_Infinite().GetEntities((int)Owen.Common.InfiniteType.Surgery, id);
     ddl.DataTextField = "InfiniteName";
     ddl.DataValueField = "InfiniteID";
     ddl.DataSource = list;
     ddl.DataBind();
     ddl.Items.Insert(0, new ListItem("--请选择--", ""));
 }
Beispiel #7
0
    internal static void SetUpSSBControls(ListControl lst, IEnumerator en)
    {
        //ComboBox cbo = null;
        //ListBox lb = null;
        //Control ctrl;
        //lst.DataSource
        //if (lst is ComboBox) {
        //  lst.O

        //}
    }
 public List<string> GetSelectedItems(ListControl control)
 {
     List<string> selectedItems = new List<string>();
     foreach (ListItem item in control.Items)
     {
         if (item.Selected == true)
         {
             selectedItems.Add(item.Text);
         }
     }
     return selectedItems;
 }
Beispiel #9
0
 public static void CheckItems(ListControl all, IList<string> needChecked)
 {
     foreach (ListItem item in all.Items)
     {
         foreach (string itemCheck in needChecked)
         {
             if (item.Text == itemCheck)
             {
                 item.Selected = true;
             }
         }
     }
 }
Beispiel #10
0
 public static string GetDDLsText(ListControl ddl, string val)
 {
     if ((val.Trim() != "") && (val.Trim() != "0"))
     {
         try
         {
             for (int i = 0; i < ddl.Items.Count; i++)
             {
                 if (ddl.Items[i].Value.Trim() == val.Trim())
                 {
                     return ddl.Items[i].Text;
                 }
             }
         }
         catch (Exception)
         {
             return " ";
         }
     }
     return " ";
 }
Beispiel #11
0
 /// <summary>
 /// Gets the repeat direction.
 /// </summary>
 /// <param name="listControl">The list control.</param>
 /// <returns></returns>
 protected override RepeatDirection GetRepeatDirection(ListControl listControl)
 {
     return((listControl as CheckBoxList)?.RepeatDirection ?? RepeatDirection.Vertical);
 }
Beispiel #12
0
 /// <summary>
 /// Gets the type of the input tag.
 /// </summary>
 /// <param name="listControl">The list control.</param>
 /// <returns></returns>
 public override string GetInputTagType(ListControl listControl)
 {
     return("checkbox");
 }
Beispiel #13
0
 /// <summary>
 /// Метод заполняющий контролсы типа ListControl
 /// </summary>
 /// <param name="DataSource">Источник данных</param>
 /// <param name="DisplayMember">Отображаемый элемент</param>
 /// <param name="GenerateItems">Генерировать элементы или брать их из источника данных</param>
 protected void FillListControl(ListControl ctrl, object DataSource, string DisplayMember, bool GenerateItems)
 {
     ControlFiller.FillListControl(ctrl, DataSource, DisplayMember, GenerateItems);
 }
Beispiel #14
0
 /// <summary>
 /// 绑定DropDownList,CheckBoxList,RadioButtonList,ListBox控件
 /// </summary>
 /// <param name="sql">SQL语句(至少需1个字段 0列值 1列显示 2列=="1"选择 3列=="1"加(*)标记)</param>
 /// <param name="listCtrl">DropDownList,CheckBoxList,RadioButtonList,ListBox控件id值</param>
 /// <param name="isAll">有否“请选择”</param>
 public void BindListCtrl(string sql, ListControl listCtrl, bool isAll)
 {
     WebHelper.BindListCtrl(dao.GetDataTable(sql), listCtrl, isAll);
 }
    /// <summary>
    /// Gets selected items.
    /// </summary>
    /// <param name="control">Control</param>  
    /// <param name="ids">Id's of selected values separed by semicolon</param>
    private string GetSelectedItems(ListControl control, out string ids)
    {
        ids = "";
        string selected = "";

        // loop thru all items
        for (int i = 0; i != control.Items.Count; i++)
        {
            if (control.Items[i].Selected)
            {
                selected += " " + control.Items[i].Value;
                ids += ValidationHelper.GetString(i, "") + ";";
            }
        }

        if (String.IsNullOrEmpty(selected) && (control.SelectedItem != null))
        {
            selected = control.SelectedItem.Value;
            ids = control.SelectedIndex.ToString();
        }

        return selected;
    }
Beispiel #16
0
 /// <summary>
 /// Executes a query and binds it to a ListControl.
 /// </summary>
 /// <param name="listControl">The list control you wish to use. For example a dropdown box.</param>
 /// <param name="sql">Your sql query string</param>
 public static void ExecuteAndBind(ListControl listControl, string sql)
 {
     ExecuteAndBind(listControl, null, null, null, sql, null, DataBaseConnectionType.Auto);
 }
Beispiel #17
0
        void BindFile(Control control, Control selectControl, string id)
        {
            ///载入数据
            DataTable dt = _controlsDataTable[id];

            if (selectControl != null)
            {
                ///若有selectControl控件,则在selectControl选择项改变后绑定control
                ListControl listSelect = (ListControl)selectControl;
                if (control is ListControl)
                {
                    ListControl  listControl    = (ListControl)control;
                    EventHandler bindingHandler = delegate(object sender, EventArgs e)
                    {
                        DataView dv = new DataView(_controlsDataTable[_dicControlDataBindId[listControl]]);
                        dv.RowFilter              = string.Format("selectValue='{0}'", listSelect.SelectedValue);
                        listControl.DataSource    = dv;
                        listControl.DisplayMember = "text";
                        listControl.ValueMember   = "value";
                    };
                    listSelect.SelectedValueChanged += bindingHandler;

                    //首先执行一次绑定
                    bindingHandler(listSelect, EventArgs.Empty);
                }
                else
                {
                    SelectGroup  listControl    = (SelectGroup)control;
                    EventHandler bindingHandler = delegate(object sender, EventArgs e)
                    {
                        DataView dv = new DataView(_controlsDataTable[_dicControlDataBindId[listControl]]);
                        dv.RowFilter              = string.Format("selectValue='{0}'", listSelect.SelectedValue);
                        listControl.DataSource    = dv;
                        listControl.DisplayMember = "text";
                        listControl.ValueMember   = "value";

                        listControl.DataBinding();
                    };
                    listSelect.SelectedValueChanged += bindingHandler;

                    //首先执行一次绑定
                    bindingHandler(listSelect, EventArgs.Empty);
                }
            }
            else
            {
                //无selectControl控件,直接绑定数据
                if (control is ListControl)
                {
                    ListControl listControl = (ListControl)control;

                    listControl.DataSource    = dt;
                    listControl.DisplayMember = "text";
                    listControl.ValueMember   = "value";
                }
                else
                {
                    SelectGroup listControl = (SelectGroup)control;

                    listControl.DataSource    = dt;
                    listControl.DisplayMember = "text";
                    listControl.ValueMember   = "value";

                    listControl.DataBinding();
                }
            }
        }
    /// <summary>
    /// Gets where condition based on value of given controls.
    /// </summary>
    /// <param name="column">Column to compare</param>
    /// <param name="drpOperator">List control with operator</param>
    /// <param name="valueBox">Text control with value</param>
    /// <returns>Where condition for outdated documents</returns>
    private string GetOutdatedWhereCondition(string column, ListControl drpOperator, ITextControl valueBox)
    {
        string condition = drpOperator.SelectedValue;
        string value = SqlHelper.EscapeQuotes(valueBox.Text);
        value = TextHelper.LimitLength(value, 100);

        string where = column + " ";
        if (string.IsNullOrEmpty(value))
        {
            where = string.Empty;
        }
        else
        {
            // Create condition based on operator
            switch (condition)
            {
                case WhereBuilder.LIKE:
                case WhereBuilder.NOT_LIKE:
                    where += condition + " N'%" + SqlHelper.EscapeLikeText(value) + "%'";
                    break;

                case WhereBuilder.EQUAL:
                case WhereBuilder.NOT_EQUAL:
                    where += condition + " N'" + value + "'";
                    break;

                default:
                    where = string.Empty;
                    break;
            }
        }
        return where;
    }
 private void PrepareCustomPropertyField(WebControl label, ListControl list, PackageProperties property)
 {
     list.Items.Clear();
     if (property == PackageProperties.DestinationAddress || property == PackageProperties.SourceAddress)
     {
         label.ToolTip = "<p>Select the address property to use.</p>";
         list.Items.AddRange(GetAddressProperties());
         list.Visible = true;
     }
     else if (property == PackageProperties.UseMethod)
     {
         label.ToolTip = "<p>Select the shipping method to use.</p>";
         list.Items.AddRange(GetShippingMethods());
         list.Visible = true;
     }
     else
     {
         label.ToolTip = "";
         list.Items.Add(new ListItem("n/a", ""));
         list.Visible = false;
     }
 }
 private void PrepareCustomPropertyField(WebControl label, ListControl list, ItemProperties property)
 {
     list.Items.Clear();
     if (property == ItemProperties.CustomProperty)
     {
         label.ToolTip = "<p>Select the custom property to use.</p>";
         list.Items.AddRange(GetPropertyTypes());
         list.Visible = true;
     }
     else if (property == ItemProperties.Manufacturer || property == ItemProperties.Vendor)
     {
         label.ToolTip = string.Format("<p>Select the {0} property to use.</p>", property.ToString().ToLower());
         list.Items.AddRange(GetVendorManufacturerProperties());
         list.Visible = true;
     }
     else
     {
         label.ToolTip = "";
         list.Items.Add(new ListItem("n/a", ""));
         list.Visible = false;
     }
 }
Beispiel #21
0
 private static void BindList(ListControl listControl, MDataTable source)
 {
     listControl.DataSource = source;
     listControl.DataValueField = source.Columns[0].ColumnName;
     listControl.DataTextField = source.Columns[source.Columns.Count > 1 ? 1 : 0].ColumnName;
     listControl.DataBind();
 }
Beispiel #22
0
 public virtual RowSection CreateRowSection( ListControl listControl, RowIdentifier rowIdentifier, HeaderSection headerSection, int position )
 {
     return new RowSection( listControl, rowIdentifier, headerSection, position );
 }
    // attempts to set the specified drop down to the value specified. If a delegate is supplied
    // and the attempt was successful, the delegate will be run and the result will be indicated
    private bool SetDropDown(ListControl list, string value, BindList bindListDelegate)
    {
        ListItem item = list.Items.FindByValue(value);
        if (item != null)
        {
            item.Selected = true;

            if (bindListDelegate != null)
                bindListDelegate();

            return true;
        }
        return false;
    }
Beispiel #24
0
 /// <summary>
 /// Gets the selected value of the input <see cref="cb"/>. If no value is selected, will return 0.
 /// </summary>
 /// <param name="cb">ComboBox to retrieve value for.</param>
 internal static int GetIndex(ListControl cb)
 {
     return((int)(cb.SelectedValue ?? 0));
 }
Beispiel #25
0
 /// <summary>
 /// Tries to set the selected value. If the value does not exist, will set the first item in the list.
 /// </summary>
 /// <param name="listControl">The list control.</param>
 /// <param name="value">The value.</param>
 public static void SetValue(this ListControl listControl, Guid?value)
 {
     listControl.SetValue(value == null ? "" : value.ToString());
 }
 /// <summary>
 /// Inserts a collection of <see cref="ListItem"/> into a <see cref="System.Web.UI.WebControls.ListControl"/>.
 /// Each item has a value of the name of the category plus ticks to indicate hierarchy between categories.
 /// Each item has a value of the category's itemId.
 /// If you have problems showing all Categories, you can try using <see cref="DisplayChildren(ListControl, int, int?)"/> on an instantiated ItemRelationship (see <see cref="Controls.ItemRelationships.UpdateAvailableItems"/> for an example).
 /// </summary>
 /// <param name="lc">The <see cref="System.Web.UI.WebControls.ListControl"/> into which the category options will be added.</param>
 /// <param name="categoryId">The id of the parent category from which the hierarchy will start, or -1 if all categories.</param>
 /// <param name="portalId">The id of the portal in which these categories reside.</param>
 /// <param name="includeParentCategory">if set to <c>true</c> includes the parent category in the list, otherwise only shows the parent's children.  This is ignored if the TopLevelCategory is selected.</param>
 public static void DisplayCategoryHierarchy(ListControl lc, int categoryId, int portalId, bool includeParentCategory)
 {
     DisplayCategoryHierarchy(lc, categoryId, portalId, includeParentCategory, -1);
 }
Beispiel #27
0
 public virtual ListSection CreateListSection( ListControl listControl )
 {
     return new ListSection( listControl );
 }
Beispiel #28
0
 /// <summary>
 /// Executes a query and binds it to a ListControl.
 /// </summary>
 /// <param name="listControl">The list control you wish to use. For example a dropdown box.</param>
 /// <param name="valueField">The name of the field representing the value.</param>
 /// <param name="textField">The name of the field representing the text to show.</param>
 /// <param name="selectedValue">The selectedValue for this web control.</param>
 /// <param name="sql">Your sql query string</param>
 public static void ExecuteAndBind(ListControl listControl, string valueField, string textField,
                                   string selectedValue, string sql)
 {
     ExecuteAndBind(listControl, valueField, textField, selectedValue, sql, null, DataBaseConnectionType.Auto);
 }
Beispiel #29
0
    private string[] getCurrentTagPair(ListControl list)
    {
        string tagLeft = "";
        string tagRight = "";

        switch (list.SelectedIndex)
        {
            case 0:
                tagLeft = "{";
                tagRight = "}";
                break;
            case 1:
                tagLeft = "{@";
                tagRight = "}";
                break;
            case 2:
                tagLeft = "{#";
                tagRight = "}";
                break;
            case 3:
                tagLeft = "{$";
                tagRight = "}";
                break;
            case 4:
                tagLeft = "{%";
                tagRight = "}";
                break;
        }
        return new string[] { tagLeft, tagRight };
    }
Beispiel #30
0
 internal static sqlservers getSqlServerFromTable(DataTable table, ListControl control)
 {
     return(new sqlservers((string)table.Rows[control.SelectedIndex]["host"], unchecked ((int)(long)table.Rows[control.SelectedIndex]["port"]),
                           (string)table.Rows[control.SelectedIndex]["username"], EncryptionUtils.sDecrypt((string)table.Rows[control.SelectedIndex]["password"])));
 }
Beispiel #31
0
        /// <summary>
        /// Binds the type of the list to defined.
        /// </summary>
        /// <param name="listControl">The list control.</param>
        /// <param name="definedTypeGuid">The defined type GUID.</param>
        /// <param name="insertBlankOption">if set to <c>true</c> [insert blank option].</param>
        protected void BindListToDefinedType(ListControl listControl, string definedTypeGuid, bool insertBlankOption = false)
        {
            var definedType = DefinedTypeCache.Get(new Guid(definedTypeGuid));

            listControl.BindToDefinedType(definedType, insertBlankOption);
        }
Beispiel #32
0
 /// <summary>
 /// 绑定DropDownList,CheckBoxList,RadioButtonList,ListBox控件
 /// </summary>
 /// <param name="id">代码ID</param>
 /// <param name="listCtrl">DropDownList,CheckBoxList,RadioButtonList,ListBox控件id值</param>
 /// <param name="isAll">有否“全部”</param>
 public void BindCodeList(string id, ListControl listCtrl, bool isAll)
 {
     WebHelper.BindListCtrl(GetCodeTable(id), listCtrl, isAll);
 }
        /// <summary>
        /// 绑定DropDownList、ListBox等
        /// </summary>
        /// <param name="list"></param>
        /// <param name="dataSource">枚举类型</param>
        public static void BindList(ListControl list, Type dataSource)
        {
            System.Data.DataTable dt = EnumHelper.GetEnumTable(dataSource);

            BindList(list, dt.DefaultView, "Text", "Value");
        }
Beispiel #34
0
        /// <summary>
        /// 把列表控件的选定项的值转换为指定的类型,如果转换不成功返回类型的默认值..
        /// </summary>
        /// <typeparam name="T">要转换的类型</typeparam>
        /// <param name="ctl">列表控件</param>
        /// <returns></returns>
        public static T GetValue <T>(this ListControl ctl)
        {
            var v = ctl.SelectedValue;

            return(v.ConvertTo <T>());
        }
 /// <summary>
 /// 绑定DropDownList、ListBox等
 /// modify by wsliu
 /// 修改记录:方法内部实现是自己调用自己,为死循环,导致IIS错误
 /// </summary>
 /// <param name="list">控件ID</param>
 /// <param name="dataSource">数据源</param>
 /// <param name="textField">显示的文本字段</param>
 /// <param name="valueField">值字段</param>
 public static void BindList(ListControl list, ArrayList dataSource, string textField, string valueField)
 {
     //BindList(list, dataSource, textField, valueField);
     BindList(list, (object)dataSource, textField, valueField);
 }
Beispiel #36
0
 /// <summary>
 /// Gets the repeat columns.
 /// </summary>
 /// <param name="listControl">The list control.</param>
 /// <returns></returns>
 public override int GetRepeatColumns(ListControl listControl)
 {
     return((listControl as CheckBoxList)?.RepeatColumns ?? 0);
 }
 /// <summary>
 /// 绑定选择项
 /// </summary>
 /// <param name="list">DataList控件</param>
 /// <param name="textField">绑定字段名</param>
 /// <param name="valueField">绑定字段值</param>
 public static void BindItem(ListControl list, string textField, string valueField)
 {
     list.Items.Insert(0, new ListItem(textField, valueField, true));
 }
Beispiel #38
0
 /// <summary>
 /// Gets the name of the input.
 /// </summary>
 /// <param name="listControl">The list control.</param>
 /// <param name="itemIndex">Index of the item.</param>
 /// <returns></returns>
 public override string GetInputName(ListControl listControl, int itemIndex)
 {
     return($"{listControl.UniqueID}${itemIndex}");
 }
 /// <summary>
 /// 绑定选择项
 /// </summary>
 /// <param name="list">DataList控件</param>
 public static void BindItem(ListControl list)
 {
     BindItem(list, "[Please select]", "0");
 }
Beispiel #40
0
 /// <summary>
 /// Sets the read only value.
 /// </summary>
 /// <param name="listControl">The list control.</param>
 /// <param name="value">The value.</param>
 public static void SetReadOnlyValue(this ListControl listControl, string value)
 {
     listControl.Items.Clear();
     listControl.Items.Add(value);
 }
 /// <summary>
 /// Help to set value to be selected
 /// </summary>
 /// <param name="list">list control</param>
 /// <param name="text">text</param>
 public static void SelectedListByText(ListControl list, string text)
 {
     list.SelectedIndex = -1;
     list.SelectedIndex = list.Items.IndexOf(list.Items.FindByText(text.ToString()));
 }
Beispiel #42
0
 /// <summary>
 /// Selecteds the value as enum or null.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="listControl">The list control.</param>
 /// <param name="defaultValue">The default value.</param>
 /// <returns></returns>
 public static T?SelectedValueAsEnumOrNull <T>(this ListControl listControl, T?defaultValue = null) where T : struct
 {
     return(listControl.SelectedValue.ConvertToEnumOrNull <T>(defaultValue));
 }
 protected void LoadCategories(ListControl list)
 {
     list.DataSource = CATEGORY.List;
     list.DataBind();
     list.Items.Insert(0, new ListItem("", ""));
 }
        private void CreateControls()
        {
            // выбора максимального кол-ва игроков
            _maxPlayersLabel = new LabelControl
            {
                Bounds = new UniRectangle(-60f, -34f, 100f, 24f),
                Text   = "Max Players"
            };

            // выбор карты
            _tileLabel = new LabelControl
            {
                Bounds = new UniRectangle(60f, -34f, 150f, 24f),
                Text   = "Map"
            };

            _tileList = new ListControl
            {
                Bounds = new UniRectangle(60f, -4f, 150f, 300f)
            };
            _tileList.Items.Add("Empty");
            _tileList.Items.Add("With stones");
            _tileList.SelectionMode = ListSelectionMode.Single;
            _tileList.SelectedItems.Add(0);

            _tileList.Slider.Bounds.Location.X.Offset -= 1.0f;
            _tileList.Slider.Bounds.Location.Y.Offset += 1.0f;
            _tileList.Slider.Bounds.Size.Y.Offset     -= 2.0f;

            // выбор режима игры
            _gameModeLabel = new LabelControl
            {
                Bounds = new UniRectangle(230f, -34f, 150f, 24f),
                Text   = "Mode"
            };

            _maxPlayersList = new ListControl
            {
                Bounds = new UniRectangle(-60f, -4f, 100f, 300f)
            };
            _maxPlayersList.Slider.Bounds.Location.X.Offset -= 1.0f;
            _maxPlayersList.Slider.Bounds.Location.Y.Offset += 1.0f;
            _maxPlayersList.Slider.Bounds.Size.Y.Offset     -= 2.0f;

            for (int i = 1; i < 11; i++)
            {
                _maxPlayersList.Items.Add(i + string.Empty);
            }

            _maxPlayersList.SelectionMode = ListSelectionMode.Single;
            _maxPlayersList.SelectedItems.Add(0);

            _maxPlayers = new LabelControl
            {
                Bounds = new UniRectangle(500f, 50f, 150f, 24f),
            };

            _tile = new LabelControl
            {
                Bounds = new UniRectangle(500f, 80f, 150f, 24f),
            };

            _gameModList = new ListControl
            {
                Bounds = new UniRectangle(230f, -4f, 150f, 300f)
            };

            _gameModList.Items.Add("Simple");
            _gameModList.Items.Add("Real");
            _gameModList.SelectionMode = ListSelectionMode.Single;
            _gameModList.SelectedItems.Add(0);

            _gameModList.Slider.Bounds.Location.X.Offset -= 1.0f;
            _gameModList.Slider.Bounds.Location.Y.Offset += 1.0f;
            _gameModList.Slider.Bounds.Size.Y.Offset     -= 2.0f;

            _gameMode = new LabelControl
            {
                Bounds = new UniRectangle(500f, 110f, 150f, 24f),
            };

            // Create Button
            _createButton = new ButtonControl
            {
                Text   = "Create",
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -200f), new UniScalar(0.4f, 190f), 120, 32)
            };

            // Back Button
            _backButton = new ButtonControl
            {
                Text   = "Back",
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -378f), new UniScalar(0.4f, 190f), 120, 32)
            };
        }
 /// <summary>
 /// Returns the ListItem that has a value matching the Value passed in
 /// via a OrdinalIgnoreCase search.
 /// </summary>
 private ListItem FindItemInListControlByValue(ListControl control, string Value)
 {
     foreach (ListItem li in control.Items)
     {
         if (string.Equals(Value, li.Value, StringComparison.OrdinalIgnoreCase))
             return li;
     }
     return null;
 }
 public void DisplayChildren(ListControl lc, int portalId)
 {
     this.DisplayChildren(lc, portalId, null);
 }
    /// <summary>
    /// Gets where condition based on value of given controls.
    /// </summary>
    /// <param name="where">Where condition</param>
    /// <param name="column">Column to compare</param>
    /// <param name="drpOperator">List control with operator</param>
    /// <param name="valueBox">Text control with value</param>
    /// <returns>Where condition for outdated documents</returns>
    private void AddOutdatedWhereCondition(WhereCondition where, string column, ListControl drpOperator, ITextControl valueBox)
    {
        var value = TextHelper.LimitLength(valueBox.Text, 100);

        if (!String.IsNullOrEmpty(value))
        {
            string condition = drpOperator.SelectedValue;

            // Create condition based on operator
            switch (condition)
            {
                case WhereBuilder.LIKE:
                    where.WhereContains(column, value);
                    break;

                case WhereBuilder.NOT_LIKE:
                    where.WhereNotContains(column, value);
                    break;

                case WhereBuilder.EQUAL:
                    where.WhereEquals(column, value);
                    break;

                case WhereBuilder.NOT_EQUAL:
                    where.WhereNotEquals(column, value);
                    break;
            }
        }
    }
Beispiel #48
0
 /// <summary>
 /// Executes a query and binds it to a ListControl.
 /// </summary>
 /// <param name="listControl">The list control you wish to use. For example a dropdown box.</param>
 /// <param name="sql">Your sql query string</param>
 /// <param name="connectionString">Your database connection string.</param>
 /// <param name="connectionType">The type of database you are using.</param>
 public static void ExecuteAndBind(ListControl listControl, string sql, string connectionString,
                                   DataBaseConnectionType connectionType)
 {
     ExecuteAndBind(listControl, null, null, null, sql, connectionString, connectionType);
 }
Beispiel #49
0
 public virtual GroupSection CreateGroupSection( ListControl listControl, RowIdentifier ri, HeaderSection headerSection, int position, int groupIndentWidth )
 {
     return new GroupSection( listControl, ri, headerSection, position, groupIndentWidth );
 }
Beispiel #50
0
    /// <summary>
    /// Gets where condition based on value of given controls.
    /// </summary>
    /// <param name="column">Column to compare</param>
    /// <param name="drpOperator">List control with operator</param>
    /// <param name="valueBox">Text control with value</param>
    /// <returns>Where condition for outdated documents</returns>
    private static string GetOutdatedWhereCondition(string column, ListControl drpOperator, ITextControl valueBox)
    {
        string condition = drpOperator.SelectedValue;
        string value = SqlHelperClass.GetSafeQueryString(valueBox.Text, false);
        value = TextHelper.LimitLength(value, 100);

        string where = column + " ";
        if (string.IsNullOrEmpty(value))
        {
            where = string.Empty;
        }
        else
        {
            // Create condition based on operator
            switch (condition)
            {
                case "LIKE":
                case "NOT LIKE":
                    where += condition + " N'%" + value + "%'";
                    break;

                case "=":
                case "<>":
                    where += condition + " N'" + value + "'";
                    break;

                default:
                    where = string.Empty;
                    break;
            }
        }
        return where;
    }
Beispiel #51
0
 public virtual OptionsToolbarSection CreateOptionsToolbarSection( ListControl listControl )
 {
     return new ToolStripOptionsToolbarSection( listControl );
 }
 protected void AddListItemToListControl(string text, string value, ListControl listControl)
 {
     ListItem _listItem = new ListItem(text, value);
     listControl.Items.Add(_listItem);
 }
 /// <summary>
 /// Selects item int list control.
 /// </summary>
 /// <param name="itemString">Item</param>
 /// <param name="control">Control</param>
 private void SelectItem(string itemString, ListControl control)
 {
     int item = ValidationHelper.GetInteger(itemString, -1);
     if ((item != -1) && item < control.Items.Count)
     {
         control.Items[item].Selected = true;
     }
 }
 protected void LoadListItems(ListControl list, string category)
 {
     list.DataSource = db.GetListItemTitles(category: category);
     list.DataBind();
     list.Items.Insert(0, new ListItem("", ""));
 }
Beispiel #55
0
 public virtual Section CreateCustomiseListSection( ListControl listControl )
 {
     return new CustomiseListSection( listControl );
 }
    /// <summary>
    /// Gets selected items.
    /// </summary>
    /// <param name="control">Control</param>  
    /// <param name="ids">Id's of selected values separed by semicolon</param>
    private string GetSelectedItems(ListControl control, out string ids)
    {
        ids = "";
        string selected = "";

        // loop thru all items
        for (int i = 0; i != control.Items.Count; i++)
        {
            if (control.Items[i].Selected)
            {
                selected += " " + control.Items[i].Value;
                ids += ValidationHelper.GetString(i, "") + ";";
            }
        }
        return selected;
    }
 protected void LoadBPMGroup(ListControl list)
 {
     list.Items.Clear();
     dalOU.LoadGroups(list);
 }
 private void BuildList(ListControl cbl, IEnumerable<string> tableList)
 {
     cbl.Items.Clear();
     foreach (string s in tableList)
     {
         if (CodeService.ShouldGenerate(s, ddlProviders.SelectedValue))
         {
             ListItem item = new ListItem(s, s);
             cbl.Items.Add(item);
         }
     }
 }
Beispiel #59
0
        /// <summary>
        /// Pulls the data to "current". Used in cases where events aren't possible
        /// </summary>
        public virtual void Pull()
        {
            //if we are not attached to a control (for what ever reason - usually because
            //of "fake" contollery,  we'll fail here unless we bail. If the subject is null
            //we assume this to be the case.
            if (subject == null)
            {
                return;
            }

            //listboxes and comboboxes need a special bit of co-ercing
            if (subject is ListControl)
            {
                ListControl tempLC = (ListControl)subject;

                switch (listControlMapping)
                {
                case ListControlMapping.Text:
                    tempLC.Text = ConversionHelper.ToString(target.CurrentValue, String.Empty);
                    break;

                case ListControlMapping.Index:

                    tempLC.SelectedIndex = ConversionHelper.ToInt32(target.CurrentValue, -1);
                    break;

                case ListControlMapping.Value:
                default:
                    tempLC.SelectedValue = target.CurrentValue;
                    break;
                }
            }
            else if (subject is CheckBox)
            {
                CheckBox tempCB = (CheckBox)subject;
                tempCB.Checked = Convert.ToBoolean(target.CurrentValue);
            }
            else if (subject is NumericUpDown)
            {
                NumericUpDown tempNUD = (NumericUpDown)subject;
                Decimal       temp    = Convert.ToDecimal(target.CurrentValue);

                //handle overflows:
                if (temp > tempNUD.Maximum)
                {
                    tempNUD.Value = tempNUD.Maximum;
                }
                else if (temp < tempNUD.Minimum)
                {
                    tempNUD.Value = tempNUD.Minimum;
                }
                else
                {
                    tempNUD.Value = Convert.ToDecimal(target.CurrentValue);
                }
            }
            else if (subject is NullableDateTimePicker)
            {
                NullableDateTimePicker tempDTP = (NullableDateTimePicker)subject;
                try
                {
                    if (target.CurrentValue == null)
                    {
                        tempDTP.Value      = tempDTP.NullDate;
                        tempDTP.DateIsNull = true;
                    }
                    else
                    {
                        tempDTP.Value = Convert.ToDateTime(target.CurrentValue);
                    }
                }
                catch
                {
                    tempDTP.Value = tempDTP.NullDate;
                }
            }
            else if (subject is DateTimePicker)
            {
                DateTimePicker tempDTP = (DateTimePicker)subject;
                try
                {
                    tempDTP.Value = Convert.ToDateTime(target.CurrentValue);
                }
                catch
                {
                    tempDTP.Text = String.Empty; //set null date
                }
            }
            else
            {
                subject.Text = Convert.ToString(target.CurrentValue); //subject.TextChanged += new EventHandler(subject_TextChanged); //default
            }
        }