Exemplo n.º 1
0
 private void importGoldenDatacsvToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ImportGold importData = new ImportGold();
     importData.ShowDialog();
 }
Exemplo n.º 2
0
        private void buildKGUFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ImportGold bk = new ImportGold();
            bk.ShowDialog();

            #region ---
            //DataTable tblKGUData = new DataTable();
            //DataHeader tHeader = new DataHeader();
            //tHeader = _DataParse.Header;

            //#region *** Selected file ***
            //OpenFileDialog openfiledialog1 = new OpenFileDialog();
            //openfiledialog1.Title = "Open original KGU file";
            //if (openfiledialog1.ShowDialog() != DialogResult.OK) return;
            //string strfilename = openfiledialog1.FileName;

            //#endregion *** Selected file ***

            //#region *** Parsing data ***
            //lblBar.Text = "Building KGU file";
            //Application.DoEvents();
            //dgvData.DataSource = null;
            ////this.Refresh();
            //try
            //{
            //    tblKGUData = _DataParse.GetDataFromCsv(strfilename);
            //}
            //catch (Exception ex)
            //{
            //    throw new Exception(ex.Message);
            //}

            //#endregion *** Parsing data ***

            //#region *** Save file ***
            //SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            //saveFileDialog1.Title = "Build KGU file";
            ////saveFileDialog1.Filter = "CSV File|*.csv";

            //saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            //if (tblKGUData.Rows.Count == 0)
            //{
            //    MessageBox.Show("No Test data need to be saved", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}
            //saveFileDialog1.Title = "Save Test Data as";
            //saveFileDialog1.FileName = "";
            //if (saveFileDialog1.ShowDialog() != DialogResult.OK) return;

            //StreamWriter swData = new StreamWriter(saveFileDialog1.FileName);
            //StringBuilder sbContent = new StringBuilder();
            ////Header
            ////sbContent.Append(_DataParse.Header.

            //foreach (DataRow drTemp in tblKGUData.Rows)
            //{
            //    sbContent = new StringBuilder();
            //    int RowIndex = tblKGUData.Rows.IndexOf(drTemp);

            //    if (RowIndex == 0)
            //    {
            //        sbContent.Append("Test_Num ");
            //        for (int i = 3; i < tblKGUData.Columns.Count - 3; i++)
            //        {
            //            sbContent.Append(i - 2);
            //            sbContent.Append(" ");
            //        }
            //        swData.WriteLine(sbContent.ToString());

            //        sbContent = new StringBuilder();
            //        drTemp[2] = "Test_Item";
            //    }
            //    else if (RowIndex == 1)
            //    {
            //        drTemp[2] = "L_Tol";
            //    }
            //    else if (RowIndex == 2)
            //    {
            //        drTemp[2] = "H_Tol";
            //    }
            //    else if (RowIndex == 3)
            //    {
            //        drTemp[2] = "Enable";
            //    }

            //    for (int i = 2; i < tblKGUData.Columns.Count - 3; i++)
            //    {
            //        string strTemp;
            //        if (RowIndex == 0)
            //        {
            //            strTemp = drTemp[i].ToString().Replace(" ", "_");
            //        }
            //        else if (RowIndex == 1 || RowIndex == 2)
            //        {
            //            if (drTemp[i].ToString() == "")
            //                strTemp = "0";
            //            else
            //                strTemp = drTemp[i].ToString();
            //        }
            //        else
            //        {
            //            strTemp = drTemp[i].ToString();
            //        }

            //        sbContent.Append(strTemp);
            //        sbContent.Append(" ");
            //    }
            //    //sbContent.AppendLine(drTemp[tblKGUData.Columns.Count - 2].ToString());
            //    swData.WriteLine(sbContent.ToString());
            //}
            //swData.Close();
            //lblBar.Text = lblBar.Text + "...Done";

            //#endregion *** Save file ***

            //_DataParse.Header = tHeader;
            #endregion ---

        }
Exemplo n.º 3
0
        private void importGoldenDatacsvToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ImportGold importData = new ImportGold();

            importData.ShowDialog();
        }