protected override void ExtractValues(IOrderedDictionary dictionary)
        {
            if (FileUploadEdit.HasFile)
            {
                var fileName = Guid.NewGuid() + Path.GetExtension(FileUploadEdit.FileName);

                // try to upload the file showing error if it fails
                try
                {
                    Global.UploadFile(FileUploadEdit.FileBytes, fileName);

                    image_name.Value = fileName;
                    ImageEdit.ImageUrl = Global.Context.FileStorageUrl + fileName;
                }
                catch (Exception ex)
                {
                    // display error
                    CustomValidator1.IsValid = false;
                    CustomValidator1.ErrorMessage = ex.Message;
                    image_name.Value = null;
                }
            }

            dictionary[Column.Name] = image_name.Value;
        }
 protected override void ExtractValues(IOrderedDictionary dictionary) {
     if (_valueExtrator != null) {
         object value = _valueExtrator();
         string stringValue = value as string;
         dictionary[Column.Name] = (stringValue != null ? ConvertEditedValue(stringValue) : value);
     }
 }
		/// <summary>
		/// Parses the parameters passed to the constructor.
		/// </summary>
		/// <param name="fields">The object[] passed to the constructor.</param>
		/// <exception cref="ArgumentException">Either the length of the params argument is odd, each pair of objects within the params argument do not each comprise a valid <see cref="KeyValuePair{SortBy,SortOrder}"/>, or there is a duplicate <see cref="SortBy"/> key within the params argument.</exception>
		private void ParseParams(ref object[] fields)
		{
			var orderedDictionary = new OrderedDictionary();
			
			// Must have an even number of items in the array.
			if (fields.Length % 2 != 0)
			{
				throw new ArgumentException("There must be an even number of items in the array.");
			}
			else
			{
				for (int i = 0; i < fields.Length/2; i++)
				{
					if (fields[i*2] is SortBy && fields[i*2 + 1] is SortOrder)
					{
						orderedDictionary.Add((SortBy)fields[i * 2], (SortOrder)fields[i * 2 + 1]);
					}
					else
					{
						throw new ArgumentException(
							"Each pair of items added to the object array must be a pairing of SortBy then SortOrder.");
					}
				}
			}

			OrderedDictionary = orderedDictionary;
		}
		internal GridViewUpdatedEventArgs (int affectedRows, Exception e, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
		: this (affectedRows, e)
		{
			this.keys = keys;
			this.newValues = newValues;
			this.oldValues = oldValues;
		}
 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);
         }
     }
 }
		public DataEventArgs(Int32 pageSize, Int32 startRowIndex, String sortExpression, IOrderedDictionary parameters)
		{
			this.PageSize = pageSize;
			this.StartRowIndex = startRowIndex;
			this.SortExpression = sortExpression;
			this.Parameters = parameters;
		}
示例#7
0
		internal DetailsViewUpdateEventArgs (object argument, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
		{
			this.argument = argument;
			this.keys = keys;
			this.newValues = newValues;
			this.oldValues = oldValues;
		}
		internal GridViewUpdateEventArgs (int rowIndex, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
		{
			this.rowIndex = rowIndex;
			this.keys = keys;
			this.newValues = newValues;
			this.oldValues = oldValues;
		}
		internal FormViewUpdateEventArgs (object argument, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
		: this (argument)
		{
			this.keys = keys;
			this.oldValues = oldValues;
			this.newValues = newValues;
		}
 protected override void ExtractValues(IOrderedDictionary dictionary) {
     string value = DropDownList1.SelectedValue;
     if (value == String.Empty) {
         value = null;
     }
     dictionary[Column.Name] = ConvertEditedValue(value);
 }
示例#11
0
    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);
    }
示例#12
0
 /// <summary>
 /// Binds a controls value to a property of an entity.
 /// </summary>
 /// <param name="formView">A <see cref="FormView"/> object.</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>
 /// <param name="controlId">The id of the control to get the value from.</param>
 public static void BindControl(FormView formView, IOrderedDictionary list, string propertyName, string controlId)
 {
     if (formView != null)
      {
     Control control = formView.FindControl(controlId);
     BindControl(control, list, propertyName);
      }
 }
        protected override void ExtractValues(IOrderedDictionary dictionary) {
            // If it's an empty string, change it to null
            string val = DropDownList1.SelectedValue;
            if (val == String.Empty)
                val = null;

            ExtractForeignKey(dictionary, val);
        }
示例#14
0
		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);
		}
