public static bool StopUserVerification(int ChoreListId, string Phone) { try { using (var db = new ChoremanEntities(PrivateValues.GetConnectionString())) { bool to_return = false; //get corresponding chore user(s) var ChoreUsers = db.ChoreUsers.Where(x => x.ChoreListId == ChoreListId && x.Phone == Phone); foreach (var ChoreUser in ChoreUsers) { ChoreUser.IsVerified = false; to_return = true; } db.SaveChanges(); return(true); } } catch (Exception ex) { throw Utility.ThrowException(ex); } }
public MessageRepository() { if (Utility.IsTest()) { this.db = new ChoremanEntities(); } else { this.db = new ChoremanEntities(PrivateValues.GetConnectionString()); } }
public static int CountPendingVerifications(string Phone) { try { using (var db = new ChoremanEntities(PrivateValues.GetConnectionString())) { return(db.ChoreUsers.Count(x => x.Phone == Phone && x.IsPendingCancel)); } } catch (Exception ex) { throw Utility.ThrowException(ex); } }
public static string GetChoreListName(int ChoreListId) { try { using (var db = new ChoremanEntities(PrivateValues.GetConnectionString())) { return(db.ChoreLists.SingleOrDefault(x => x.Id == ChoreListId).Name); } } catch (Exception ex) { throw Utility.ThrowException(ex); } }
public static bool IsChoreUser(string Phone) { try { using (var db = new ChoremanEntities(PrivateValues.GetConnectionString())) { return(db.ChoreUsers.Count(x => x.Phone == Phone && x.IsActive) > 0); } } catch (Exception ex) { throw Utility.ThrowException(ex); } }
public AccountPaymentsRepository() { try { if (Utility.IsTest()) { this.db = new ChoremanEntities(); } else { this.db = new ChoremanEntities(PrivateValues.GetConnectionString()); } } catch (Exception ex) { throw Utility.ThrowException(ex); } }
public static bool StopVerificationAll(string Phone) { try { using (var db = new ChoremanEntities(PrivateValues.GetConnectionString())) { foreach (var ChoreUser in db.ChoreUsers.Where(x => x.Phone == Phone)) { ChoreUser.IsPendingCancel = false; ChoreUser.IsVerified = false; } return(true); } } catch (Exception ex) { throw Utility.ThrowException(ex); } }
public static List <ChoreList> GetNonVerifiedChoreLists(string Phone) { try { List <ChoreList> to_return = new List <ChoreList>(); using (var db = new ChoremanEntities(PrivateValues.GetConnectionString())) { foreach (var ChoreUser in db.ChoreUsers.Where(x => x.Phone == Phone && x.IsActive && !x.IsVerified)) { //check if chorelist number exists in return list if (to_return.Count(x => x.Id == ChoreUser.ChoreListId) == 0) { to_return.Add(ChoreUser.ChoreList); } } } return(to_return); } catch (Exception ex) { throw Utility.ThrowException(ex); } }
public static bool PendingStopVerificationAll(string Phone) { try { bool to_return = false; using (var db = new ChoremanEntities(PrivateValues.GetConnectionString())) { foreach (var ChoreUser in db.ChoreUsers.Where(x => x.IsActive && x.IsVerified && x.Phone == Phone)) { ChoreUser.IsPendingCancel = true; to_return = true; } db.SaveChanges(); return(to_return); } } catch (Exception ex) { throw Utility.ThrowException(ex); } }