private void Init() { bs.DataSource = _db.TS_ROLE.ToList(); grid.PrimaryGrid.DataSource = bs; bn.BindingSource = bs; _selectedData = new TS_ROLE(); }
private void grid_MasterGridCellActivated(object sender, GridCellActivatedEventArgs e) { _selectedData = (TS_ROLE)e.NewActiveCell.GridRow.DataItem; if (string.IsNullOrEmpty(_selectedData.RoleCode)) { return; } SetDetailGridDataSource(_db, _selectedData.RoleCode); }
public static void AddOrUpdate(PowerEntities db, TS_ROLE selectedData, TS_OPERATOR oper) { try { db.TS_ROLE.AddOrUpdate(p => p.RoleCode, selectedData); } catch (DbEntityValidationException dbEx) { Console.WriteLine(dbEx.ToString()); throw; } }
public static void Delete(PowerEntities db, TS_ROLE data, TS_OPERATOR oper) { db.Entry(data).State = EntityState.Deleted; }