Example #1
0
        public void delete_pack(PackagesEN p)
        {
            string        s = ConfigurationManager.ConnectionStrings["DatabaseConnection"].ToString();
            SqlConnection c = new SqlConnection(s);

            try
            {
                c.Open();
                SqlCommand com = new SqlCommand("Delete From Packages Where Id = " + p.Id, c);
                com.ExecuteNonQuery();
            }
            catch (Exception exc)
            {
                exc.ToString();
                Console.WriteLine("ERROR: Delete pack");
            }
            finally
            {
                c.Close();
            }
        }
Example #2
0
        public void add_pack(PackagesEN p)
        {
            string        s = ConfigurationManager.ConnectionStrings["DatabaseConnection"].ToString();
            SqlConnection c = new SqlConnection(s);

            try
            {
                c.Open();
                SqlCommand com = new SqlCommand("Insert Into Packages (Id,Name,Transport,Hotel) VALUES ('" + p.Id + "','" + p.Name + "','" + p.Transport + "','" +
                                                p.Hotel + "')", c);

                com.ExecuteNonQuery();
            }
            catch (Exception exc)
            {
                exc.ToString();
                Console.WriteLine("ERROR: Add pack");
            }
            finally
            {
                c.Close();
            }
        }