private void PhysicalInsert()
        {
            if (txtPhysicalName.Text != "" &&
                txtNotePhysical.Text != "" &&
                dtPhysicalDate.Text != "")
            {
                DataConnect.PhysicalAssessment entity = new DataConnect.PhysicalAssessment();
                entity.Date = DateTime.Parse(dtPhysicalDate.EditValue.ToString());
                entity.Name = txtPhysicalName.Text;
                entity.Note = txtNotePhysical.Text;

                entity.Status = true;

                PhysicalAssessmentDAO m_PhysicalDAO = new PhysicalAssessmentDAO();
                if (iFunction == 1)
                {
                    if (m_PhysicalDAO.PhysicalInsert(entity) == true)
                    {
                        XtraMessageBox.Show("Thêm đợt cân đo thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        XtraMessageBox.Show("Hệ thống đã xảy ra lỗi", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (iFunction == 2)
                {
                    entity.PhysicalAssessmentID = physicalAssessment.PhysicalAssessmentID;
                    if (m_PhysicalDAO.PhysicalUpdate(entity) == true)
                    {
                        XtraMessageBox.Show("Cập nhật thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        XtraMessageBox.Show("Hệ thống đã xảy ra lỗi", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                XtraMessageBox.Show("Mời bạn nhập đầy đủ thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void PhysicalInsert()
        {
            DataConnect.PhysicalAssessment       entity  = new DataConnect.PhysicalAssessment();
            DataConnect.PhysicalAssessmentDetail entity2 = new DataConnect.PhysicalAssessmentDetail();

            if (iFunction == 1)
            {
                /*
                 *  int NewPhysicalID = m_PhysicalDAO.PhysicalInsert(entity);
                 *  if (NewPhysicalID > 0)
                 *  {
                 *      for (int i = 0; i < bandedGridView1.RowCount; i++)
                 *      {
                 *          entity2.PhysicalAssessmentID = NewPhysicalID;
                 *          entity2.StudentID = int.Parse(bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["StudentID"]).ToString());
                 *          entity2.Height = int.Parse(bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["Height"]).ToString());
                 *          entity2.Weight = int.Parse(bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["Weight"]).ToString());
                 *          entity2.HeightRating = bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["HeightRating"]).ToString();
                 *          entity2.WeightRating = bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["WeightRating"]).ToString();
                 *          entity2.Note = bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["NoteDetail"]).ToString();
                 *          entity2.Status = true;
                 *          if (m_PhysicalDetailDAO.PhysicalDetailInsert(entity2) == true)
                 *          {
                 *
                 *          }
                 *          else
                 *          {
                 *              XtraMessageBox.Show("Bản ghi " + i + "bị lỗi");
                 *              break;
                 *          }
                 *      }
                 *      XtraMessageBox.Show("Thêm kết quả cân đo thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 *      DialogResult = DialogResult.OK;
                 *      this.Close();
                 *  }
                 *  else
                 *  {
                 *      XtraMessageBox.Show("Hệ thống đã xảy ra lỗi", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 *  }
                 */
            }
            else if (iFunction == 2)
            {
                for (int i = 0; i < bandedGridView1.RowCount; i++)
                {
                    entity.PhysicalAssessmentID       = m_PhysicalTable.PhysicalAssessmentID;
                    entity2.PhysicalAssessmentDeailID = (int)(bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["PhysicalAssessmentDetailID"]));
                    entity2.PhysicalAssessmentID      = m_PhysicalTable.PhysicalAssessmentID;
                    entity2.StudentID    = int.Parse(bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["StudentID"]).ToString());
                    entity2.Height       = int.Parse(bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["Height"]).ToString());
                    entity2.Weight       = int.Parse(bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["Weight"]).ToString());
                    entity2.HeightRating = bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["HeightRating"]).ToString();
                    entity2.WeightRating = bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["WeightRating"]).ToString();
                    entity2.Note         = bandedGridView1.GetRowCellValue(i, bandedGridView1.Columns["NoteDetail"]).ToString();
                    entity2.Status       = true;
                    if (m_PhysicalDetailDAO.PhysicalDetailUpdate(entity2) == true)
                    {
                    }
                    else
                    {
                        XtraMessageBox.Show("Bản ghi " + i + "bị lỗi");
                        break;
                    }
                }
                XtraMessageBox.Show("Cập nhật thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                XtraMessageBox.Show("Hệ thống đã xảy ra lỗi", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }