private void deleteButton_Click(object sender, EventArgs e) { addMember addMemberOBj = new addMember(); addMemberOBj.mID = int.Parse(mIDTextBox.Text); addMemberOBj.name = nameTextBox.Text; addMemberOBj.contactNo = contactNoTextBox.Text; addMemberOBj.email = emailTextBox.Text; addMemberOBj.address = addressTextBox.Text; addMemberBL addMemberBLOBj = new addMemberBL(); bool result = addMemberBLOBj.DeleteMemberFromBL(addMemberOBj); if (result) { MessageBox.Show("Succesfully Delete!!!!"); CleanTextBar(); this.PopulateGridView(); } else { MessageBox.Show("ERROR!!", "Alert!!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); } }
private void addButton_Click(object sender, EventArgs e) { addMember addMemberOBj = new addMember(); addMemberOBj.mID = int.Parse(mIDTextBox.Text); addMemberOBj.name = nameTextBox.Text; addMemberOBj.contactNo = contactNoTextBox.Text; addMemberOBj.email = emailTextBox.Text; addMemberOBj.address = addressTextBox.Text; addMemberBL addMemberBLOBj = new addMemberBL(); bool result = addMemberBLOBj.ValidateNewMemberAndSendToDA(addMemberOBj); if (result) { MessageBox.Show("Succesful Added!!!!"); CleanTextBar(); this.PopulateGridView(); //tSSLabel1.Text = "Succesfull!!"; // label1.Text = rowsAffected + " Rows Succesfull!!!!!!!!!!"; } else { MessageBox.Show("ERROR!!", "Alert!!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); } }
public bool DeleteMemberFromBL(addMember addMemberOBj) { if (addMemberOBj.mID == 0 || addMemberOBj.name == "" || addMemberOBj.contactNo == "" || addMemberOBj.email == "" || addMemberOBj.address == "") { return(false); } else { addMemberDA addMemberDAobj = new addMemberDA(); bool result = addMemberDAobj.DeleteMemberFromDB(addMemberOBj); return(result); } }
public bool UpdateMemberAndSendToBL(addMember addMemberOBj) { if (addMemberOBj.mID == 0 || addMemberOBj.name == "" || addMemberOBj.contactNo == "" || addMemberOBj.email == "" || addMemberOBj.address == "") { return(false); } else { addMemberDA addMemberDAobj = new addMemberDA(); bool result = addMemberDAobj.UpdateMemberToDB(addMemberOBj); return(result); } }
public bool DeleteMemberFromDB(addMember addMemberOBj) { SqlConnection connection = DatabaseConnection.OpenAnSqlConnection(); string query = "DELETE WHERE MID =" + addMemberOBj.mID + ""; SqlCommand command = new SqlCommand(query, connection); int rowsAffected = command.ExecuteNonQuery(); if (rowsAffected == 1) { return(true); } else { return(false); } }
public bool UpdateMemberToDB(addMember addMemberOBj) { SqlConnection connection = DatabaseConnection.OpenAnSqlConnection(); string query = "UPDATE Member SET Name ='" + addMemberOBj.name + "', ContactNo='" + addMemberOBj.contactNo + "', Email ='" + addMemberOBj.email + "' , Address ='" + addMemberOBj.address + "' WHERE MID =" + addMemberOBj.mID + ""; SqlCommand command = new SqlCommand(query, connection); int rowsAffected = command.ExecuteNonQuery(); if (rowsAffected == 1) { return(true); } else { return(false); } }
public bool SaveNewMemberToDB(addMember addMemberOBj) { SqlConnection connection = DatabaseConnection.OpenAnSqlConnection(); string query = "INSERT INTO Member VALUES(" + addMemberOBj.mID + ",'" + addMemberOBj.name + "','" + addMemberOBj.contactNo + "','" + addMemberOBj.email + "' ,'" + addMemberOBj.address + "')"; SqlCommand command = new SqlCommand(query, connection); int rowsAffected = command.ExecuteNonQuery(); if (rowsAffected == 1) { return(true); } else { return(false); } }