public static Client GetClient(string userName, string password) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var clientData = db.Clients.Where(c => c.userName == userName).Where(c => c.pass == password).First(); return(clientData); }
public static IQueryable <USState> GetStates() { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var stateData = from us in db.USStates select us; return(stateData); }
internal static void AddAnimal(Animal animal) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); db.Animals.InsertOnSubmit(animal); db.SubmitChanges(); }
internal static Employee EmployeeLogin(string userName, string password) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var employee = db.Employees.Where(c => c.userName == userName).Where(c => c.pass == password).First(); return(employee); }
private IQueryable <Animal> SearchForAnimal(int iD) { HumaneSociety2DataContext context = new HumaneSociety2DataContext(); var animals = (from data in context.Animals where data.ID == iD select data); return(animals); }
public static Employee RetrieveEmployeeUser(string email, int employeeNumber) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Employee employee = db.Employees.Where(c => c.employeeNumber == employeeNumber).Where(c => c.email == email).First(); return(employee); }
private IQueryable <Animal> SearchForAnimal(int iD) { HumaneSociety2DataContext context = new HumaneSociety2DataContext(); var animals = (from animal in context.Animals where animal.AnimalId == iD select animal); return(animals); }
public static Animal GetAnimalByID(int iD) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var animalData = db.Animals.Where(c => c.ID == iD).First(); return(animalData); }
public static IQueryable <Client> RetrieveClients() { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var clientData = from c in db.Clients select c; return(clientData); }
internal static IQueryable <AnimalShotJunction> GetShots(Animal animal) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var shotData = db.AnimalShotJunctions.Where(c => c.Animal_ID == animal.ID); return(shotData); }
public static IQueryable <ClientAnimalJunction> GetPendingAdoptions() { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var pendingAdoptions = db.ClientAnimalJunctions.Where(pa => pa.approvalStatus == "pending"); return(pendingAdoptions); }
public static void AddNewClient(string inputFirstName, string inputLastName, string username, string password, string email, string streetAddress, int zipCode, int state) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); UserAddress newUserAddress = new UserAddress() { addessLine1 = streetAddress, zipcode = zipCode, USStates = state, }; db.UserAddresses.InsertOnSubmit(newUserAddress); db.SubmitChanges(); Client newClient = new Client() { firstName = inputFirstName, lastName = inputLastName, userName = username, pass = password, email = email, userAddress = newUserAddress.ID }; db.Clients.InsertOnSubmit(newClient); db.SubmitChanges(); }
private static void UpdateDemeanor(Animal animal, string newValue) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Animal animalUpdating = db.Animals.Where(c => c.ID == animal.ID).First(); animalUpdating.demeanor = newValue; db.SubmitChanges(); }
private static void UpdateAnimalAge(Animal animal, string newValue) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Animal animalUpdating = db.Animals.Where(c => c.ID == animal.ID).First(); animalUpdating.age = Convert.ToInt32(newValue); db.SubmitChanges(); }
internal static void RemoveAnimal(Animal animal) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var deletedAnimal = db.Animals.Where(c => c.ID == animal.ID).First(); db.Animals.DeleteOnSubmit(deletedAnimal); db.SubmitChanges(); }
public static void DeleteEmployee(Employee employee) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var deletedEmployee = db.Employees.Where(c => c.employeeNumber == employee.employeeNumber).First(); db.Employees.DeleteOnSubmit(deletedEmployee); db.SubmitChanges(); }
public static IQueryable <ClientAnimalJunction> GetUserAdoptionStatus(Client client) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var clientData = db.Clients.Where(c => c.ID == client.ID).First(); var junctionData = db.ClientAnimalJunctions.Where(c => client.ID == clientData.ID); return(junctionData); }
public static void CreateEmployee(Employee employee) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Employee newEmployee = employee; db.Employees.InsertOnSubmit(newEmployee); db.SubmitChanges(); }
public static void UpdateClient(Client client) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var clientData = db.Clients.Where(c => c.ID == client.ID).First(); clientData = client; db.SubmitChanges(); }
internal static int?GetLocation(string roomName) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Room selectedRoom = db.Rooms.Where(c => c.name == roomName).First(); int? roomID = selectedRoom.ID; return(roomID); }
public static void AddUsernameAndPassword(Employee employee) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Employee currentEmployee = db.Employees.Where(c => c.ID == employee.ID).First(); currentEmployee.userName = employee.userName; currentEmployee.pass = employee.pass; }
private static void UpdatePetFriendly(Animal animal, string newValue) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Animal animalUpdating = db.Animals.Where(c => c.ID == animal.ID).First(); bool petFriendlyUpdate = Boolean.TryParse(newValue, out petFriendlyUpdate); animalUpdating.petFriendly = petFriendlyUpdate; db.SubmitChanges(); }
internal static void UpdateShot(string v, Animal animal) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Animal animalUpdating = db.Animals.Where(c => c.ID == animal.ID).First(); Shot shotUpdating = db.Shots.Where(c => c.name == v).First(); AnimalShotJunction animalShotJunction = db.AnimalShotJunctions.Where(c => c.Animal_ID == animalUpdating.ID).Where(c => c.Shot_ID == shotUpdating.ID).First(); animalShotJunction.dateRecieved = DateTime.Now; }
private static void UpdateBreed(Animal animal, string newValue) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Animal animalUpdating = db.Animals.Where(c => c.ID == animal.ID).First(); Breed newBreed = db.Breeds.Where(c => c.breed1 == newValue).First(); animalUpdating.breed = newBreed.ID; db.SubmitChanges(); }
private static void UpdatePetWeight(Animal animal, string newValue) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Animal animalUpdating = db.Animals.Where(c => c.ID == animal.ID).First(); animalUpdating.weight = Convert.ToInt32(newValue); UserInterface.DisplayUserOptions("Weight entered was not a number."); db.SubmitChanges(); }
private static void AddNewDiet(string foodType, int foodAmount) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); DietPlan newDietPlan = new DietPlan(); newDietPlan.food = foodType; newDietPlan.amount = foodAmount; db.DietPlans.InsertOnSubmit(newDietPlan); db.SubmitChanges(); }
private static void AddNewBreed(string breedName) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Breed newBreed = new Breed(); newBreed.breed1 = breedName; newBreed.pattern = UserInterface.GetStringData("pattern", "the animal's"); db.Breeds.InsertOnSubmit(newBreed); db.SubmitChanges(); }
public static void UpdateEmployee(Employee employee) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var updatedEmployee = db.Employees.Where(c => employee.employeeNumber == c.employeeNumber).First(); updatedEmployee.firsttName = employee.firsttName; updatedEmployee.lastName = employee.lastName; updatedEmployee.employeeNumber = employee.employeeNumber; updatedEmployee.email = employee.email; db.SubmitChanges(); }
private static void UpdateCategory(Animal animal, string newValue) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); Animal animalUpdating = db.Animals.Where(c => c.ID == animal.ID).First(); var breed = db.Breeds.Where(c => c.ID == animalUpdating.breed).First(); var category = db.Catagories.Where(c => c.ID == breed.catagory).First(); category.catagory1 = newValue; breed.catagory = category.ID; db.SubmitChanges(); }
public static void Adopt(object animal, Client client) { HumaneSociety2DataContext db = new HumaneSociety2DataContext(); var animalData = db.Animals.Where(a => a == animal).First(); var clientData = db.Clients.Where(c => c.ID == client.ID).First(); var clientJunctionData = db.ClientAnimalJunctions.Where(c => c.client == clientData.ID).Where(cj => cj.animal == animalData.ID).First(); clientJunctionData.approvalStatus = "pending"; animalData.adoptionStatus = "pending"; db.SubmitChanges(); }