/// <summary>
 /// This method inserts the details of the participant into the TT database and 
 /// returns the generated TTID on successful insertion and 0 otherwise.
 /// </summary>
 /// <param name="participant">An object of Participant class containing the details of the participant.</param>
 /// <returns>It returns generated TTID.</returns>
 public static int AddNewParticipant(Participant participant)
 {
     sql = "INSERT INTO Participants(Name,EmailID,ContactNo,PartnerID,StudentNo,Password,GenderID,BranchID,Year,CollegeID,TShirt,Accomodation)" +
     "VALUES(@Name,@EmailID,@ContactNo,@PartnerID,@StudentNo,@Password,@GenderID,@BranchID,@Year,@CollegeID,@TShirt,@Accomodation)";
     Connect.ConnectTT();
     int ttID;
     string[] s = { "@Name", "@EmailID", "@ContactNo", "@PartnerID", "@StudentNo", "@Password", "@GenderID", "@BranchID", "@Year", "CollegeID", "TShirt", "Accomodation" };
     try
     {
         c = new Connect(sql, s, participant.Name, participant.EmailID, participant.ContactNo, participant.PartnerID, participant.StudentNo, participant.Password,
           ((int)participant.Gender), ((int)participant.Branch), participant.Year, participant.CollegeID, participant.WantTShirt, participant.WantAccomodation);
         ttID = c.lastId;
     }
     catch (Exception ex)
     {
         ttID = 0;
     }
     return ttID;
 }
 /// <summary>
 /// This method updates the details of the participant.
 /// </summary>
 /// <param name="participant">An object of Participant type.</param>
 /// <returns>It returns true if the details are upadted otherwise false.</returns>
 public static bool UpdateParticipantDetails(Participant participant)
 {
     sql = "UPDATE Participants SET Accomodation = @accomodation,BranchID=@branchID,CollegeID=@collegeID,ContactNo=@contactNo,EmailID=@emailID,"
     + "GenderID=@genderID,Name=@name,PartnerID=@partnerId,Password=@password,StudentNo=@studentNo,TShirt=@tshirt,Year=@year WHERE TTID=@ttid";
     string[] s = { "@accomodation", "@branchID", "@collegeID", "@contactNo", "@emailID", "@genderID", "@name", "@partnerID", "@password", "@studentNo", "@tshirt", "@year", "@ttid" };
     Connect.ConnectTT();
     try
     {
         c = new Connect(sql, s, participant.WantAccomodation, ((int)participant.Branch), participant.CollegeID, participant.ContactNo, participant.EmailID,
             ((int)participant.Gender), participant.Name, participant.PartnerID, participant.Password, participant.StudentNo, participant.WantTShirt,
             participant.Year, participant.TTID);
         return true;
     }
     catch (Exception ex)
     {
         return false;
     }
 }
 public static int AddNewParticipant(Participant participant)
 {
     return ParticipantRepository.AddNewParticipant(participant);
 }
 private static Participant InitializeParticipant(DataTable participantDataTable)
 {
     if (participantDataTable.Rows.Count > 0)
     {
         DataRow row = participantDataTable.Rows[0];
         bool tshirt, accomodation;
         if (row["TShirt"].ToString() == "1")
             tshirt = true;
         else
             tshirt = false;
         if (row["Accomodation"].ToString() == "1")
             accomodation = true;
         else
             accomodation = false;
         Participant participant = new Participant
         {
             Name = row["Name"].ToString(),
             TTID = (int)row["TTID"],
             PartnerID = (int)row["PartnerID"],
             Password = row["Password"].ToString(),
             WantTShirt = tshirt,
             WantAccomodation = accomodation,
             EmailID = row["EmailID"].ToString(),
             ContactNo = row["ContactNo"].ToString(),
             StudentNo = row["StudentNo"].ToString(),
             Gender = (GenderType)Enum.Parse(typeof(GenderType), row["GenderID"].ToString()),
             Branch = (BranchType)Enum.Parse(typeof(BranchType), row["BranchID"].ToString()),
             Year = int.Parse(row["Year"].ToString()),
             CollegeID = int.Parse(row["CollegeID"].ToString())
         };
         return participant;
     }
     else
     {
         return null;
     }
 }
 public static bool UpdateParticipantDetails(Participant participant)
 {
     return ParticipantRepository.UpdateParticipantDetails(participant);
 }
Exemplo n.º 6
0
 public static int InsertParticipantDetails(Participant participant)
 {
     return(ParticipantRepository.InsertParticipantDetails(participant));
 }
Exemplo n.º 7
0
 public static bool UpdateParticipantDetails(Participant participant)
 {
     return(ParticipantRepository.UpdateParticipantDetails(participant));
 }