public void RemoveSelected(CRTObject row, Boolean applyToCheckBox) {
   if (this.CheckSelected(row)) {
     if (applyToCheckBox) {
       var v_cbx = row.ExtObject as CheckBox;
       if (v_cbx != null)
         v_cbx.IsChecked = this.Inversion;
     }
     this.Values.Remove(row.GetValue<String>(this.ValueField));
   }
 }
 private void _doOnLocation(CRTObject row, EBioException exception, EventHandler<OnSelectEventArgs> callback) {
   if (callback != null) {
     callback(this, new OnSelectEventArgs {
       ex = exception,
       selection = new VSingleSelection { ValueRow = row }
     });
   }
 }
 private static Boolean _checkFilter(CRTObject row, Int64 rowPos, JsonStoreFilter filter) {
   if ((row != null) && (filter != null)) {
     if (rowPos >= filter.FromPosition) {
       return filter.Check(row);
     }
     return false;
   }
   return false;
 }
 public JSClientAfterMonRowEventArgs(CRTObject row) {
   this.Row = row;
 }
 /// <summary>
 /// Преобразует строку со значениями первичного ключа в параметры.
 /// </summary>
 /// <param name="row">Строка со значениями первичного ключа.</param>
 /// <returns></returns>
 public Params GetPK(CRTObject row) {
   var @params = new Params();
   var pkDef = this.GetPKFields();
   foreach (var t in pkDef) {
     var vType = t.GetDotNetType();
     var vValue = row.GetValue(t.Name, vType);
     @params.Add(new Param(t.Name, vValue, vType, ParamDirection.Input));
   }
   return @params;
 }
 public Boolean Check(CRTObject row) {
   var rslt = (this.JoinCondition == JSFilterItemSplitterType.And) ? true : false;
   foreach (var c in this.Items) {
     var locRslt = false;
     if (c is JSFilterItemCondition)
       locRslt = c.check(row);
     if (this.JoinCondition == JSFilterItemSplitterType.And)
       rslt = rslt && locRslt;
     else
       rslt = rslt || locRslt;
   }
   return rslt;
 }
 public Boolean CheckSelected(CRTObject row) {
   return this.Values.Any((v) => {
     return String.Equals(v, row.GetValue<String>(this.ValueField));
   });
 }
 public JSClientRowPropertyChangingEventArgs(Boolean cancel, CRTObject row, String propertyName)
   : base(cancel) {
   this.Row = row;
   this.PropertyName = propertyName;
 }
 public void AddRow(CRTObject row) {
   this.InsertRow(-1, row);
 }
 private void _doOnAfterDeleteRow(Int32 index, CRTObject row) {
   if (!this._rowMonEventsDisabled) {
     this._regChanges(new JSChangedRow(index, JsonStoreRowChangeType.Deleted, row, row));
     var eve = this.OnAfterDeleteRow;
     if (eve != null) {
       var args = new JSClientAfterMonRowEventArgs(row);
       eve(this, args);
     }
   }
 }
    public void InsertRow(Int32 index, CRTObject row) {
      var v_ds = this.DS0 as IList;
      if (v_ds != null) {
        var v_cancel = false;
        this._doOnBeforeInsertRow(ref v_cancel, row);
        if (!v_cancel) {
          if (index >= 0)
            v_ds.Insert(index, row);
          else
            v_ds.Add(row);
          this._doOnAfterInsertRow(row);
        }

      }
    }
 private void _doOnBeforeDeleteRow(ref Boolean cancel, CRTObject row) {
   if (!this._rowMonEventsDisabled) {
     var eve = this.OnBeforeDeleteRow;
     if (eve != null) {
       var args = new JSClientBeforeMonRowEventArgs(cancel, row);
       eve(this, args);
       cancel = args.Cancel;
     }
   }
 }
 private void _doOnAfterInsertRow(CRTObject newRow) {
   if (!this._rowMonEventsDisabled) {
     var v_indx = this.IndexOf(newRow);
     this._regChanges(new JSChangedRow(v_indx, JsonStoreRowChangeType.Added, newRow, null));
     var eve = this.OnAfterInsertRow;
     if (eve != null) {
       var args = new JSClientAfterMonRowEventArgs(newRow);
       eve(this, args);
     }
   }
 }
 public Int32 IndexOf(CRTObject row) {
   var foundItem = this.DS.Select((item, index) => new {
     Item = item,
     Position = index
   }).FirstOrDefault(i => i.Item == row);
   return (foundItem != null) ? foundItem.Position : -1;
 }
 public void CancelChanges(CRTObject row) {
   if ((this._dsChanges != null) && (row != null)) {
     var c = this._dsChanges.Where(itm => { return itm.CurRow == row; }).FirstOrDefault();
     if (c != null) {
       c.CurRow.DisableEvents();
       c.OrigRow.DisableEvents();
       try {
         if (c.State == JsonStoreRowChangeType.Modified) {
           c.CurRow.SetValues(c.OrigRow);
         }
         c.MarkUnchanged();
       } finally {
         c.CurRow.EnableEvents();
         c.OrigRow.EnableEvents();
       }
       this._dsChanges.Remove(c);
     }
   }
 }
 private void _doOnRowPropertyChanging(Object sender, PropertyChangingEventArgs e) {
   this._lastPreChangedRow = ((CRTObject)sender).Copy();
   var eve = this.OnRowPropertyChanging;
   if (eve != null) {
     var ee = new JSClientRowPropertyChangingEventArgs(false, this._lastPreChangedRow, e.PropertyName);
     eve(this, ee);
   }
 }
 public override Boolean check(CRTObject row) {
   var val = row.GetValue<Object>(this.FieldName);
   return this._check(val);
 }
 public void RemoveRow(CRTObject row) {
   if (row != null) {
     var v_ds = this.DS0 as IList;
     if (v_ds != null) {
       var v_cancel = false;
       this._doOnBeforeDeleteRow(ref v_cancel, row);
       if (!v_cancel) {
         var v_indx = this.IndexOf(row);
         v_ds.Remove(row);
         this._doOnAfterDeleteRow(v_indx, row);
       }
     }
   }
 }
 public virtual Boolean check(CRTObject row) { throw new NotImplementedException(); }
 private static void _setFieldValue(CRTObject row, String fldName, Object value) {
   if (row != null) {
     row[fldName] = value;
   }
 }
 public void AddSelected(CRTObject row) {
   this.AddSelected(row, true);
 }
 public JSClientRowPropertyChangedEventArgs(CRTObject row, String propertyName) {
   this.Row = row;
   this.PropertyName = propertyName;
 }
 public void RemoveSelected(CRTObject row) {
   this.RemoveSelected(row, true);
 }
 public JSChangedRow(Int32 index, JsonStoreRowChangeType state, CRTObject newRow, CRTObject origRow) {
   this.Index = index;
   this.State = state;
   this.OrigRow = origRow;
   this.CurRow = newRow;
 }
Example #25
0
 private void _doOnRowCheckedChanged(CRTObject row, Boolean chked) {
   if (this._onRowCheckedChangedEnabled) {
     this._onRowCheckedChangedEnabled = false;
     if (chked) {
       if (!this._owner.Selection.Inversion)
         this._owner.Selection.AddSelected(row, false);
       else
         this._owner.Selection.RemoveSelected(row, false);
     } else {
       if (this._owner.Selection.Inversion)
         this._owner.Selection.AddSelected(row, false);
       else
         this._owner.Selection.RemoveSelected(row, false);
     }
     this._onRowCheckedChangedEnabled = true;
   }
 }
 public JSClientBeforeMonRowEventArgs(Boolean cancel, CRTObject row)
   : base(cancel) {
   this.Row = row;
 }