示例#15
0
 public DataItemKey(IOrderedDictionary values) :
     this()
 {
     foreach (string k in values.Keys)
     {
         Values.Add(k, values[k]);
     }
 }
示例#16
0
     protected override void ExtractValues(IOrderedDictionary dictionary) {
         // If it's an empty string, change it to null
         string value = DropDownList1.SelectedValue;
         if (String.IsNullOrEmpty(value)) {
             value = null;
         }
 
         ExtractForeignKey(dictionary, value);
     }
        protected override void ExtractValues( IOrderedDictionary dictionary )
        {
            // If it's an empty string, change it to null
            string val = FolderIDHidden.Value;
            if( val == String.Empty )
                val = null;

            ExtractForeignKey( dictionary, val );
        }
        protected override void ExtractValues(IOrderedDictionary dictionary)
        {
            // S'il s'agit d'une chaîne vide, la changer en valeur null
            string val = DropDownList1.SelectedValue;
            if (val == String.Empty)
                val = null;

            ExtractForeignKey(dictionary, val);
        }
示例#19
0
 public void ExtractValues()
 {
     if (Values == null)
         Values = new OrderedDictionary();
     ExtractValues(Values, this);
     if (Template is IBindableTemplate)
         foreach (DictionaryEntry entry in ((IBindableTemplate)Template).ExtractValues(this))
             Values[entry.Key] = entry.Value;
 }
    protected override void ExtractValues(IOrderedDictionary dictionary) {
        // Es una cadena vacía, cámbiela a NULL
        string value = DropDownList1.SelectedValue;
        if (String.IsNullOrEmpty(value)) {
            value = null;
        }

        ExtractForeignKey(dictionary, value);
    }
 protected override void ExtractValues(IOrderedDictionary dictionary)
 {
     // If it's an empty string, change it to null
     var value = DropDownList1.SelectedValue;
     if (String.IsNullOrEmpty(value))
     {
         value = null;
     }
     dictionary[Column.Name] = ConvertEditedValue(value);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="dictionary"></param>
 /// <param name="container"></param>
 public static void ExtractValuesFromBindableControls(IOrderedDictionary dictionary, Control container)
 {
     IBindableControl control = container as IBindableControl;
     if (control != null)
          control.ExtractValues(dictionary);
     foreach (Control control2 in container.Controls)
     {
         ExtractValuesFromBindableControls(dictionary, control2);
     }
 }
示例#23
0
        protected override void ExtractValues(IOrderedDictionary dictionary)
        {
            // S'il s'agit d'une chaîne vide, la changer en valeur null
            string value = DropDownList1.SelectedValue;
            if (String.IsNullOrEmpty(value))
            {
                value = null;
            }

            ExtractForeignKey(dictionary, value);
        }
 protected override void ExtractValues(IOrderedDictionary dictionary)
 {
     if( DropDownList1.SelectedValue != "" )
     {
         dictionary[ Column.Name ] = Enum.Parse( Column.ColumnType, DropDownList1.SelectedValue );
     }
     else
     {
         dictionary[ Column.Name ] = null;
     }
 }
示例#25
0
 protected override void ExtractValues(IOrderedDictionary dictionary)
 {
     if( _keepPasswordBox.Checked )
     {
         dictionary[ Column.Name ] = CurrentPassword;
     }
     else
     {
         dictionary[ Column.Name ] = ConvertEditedValue( _passwordBox.Text.GetMD5Hash() );
     }
 }
 public LinqDataSourceSelectEventArgs(DataSourceSelectArguments arguments,
         IDictionary<string, object> whereParameters, IOrderedDictionary orderByParameters,
         IDictionary<string, object> groupByParameters, IDictionary<string, object> orderGroupsByParameters,
         IDictionary<string, object> selectParameters) {
     _arguments = arguments;
     _groupByParameters = groupByParameters;
     _orderByParameters = orderByParameters;
     _orderGroupsByParameters = orderGroupsByParameters;
     _selectParameters = selectParameters;
     _whereParameters = whereParameters;
 }
        protected override void ExtractValues(IOrderedDictionary dictionary)
        {
            // Если это пустая строка, измените ее на null
            string value = DropDownList1.SelectedValue;
            if (String.IsNullOrEmpty(value))
            {
                value = null;
            }

            ExtractForeignKey(dictionary, value);
        }
 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);
             }
         }
     }
 }
        public static ArrayList SaveViewState(IOrderedDictionary dictionary) {
            if (dictionary == null) {
                throw new ArgumentNullException("dictionary");
            }

            ArrayList list = new ArrayList(dictionary.Count);
            foreach (DictionaryEntry entry in dictionary) {
                list.Add(new Pair(entry.Key, entry.Value));
            }
            return list;
        }
