private void StartBtn_Click(object sender, EventArgs e) { foreach (Participant addparticipant in selectedParticipants.getParticipants()) { participantsResponses.addParticipant(addparticipant); } foreach (Participant participant in participantsResponses.getParticipants()) { if (participant.getResponded() == false) { var fromAddress = new MailAddress("*****@*****.**", "From Meeting Scedular System"); var toAddress = new MailAddress(participant.getEmail(), participant.getName()); const string fromPassword = "******"; const string subject = "Respond with meeting constraints"; const string body = "You have been invited to a meeting please respond with your meeting your preferred and excluded dates and times."; var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; using (var message = new MailMessage(fromAddress, toAddress) { Subject = subject, Body = body }) { smtp.Send(message); } } } System.Windows.Forms.MessageBox.Show("Participants have been informed via their email"); MainGB.Visible = false; RespondersGB.Visible = true; updateDisplay(); }
private void moveparticipantsLeftBtn_Click(object sender, EventArgs e) { if (allParticipantListBox.SelectedItems.Count == 1) { int currentParticipantIndex = allParticipantListBox.SelectedIndex; Participant tempParticipant = allParticipants.getParticipants()[currentParticipantIndex]; bool found = false; foreach (Participant participant in selectedParticipants.getParticipants()) { if (tempParticipant == participant) { found = true; } } if (found == false) { selectedParticipants.addParticipant(tempParticipant); } } updateDisplay(); }
private void Form1_Load(object sender, EventArgs e) { /* * //DateTime dateTime = DateTime.ParseExact("2009-12-01 23:12:10", "yyyy-MM-dd HH:mm:ss", null); * string[] lines = System.IO.File.ReadAllLines(System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory.ToString(), "allParticipants.txt")); * * // Display the file contents by using a foreach loop. * int lineNum = 1; * foreach (string line in lines) * { * if(line == "#") * { * Participant loadParticipant = new Participant(); * lineNum = 0; * } * //while (nextParticipant == false) * * if (lineNum == 1) * { * loadParticipant.setName(line); * lineNum++; * } * if (lineNum == 2) * { * loadParticipant.setEmail(line); * lineNum++; * } * if (lineNum == 3) * { * //importance = line; * lineNum++; * } * if(lineNum == 4 && line == "ex") * { * lineNum++; * } * if(lineNum == 5) * { * if (line == "pre") * { * lineNum++; * } * else * { * DateTime newDate = DateTime.Parse(line); * loadParticipant.addExSetSlot(newDate); * } * * } * if(lineNum == 6) * { * if(line == "#") * { * lineNum++; * } * else * { * DateTime newDate = DateTime.Parse(line); * loadParticipant.addPreSet(newDate); * } * } * if (lineNum == 7) * { * allParticipants.addParticipant(loadParticipant); * lineNum = 1; * } * * * // Use a tab to indent each line of the file. * * Console.WriteLine("\t" + line); * } * * // Keep the console window open in debug mode. * Console.WriteLine("Press any key to exit."); * System.Console.ReadKey();*/ //load function Participant loadParticipant = new Participant(); loadParticipant.setName("bob"); loadParticipant.setEmail("*****@*****.**"); allParticipants.addParticipant(loadParticipant); loadParticipant = new Participant(); loadParticipant.setName("alan"); loadParticipant.setEmail("*****@*****.**"); allParticipants.addParticipant(loadParticipant); RespondersGB.Visible = false; AddPartcipantGB.Visible = false; availableDatesGB.Visible = false; updateDisplay(); }