private void btnViewProduct_Click(object sender, EventArgs e) { try { DetailNews detailNews = new DetailNews(selectedAccount, 1); detailNews.ShowDialog(); } catch { MessageBox.Show("Your account didn't fill all the information"); } }
private void InfoData_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (flag1 == true && flag2 == true) { if (InfoData.Columns[e.ColumnIndex].Name == "Delete") { DialogResult result = MessageBox.Show("Do you want to delete?", "Confirm!", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { FoodN.DAO.DeleteDAO.delUserByID(Convert.ToInt32(InfoData.Rows[e.RowIndex].Cells[0].Value.ToString()), Convert.ToInt32(InfoData.Rows[e.RowIndex].Cells[7].Value.ToString())); } } else { DetailInfo detailInfo = new DetailInfo(((List <FoodN.Entity.User>)InfoData.DataSource)[e.RowIndex], 0); detailInfo.ShowDialog(); } userData(); } if (flag1 == true && flag2 == false) { if (InfoData.Columns[e.ColumnIndex].Name == "Delete") { DialogResult result = MessageBox.Show("Do you want to delete?", "Confirm!", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { FoodN.DAO.DeleteDAO.delFood(Convert.ToInt32(InfoData.Rows[e.RowIndex].Cells[0].Value.ToString())); } } else { DetailNews detailNews = new DetailNews(((List <FoodN.Entity.Food>)InfoData.DataSource)[e.RowIndex], 0); detailNews.ShowDialog(); } foodData(); } if (flag1 == false && flag2 == true) { if (InfoData.Columns[e.ColumnIndex].Name == "Delete") { DialogResult result = MessageBox.Show("Do you want to delete?", "Confirm!", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { FoodN.DAO.DeleteDAO.delRequest(Convert.ToInt32(InfoData.Rows[e.RowIndex].Cells[0].Value.ToString())); } } else { Request request = new Request(((List <FoodN.Entity.Request>)InfoData.DataSource)[e.RowIndex]); request.ShowDialog(); } request(); } } catch { MessageBox.Show("Somebody touch my sapget!!"); } }