示例#30
0
        /// <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));
             }
        }
示例#31
0
 protected virtual void ExtractValues(IOrderedDictionary dictionary)
 {
     throw new NotImplementedException();
 }
示例#32
0
 public OrderedDictionaryDebugView(IOrderedDictionary dict)
 {
     _dict = dict;
 }
示例#33
0
        public void SetDatabaseContext(DbCommand cmd, HttpContext context, Control ctl)
        {
            if (!_parametersChanged)
            {
                // 1) Do nothing if the parameters have not changed because we have already set the context.
                // 2) If Enable property is false then too do nothing
                return;
            }
            StringBuilder sb = new StringBuilder();

            sb.Append("BEGIN ");
            bool bCode = PrepareApplicationContext(cmd, sb);

            if (this.ContextParameters != null && this._contextParameters.Count > 0 && this.EnableSysContext)
            {
                if (string.IsNullOrEmpty(this.ContextPackageName))
                {
                    throw new HttpException("If ContextParameters are supplied, CustomContextPackage must be specified as well");
                }
                //OracleParameter param;
                if (_uniqueId == Guid.Empty)
                {
                    _uniqueId = Guid.NewGuid();
                    sb.Append("DBMS_SESSION.SET_IDENTIFIER(client_id => :client_id); ");
                    bCode = true;
                }
                DbParameter param = cmd.CreateParameter();
                param.ParameterName = "client_id";
                param.Value         = _uniqueId.ToString();
                param.DbType        = DbType.String;
                cmd.Parameters.Add(param);
                IOrderedDictionary values = this.ContextParameters.GetValues(context, ctl);
                foreach (Parameter parameter in this.ContextParameters)
                {
                    // ConvertEmptyStringToNull true implies that null value will be set. false implies that null value will
                    // not be set.
                    string strValue = string.Format("{0}", values[parameter.Name]);
                    if (!string.IsNullOrEmpty(strValue) || parameter.ConvertEmptyStringToNull)
                    {
                        sb.Append(this.ContextPackageName);
                        sb.Append(".");
                        sb.AppendFormat(this.ProcedureFormatString, parameter.Name);
                        sb.Append("; ");
                        param = cmd.CreateParameter();
                        param.ParameterName = parameter.Name;
                        param.Value         = string.IsNullOrEmpty(strValue) ? DBNull.Value : (object)strValue;
                        param.DbType        = parameter.GetDatabaseType();
                        cmd.Parameters.Add(param);
                        bCode = true;
                    }
                }
                _parametersChanged = false;
            }

            if (bCode)
            {
                sb.Append("END;");
                cmd.CommandText = sb.ToString();
                cmd.CommandType = CommandType.Text;
                QueryLogging.TraceOracleCommand(context.Trace, cmd);
                cmd.ExecuteNonQuery();
            }
        }
