private void bunifuFlatButton1_Click_1(object sender, EventArgs e) { if (!bunifuCheckbox1.Checked) { yearsec.Text = "Non-Student"; _collegeCode = "N/A"; } if (fullname.Text.Trim().Length < 6) { MessageBox.Show("Please validate your fields"); } else { try { // Check if event is open SqlUtils.ExecuteInsert("insert into attendee(attendee_fullname,attendee_yrsec,college_code,eventid,attendee_present) values (@name,@yrsec,@code,@id,@present)", new string[] { "@name", "@yrsec", "@code", "@id", "@present" }, new string[] { fullname.Text.Trim(), yearsec.Text.Trim(), bunifuCheckbox1.Checked == false ? "N/A" : college.selectedValue, UserInfo.EventId.ToString(), "0" }); var rd = SqlUtils.ExecuteQueryReader("select attendee_id from attendee order by attendee_id", false); string Id = ""; while (rd.Read()) { Id = Convert.ToString(rd["attendee_id"]); } // Update event int registered = 0; var reader = SqlUtils.ExecuteQueryReader("select count(*) as registered from attendee where eventid=" + UserInfo.EventId, false); while (reader.Read()) { registered = (int)reader["registered"]; } SqlUtils.ExecuteQuery("update custom_event set event_registered=" + registered + " where eventid=" + UserInfo.EventId, false); var Generator = new uGenerate(fullname.Text); RegisterPanel.Controls.Add(Generator); Generator.Serialize(Id); Generator.Dock = DockStyle.Fill; Generator.BringToFront(); } catch (Exception ex) { MessageBox.Show("Please add 'N/A' in college code and 'Non-Student' in description under Manage College Section of this dashboard. Otherwise addition will going to fail." + ex.Message, "Incomplete Setup: College"); } } }
// Update Button private void bunifuFlatButton1_Click(object sender, EventArgs e) { if (fullname.Text.Trim().Length > 6) { string attendeeName = AttendeeNames.selectedValue.Trim(); int id = attendeeName.IndexOf(':'); int attendee = Convert.ToInt32(attendeeName.Substring(0, id)); try { SqlUtils.ExecuteInsert("update attendee set attendee_fullname=@full,attendee_yrsec=@yrsec,college_code=@code where attendee_id=@aid", new string[] { "@full", "@yrsec", "@code", "@aid" }, new string[] { fullname.Text.Trim(), bunifuCheckbox1.Checked.Equals(false) ? "Non-Student" : yearsec.Text.Trim(), bunifuCheckbox1.Checked.Equals(false) ? "N/A":college.Items[college.SelectedIndex].ToString(), attendee.ToString() }); uGenerate Generator = new uGenerate(fullname.Text); Controls.Add(Generator); Generator.Serialize(UniversalAttendeeId); Generator.Dock = DockStyle.Fill; Generator.BringToFront(); } catch (SqlException ex) { MessageBox.Show(ex.Message); } } }