Пример #1
0
        public static List <Animal> GetTable()
        {
            HSDataDataContext context = new HSDataDataContext();
            var results = context.Animals.Select(animals => animals);

            return(results.ToList());
        }
Пример #2
0
        public static List <Transaction> GetTransaction()
        {
            HSDataDataContext context = new HSDataDataContext();
            var results = context.Transactions.Select(transactions => transactions);

            return(results.ToList());
        }
Пример #3
0
        public static List <Adopter> GetTable()
        {
            HSDataDataContext context = new HSDataDataContext();
            var results = context.Adopters.Select(adopter => adopter);

            return(results.ToList());
        }
Пример #4
0
 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);
     }
 }
Пример #5
0
 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);
     }
 }
Пример #6
0
 public static bool AddAnimal(Animal addition)
 {
     try
     {
         HSDataDataContext context = new HSDataDataContext();
         context.Animals.InsertOnSubmit(addition);
         context.SubmitChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Пример #7
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);
     }
 }
Пример #8
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);
     }
 }
Пример #9
0
 public static bool DeleteAdopter(Adopter del)
 {
     try
     {
         HSDataDataContext context = new HSDataDataContext();
         context.Adopters.DeleteOnSubmit(del);
         context.SubmitChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Пример #10
0
        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);
            }
        }
Пример #11
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);
            }
        }
Пример #12
0
        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);
            }
        }