当前位置: 首页>>代码示例>>C#>>正文


C# IOrderedDictionary.Add方法代码示例

本文整理汇总了C#中IOrderedDictionary.Add方法的典型用法代码示例。如果您正苦于以下问题:C# IOrderedDictionary.Add方法的具体用法?C# IOrderedDictionary.Add怎么用?C# IOrderedDictionary.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOrderedDictionary的用法示例。


在下文中一共展示了IOrderedDictionary.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExtractValuesFromCell

 public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
 {
     Control control = null;
     string dataField = this.DataField;
     object obj2 = null;
     if (cell.Controls.Count > 0)
     {
         control = cell.Controls[0];
         CheckBox box = control as CheckBox;
         if ((box != null) && (includeReadOnly || box.Enabled))
         {
             obj2 = box.Checked;
         }
     }
     if (obj2 != null)
     {
         if (dictionary.Contains(dataField))
         {
             dictionary[dataField] = obj2;
         }
         else
         {
             dictionary.Add(dataField, obj2);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:CheckBoxField.cs

示例2: CopyTo

		public static void CopyTo (this IOrderedDictionary from, IOrderedDictionary to)
		{
			if (to == null || from.Count == 0)
				return;

			foreach (DictionaryEntry de in from)
				to.Add (de.Key, de.Value);
		}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:HelperExtensions.cs

示例3: LoadViewState

        public static void LoadViewState(IOrderedDictionary dictionary, ArrayList state) {
            if (dictionary == null) {
                throw new ArgumentNullException("dictionary");
            }
            if (state == null) {
                throw new ArgumentNullException("state");
            }

            if (state != null) {
                for (int i = 0; i < state.Count; i++) {
                    Pair pairEntry = (Pair)state[i];
                    dictionary.Add(pairEntry.First, pairEntry.Second);
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:OrderedDictionaryStateHelper.cs

示例4: ExtractValuesFromCell

 public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
 {
     Control control = null;
     string dataImageUrlField = this.DataImageUrlField;
     object imageUrl = null;
     bool flag = false;
     if ((((rowState & DataControlRowState.Insert) == DataControlRowState.Normal) || this.InsertVisible) && (cell.Controls.Count != 0))
     {
         control = cell.Controls[0];
         Image image = control as Image;
         if (image != null)
         {
             if (includeReadOnly)
             {
                 flag = true;
                 if (image.Visible)
                 {
                     imageUrl = image.ImageUrl;
                 }
             }
         }
         else
         {
             TextBox box = control as TextBox;
             if (box != null)
             {
                 imageUrl = box.Text;
                 flag = true;
             }
         }
         if ((imageUrl != null) || flag)
         {
             if ((this.ConvertEmptyStringToNull && (imageUrl is string)) && (((string) imageUrl).Length == 0))
             {
                 imageUrl = null;
             }
             if (dictionary.Contains(dataImageUrlField))
             {
                 dictionary[dataImageUrlField] = imageUrl;
             }
             else
             {
                 dictionary.Add(dataImageUrlField, imageUrl);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:47,代码来源:ImageField.cs

示例5: ExtractValuesFromCell

 public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
 {
     if (cell.Controls.Count > 0)
     {
         DropDownList ddl = cell.Controls[0] as DropDownList;
         if (null == ddl)
         {
             throw new InvalidOperationException("DropDownField could not extract control.");
         }
         object selectedValue = ddl.SelectedValue;
         if (dictionary.Contains(this.DataField))
         {
             dictionary[this.DataField] = selectedValue;
         }
         else
         {
             dictionary.Add(this.DataField, selectedValue);
         }
     }
 }
开发者ID:t1b1c,项目名称:lwas,代码行数:20,代码来源:DropDownListField.cs

示例6: ExtractValuesFromCell

        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            string format = this.DataFormatString;

            object val = null;
            try
            {
                Decimal d = Decimal.Parse(cell.Text, CultureInfo.CurrentCulture);
                val = d;
            }
            catch (Exception ex)
            { }

            string dataField = this.DataField;
            if (dictionary.Contains(dataField))
                dictionary[dataField] = val;
            else
            {
                dictionary.Add(dataField, val);
            }
        }
开发者ID:t1b1c,项目名称:lwas,代码行数:21,代码来源:NumberBoundField.cs

示例7: ExtractValuesFromCell

        /// <summary>
        /// This method is called by the ExtractRowValues methods of 
        /// GridView and DetailsView. Retrieve the current value of the 
        /// cell from the Checked state of the Radio button.
        /// </summary>
        /// <param name="dictionary"></param>
        /// <param name="cell"></param>
        /// <param name="rowState"></param>
        /// <param name="includeReadOnly"></param>
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            // Determine whether the cell contains a RadioButtonList
            // in its Controls collection.
            if (cell.Controls.Count > 0)
            {
                object radio = cell.Controls[0];

                object checkedValue = null;
                if (radio is RadioButton || radio is RadioButtonList)
                {
                    if (radio is RadioButton)
                    {
                        checkedValue = ((RadioButton)radio).Checked;
                    }
                    else if (radio is RadioButtonList)
                    {
                        checkedValue = ((RadioButtonList)radio).SelectedValue;
                    }
                }
                else
                {
                    // A RadioButton is expected, but a null is encountered.
                    throw new InvalidOperationException("BoundRadioButtonField could not extract control.");
                }

                // Add the value of the Checked attribute of the
                // RadioButton to the dictionary.
                if (dictionary.Contains(DataField))
                {
                    dictionary[DataField] = checkedValue;
                }
                else
                {
                    dictionary.Add(DataField, checkedValue);
                }
            }
        }
开发者ID:mario-loza,项目名称:School,代码行数:47,代码来源:BoundRadioButtonField.cs

示例8: ExtractValuesFromCell

        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            string format = this.DataFormatString;
            if (string.IsNullOrEmpty(format))
                format = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;

            object val = null;
            try
            {
                DateTime dt = DateTime.ParseExact(cell.Text, format, CultureInfo.CurrentCulture);
                val = dt;
            }
            catch (Exception ex)
            { }

            string dataField = this.DataField;
            if (dictionary.Contains(dataField))
                dictionary[dataField] = val;
            else
            {
                dictionary.Add(dataField, val);
            }
        }
开发者ID:t1b1c,项目名称:lwas,代码行数:23,代码来源:DateBoundField.cs

示例9: SetValues

		/// <summary>
		/// Adds elements to the collection having the specified names and values.
		/// </summary>
		/// <param name="list">A collection of name/value pairs.</param>
		/// <param name="names">The property names.</param>
		/// <param name="values">The property values.</param>
		public static void SetValues(IOrderedDictionary list, String[] names, Object[] values)
		{
			for ( int i = 0; i < names.Length; i++ )
			{
				if ( list.Contains(names[i]) )
				{
					list.Remove(names[i]);
				}

				list.Add(names[i], values[i]);
			}
		}
开发者ID:pratik1988,项目名称:VedicKart,代码行数:18,代码来源:FormUtilBase.generated.cs

示例10: BindControl

		/// <summary>
      /// Binds a controls value to a property of an entity.
      /// </summary>
      /// <param name="control">The control to get the value from.</param>
      /// <param name="list">The <see cref="IOrderedDictionary"/> containing the values.</param>
      /// <param name="propertyName">The name of the property to bind the value to.</param>
      public static void BindControl(Control control, IOrderedDictionary list, String propertyName)
      {
         if (control != null)
         {
            if (list.Contains(propertyName))
            {
               list.Remove(propertyName);
            }

            list.Add(propertyName, GetValue(control));
         }
      }
开发者ID:pratik1988,项目名称:VedicKart,代码行数:18,代码来源:FormUtilBase.generated.cs

示例11: ExtractValuesFromCell

        /// <devdoc>
        /// Extracts the value(s) from the given cell and puts the value(s) into a dictionary.  Indicate includeReadOnly
        /// to have readonly fields' values inserted into the dictionary.
        /// </devdoc>
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly) {
            Control childControl = null;
            string dataField = DataField;
            object value = null;
            string nullDisplayText = NullDisplayText;

            if (((rowState & DataControlRowState.Insert) != 0) && !InsertVisible) {
                return;
            }

            if (cell.Controls.Count > 0) {
                childControl = cell.Controls[0];

                TextBox editBox = childControl as TextBox;
                if (editBox != null) {
                    value = editBox.Text;
                }
            }
            else {
                if (includeReadOnly == true) {
                    string cellText = cell.Text;
                    if (cellText == "&nbsp;") { // nothing HtmlEncodes to &nbsp;, so we know that this means it was empty.
                        value = String.Empty;
                    }
                    else {
                        if (SupportsHtmlEncode && HtmlEncode) {
                            value = HttpUtility.HtmlDecode(cellText);
                        }
                        else {
                            value = cellText;
                        }
                    }
                }
            }

            if (value != null) {
                if ((value is string) && (((string)value).Length == 0) && ConvertEmptyStringToNull) {
                    value = null;
                }

                if (value is string && (string)value == nullDisplayText && nullDisplayText.Length > 0) {
                    value = null;
                }

                if (dictionary.Contains(dataField)) {
                    dictionary[dataField] = value;
                }
                else {
                    dictionary.Add(dataField, value);
                }
            }

        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:57,代码来源:BoundField.cs

示例12: SetFormViewParameters

    public static void SetFormViewParameters(IOrderedDictionary parameters, object instance)
    {
        Type ObjType = instance.GetType();
        foreach (DictionaryEntry parameter in parameters)
        {
            PropertyInfo property = ObjType.GetProperty(parameter.Key.ToString());
            if (property != null)
            {
                Type t = property.PropertyType;
                object value = null;
                     switch (t.Name)
                {
                    case "Decimal":
                        if (!string.IsNullOrEmpty(parameter.Value.ToString()))
                            value = Convert.ToDecimal(parameter.Value);
                        else
                            value = Convert.ToDecimal(0.0);
                        break;
                    case "Boolean":
                        value = Convert.ToBoolean(parameter.Value);
                        break;
                    case "DateTime":
                        String DateTimeFormat = "dd/MM/yyyy";
                        DateTimeFormatInfo info = new DateTimeFormatInfo();
                        info.ShortDatePattern = DateTimeFormat;
                        String date = Convert.ToString(parameter.Value);
                        if (!String.IsNullOrEmpty(date) || date == "null")
                            value = Convert.ToDateTime(date,info);
                        break;
                    case "Double":
                        if (!string.IsNullOrEmpty(parameter.Value.ToString()))
                            value = Convert.ToDouble(parameter.Value);
                        else
                            value = 0.0;
                        break;
                    case "Int32":
                        value = Convert.ToInt32(parameter.Value);
                        break;
                    case "Single":
                        value = Convert.ToSingle(parameter.Value);
                        break;
                    case "String":
                        value = Convert.ToString(parameter.Value);
                        break;
                    case "Guid":
                        if (!string.IsNullOrEmpty(parameter.Value.ToString()))
                            value = new Guid("11111111111111111111111111111111");
                        break;
                    default:
                        break;
                }

                property.SetValue(instance, value, null);

            }
        }
        parameters.Clear();
        parameters.Add("Values", instance);
    }
开发者ID:Siddhartha261,项目名称:IGRSS,代码行数:59,代码来源:Global.asax.cs

示例13: ExtractValuesFromCell

        /// <devdoc>
        /// Extracts the value(s) from the given cell and puts the value(s) into a dictionary.  Indicate includeReadOnly
        /// to have readonly fields' values inserted into the dictionary.
        /// </devdoc>
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly) {
            Control childControl = null;
            string dataField = DataField;
            object value = null;

            if (cell.Controls.Count > 0) {
                childControl = cell.Controls[0];

                CheckBox checkBox = childControl as CheckBox;
                if (checkBox != null) {
                    if (includeReadOnly || checkBox.Enabled) {
                        value = checkBox.Checked;
                    }
                }
            }

            if (value != null) {
                if (dictionary.Contains(dataField)) {
                    dictionary[dataField] = value;
                }
                else {
                    dictionary.Add(dataField, value);
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:29,代码来源:CheckBoxField.cs

示例14: ExtractValuesFromCell

        /// <devdoc>
        /// Extracts the value(s) from the given cell and puts the value(s) into a dictionary.  Indicate includeReadOnly
        /// to have readonly fields' values inserted into the dictionary.
        /// </devdoc>
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly) {
            Control childControl = null;
            string dataField = DataImageUrlField;
            object value = null;
            bool includeNullValue = false;

            if (((rowState & DataControlRowState.Insert) != 0) && !InsertVisible) {
                return;
            }

            if (cell.Controls.Count == 0) { // this should happen only in design mode
                Debug.Assert(DesignMode, "Unless you're in designmode, there should be a control in the cell.");
                return;
            }

            childControl = cell.Controls[0];
            
            Image image = childControl as Image;
            if (image != null) {
                if (includeReadOnly) {
                    includeNullValue = true;
                    if (image.Visible) {
                        value = image.ImageUrl;
                    }
                }
            }
            else {
                TextBox editBox = childControl as TextBox;
                if (editBox != null) {
                    value = editBox.Text;
                    includeNullValue = true;    // just in case someone wrote a derived textbox that returns null for Text.
                }
            }

            if (value != null || includeNullValue) {
                if (ConvertEmptyStringToNull && value is string && ((string)value).Length == 0) {
                    value = null;
                }

                if (dictionary.Contains(dataField)) {
                    dictionary[dataField] = value;
                }
                else {
                    dictionary.Add(dataField, value);
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:51,代码来源:ImageField.cs

示例15: ExtractValuesFromCell

 public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
 {
     Control control = null;
     string dataField = this.DataField;
     object text = null;
     string nullDisplayText = this.NullDisplayText;
     if (((rowState & DataControlRowState.Insert) == DataControlRowState.Normal) || this.InsertVisible)
     {
         if (cell.Controls.Count > 0)
         {
             control = cell.Controls[0];
             TextBox box = control as TextBox;
             if (box != null)
             {
                 text = box.Text;
             }
         }
         else if (includeReadOnly)
         {
             string s = cell.Text;
             if (s == "&nbsp;")
             {
                 text = string.Empty;
             }
             else if (this.SupportsHtmlEncode && this.HtmlEncode)
             {
                 text = HttpUtility.HtmlDecode(s);
             }
             else
             {
                 text = s;
             }
         }
         if (text != null)
         {
             if (((text is string) && (((string) text).Length == 0)) && this.ConvertEmptyStringToNull)
             {
                 text = null;
             }
             if (((text is string) && (((string) text) == nullDisplayText)) && (nullDisplayText.Length > 0))
             {
                 text = null;
             }
             if (dictionary.Contains(dataField))
             {
                 dictionary[dataField] = text;
             }
             else
             {
                 dictionary.Add(dataField, text);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:54,代码来源:BoundField.cs


注:本文中的IOrderedDictionary.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。