示例#34
0
 public ClipboardDataModel(IOrderedDictionary <string, MemoryStream> clipboardData)
 {
     ClipboardData = clipboardData;
 }
 protected override void ExtractValues(IOrderedDictionary dictionary)
 {
     dictionary[Column.Name] = ddlComparePattern.SelectedValue;
 }
示例#36
0
 /// <summary>
 /// Implementation of IBindableControl.ExtractValues
 /// </summary>
 /// <param name="dictionary">The dictionary that contains all the new values</param>
 protected virtual void ExtractValues(IOrderedDictionary dictionary)
 {
     // To nothing in the base class.  Derived field templates decide what they want to save
 }
 private static SupportBean LessThanOrEqualToFirstEvent(
     IOrderedDictionary <int, IList <SupportBean> > treemap,
     int key)
 {
     return(treemap.LessThanOrEqualTo(key)?.Value.First());
 }
示例#38
0
 internal void SetValues(IOrderedDictionary values)
 {
     _values = values;
 }
示例#39
0
 internal void SetKeys(IOrderedDictionary keys)
 {
     _keys = keys;
 }
示例#40
0
 protected override void ExtractValues(IOrderedDictionary dictionary)
 {
     dictionary[Column.Name] = CheckBox1.Checked;
 }
示例#41
0
 internal GridViewUpdateEventArgs(int rowIndex, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
 {
     this.rowIndex  = rowIndex;
     this.keys      = keys;
     this.newValues = newValues;
     this.oldValues = oldValues;
 }
示例#42
0
 protected override void ExtractValues(IOrderedDictionary dictionary)
 {
     dictionary[Column.Name] = ConvertEditedValue(cmbUsers.SelectedValue);
 }
示例#43
0
 public ObjectDataSourceSelectingEventArgs(IOrderedDictionary inputParameters, DataSourceSelectArguments arguments, bool executeSelectCount) : base(inputParameters)
 {
     this.executeSelectCount = executeSelectCount;
     this.arguments          = arguments;
 }
 public ObjectDataSourceFilteringEventArgs(IOrderedDictionary parameterValues)
 {
     this.parameters = parameterValues;
 }
示例#45
0
 protected override void ExtractValues(IOrderedDictionary dictionary)
 {
     dictionary[Column.Name] = DatePicker1.Date;
 }
 internal DetailsViewUpdatedEventArgs(int affectedRows, Exception e, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues)
     : this(affectedRows, e)
 {
     this.keys      = keys;
     this.newValues = newValues;
     this.oldValues = oldValues;
 }
 internal GridViewDeleteEventArgs(int index, IOrderedDictionary keys, IOrderedDictionary values)
 {
     this.rowIndex = index;
     this.keys     = keys;
     this.values   = values;
 }
示例#48
0
 internal FormViewDeleteEventArgs(int index, IOrderedDictionary keys, IOrderedDictionary values)
     : this(index)
 {
     this.keys   = keys;
     this.values = values;
 }
示例#49
0
 public LinqDataSourceSelectEventArgs(DataSourceSelectArguments arguments,
                                      IDictionary <string, object> whereParameters, IOrderedDictionary orderByParameters,
                                      IDictionary <string, object> groupByParameters, IDictionary <string, object> orderGroupsByParameters,
                                      IDictionary <string, object> selectParameters)
 {
     _arguments               = arguments;
     _groupByParameters       = groupByParameters;
     _orderByParameters       = orderByParameters;
     _orderGroupsByParameters = orderGroupsByParameters;
     _selectParameters        = selectParameters;
     _whereParameters         = whereParameters;
 }
 internal void SetNewValues(IOrderedDictionary newValues)
 {
     this._values = newValues;
 }
示例#51
0
 public DataKey(IOrderedDictionary keyTable, string[] keyNames)
 {
     this.keyTable = keyTable;
     this.keyNames = keyNames;
 }
 internal void SetOldValues(IOrderedDictionary oldValues)
 {
     this._oldValues = oldValues;
 }
示例#53
0
        protected internal override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            if (SortParameterName.Length > 0 && SelectCommandType == SqlDataSourceCommandType.Text)
            {
                throw new NotSupportedException("The SortParameterName property is only supported with stored procedure commands in SqlDataSource");
            }

            if (arguments.SortExpression.Length > 0 && owner.DataSourceMode == SqlDataSourceMode.DataReader)
            {
                throw new NotSupportedException("SqlDataSource cannot sort. Set DataSourceMode to DataSet to enable sorting.");
            }

            if (arguments.StartRowIndex > 0 || arguments.MaximumRows > 0)
            {
                throw new NotSupportedException("SqlDataSource does not have paging enabled. Set the DataSourceMode to DataSet to enable paging.");
            }

            if (FilterExpression.Length > 0 && owner.DataSourceMode == SqlDataSourceMode.DataReader)
            {
                throw new NotSupportedException("SqlDataSource only supports filtering when the data source's DataSourceMode is set to DataSet.");
            }

            InitConnection();

            DbCommand command = factory.CreateCommand();

            command.CommandText = SelectCommand;
            command.Connection  = connection;
            if (SelectCommandType == SqlDataSourceCommandType.Text)
            {
                command.CommandType = CommandType.Text;
            }
            else
            {
                command.CommandType = CommandType.StoredProcedure;
                if (SortParameterName.Length > 0 && arguments.SortExpression.Length > 0)
                {
                    command.Parameters.Add(CreateDbParameter(SortParameterName, arguments.SortExpression));
                }
            }

            if (SelectParameters.Count > 0)
            {
                InitializeParameters(command, SelectParameters, null, null, false);
            }

            Exception exception = null;

            if (owner.DataSourceMode == SqlDataSourceMode.DataSet)
            {
                DataView dataView = null;

                if (owner.EnableCaching)
                {
                    dataView = (DataView)owner.Cache.GetCachedObject(SelectCommand, SelectParameters);
                }

                if (dataView == null)
                {
                    SqlDataSourceSelectingEventArgs selectingArgs = new SqlDataSourceSelectingEventArgs(command, arguments);
                    OnSelecting(selectingArgs);
                    if (selectingArgs.Cancel || !PrepareNullParameters(command, CancelSelectOnNullParameter))
                    {
                        return(null);
                    }
                    try {
                        DbDataAdapter adapter = factory.CreateDataAdapter();
                        DataSet       dataset = new DataSet();

                        adapter.SelectCommand = command;
                        adapter.Fill(dataset, name);

                        dataView = dataset.Tables [0].DefaultView;
                        if (dataView == null)
                        {
                            throw new InvalidOperationException();
                        }
                    }
                    catch (Exception e) {
                        exception = e;
                    }
                    int rowsAffected = (dataView == null) ? 0 : dataView.Count;
                    SqlDataSourceStatusEventArgs selectedArgs = new SqlDataSourceStatusEventArgs(command, rowsAffected, exception);
                    OnSelected(selectedArgs);

                    if (exception != null && !selectedArgs.ExceptionHandled)
                    {
                        throw exception;
                    }

                    if (owner.EnableCaching)
                    {
                        owner.Cache.SetCachedObject(SelectCommand, selectParameters, dataView);
                    }
                }

                if (SortParameterName.Length == 0 || SelectCommandType == SqlDataSourceCommandType.Text)
                {
                    dataView.Sort = arguments.SortExpression;
                }

                if (FilterExpression.Length > 0)
                {
                    IOrderedDictionary fparams            = FilterParameters.GetValues(context, owner);
                    SqlDataSourceFilteringEventArgs fargs = new SqlDataSourceFilteringEventArgs(fparams);
                    OnFiltering(fargs);
                    if (!fargs.Cancel)
                    {
                        object [] formatValues = new object [fparams.Count];
                        for (int n = 0; n < formatValues.Length; n++)
                        {
                            formatValues [n] = fparams [n];
                            if (formatValues [n] == null)
                            {
                                return(dataView);
                            }
                        }
                        dataView.RowFilter = string.Format(FilterExpression, formatValues);
                    }
                }

                return(dataView);
            }
            else
            {
                SqlDataSourceSelectingEventArgs selectingArgs = new SqlDataSourceSelectingEventArgs(command, arguments);
                OnSelecting(selectingArgs);
                if (selectingArgs.Cancel || !PrepareNullParameters(command, CancelSelectOnNullParameter))
                {
                    return(null);
                }

                DbDataReader reader = null;
                bool         closed = connection.State == ConnectionState.Closed;

                if (closed)
                {
                    connection.Open();
                }
                try {
                    reader = command.ExecuteReader(closed ? CommandBehavior.CloseConnection : CommandBehavior.Default);
                }
                catch (Exception e) {
                    exception = e;
                }
                int rows = reader == null ? 0 : reader.RecordsAffected;
                SqlDataSourceStatusEventArgs selectedArgs = new SqlDataSourceStatusEventArgs(command, rows, exception);
                OnSelected(selectedArgs);
                if (exception != null && !selectedArgs.ExceptionHandled)
                {
                    throw exception;
                }

                return(reader);
            }
        }
