本文整理汇总了C#中IOrderedDictionary.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# IOrderedDictionary.Contains方法的具体用法?C# IOrderedDictionary.Contains怎么用?C# IOrderedDictionary.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOrderedDictionary
的用法示例。
在下文中一共展示了IOrderedDictionary.Contains方法的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);
}
}
}
示例2: 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 == " ")
{
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);
}
}
}
}
示例3: 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));
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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]);
}
}
示例10: GetObjectMethod
MethodInfo GetObjectMethod (string methodName, IOrderedDictionary parameters, DataObjectMethodType methodType)
{
MemberInfo[] methods = ObjectType.GetMember (methodName, MemberTypes.Method, BindingFlags.Instance |
BindingFlags.Static |
BindingFlags.Public |
BindingFlags.IgnoreCase |
BindingFlags.FlattenHierarchy);
if (methods.Length > 1) {
// MSDN: The ObjectDataSource resolves method overloads by method name and number
// of parameters; the names and types of the parameters are not considered.
// LAMESPEC: the tests show otherwise
DataObjectMethodAttribute methodAttribute = null;
MethodInfo methodInfo = null;
bool hasConflict = false;
foreach (MethodInfo me in methods) { // we look for methods only
ParameterInfo [] pinfos = me.GetParameters ();
if (pinfos.Length == parameters.Count) {
object [] attrs = me.GetCustomAttributes (typeof (DataObjectMethodAttribute), true);
DataObjectMethodAttribute domAttr = (attrs != null && attrs.Length > 0) ? (DataObjectMethodAttribute) attrs [0] : null;
if (domAttr != null && domAttr.MethodType != methodType)
continue;
bool paramsMatch = true;
foreach (ParameterInfo pinfo in pinfos) {
if (!parameters.Contains (pinfo.Name)) {
paramsMatch = false;
break;
}
}
if (!paramsMatch)
continue;
if (domAttr != null) {
if (methodAttribute != null) {
if (methodAttribute.IsDefault) {
if (domAttr.IsDefault) {
methodInfo = null;
break; //fail due to a conflict
}
else
continue; //existing matches better
}
else {
methodInfo = null; //we override
hasConflict = !domAttr.IsDefault;
}
}
else
methodInfo = null; //we override
}
if (methodInfo == null) {
methodAttribute = domAttr;
methodInfo = me;
continue;
}
hasConflict = true;
}
}
if (!hasConflict && methodInfo != null)
return methodInfo;
}
else if (methods.Length == 1) {
MethodInfo me = methods[0] as MethodInfo;
if (me != null && me.GetParameters().Length == parameters.Count)
return me;
}
throw CreateMethodException (methodName, parameters);
}
示例11: GetParameterArray
object[] GetParameterArray (ParameterInfo[] methodParams, IOrderedDictionary viewParams, out ArrayList outParamInfos)
{
// FIXME: make this case insensitive
outParamInfos = null;
object[] values = new object [methodParams.Length];
foreach (ParameterInfo mp in methodParams) {
// Parameter names must match
if (!viewParams.Contains (mp.Name)) return null;
values [mp.Position] = ConvertParameter (mp.ParameterType, viewParams [mp.Name]);
if (mp.ParameterType.IsByRef) {
if (outParamInfos == null) outParamInfos = new ArrayList ();
outParamInfos.Add (mp);
}
}
return values;
}
示例12: 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 == " ") { // nothing HtmlEncodes to , 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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例15: Update
public bool Update(IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
{
IDao<Item, string> dao = DaoFactory.GetDao<Item, string>();
Item item = dao.GetById(keys[0].ToString(), true);
if (item == null) return false;
if (newValues.Contains("Forhtf")) item.Forhtf = Convert.ToBoolean(newValues["Forhtf"].ToString());
if (newValues.Contains("Fordnf")) item.Fordnf = Convert.ToBoolean(newValues["Fordnf"].ToString());
if (newValues.Contains("Colorcode")) item.Colorcode = (newValues["Colorcode"].ToString());
if (newValues.Contains("Colorname")) item.Colorcode = (newValues["Colorname"].ToString());
if (newValues.Contains("Id")) item.Colorcode = (newValues["Id"].ToString());
if (newValues.Contains("Itemname")) item.Itemname = (newValues["Itemname"].ToString());
//if (newValues.Contains("Areacode")) item.Areacode = (newValues["Areacode"].ToString());
try
{
return (dao.SaveOrUpdate(item) != null);
}
catch { return false; }
}