// delte meber public void DeleteMemeber(UpdateMemberDB objt) { DBConnection mycon = new DBConnection(); String SQL = "delete from Member where MemberID='" + objt.NICNumber + "'"; mycon.addvalues(SQL); }
private void buttonDelete_Click(object sender, EventArgs e) {// delete button coding try { UpdateMemberDB objt = new UpdateMemberDB(); String NicNumber; NicNumber = dataGridViewUpdateMember.SelectedCells[0].Value.ToString(); objt.NICNumber1 = NicNumber; objt.DeleteMemeber(objt); } catch (Exception ex) { MessageBox.Show(ex.Message); } // refersh table try { UpdateMemberDB obj = new UpdateMemberDB(); SqlDataReader DR = obj.getMemberInfo(); DataTable dt = new DataTable(); dt.Columns.Add("MemberID"); dt.Columns.Add("FristName"); dt.Columns.Add("LastName"); dt.Columns.Add("Email"); dt.Columns.Add("MemberPassword"); dt.Columns.Add("gender"); dt.Columns.Add("Adress"); dt.Columns.Add("Phone_Number"); dt.Columns.Add("Registerdate"); dt.Columns.Add("Registationfee"); while (DR.Read()) { DataRow row = dt.NewRow(); row["MemberID"] = DR["MemberID"]; row["FristName"] = DR["FristName"]; row["LastName"] = DR["LastName"]; row["Email"] = DR["Email"]; row["MemberPassword"] = DR["MemberPassword"]; row["gender"] = DR["gender"]; row["Adress"] = DR["Adress"]; row["Phone_Number"] = DR["Phone_Number"]; row["Registerdate"] = DR["Registerdate"]; row["Registationfee"] = DR["Registationfee"]; dt.Rows.Add(row); } dataGridViewUpdateMember.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message); } textBoxFristName.Text = ""; textBoxLastName.Text = ""; textBoxEmail.Text = ""; textBoxPassword.Text = ""; textBoxConfirmpassword.Text = ""; richTextBoxAdress.Text = ""; textBoxPhonenumber.Text = ""; textBoxRegistraionFee.Text = ""; }
public void enterupdateMemeber(UpdateMemberDB obj) { // Update Members details String SQL = "update Member set FristName='" + obj.FristName + "',LastName='" + obj.LastName + "',Email='" + obj.Email + "',MemberPassword='******',gender='" + obj.Gender + "',Adress ='" + obj.Address + "',Phone_Number='" + obj.Phonenumber + "',Registationfee='" + obj.Registarationfee + "'where MemberID='" + obj.NICNumber + "'"; DBConnection mycon = new DBConnection(); mycon.addvalues(SQL); }
private void dataGridViewUpdateMember_CellClick(object sender, DataGridViewCellEventArgs e) { // getting selected member details try { String NICNO; NICNO = dataGridViewUpdateMember.SelectedCells[0].Value.ToString(); UpdateMemberDB obj = new UpdateMemberDB(); SqlDataReader DR = obj.getupdateMemberInfo(NICNO); DataTable dt = new DataTable(); dt.Columns.Add("MemberID"); dt.Columns.Add("FristName"); dt.Columns.Add("LastName"); dt.Columns.Add("Email"); dt.Columns.Add("MemberPassword"); dt.Columns.Add("gender"); dt.Columns.Add("Adress"); dt.Columns.Add("Phone_Number"); // dt.Columns.Add("Registerdate"); dt.Columns.Add("Registationfee"); while (DR.Read()) { DataRow row = dt.NewRow(); // row["MemberID"] = DR["MemberID"]; textBoxFristName.Text = DR["FristName"].ToString(); textBoxLastName.Text = DR["LastName"].ToString(); textBoxEmail.Text = DR["Email"].ToString(); textBoxPassword.Text = DR["MemberPassword"].ToString(); textBoxConfirmpassword.Text = DR["MemberPassword"].ToString(); comboBoxGender.Text = DR["gender"].ToString(); richTextBoxAdress.Text = DR["Adress"].ToString(); textBoxPhonenumber.Text = DR["Phone_Number"].ToString(); textBoxRegistraionFee.Text = DR["Registationfee"].ToString(); dt.Rows.Add(row); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void textBoxSearchMember_KeyUp(object sender, KeyEventArgs e) { // serach Member details try { UpdateMemberDB objt = new UpdateMemberDB(); SqlDataReader DR = objt.SearchMember(textBoxSearchMember.Text); DataTable dt = new DataTable(); dt.Columns.Add("MemberID"); dt.Columns.Add("FristName"); dt.Columns.Add("LastName"); dt.Columns.Add("Email"); dt.Columns.Add("MemberPassword"); dt.Columns.Add("gender"); dt.Columns.Add("Adress"); dt.Columns.Add("Phone_Number"); dt.Columns.Add("Registerdate"); dt.Columns.Add("Registationfee"); while (DR.Read()) { DataRow row = dt.NewRow(); row["MemberID"] = DR["MemberID"]; row["FristName"] = DR["FristName"]; row["LastName"] = DR["LastName"]; row["Email"] = DR["Email"]; row["MemberPassword"] = DR["MemberPassword"]; row["gender"] = DR["gender"]; row["Adress"] = DR["Adress"]; row["Phone_Number"] = DR["Phone_Number"]; row["Registerdate"] = DR["Registerdate"]; row["Registationfee"] = DR["Registationfee"]; dt.Rows.Add(row); } dataGridViewUpdateMember.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void UpdateMember_Load(object sender, EventArgs e) { // geeting memeber details and display datagird view try { UpdateMemberDB obj = new UpdateMemberDB(); SqlDataReader DR = obj.getMemberInfo(); DataTable dt = new DataTable(); dt.Columns.Add("MemberID"); dt.Columns.Add("FristName"); dt.Columns.Add("LastName"); dt.Columns.Add("Email"); dt.Columns.Add("MemberPassword"); dt.Columns.Add("gender"); dt.Columns.Add("Adress"); dt.Columns.Add("Phone_Number"); dt.Columns.Add("Registerdate"); dt.Columns.Add("Registationfee"); while (DR.Read()) { DataRow row = dt.NewRow(); row["MemberID"] = DR["MemberID"]; row["FristName"] = DR["FristName"]; row["LastName"] = DR["LastName"]; row["Email"] = DR["Email"]; row["MemberPassword"] = DR["MemberPassword"]; row["gender"] = DR["gender"]; row["Adress"] = DR["Adress"]; row["Phone_Number"] = DR["Phone_Number"]; row["Registerdate"] = DR["Registerdate"]; row["Registationfee"] = DR["Registationfee"]; dt.Rows.Add(row); } dataGridViewUpdateMember.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, EventArgs e) {// update button// Empty filed val;idation if (textBoxFristName.Text == "") { MessageBox.Show("Insert Frist Name", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (textBoxLastName.Text == "") { MessageBox.Show("Insert Last Name", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (textBoxEmail.Text == "") { MessageBox.Show("Insert Email", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (textBoxPassword.Text == "") { MessageBox.Show("Insert password", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (textBoxConfirmpassword.Text == "") { MessageBox.Show("Insert Confirm Password", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (richTextBoxAdress.Text == "") { MessageBox.Show("Insert Adress", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (textBoxPhonenumber.Text == "") { MessageBox.Show("Insert PhoneNumber", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (textBoxRegistraionFee.Text == "") { MessageBox.Show("Insert RegistrationFee", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { UpdateMemberDB obj = new UpdateMemberDB(); String NICNO; NICNO = dataGridViewUpdateMember.SelectedCells[0].Value.ToString(); obj.NICNumber1 = NICNO; obj.FristName1 = textBoxFristName.Text; obj.LastName1 = textBoxLastName.Text; obj.Email1 = textBoxEmail.Text; obj.Password = textBoxPassword.Text; obj.Gender1 = comboBoxGender.Text; obj.Address1 = richTextBoxAdress.Text; obj.Phonenumber1 = Convert.ToInt32(textBoxPhonenumber.Text); obj.Registarationfee1 = Convert.ToDouble(textBoxRegistraionFee.Text); obj.enterupdateMemeber(obj); } // refresh table try { UpdateMemberDB objt = new UpdateMemberDB(); SqlDataReader DR = objt.getMemberInfo(); DataTable dt = new DataTable(); dt.Columns.Add("MemberID"); dt.Columns.Add("FristName"); dt.Columns.Add("LastName"); dt.Columns.Add("Email"); dt.Columns.Add("MemberPassword"); dt.Columns.Add("gender"); dt.Columns.Add("Adress"); dt.Columns.Add("Phone_Number"); dt.Columns.Add("Registerdate"); dt.Columns.Add("Registationfee"); while (DR.Read()) { DataRow row = dt.NewRow(); row["MemberID"] = DR["MemberID"]; row["FristName"] = DR["FristName"]; row["LastName"] = DR["LastName"]; row["Email"] = DR["Email"]; row["MemberPassword"] = DR["MemberPassword"]; row["gender"] = DR["gender"]; row["Adress"] = DR["Adress"]; row["Phone_Number"] = DR["Phone_Number"]; row["Registerdate"] = DR["Registerdate"]; row["Registationfee"] = DR["Registationfee"]; dt.Rows.Add(row); } dataGridViewUpdateMember.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message); } //send email try { SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587); smtp.EnableSsl = true; smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential("*****@*****.**", "ishpvi928280"); MailMessage mail = new MailMessage("*****@*****.**", textBoxEmail.Text, "Your detalis has been updated get mor info please contact administor!!Your loinid is Your NIC Number and password given bellow ", textBoxConfirmpassword.Text); mail.Priority = MailPriority.High; smtp.Send(mail); MessageBox.Show("Mail Send"); } catch (Exception ex) { MessageBox.Show(ex.Message); } // Clear textfileds // textBoxNICNumber.Text = ""; textBoxFristName.Text = ""; textBoxLastName.Text = ""; textBoxEmail.Text = ""; textBoxPassword.Text = ""; textBoxConfirmpassword.Text = ""; richTextBoxAdress.Text = ""; textBoxPhonenumber.Text = ""; textBoxRegistraionFee.Text = ""; }