示例#54
0
 /// <summary>
 /// Sets the fields of the current record invoked by <see cref="ReadNext"/>.
 /// </summary>
 /// <param name="fields">The fields of the current record invoked by <see cref="ReadNext"/>.</param>
 protected void SetFields(IOrderedDictionary fields)
 {
     Fields = fields;
 }
示例#55
0
 internal GridViewDeletedEventArgs(int affectedRows, Exception e, IOrderedDictionary keys, IOrderedDictionary values)
     : this(affectedRows, e)
 {
     this.keys   = keys;
     this.values = values;
 }
示例#56
0
 protected override void ExtractValues(IOrderedDictionary dictionary)
 {
     dictionary[Column.Name] = tkv.Utility.CurrencyHelpers.GetValidCurrency(ConvertEditedValue(TextBox1.Text));
 }
示例#57
0
 internal DetailsViewInsertEventArgs(object argument, IOrderedDictionary values)
 {
     this.argument = argument;
     this.values   = values;
 }
示例#58
0
 protected override void ExtractValues(IOrderedDictionary dictionary)
 {
     dictionary[Column.Name] = ConvertEditedValue(TextBox1.Text);
 }
        private static void AssertOrderedDictionary(
            IOrderedDictionary <int, IList <SupportBean> > treemap,
            IOrderedDictionary <object, ICollection <EventBean> > actual)
        {
            Assert.AreEqual(treemap.Count, actual.Count);
            foreach (var key in treemap.Keys)
            {
                var expectedEvents = treemap.Get(key).ToArray();
                EPAssertionUtil.AssertEqualsExactOrder(expectedEvents, ToArrayOfUnderlying(actual.Get(key)));
            }

            CompareEntry(treemap.First(), actual.FirstEntry);
            CompareEntry(treemap.Last(), actual.LastEntry);
            CompareEntry(treemap.LessThanOrEqualTo(5), actual.LessThanOrEqualTo(5));
            CompareEntry(treemap.GreaterThanOrEqualTo(5), actual.GreaterThanOrEqualTo(5));
            CompareEntry(treemap.LessThan(5), actual.LessThan(5));
            CompareEntry(treemap.GreaterThan(5), actual.GreaterThan(5));

            Assert.AreEqual(treemap.Keys.First(), actual.FirstEntry.Key);
            Assert.AreEqual(treemap.Keys.Last(), actual.LastEntry.Key);
            Assert.AreEqual(treemap.LessThanOrEqualTo(5)?.Key, actual.LessThanOrEqualTo(5)?.Key);
            Assert.AreEqual(treemap.GreaterThanOrEqualTo(5)?.Key, actual.GreaterThanOrEqualTo(5)?.Key);
            Assert.AreEqual(treemap.LessThan(5)?.Key, actual.LessThan(5)?.Key);
            Assert.AreEqual(treemap.GreaterThan(5)?.Key, actual.GreaterThan(5)?.Key);

            Assert.AreEqual(treemap.ContainsKey(5), actual.ContainsKey(5));
            Assert.AreEqual(treemap.IsEmpty(), actual.IsEmpty());

            EPAssertionUtil.AssertEqualsExactOrder(new object[] { 1, 4, 6, 8, 9 }, actual.Keys.ToArray());

            Assert.AreEqual(1, actual.Between(9, true, 9, true).Count);
            Assert.AreEqual(1, actual.Tail(9).Count);
            Assert.AreEqual(1, actual.Tail(9, true).Count);
            Assert.AreEqual(1, actual.Head(2).Count);
            Assert.AreEqual(1, actual.Head(2, false).Count);

            Assert.AreEqual(5, actual.Count);
            Assert.AreEqual(5, actual.Keys.Count);
            Assert.AreEqual(5, actual.Values.Count);

            // values
            var values = actual.Values;

            Assert.That(values.Count, Is.EqualTo(5));
            Assert.That(values.IsEmpty(), Is.False);

            var valuesEnum = values.GetEnumerator();

            Assert.That(valuesEnum, Is.Not.Null);
            Assert.That(valuesEnum.MoveNext, Is.True);

            CollectionAssert.AreEqual(
                treemap.Get(1).ToArray(),
                ToArrayOfUnderlying(valuesEnum.Current));

            Assert.That(valuesEnum.MoveNext, Is.True);
            Assert.That(values.ToArray(), Has.Length.EqualTo(5));

            CollectionAssert.AreEqual(
                treemap.Get(1).ToArray(),
                ToArrayOfUnderlying((ICollection <EventBean>)values.ToArray()[0]));

            // ordered key set
            var oks = actual.OrderedKeys;

            //Assert.That(oks.Comparator());
            Assert.That(oks.FirstEntry, Is.EqualTo(1));
            Assert.That(oks.LastEntry, Is.EqualTo(9));
            Assert.That(oks.Count, Is.EqualTo(5));
            Assert.That(oks.IsEmpty(), Is.False);
            Assert.That(oks.Contains(6), Is.True);
            Assert.That(oks.ToArray(), Is.Not.Null);

            Assert.That(oks.LessThan(5), Is.EqualTo(4));
            Assert.That(oks.GreaterThan(5), Is.EqualTo(6));
            Assert.That(oks.LessThanOrEqualTo(5), Is.EqualTo(4));
            Assert.That(oks.GreaterThanOrEqualTo(5), Is.EqualTo(6));

            Assert.That(oks.Between(1, true, 100, true), Is.Not.Null);
            Assert.That(oks.Head(100, true), Is.Not.Null);
            Assert.That(oks.Tail(1, true), Is.Not.Null);

            // ordered key set - enumerator
            var oksit = oks.GetEnumerator();

            Assert.That(oksit, Is.Not.Null);
            Assert.That(oksit.MoveNext(), Is.True);
            Assert.That(oksit.Current, Is.EqualTo(1));
            Assert.That(oksit.MoveNext(), Is.True);


            // entry set
            ICollection <KeyValuePair <object, ICollection <EventBean> > > set = actual;

            Assert.IsFalse(set.IsEmpty());
            var setit = set.GetEnumerator();
            var entry = setit.Advance();

            Assert.AreEqual(1, entry.Key);
            Assert.IsTrue(setit.MoveNext());
            EPAssertionUtil.AssertEqualsExactOrder(treemap.Get(1).ToArray(), ToArrayOfUnderlying(entry.Value));
            var array = set.ToArray();

            Assert.AreEqual(5, array.Length);
            Assert.AreEqual(1, array[0].Key);
            EPAssertionUtil.AssertEqualsExactOrder(treemap.Get(1).ToArray(), ToArrayOfUnderlying(array[0].Value));
            Assert.IsNotNull(set.ToArray());

            // sorted map
            var events = actual.Head(100);

            Assert.AreEqual(5, events.Count);
        }
示例#60
0
 void IBindableControl.ExtractValues(IOrderedDictionary dictionary)
 {
     ExtractValues(dictionary);
 }