public static List <Usuario> GetAllUsuarios() { using (var db = new DB_PLANTILLA()) { return(db.GetAllRecords <Usuario>()); } }
public static Usuario Autenticate(string username, string password) { using (var db = new DB_PLANTILLA()) { if (!db.GetAllRecords <Usuario>().Any()) { var _newUser = new Usuario() { username = "******", password = "******", access_Level = 3 }; db.AddElemento(_newUser.GetType(), _newUser); } var result = db.GetSingleRecord <Usuario>(u => u.username == username && u.password == password); return(result); } }
void FillData() { SplashScreenManager.ShowForm(typeof(WaitScreen)); gridControl1.DataSource = CreateColumns(); using (var db = new DB_PLANTILLA()) { var _locales = db.GetAllRecords <T_Local>(); var _subTipos = db.GetAllElements <T_Subsistema_Tipo>(); var _subAreas = db.GetAllElements <T_Subsistema_Area>(); var _coefs = db.GetAllElements <T_CoefArea>(); var _porcientos = db.GetAllElements <T_Porciento_BD>(); foreach (var item in _localesByProject) { gridView1.AddNewRow(); int _rowHandle = gridView1.GetRowHandle(gridView1.DataRowCount); if (gridView1.IsNewItemRow(_rowHandle)) { var _local = new DB_BIM().GetSingleRecord <Local>(x => x.Id == item.Local); gridView1.SetRowCellValue(_rowHandle, gridView1.Columns["RoomID"], _local.RoomId); gridView1.SetRowCellValue(_rowHandle, gridView1.Columns["KeyName"], _local.Key_Name); var _subTipo = new DB_PLANTILLA().GetSingleRecord <T_Subsistema_Tipo>(x => x.Id == _local.SubsistemaTipo); gridView1.SetRowCellValue(_rowHandle, gridView1.Columns["SubTipo"], _subTipo.Value.ToString()); var _subArea = new DB_PLANTILLA().GetSingleRecord <T_Subsistema_Area>(x => x.Id == _local.SubsistemaArea); gridView1.SetRowCellValue(_rowHandle, gridView1.Columns["SubArea"], _subArea.Value.ToString()); var _coefArea = new DB_BIM().GetSingleElement <CoefArea>(x => x.Id == _local.Coef_Area); gridView1.SetRowCellValue(_rowHandle, gridView1.Columns["Coef"], _coefArea.Value); var _porcientoBD = new DB_PLANTILLA().GetSingleRecord <T_Porciento_BD>(x => x.Id == _local.Porciento_BD); gridView1.SetRowCellValue(_rowHandle, gridView1.Columns["PorcientoBD"], _porcientoBD.Value); } } } SplashScreenManager.CloseForm(); }