예제 #1
0
        private void buttonXImportDataSet_Click(object sender, EventArgs e)
        {
            this.openFileDialogMain.Filter = "Excel file (*.xls)|*.xls";

            if (this.openFileDialogMain.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            this.textBoxXFilePathPreprocessing.Text = this.openFileDialogMain.FileName;

            DataTable dtNewDataSet = ReadDataFromExcelFile(this.openFileDialogMain.FileName);

            if ((datasetTA.CountRows() as int?) > 0)
            {
                DialogResult dR = MessageBox.Show("Hiện đã có dữ liệu!! Bạn có muốn nạp mới dữ liệu??"
                                                  , "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dR == DialogResult.No)
                {
                    return;
                }
            }

            datasetTA.DeleteAllData();
            datasetTempTA.DeleteAllData();
            bayesObjectTA.DeleteAll();

            DiabetesDataSet.DataSetDataTable dataSetDataTable = new DiabetesDataSet.DataSetDataTable();

            foreach (DataRow dtRow in dtNewDataSet.Rows)
            {
                var row = dataSetDataTable.NewDataSetRow();

                row["MaBn"]            = Convert.ToDecimal(dtRow["MaBn"]);
                row["HoTen"]           = dtRow["HoTen"].ToString();
                row["NamSinh"]         = Convert.ToDecimal(dtRow["NamSinh"]);
                row["NgayKham"]        = Convert.ToDateTime(dtRow["NgayKham"]);
                row["GioiTinh"]        = dtRow["GioiTinh"].ToString();
                row["Cholesterol"]     = Convert.ToDecimal(dtRow["Cholesterol"]);
                row["HDL_Cholesterol"] = Convert.ToDecimal(dtRow["HDL_Cholesterol"]);
                row["Triglyceride"]    = Convert.ToDecimal(dtRow["Triglyceride"]);
                row["LDL_Cholesterol"] = Convert.ToDecimal(dtRow["LDL_Cholesterol"]);
                row["Glucose"]         = Convert.ToDecimal(dtRow["Glucose"]);
                row["SGOT"]            = Convert.ToDecimal(dtRow["SGOT"]);
                row["SGPT"]            = Convert.ToDecimal(dtRow["SGPT"]);
                row["Urea"]            = Convert.ToDecimal(dtRow["Urea"]);
                row["WBC"]             = Convert.ToDecimal(dtRow["WBC"]);
                row["LYM"]             = Convert.ToDecimal(dtRow["LYM"]);
                row["MONO"]            = Convert.ToDecimal(dtRow["MONO"]);
                row["GRAN"]            = Convert.ToDecimal(dtRow["GRAN"]);
                row["TyLeLYM"]         = Convert.ToDecimal(dtRow["TyLeLYM"]);
                row["TyLeMONO"]        = Convert.ToDecimal(dtRow["TyLeMONO"]);
                row["TyLeGRAN"]        = Convert.ToDecimal(dtRow["TyLeGRAN"]);
                row["HGB"]             = Convert.ToDecimal(dtRow["HGB"]);
                row["RBC"]             = Convert.ToDecimal(dtRow["RBC"]);
                row["HTC"]             = Convert.ToDecimal(dtRow["HTC"]);
                row["MCV"]             = Convert.ToDecimal(dtRow["MCV"]);
                row["MCH"]             = Convert.ToDecimal(dtRow["MCH"]);
                row["MCHC"]            = Convert.ToDecimal(dtRow["MCHC"]);
                row["RDW_CV"]          = Convert.ToDecimal(dtRow["RDW_CV"]);
                row["PLT"]             = Convert.ToDecimal(dtRow["PLT"]);
                row["MPV"]             = Convert.ToDecimal(dtRow["MPV"]);
                row["PDW"]             = Convert.ToDecimal(dtRow["PDW"]);
                row["PCT"]             = Convert.ToDecimal(dtRow["PCT"]);
                row["Na"]        = Convert.ToDecimal(dtRow["Na"]);
                row["K"]         = Convert.ToDecimal(dtRow["K"]);
                row["Cl"]        = Convert.ToDecimal(dtRow["Cl"]);
                row["Ca"]        = Convert.ToDecimal(dtRow["Ca"]);
                row["TieuDuong"] = dtRow["TieuDuong"].ToString();

                dataSetDataTable.AddDataSetRow(row);
                //InsertDataSetRow(dtRow);
            }
            datasetTA.Update(dataSetDataTable);

            AgeDiscretization();
            GenderDiscretization();

            this.codification = null;

            ResetDataGridViewPreprocessingData();
        }
        private void buttonXImportDataSet_Click(object sender, EventArgs e)
        {
            this.openFileDialogMain.Filter = "Excel file (*.xls)|*.xls";

            if (this.openFileDialogMain.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            this.textBoxXFilePathPreprocessing.Text = this.openFileDialogMain.FileName;

            DataTable dtNewDataSet = ReadDataFromExcelFile(this.openFileDialogMain.FileName);

            if ((datasetTA.CountRows() as int?) > 0)
            {
                DialogResult dR = MessageBox.Show("Hiện đã có dữ liệu!! Bạn có muốn nạp mới dữ liệu??"
                    , "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dR == DialogResult.No)
                {
                    return;
                }
            }

            datasetTA.DeleteAllData();
            datasetTempTA.DeleteAllData();
            bayesObjectTA.DeleteAll();

            DiabetesDataSet.DataSetDataTable dataSetDataTable = new DiabetesDataSet.DataSetDataTable();

            foreach (DataRow dtRow in dtNewDataSet.Rows)
            {
                var row = dataSetDataTable.NewDataSetRow();

                row["MaBn"] = Convert.ToDecimal(dtRow["MaBn"]);
                row["HoTen"] = dtRow["HoTen"].ToString();
                row["NamSinh"] = Convert.ToDecimal(dtRow["NamSinh"]);
                row["NgayKham"] = Convert.ToDateTime(dtRow["NgayKham"]);
                row["GioiTinh"] = dtRow["GioiTinh"].ToString();
                row["Cholesterol"] = Convert.ToDecimal(dtRow["Cholesterol"]);
                row["HDL_Cholesterol"] = Convert.ToDecimal(dtRow["HDL_Cholesterol"]);
                row["Triglyceride"] = Convert.ToDecimal(dtRow["Triglyceride"]);
                row["LDL_Cholesterol"] = Convert.ToDecimal(dtRow["LDL_Cholesterol"]);
                row["Glucose"] = Convert.ToDecimal(dtRow["Glucose"]);
                row["SGOT"] = Convert.ToDecimal(dtRow["SGOT"]);
                row["SGPT"] = Convert.ToDecimal(dtRow["SGPT"]);
                row["Urea"] = Convert.ToDecimal(dtRow["Urea"]);
                row["WBC"] = Convert.ToDecimal(dtRow["WBC"]);
                row["LYM"] = Convert.ToDecimal(dtRow["LYM"]);
                row["MONO"] = Convert.ToDecimal(dtRow["MONO"]);
                row["GRAN"] = Convert.ToDecimal(dtRow["GRAN"]);
                row["TyLeLYM"] = Convert.ToDecimal(dtRow["TyLeLYM"]);
                row["TyLeMONO"] = Convert.ToDecimal(dtRow["TyLeMONO"]);
                row["TyLeGRAN"] = Convert.ToDecimal(dtRow["TyLeGRAN"]);
                row["HGB"] = Convert.ToDecimal(dtRow["HGB"]);
                row["RBC"] = Convert.ToDecimal(dtRow["RBC"]);
                row["HTC"] = Convert.ToDecimal(dtRow["HTC"]);
                row["MCV"] = Convert.ToDecimal(dtRow["MCV"]);
                row["MCH"] = Convert.ToDecimal(dtRow["MCH"]);
                row["MCHC"] = Convert.ToDecimal(dtRow["MCHC"]);
                row["RDW_CV"] = Convert.ToDecimal(dtRow["RDW_CV"]);
                row["PLT"] = Convert.ToDecimal(dtRow["PLT"]);
                row["MPV"] = Convert.ToDecimal(dtRow["MPV"]);
                row["PDW"] = Convert.ToDecimal(dtRow["PDW"]);
                row["PCT"] = Convert.ToDecimal(dtRow["PCT"]);
                row["Na"] = Convert.ToDecimal(dtRow["Na"]);
                row["K"] = Convert.ToDecimal(dtRow["K"]);
                row["Cl"] = Convert.ToDecimal(dtRow["Cl"]);
                row["Ca"] = Convert.ToDecimal(dtRow["Ca"]);
                row["TieuDuong"] = dtRow["TieuDuong"].ToString();

                dataSetDataTable.AddDataSetRow(row);
                //InsertDataSetRow(dtRow);
            }
            datasetTA.Update(dataSetDataTable);

            AgeDiscretization();
            GenderDiscretization();

            this.codification = null;

            ResetDataGridViewPreprocessingData();
        }