Example #1
0
        public void SetValue(CellContext cellContext, object p_Value)
        {
            //Выдергиваю текущее значение
            Map    map      = (cellContext.Grid as FRom.Grid.FRomGrid).DataSource;
            object oldValue = map[
                cellContext.Position.Column - cellContext.Grid.FixedColumns,
                cellContext.Position.Row - cellContext.Grid.FixedRows,
                null];

            SourceGrid.ValueChangeEventArgs valArgs = new SourceGrid.ValueChangeEventArgs(oldValue, p_Value);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);
            }

            map[
                cellContext.Position.Column - cellContext.Grid.FixedColumns,
                cellContext.Position.Row - cellContext.Grid.FixedRows,
                null] = p_Value;

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
            }
        }
Example #2
0
        public override void OnValueChanging(CellContext sender, ValueChangeEventArgs e)
        {
            base.OnValueChanging(sender, e);

            //BeginEdit on the row, set the Cancel = true if failed to start editing.
            bool success = ((DataGrid)sender.Grid).BeginEditRow(sender.Position.Row);

            if (success == false)
            {
                throw new SourceGridException("Failed to editing row " + sender.Position.Row.ToString());
            }
        }
Example #3
0
        public virtual void SetValue(CellContext cellContext, object p_Value)
        {
            Array  array    = ((ArrayGrid)cellContext.Grid).DataSource;
            object oldValue = array.GetValue(cellContext.Position.Row - cellContext.Grid.FixedRows, cellContext.Position.Column - cellContext.Grid.FixedColumns);
            ValueChangeEventArgs valArgs = new ValueChangeEventArgs(oldValue, p_Value);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);
            }

            array.SetValue(p_Value, cellContext.Position.Row - cellContext.Grid.FixedRows, cellContext.Position.Column - cellContext.Grid.FixedColumns);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
            }
        }
Example #4
0
        public void SetValue(CellContext cellContext, object p_Value)
        {
            //Выдергиваю текущее значение
            Map map = (cellContext.Grid as FRom.Grid.FRomGrid).DataSource;
            object oldValue = map[
                cellContext.Position.Column - cellContext.Grid.FixedColumns,
                cellContext.Position.Row - cellContext.Grid.FixedRows,
                null];

            SourceGrid.ValueChangeEventArgs valArgs = new SourceGrid.ValueChangeEventArgs(oldValue, p_Value);

            if (cellContext.Grid != null)
                cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);

            map[
                cellContext.Position.Column - cellContext.Grid.FixedColumns,
                cellContext.Position.Row - cellContext.Grid.FixedRows,
                null] = p_Value;

            if (cellContext.Grid != null)
                cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
        }
Example #5
0
        public void SetValue(CellContext cellContext, object value)
        {
            DataGrid           grid     = (DataGrid)cellContext.Grid;
            PropertyDescriptor prop     = grid.Columns[cellContext.Position.Column].PropertyColumn;
            object             oldValue = GetValue(cellContext);

            ValueChangeEventArgs valArgs = new ValueChangeEventArgs(oldValue, value);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);
            }



            grid.DataSource.SetEditValue(prop, valArgs.NewValue);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
            }
        }
Example #6
0
        public void SetValue(CellContext cellContext, object value)
        {
            DataGrid           grid     = (DataGrid)cellContext.Grid;
            PropertyDescriptor prop     = grid.Columns[cellContext.Position.Column].PropertyColumn;
            object             oldValue = GetValue(cellContext);

            //[email protected]: if value is the same,
            //no need to trigger value changed event or to write back to datasource.
            string oldText = oldValue == null ? string.Empty : oldValue.ToString();
            string newText = value == null ? string.Empty : value.ToString();

            if (newText == oldText)
            {
                return;
            }

            ValueChangeEventArgs valArgs = new ValueChangeEventArgs(oldValue, value);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);
            }

            //[email protected]: ValueChanging event will be used for validation
            //If operation cancelled then return without setting database. i.e., reject changes
            if (valArgs.Cancel)
            {
                return;
            }

            grid.DataSource.SetEditValue(prop, valArgs.NewValue);

            if (cellContext.Grid != null)
            {
                cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
            }
        }
Example #7
0
		public virtual void SetValue(CellContext cellContext, object p_Value)
		{
			Array array = ((ArrayGrid)cellContext.Grid).DataSource;
			object oldValue = array.GetValue(cellContext.Position.Row - cellContext.Grid.FixedRows, cellContext.Position.Column - cellContext.Grid.FixedColumns);
			ValueChangeEventArgs valArgs = new ValueChangeEventArgs(oldValue, p_Value);
			if (cellContext.Grid != null)
				cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);

			array.SetValue(p_Value, cellContext.Position.Row - cellContext.Grid.FixedRows, cellContext.Position.Column - cellContext.Grid.FixedColumns);

			if (cellContext.Grid != null)
				cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
		}
Example #8
0
		public override void OnValueChanging(CellContext sender, ValueChangeEventArgs e)
		{
			base.OnValueChanging (sender, e);

			//BeginEdit on the row, set the Cancel = true if failed to start editing.
			bool success = ((DataGrid)sender.Grid).BeginEditRow(sender.Position.Row);
			if (success == false)
				throw new SourceGridException("Failed to editing row " + sender.Position.Row.ToString());
		}
Example #9
0
		public void SetValue(CellContext cellContext, object value)
		{
			DataGrid grid = (DataGrid)cellContext.Grid;
			PropertyDescriptor prop = grid.Columns[cellContext.Position.Column].PropertyColumn;
			object oldValue = GetValue(cellContext);
			
			ValueChangeEventArgs valArgs = new ValueChangeEventArgs(oldValue, value);
			if (cellContext.Grid != null)
				cellContext.Grid.Controller.OnValueChanging(cellContext, valArgs);

			

			

			grid.DataSource.SetEditValue(prop, valArgs.NewValue);

			if (cellContext.Grid != null)
				cellContext.Grid.Controller.OnValueChanged(cellContext, EventArgs.Empty);
		}