protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["TId"] == null || !int.TryParse(Request.QueryString["TId"], out TrainingId) || !ConnectionClass.TrainingExists(TrainingId))
            {
                Response.Redirect("Program.aspx");
            }
            UserC = (UserClass)Session["User"];
            Tr = ConnectionClass.GetTrainingById(TrainingId);
            Warming = ConnectionClass.GetStageByTrainingIdAndType(Tr.GetTrainingId(), "Warming");
            Skill = ConnectionClass.GetStageByTrainingIdAndType(Tr.GetTrainingId(), "Skill");
            Wod = ConnectionClass.GetStageByTrainingIdAndType(Tr.GetTrainingId(), "Wod");
            if (Tr.GetTrainerId() != UserC.GetId())
            {
                Response.Redirect("Program.aspx");

            }
            if (!IsPostBack)
                FillPanel();
        }
 public static void UpdateTraining(TrainingClass Tr)
 {
     Conn.Open();
     string Query = String.Format("Update [dbo].[Trainings] set Day='{0}', Hour='{1}' ,Trainer_id={2}, Name='{3}' where Id={4}", Tr.GetDay(), Tr.GetHour(), Tr.GetTrainerId(), Tr.GetTrainingName(), Tr.GetTrainingId());
     command = new SqlCommand(Query, Conn);
     command.ExecuteNonQuery();
     Conn.Close();
 }
 public static void InsertNewTraining(TrainingClass Tr)
 {
     Conn.Open();
     string Query = String.Format("Insert into [dbo].[Trainings](Day,Hour,Trainer_id,Name) values ('{0}','{1}',{2},'{3}')", Tr.GetDay(), Tr.GetHour(), Tr.GetTrainerId(),Tr.GetTrainingName());
     command = new SqlCommand(Query, Conn);
     command.ExecuteNonQuery();
     Conn.Close();
 }