示例#1
0
 private void btnViewUser_Click(object sender, EventArgs e)
 {
     try
     {
         if (selectedAccount.roleID == 3)
         {
             DetailInfo detail = new DetailInfo(selectedAccount, 1);
             detail.ShowDialog();
             selectedAccount.roleID = Convert.ToInt32(FoodN.DAO.LoginDAO.getAdminLogin(selectedAccount.accountName, selectedAccount.accountPass).Rows[0][3].ToString());
         }
         else
         {
             DetailInfo detailInfo = new DetailInfo(Entity.UserDisplay.getUserByAccountID(selectedAccount.accountID), selectedAccount, 1);
             detailInfo.ShowDialog();
             selectedAccount.roleID = Convert.ToInt32(FoodN.DAO.LoginDAO.getAdminLogin(selectedAccount.accountName, selectedAccount.accountPass).Rows[0][3].ToString());
         }
         mainScreen();
     }
     catch
     {
         MessageBox.Show("Your account didn't fill all the information");
     }
 }
示例#2
0
 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!!");
     }
 }