public bool InsertRecord_UserInfo(tblUserInfo rec) { try { MentorJEntities context = new MentorJEntities(); tblUserInfo existingRec = ReadRecord_UserInfo(rec.UserID); if (existingRec == null) { if (isUserNameTaken_UserInfo(rec) == true) //if check fails, then username already taken. { return(false); } if (isEmailTaken_UserInfo(rec) == true) //if check fails, then username already taken. { return(false); } rec.AccountCreationDate = DateTime.Now; rec.LastUpdatedDate = DateTime.Now; rec.FailedLoginAttempts = 0; rec.LastFailedLoginDate = DateTime.Now; context.tblUserInfoes.Add(rec); context.SaveChangesAsync(); return(true); } return(false); } catch (Exception ex) { throw ex; } }
public static string insertUpdateData(tblUserInfo data, string path) { try { var db = new SQLiteAsyncConnection(path); if (db.InsertAsync(data).ToString() == 0.ToString()) { db.UpdateAsync(data); } return("Single data file inserted or updated"); } catch (SQLiteException ex) { return(ex.Message); } }
public static bool deleteRecord(tblUserInfo data, string path) { try { var db = new SQLiteAsyncConnection(path); long userid = data.UserID; var query = db.GetAsync <tblUserInfo>(t => t.UserID == userid).Result; if (query != null) { return(db.DeleteAsync(query).IsCompleted); } return(false); } catch (SQLiteException ex) { throw ex; } }
public bool DeleteRecord_UserInfo(long ID) { try { MentorJEntities context = new MentorJEntities(); tblUserInfo existingRec = ReadRecord_UserInfo(ID); if (existingRec != null) //there is a record { context.tblUserInfoes.Remove(existingRec); context.SaveChangesAsync(); return(true); } return(false); } catch (Exception ex) { throw ex; } }
public bool UpdateRecord_UserInfo(tblUserInfo rec) { try { MentorJEntities context = new MentorJEntities(); tblUserInfo existingRec = ReadRecord_UserInfo(rec.UserID); if (existingRec != null) { rec.LastUpdatedDate = DateTime.Now; Serializer.Clone <tblUserInfo>(rec, existingRec); context.SaveChangesAsync(); return(true); } return(false); } catch (Exception ex) { throw ex; } }
public bool AddUpdateRecord_UserInfo(tblUserInfo rec) { try { MentorJEntities context = new MentorJEntities(); tblUserInfo existingRec = ReadRecord_UserInfo(rec.UserID); if (existingRec == null) //new record { return(InsertRecord_UserInfo(rec)); } else //found existing, update { return(UpdateRecord_UserInfo(rec)); } } catch (Exception ex) { throw ex; } }
public static tblUserInfo getRecord(tblUserInfo data, string path) { try { var db = new SQLiteAsyncConnection(path); long userid = data.UserID; // for a non-parameterless query var query = db.GetAsync <tblUserInfo>(t => t.UserID == userid).Result; //var query = table.Where(x => (x.UserID == userid)); //Linq Query if (query != null) { return(query); } return(null); } catch (SQLiteException ex) { throw ex; } //Get�specific�student�� }
public bool isEmailTaken_UserInfo(tblUserInfo rec) { try { MentorJEntities context = new MentorJEntities(); var query = from n in context.tblUserInfoes select n; foreach (var users in query) { if (users.Email == rec.Email) { return(true); } } return(false); } catch (Exception ex) { throw ex; } }