private void btnSatisfied_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Chat history will be cleared.", "Alert!", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { SqlConnection con1 = new SqlConnection(connectionString); string sql1 = "DELETE FROM CHAT WHERE ChatID = @chatid"; SqlCommand cm1 = new SqlCommand(sql1, con1); con1.Open(); cm1.Parameters.AddWithValue("@chatid", chatID); cm1.ExecuteNonQuery(); con1.Close(); MessageBox.Show("Chat as been deleted"); this.Close(); ShowAllChat openShowAllChat = new ShowAllChat(); openShowAllChat.Show(); } else if (dialogResult == DialogResult.No) { } }
private void btnCancel_Click(object sender, EventArgs e) { if (ViewAll.LoginInfo.UserRole == "T") { if (ViewAll.LoginInfo.TourID != "") { this.Close(); ViewTour openViewTour = new ViewTour(); openViewTour.Show(); } else { this.Close(); ShowAllChat openAllChat = new ShowAllChat(); openAllChat.Show(); } } else if (ViewAll.LoginInfo.UserRole == "TG") { ShowAllChat openAllChat = new ShowAllChat(); openAllChat.Show(); this.Close(); } }