public void showHW(bool show, string[] content, int controlNumer) { DataRow rowReserve; DataRow rowLog; DataRow rowRecipe; if (this.InvokeRequired) { deleShowData DS = new deleShowData(showHW); this.Invoke(DS, new object[] { show, content, controlNumer }); } else { //have <END> if (show) { //not update if (controlNumer == 0) { //control == 2 4 6 8 .... if (control.showControl() % 2 == 0) { //query null if (content[0] == "QUERY_NULL") { HandleString handleString = new HandleString(); // two is reserve content = handleString.setQueryNull(2); } //add row on top rowReserve = dataTableReserve.NewRow(); rowReserve.ItemArray = content; dataTableReserve.Rows.InsertAt(rowReserve, 0); //which datagridview store or sh if (control.showControl() < 10) { //dataTable = showMessage WH_REC_dataGridView.DataSource = dataTableReserve; adjustDataGridView(WH_REC_dataGridView); WH_REC_dataGridView.Show(); } //SH reserve control = 10 else if (control.showControl() < 12) { showSHReserve(content); } // control = 12 else if (control.showControl() < 14) { AC_NAME(content, true); } // control = 14 else if (control.showControl() < 16) { stateShow(content); } // control = 16 else if (control.showControl() < 18) { modify_Recipe_Name(content, true); } // control = 18 else if (control.showControl() < 20) { //add row on top rowRecipe = dataTableAddRecipe.NewRow(); rowRecipe.ItemArray = content; dataTableAddRecipe.Rows.InsertAt(rowRecipe, 0); //showMessage = dataTable modify_allDataGridview.DataSource = dataTableAddRecipe; noSort(modify_allDataGridview); adjustDataGridView(modify_allDataGridview); modify_allDataGridview.Show(); } //control = 20 else if (control.showControl() < 22) { showDirectRecipe(content); } } //control = 1 3 5 7... else { //query null if (content[0] == "QUERY_NULL") { HandleString handleString = new HandleString(); // one is log content = handleString.setQueryNull(1); } //add row on top rowLog = dataTableLog.NewRow(); rowLog.ItemArray = content; dataTableLog.Rows.InsertAt(rowLog, 0); //which datagridview store or sh if (control.showControl() < 9) { //dataTable = showMessage WH_REC_dataGridView.DataSource = dataTableLog; adjustDataGridView(WH_REC_dataGridView); WH_REC_dataGridView.Show(); } //history control = 9 else if (control.showControl() < 11) { SH_REC_DataGridView.DataSource = dataTableLog; adjustDataGridView(SH_REC_DataGridView); SH_REC_DataGridView.Show(); } //now log of control = 11 else if (control.showControl() < 13) { SH_LOG_dataGridView.DataSource = dataTableLog; ; adjustDataGridView(SH_LOG_dataGridView); SH_LOG_dataGridView.Show(); }//control = 13 else if (control.showControl() < 15) { if (content[0] == "QUERY_NULL") { HandleString handleString = new HandleString(); // one is log content = handleString.setQueryNull(3); } //add row on top rowRecipe = dataTableRecipe.NewRow(); rowRecipe.ItemArray = content; dataTableRecipe.Rows.InsertAt(rowRecipe, 0); //dataTable = showMessage DB_Recipe_dataGridView.DataSource = dataTableRecipe; adjustDataGridView(DB_Recipe_dataGridView); DB_Recipe_dataGridView.Show(); } // control = 15 else if (control.showControl() < 17) { if (content[0] == "QUERY_NULL") { HandleString handleString = new HandleString(); // one is log content = handleString.setQueryNull(2); } //add row on top rowRecipe = dataTableAddRecipe.NewRow(); rowRecipe.ItemArray = content; dataTableAddRecipe.Rows.InsertAt(rowRecipe, 0); //dataTable = showMessage chooseRecipeDateGridView.DataSource = dataTableAddRecipe; noSort(chooseRecipeDateGridView); adjustDataGridView(chooseRecipeDateGridView); chooseRecipeDateGridView.Show(); } //control = 17 else if (control.showControl() < 19) { if (content[0] == "QUERY_NULL") { HandleString handleString = new HandleString(); // one is log content = handleString.setQueryNull(3); } //add row on top rowRecipe = dataTableRecipe.NewRow(); rowRecipe.ItemArray = content; dataTableRecipe.Rows.InsertAt(rowRecipe, 0); //dataTable = showMessage modifyDataGridview.DataSource = dataTableRecipe; adjustDataGridView(modifyDataGridview); modifyDataGridview.Show(); } //control = 19 else if (control.showControl() < 21) { //add row on top rowRecipe = dataTableAddRecipe.NewRow(); rowRecipe.ItemArray = content; dataTableAddRecipe.Rows.InsertAt(rowRecipe, 0); //showMessage = dataTable allSpiceDataGridView.DataSource = dataTableAddRecipe; noSort(allSpiceDataGridView); adjustDataGridView(allSpiceDataGridView); adjustButton(); allSpiceDataGridView.Show(); } //control = 21 else if (control.showControl() < 23) { directRecipeName(content,true); } } } //update else { //update same store if (controlNumer == control.showControl()) { if (control.showControl() % 2 == 0) { //control = 10 if (control.showControl() == 10) { showSHReserve(content); } //control = 20 if (control.showControl() == 20) { showDirectRecipe(content); } else { //delete material number same with new update string query = "物料編號 = '" + content[0] + "'"; DataRow[] dataRow = dataTableReserve.Select(query); // find the row not find no remove if (dataRow.Length > 0) { dataTableReserve.Rows.Remove(dataRow[0]); } //add row on top rowReserve = dataTableReserve.NewRow(); rowReserve.ItemArray = content; dataTableReserve.Rows.InsertAt(rowReserve, 0); //dataTable = showMessage WH_REC_dataGridView.DataSource = dataTableReserve; adjustDataGridView(WH_REC_dataGridView); WH_REC_dataGridView.Show(); } } //reserve else { //add top rowLog = dataTableLog.NewRow(); rowLog.ItemArray = content; dataTableLog.Rows.InsertAt(rowLog, 0); WH_REC_dataGridView.DataSource = dataTableLog; adjustDataGridView(WH_REC_dataGridView); WH_REC_dataGridView.Show(); } } } } //don't have <END> else { //control = 2 4 6 8 .... if (control.showControl() % 2 == 0) { //sh reserve if (control.showControl() == 10) { showSHReserve(content); } // ac_name list control == 12 else if (control.showControl() == 12) { AC_NAME(content); } else if (control.showControl() == 14) { stateShow(content); } else if (control.showControl() == 16) { modify_Recipe_Name(content); } else if (control.showControl() == 18) { //add row on top rowRecipe = dataTableAddRecipe.NewRow(); rowRecipe.ItemArray = content; dataTableAddRecipe.Rows.InsertAt(rowRecipe, 0); } else if (control.showControl() == 20) { showDirectRecipe(content); } //control = 2 4 6 8 else// { rowReserve = dataTableReserve.NewRow(); rowReserve.ItemArray = content; dataTableReserve.Rows.InsertAt(rowReserve, 0); } } //control = 1 3 5 7... else { if (control.showControl() < 13) { //dataTableLog.Rows.Add(content); //add row top rowLog = dataTableLog.NewRow(); rowLog.ItemArray = content; dataTableLog.Rows.InsertAt(rowLog, 0); } // control == 13 else if (control.showControl() < 15) { //add row top rowRecipe = dataTableRecipe.NewRow(); rowRecipe.ItemArray = content; dataTableRecipe.Rows.InsertAt(rowRecipe, 0); } //control == 15 else if (control.showControl() < 17) { rowRecipe = dataTableAddRecipe.NewRow(); rowRecipe.ItemArray = content; dataTableAddRecipe.Rows.InsertAt(rowRecipe, 0); } // control = 17 else if (control.showControl() < 19) { rowRecipe = dataTableRecipe.NewRow(); rowRecipe.ItemArray = content; dataTableRecipe.Rows.InsertAt(rowRecipe, 0); } //control = 19 else if (control.showControl() < 21) { //add row on top rowRecipe = dataTableAddRecipe.NewRow(); rowRecipe.ItemArray = content; dataTableAddRecipe.Rows.InsertAt(rowRecipe, 0); } //control = 21; else if (control.showControl() < 23) { directRecipeName(content); } } } } }
public TCPListener() { handleString = new HandleString(); }