Beispiel #1
0
        private void InsertStudent()
        {
            HealthExaminationDetail    entity          = new HealthExaminationDetail();
            HealthExaminationDetailDAO m_HealthExamDAO = new HealthExaminationDetailDAO();

            if (iFunction == 1)
            {
                int   a1 = gridView1.SelectedRowsCount;
                int[] a  = gridView1.GetSelectedRows();
                for (int i = 0; i < a1; i++)
                {
                    entity.StudentID           = (int)gridView1.GetRowCellValue(a[i], gridView1.Columns["StudentID"]);
                    entity.HealthExaminationID = healthExamination.HealthExaminationID;
                    entity.HealthInsurance     = "-- Chọn loại bảo hiểm --";
                    entity.Height = 1;
                    entity.Weight = 1;
                    entity.Rating = "Chưa đánh giá";
                    entity.Status = false;
                    if (m_HealthExamDAO.HealthDetailInsert(entity) == true)
                    {
                    }
                    else
                    {
                        XtraMessageBox.Show("Bản ghi " + i + "bị lỗi");
                    }
                }
                XtraMessageBox.Show("Thêm kết quả khám sức khỏe thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
                this.Close();
            }
        }
        private void frmAddHealthDetailInsert()
        {
            if (lblStudentName.Text != ""
                //txtStudentCode.Text != "" &&
                // txtStudentID.Text != ""
                )
            {
                DataConnect.HealthExaminationDetail entity = new DataConnect.HealthExaminationDetail();
                entity.StudentID           = int.Parse(Student.StudentID.ToString());
                entity.HealthExaminationID = int.Parse(healthExamination.HealthExaminationID.ToString());
                entity.HealthInsurance     = 1;
                entity.Height           = int.Parse(txtHeight.Text);
                entity.Weight           = int.Parse(txtWeight.Text);
                entity.Eyes             = cmbEyesRating.Text;
                entity.ENT              = cmbENTRating.Text;
                entity.Oral             = cmbOralRating.Text;
                entity.InternalMedicine = cmbInternalMedicineRating.Text;
                entity.Surgery          = cmbSurgeryRating.Text;
                entity.Dermatology      = cmbDermatologyRating.Text;
                entity.BoneMuscle       = cmbBoneMuscleRating.Text;
                entity.Nerve            = cmbNerveRating.Text;
                entity.Endocrine        = cmbEndocrineRating.Text;
                entity.Other            = txtOtherRating.Text;
                entity.Rating           = double.Parse(cmbRating.Text);
                entity.Note             = txtNote.Text;
                entity.Status           = chbStatus.Checked ? true : false;

                HealthExaminationDetailDAO m_HealthExamDAO = new HealthExaminationDetailDAO();
                if (iFunction == 1)
                {
                    if (m_HealthExamDAO.HealthDetailInsert(entity) == true)
                    {
                        XtraMessageBox.Show("Thêm kết quả khám sức khỏe 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.HealthExaminationDetailID = m_HealthExaminationDetail.HealthExaminationDetailID;
                    if (m_HealthExamDAO.HealthDetailUpdate(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);
            }
        }