예제 #1
0
 public FlightRequest(int id, bool direction, DateTime departuredate, DateTime arrivaldate, decimal price,
                      Flight flight, EntertainmentPlan entertainmentPlan, FoodPlan foodPlan, SportPlan sportPlan, Client client)
 {
     ID                = id;
     Direction         = direction;
     DepartureDate     = departuredate;
     ArrivalDate       = arrivaldate;
     Price             = price;
     Flight            = flight;
     EntertainmentPlan = entertainmentPlan;
     FoodPlan          = foodPlan;
     SportPlan         = sportPlan;
     Client            = client;
 }
예제 #2
0
 public static bool updateFoodPlan(FoodPlan foodPlan)
 {
     try
     {
         DB.loadQuery(@"UPDATE food_plans SET title=?title, text=?text, price=?price, fk_administrator=?fk_admin WHERE id=?id");
         DB.Command.Parameters.Add("?title", MySqlDbType.VarChar).Value    = foodPlan.Title;
         DB.Command.Parameters.Add("?text", MySqlDbType.VarChar).Value     = foodPlan.Text;
         DB.Command.Parameters.Add("?price", MySqlDbType.VarChar).Value    = foodPlan.Price;
         DB.Command.Parameters.Add("?fk_admin", MySqlDbType.VarChar).Value = 2;
         DB.Command.Parameters.Add("?id", MySqlDbType.VarChar).Value       = foodPlan.ID;
         DB.execute();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #3
0
 public static bool insertFoodPlan(FoodPlan foodPlan)
 {
     try
     {
         DB.loadQuery(@"INSERT INTO food_plans(title,text,price,removed,fk_administrator)VALUES(?title,?text,?price,?removed,?fk_admin);");
         DB.Command.Parameters.Add("?title", MySqlDbType.VarChar).Value  = foodPlan.Title;
         DB.Command.Parameters.Add("?text", MySqlDbType.VarChar).Value   = foodPlan.Text;
         DB.Command.Parameters.Add("?price", MySqlDbType.Decimal).Value  = foodPlan.Price;
         DB.Command.Parameters.Add("?removed", MySqlDbType.Bit).Value    = 0;
         DB.Command.Parameters.Add("?fk_admin", MySqlDbType.Int32).Value = 2;
         DB.execute();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #4
0
        public static FoodPlan selectFoodPlan(int id)
        {
            FoodPlan foodPlan = new FoodPlan();

            DB.loadQuery("select * from food_plans where id=?id");
            DB.Command.Parameters.Add("?id", MySqlDbType.Int32).Value = id;
            DataTable dt = DB.query();

            foreach (DataRow item in dt.Rows)
            {
                foodPlan.ID            = Convert.ToInt32(item["id"]);
                foodPlan.Title         = Convert.ToString(item["title"]);
                foodPlan.Text          = Convert.ToString(item["text"]);
                foodPlan.Price         = Convert.ToDecimal(item["price"]);
                foodPlan.Removed       = Convert.ToBoolean(item["removed"]);
                foodPlan.Administrator = new Administrator(Convert.ToInt32(item["fk_administrator"]));
            }

            return(foodPlan);
        }