示例#1
0
        public void AddPet()
        {
            MonamurDBDataSetTableAdapters.PetsTableAdapter t_petsTableAdap = new MonamurDBDataSetTableAdapters.PetsTableAdapter();

            /*if (ClientId == 0 || BreedId == 0)
             * {
             *  if (BreedId == 0 && ClientId == 0)
             *  {
             *      t_petsTableAdap.InsertPet(Name, Bday, null, null, About);
             *  }
             *  else if (ClientId == 0)
             *  {
             *      t_petsTableAdap.InsertPet(Name, Bday, null, BreedId, About);
             *  }
             *  else {
             *      t_petsTableAdap.InsertPet(Name, Bday, ClientId, null, About);
             *  }
             * }
             * else {
             *  t_petsTableAdap.InsertPet(Name, Bday, ClientId, BreedId, About);
             * }*/
            if (Bday == DateTime.Parse("1900-01-01"))
            {
                t_petsTableAdap.InsertPet(Name, null, ClientId, BreedId, About);
            }
            else
            {
                t_petsTableAdap.InsertPet(Name, Bday, ClientId, BreedId, About);
            }
        }
示例#2
0
 public bool Delete()
 {
     try
     {
         MonamurDBDataSetTableAdapters.PetsTableAdapter t_petsTableAdap = new MonamurDBDataSetTableAdapters.PetsTableAdapter();
         t_petsTableAdap.DeletePet(ID);
         return(true);
     }
     catch {
         return(false);
     }
 }
示例#3
0
 public bool UpdatePet()
 {
     MonamurDBDataSetTableAdapters.PetsTableAdapter t_petsTableAdap = new MonamurDBDataSetTableAdapters.PetsTableAdapter();
     try
     {
         /*if (ClientId == 0 || BreedId == 0)
          * {
          *  if (BreedId == 0 && ClientId == 0)
          *  {
          *      t_petsTableAdap.UpdatePet(Name, Bday, null, null, About, ALive, ID);
          *  }
          *  else if (ClientId == 0)
          *  {
          *      t_petsTableAdap.UpdatePet(Name, Bday, null, BreedId, About, ALive, ID);
          *  }
          *  else
          *  {
          *      t_petsTableAdap.UpdatePet(Name, Bday, ClientId, null, About, ALive, ID);
          *  }
          *
          * }
          * else
          * {
          *  t_petsTableAdap.UpdatePet(Name, Bday, ClientId, BreedId, About, ALive, ID);
          * }*/
         if (Bday == DateTime.Parse("1900-01-01"))
         {
             t_petsTableAdap.UpdatePet(Name, null, ClientId, BreedId, About, ALive, ID);
         }
         else
         {
             t_petsTableAdap.UpdatePet(Name, Bday, ClientId, BreedId, About, ALive, ID);
         }
         return(true);
     }
     catch {
         return(false);
     }
 }