public static bool AddAnimal(Animal addition)
 {
     try
     {
         HSDataDataContext context = new HSDataDataContext();
         context.Animals.InsertOnSubmit(addition);
         context.SubmitChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
 public static bool DeleteAnimals(List <Animal> del)
 {
     try
     {
         HSDataDataContext context = new HSDataDataContext();
         context.Animals.DeleteAllOnSubmit(del);
         context.SubmitChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
 public static bool AddAnimals(List <Animal> adds)
 {
     try
     {
         HSDataDataContext context = new HSDataDataContext();
         context.Animals.InsertAllOnSubmit(adds);
         context.SubmitChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Beispiel #4
0
 public static bool DeleteTransaction(Transaction del)
 {
     try
     {
         HSDataDataContext context = new HSDataDataContext();
         context.Transactions.DeleteOnSubmit(del);
         context.SubmitChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Beispiel #5
0
 public static bool AddTransaction(Transaction addition)
 {
     try
     {
         HSDataDataContext context = new HSDataDataContext();
         context.Transactions.InsertOnSubmit(addition);
         context.SubmitChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
 public static bool DeleteAdopter(Adopter del)
 {
     try
     {
         HSDataDataContext context = new HSDataDataContext();
         context.Adopters.DeleteOnSubmit(del);
         context.SubmitChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
        public static bool UpdateAdopter(Adopter updated)
        {
            try
            {
                HSDataDataContext context = new HSDataDataContext();
                var res = (context.Adopters.Where(adopters => adopters.Adopter_ID == updated.Adopter_ID)).First();

                res.Adopter_Address      = updated.Adopter_Address;
                res.Adopter_Age          = updated.Adopter_Age;
                res.Adopter_Description  = updated.Adopter_Description;
                res.Adopter_Name         = updated.Adopter_Name;
                res.Adopter_Phone_Number = updated.Adopter_Phone_Number;
                context.SubmitChanges();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Beispiel #8
0
        public static bool UpdateTransaction(Transaction updated)
        {
            try
            {
                HSDataDataContext context = new HSDataDataContext();
                var res = (from transactions in context.Transactions
                           where transactions.Transaction_ID == updated.Transaction_ID
                           select transactions).First();

                res.Animal      = updated.Animal;
                res.Adopter     = updated.Adopter;
                res.Amount_Paid = updated.Amount_Paid;
                res.Amount_Owed = updated.Amount_Owed;
                context.SubmitChanges();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
        public static bool UpdateAnimal(Animal updated)
        {
            try
            {
                HSDataDataContext context = new HSDataDataContext();
                var res = (from animals in context.Animals
                           where animals.Animal_ID.Equals(updated.Animal_ID)
                           select animals).First();

                res.Adoption_Status = updated.Adoption_Status;
                res.Color           = updated.Color;
                res.Food_Intake     = updated.Food_Intake;
                res.Has_Shot        = updated.Has_Shot;
                res.Name            = updated.Name;
                res.Room            = updated.Room;
                res.Type            = updated.Type;
                context.SubmitChanges();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }