public static void Attend(ParticipationClass At) { Conn.Open(); string query = String.Format("Insert into [dbo].[Participations](User_Id,Training_Id) values({0},{1})", At.GetUserId(), At.GetTrainingId()); command = new SqlCommand(query, Conn); command.ExecuteNonQuery(); Conn.Close(); }
protected void AttendToTraining(object sender, EventArgs e) { if (!ConnectionClass.IsAttending(UserC.GetId(), TrainingId)) { ParticipationClass Att = new ParticipationClass(UserC.GetId(), TrainingId); ConnectionClass.Attend(Att); Response.Redirect(Request.RawUrl); } }
public static void LeaveTraining(ParticipationClass Pc) { Conn.Open(); string query = String.Format("Delete from [dbo].[Participations] where User_Id={0} and Training_Id={1}",Pc.GetUserId(),Pc.GetTrainingId()); command = new SqlCommand(query, Conn); command.ExecuteNonQuery(); Conn.Close(); }