protected void DBInit() { clsMySQL db = new clsMySQL(); string strQuerySQL = "Select * from npiManual "; if (text_Cust.Text != "") { strQuerySQL = strQuerySQL + "Where New_Customer like'%" + text_Cust.Text.Trim() + "%'"; if (text_Devi.Text != "") { strQuerySQL = strQuerySQL + " and New_Device like '%" + text_Devi.Text.Trim() + "%'"; } } else { if (text_Devi.Text != "") { strQuerySQL = strQuerySQL + "Where New_Device like '%" + text_Devi.Text.Trim() + "%'"; } } try { clsMySQL.DBReply dr = db.QueryDS(strQuerySQL); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); } catch (Exception ex) { lblError.Text = "[Error Message, ButSearch] : " + ex.ToString(); } }
protected void butSearch_Click(object sender, EventArgs e) { clsMySQL db = new clsMySQL(); string strQuerySQL = "Select * from npiManual "; if (text_Cust.Text != "") { strQuerySQL = strQuerySQL + "Where New_Customer like'%" + text_Cust.Text.Trim() + "%'"; if (text_Devi.Text != "") { strQuerySQL = strQuerySQL + " and New_Device like '%" + text_Devi.Text.Trim() + "%'"; } } else { if (text_Devi.Text != "") { strQuerySQL = strQuerySQL + "Where New_Device like '%" + text_Devi.Text.Trim() + "%'"; } } try { clsMySQL.DBReply dr = db.QueryDS(strQuerySQL); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); } catch (Exception ex) { lblError.Text = "[Error Message, ButSearch] : " + ex.ToString(); } }
public void DBint(string temp) { clsMySQL ds = new clsMySQL(); clsMySQL.DBReply dr = ds.QueryDS(temp); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); ds.Close(); }
protected void put_POR_Data(string sql) { clsMySQL db = new clsMySQL(); clsMySQL.DBReply dr = db.QueryDS(sql); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); }
protected void Search_Por_Sql(string porsql) { clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(porsql); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); }
protected void GD_CATE_PageIndexChanged(object sender, EventArgs e) { clsMySQL db = new clsMySQL(); clsMySQL.DBReply dr = db.QueryDS(global_sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); ddlBind(GD_CATE); db.Close(); }
protected void butSearch_Click(object sender, EventArgs e) { string cap_sql = "select * from npi_cap_ep where CAP_EP_Name ='" + Text_packge.Text + "'"; clsMySQL ds = new clsMySQL(); clsMySQL.DBReply dr = ds.QueryDS(cap_sql); GD_CAP.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CAP.DataBind(); ds.Close(); }
protected void butSearch_Click(object sender, EventArgs e) { string cap_sql = "select * from npieptra_cap_ea where CAP_EP_Name ='" + Text_packge.Text + "'"; clsMySQL ds = new clsMySQL(); clsMySQL.DBReply dr = ds.QueryDS(cap_sql); GD_CAP.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CAP.DataBind(); ds.Close(); }
protected void GD_CATE_PageIndexChanged(object sender, EventArgs e) { string sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + cate_Stage_DDL.SelectedValue + "' OR ( EP_Cate_Cate='" + Text_Category.Text + "')"; clsMySQL db = new clsMySQL(); clsMySQL.DBReply dr = db.QueryDS(sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); ddlBind(GD_CATE); db.Close(); }
protected void DBint() { //string sql_cap = "select * from npi_ep_cap where like '" + Text_packge.Text.Trim() + "%'"; string sql_cap = "select * from npi_cap_ep "; clsMySQL ds = new clsMySQL(); clsMySQL.DBReply dr = ds.QueryDS(sql_cap); GD_CAP.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CAP.DataBind(); ds.Close(); }
protected void Search_Lv_Click1(object sender, EventArgs e) { string str_eptraver_main = "select * from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='Enable'"; //string str_eptraver_main_count = "select count(Ver_No) from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='" + DDList_Status.SelectedValue + "'"; // string str_eptraver_main = "select * from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='Enable'"; string Ver_name = rec_vername(str_eptraver_main); string sql_eptraver_main_sta = "select * from npieptra_lv_main_Status where Ver_Name='" + Ver_name + "' and Ver_Status='Enable' "; if (Customer_TB.Text.Trim() != "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>alert('您沒輸入New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() != "") { string strScript = string.Format("<script language='javascript'>alert('您沒輸入New_Customer條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>alert('您沒輸入New_Customer與New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (jude_Query_EPTRA(sql_eptraver_main_sta, Ver_name)) { Panel_gv1.Visible = true; Panel_gv2.Visible = false; clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(sql_eptraver_main_sta); gv_display_Lv_signoffdata.DataSource = dr.dsDataSet.Tables[0].DefaultView; gv_display_Lv_signoffdata.DataBind(); db.Close(); set_sta_srt("gv1"); } else if (!jude_Query_EPTRA(sql_eptraver_main_sta, Ver_name)) { Panel_gv1.Visible = false; Panel_gv2.Visible = false; string strScript = string.Format("<script language='javascript'>alert('" + Ver_name + "已被更改為Disable,請到TRA比對');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else { string strScript = string.Format("<script language='javascript'>alert('" + Ver_name + "還未送審!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } }
protected void butSearch_Click(object sender, EventArgs e) { clsMySQL db = new clsMySQL(); string sql_category = ""; sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + cate_Stage_DDL.SelectedValue + "'"; if (Text_Category.Text.Trim() != "" || Text_iit.Text.Trim() != "" || Text_sp.Text.Trim() != "" || Text_md.Text.Trim() != "" || Text_kp.Text.Trim() != "") { if (Text_Category.Text.Trim() != "") { sql_category += " and EP_Cate_Cate='" + Text_Category.Text + "'"; } if (Text_iit.Text.Trim() != "") { sql_category += " and EP_Cate_Iiitems='" + Text_iit.Text + "'"; } if (Text_sp.Text.Trim() != "") { sql_category += " and EP_Cate_SpeChar='" + Text_sp.Text + "'"; } if (Text_md.Text.Trim() != "") { sql_category += " and EP_Cate_Md='" + Text_md.Text + "'"; } if (Text_kp.Text.Trim() != "") { sql_category += " and EP_Cate_KP='" + Text_kp.Text + "'"; } } string stage_value = cate_Stage_DDL.SelectedValue; clsMySQL.DBReply dr = db.QueryDS(sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); if (GD_CATE.Rows.Count != 0) { ddlBind(GD_CATE); DropDownList ddlSelectPage = (DropDownList)GD_CATE.BottomPagerRow.FindControl("ddlSelectPage"); ddlSelectPage.SelectedIndex = 0; Label label_page = (Label)GD_CATE.BottomPagerRow.FindControl("lblcurPage"); label_page.Text = 1.ToString(); } db.Close(); }
protected void DBInit() { string strSQL = string.Format("SELECT * FROM npiimportdata"); try { clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(strSQL); db.Close(); } catch (Exception ex) { lblError.Text = "Exception Error Message---- " + ex.ToString() + ">>>>>>>>>>" + strSQL; } }
public void DBint(string temp) { //string temp = ""; //temp = Session["value_cate_stage"].ToString(); string sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + temp + "'"; clsMySQL ds = new clsMySQL(); clsMySQL.DBReply dr = ds.QueryDS(sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); ds.Close(); Session.Clear(); }
protected void up_lv_signoff_sta(string sign, int rowindex, string com) { string ver = GridView1.Rows[rowindex].Cells[2].Text; string Lv_Sign = Lv_sign.Value; string sign_Name = "jj"; clsMySQL db = new clsMySQL(); String update_Lv = string.Format("UPDATE npieptra_main_signoff_status " + "SET Signoff_Status='{0}',Signoff_Name='{1}',Signoff_Time=NOW(),Signoff_Command='{2}'" + "where Ver_Name='{3}' and Signoff_Status='{4}' " , sign, sign_Name, com, ver, "NA"); string str_eptraver_main_sta = "select * from npieptra_main_signoff_status where Ver_Name='" + ver + "'"; try { if (db.QueryExecuteNonQuery(update_Lv) == true) { if (Lv_Sign == "Acc") { string strScript = string.Format("<script language='javascript'>alert('" + ver + "簽核完成!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Lv_Sign == "Rej") { string strScript = string.Format("<script language='javascript'>alert('" + ver + "簽核完成!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } Panel_gv2.Visible = true; clsMySQL.DBReply dr = db.QueryDS(str_eptraver_main_sta); GridView2.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView2.DataBind(); set_sta_srt("gv2"); } else { lblError.Text = update_Lv; } } catch (Exception ex) { throw ex; } db.Close(); }
protected void receive_Lv(string filename, string stage, string keyitem) { string SpeChar = ""; string md = ""; string cate = ""; string key = ""; string str_sql = "select * from npieptra_lv_main where EPTRA_LV_Stage='" + stage + "' and EPTRA_KeyItem='" + keyitem + "' and Ver_Name='" + filename + "'"; clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(str_sql); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); }
protected void DBInit() { string strSQL = string.Format("SELECT * FROM npipor"); try { clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(strSQL); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); } catch (Exception ex) { lblError.Text = "Exception Error Message---- " + ex.ToString() + ">>>>>>>>>>" + strSQL; } }
protected void up_lv_signoff_sta(int RowIndex, string com) { string ver = gv_display_Lv_signoffdata.Rows[RowIndex].Cells[1].Text; string up_Name = "bruno"; clsMySQL db = new clsMySQL(); String update_Lv = string.Format("UPDATE npieptra_lv_main_status " + " SET Ver_Status='{0}',UpdateName='{1}',UpdateTime=NOW(),LV_Signoff_Status_Change_Command='{2}'" + "where Ver_Name='{3}' and Ver_Status='{4}'", "Disable", up_Name, com, ver, "Enable"); string str_eptraver_main_sta = "select * from npieptra_lv_main_Status where Ver_Name='" + ver + "'"; try { if (db.QueryExecuteNonQuery(update_Lv) == true) { Panel_gv1.Visible = false; Panel_gv2.Visible = true; clsMySQL.DBReply dr = db.QueryDS(str_eptraver_main_sta); signoff_gv2.DataSource = dr.dsDataSet.Tables[0].DefaultView; signoff_gv2.DataBind(); set_sta_srt("gv2"); } else { lblError.Text = update_Lv + db.ToString(); } } catch (Exception ex) { throw ex; } db.Close(); }
protected void btn_Search_Click(object sender, EventArgs e) { clsMySQL db = new clsMySQL(); Boolean bisWhereExist = false; string strQuerySQL = ""; lblError.Text = ""; if (ddl_Site.SelectedValue != "0" || ddl_PSV.SelectedValue != "0" || ddl_RSVI.SelectedValue != "0" || text_WaferTech.Text.Trim() != "" || text_Cust.Text.Trim() != "" || ddl_Fab.SelectedValue != "0" || text_PKG.Text.Trim() != "") { strQuerySQL = "Select * from npiPOR Where Stype='POR' "; bisWhereExist = true; } else { strQuerySQL = "Select * from npiPOR "; } if (ddl_Site.SelectedValue != "0") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_01 like'" + ddl_Site.SelectedValue + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_01 like'" + ddl_Site.SelectedValue + "%' "; } } if (text_PKG.Text.Trim() != "") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_02 like'" + text_PKG.Text.Trim() + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_02 like'" + text_PKG.Text.Trim() + "%' "; } } if (text_WaferTech.Text.Trim() != "") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_03 like'" + text_WaferTech.Text.Trim() + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_03 like'" + text_WaferTech.Text.Trim() + "%' "; } } if (ddl_Fab.SelectedValue != "0") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_04 like'" + ddl_Fab.SelectedValue + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_04 like'" + ddl_Fab.SelectedValue + "%' "; } } if (ddl_PSV.SelectedValue != "0") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_05 like'" + ddl_PSV.SelectedValue + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_05 like'" + ddl_PSV.SelectedValue + "%'"; } } if (ddl_RSVI.SelectedValue != "0") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_11 like'" + ddl_RSVI.SelectedValue + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_11 like'" + ddl_RSVI.SelectedValue + "%' "; } } if (text_Cust.Text.Trim() != "") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_14 like'" + text_Cust.Text.Trim() + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_14 like'" + text_Cust.Text.Trim() + "%' "; } } //lblError.Text = strQuerySQL; try { clsMySQL.DBReply dr = db.QueryDS(strQuerySQL); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); } catch (Exception ex) { lblError.Text = "[NPIPOR Function-Error Message, btn_Search_Click] : " + ex.ToString(); } }
protected void btnUpload_Click(object sender, EventArgs e) { string sheet_name = ""; int sheet_num; int dLastNum; int cate_items = 0; String Cate_Username = "******"; String Cate_Status = "Y"; DateTime dt = DateTime.Now; string inf_ID = ""; List<string> List_Inf_ID = new List<string>(); Boolean sign_count = false; /*List<string> Cate_Iiitems = new List<string>(); List<string> Cate_SpeChar = new List<string>(); List<string> Cate_Md = new List<string>(); List<string> Cate_Cate = new List<string>(); List<string> Cate_KP = new List<string>(); */ List<int> success_insert = new List<int>(); List<int> fail_insert = new List<int>(); int success_count = 0; int fail_count = 0; List<string> history_cate = new List<string>(); string fileName = ""; string time = ""; string count_sheet_name = ""; int debug_count=0; Boolean sign = false; Boolean sign_repeat = false; clsMySQL db = new clsMySQL(); try { fileName = Path.GetFileName(FileUploadToServer.PostedFile.FileName); //string filePath = Server.MapPath("~\\bruno\\FileUpload_Folder\\") + Path.GetFileName(FileUploadToServer.PostedFile.FileName); string filePath = Server.MapPath("FileUpload_Folder\\") + Path.GetFileName(FileUploadToServer.PostedFile.FileName); FileUploadToServer.SaveAs(filePath); if (CheckExcelFile(fileName)) { /* if (FileUploadToServer.HasFile) { } */ XSSFWorkbook wk = new XSSFWorkbook(FileUploadToServer.FileContent); XSSFSheet hst; XSSFRow hr; DataTable myDT = new DataTable(); sheet_num = wk.NumberOfSheets; for (int k = 0; k < sheet_num; k++) //從每張工作表開始做 { hst = (XSSFSheet)wk.GetSheetAt(k); cate_items = hst.LastRowNum; //每一張工作表有幾筆資料 sheet_name = hst.SheetName; if (k != sheet_num - 1) //顯示匯入的Stage有哪些 count_sheet_name += sheet_name + ","; else count_sheet_name += sheet_name; hr = (XSSFRow)hst.GetRow(0); dLastNum = hr.LastCellNum; //每一列的欄位數 /* for (int i = hr.FirstCellNum; i < hr.LastCellNum; i++) { if (hr.GetCell(i) != null) { DataColumn myColumn = new DataColumn(hr.GetCell(i).StringCellValue); myDT.Columns.Add(myColumn); } }*/ for (int j = 1; j <= cate_items; j++) { hr = (XSSFRow)hst.GetRow(j); //XSSFRow row = (XSSFRow) mySheet.GetRow(i); DataRow myrow = myDT.NewRow(); /*for(int i=1;i<dLastNum;i++) { //string strcell = hr.GetCell(i) == null ? "0" : hr.GetCell(i).ToString(); myrow = }*/ String insert_cate = string.Format("insert into npi_ep_category" + "(npi_EP_Cate_Username,npi_EP_Cate_UpdateTime,npi_EP_Cate_Status," + "EP_Cate_Stage,EP_Cate_Iiitems,EP_Cate_SpeChar," + "EP_Cate_Md,EP_Cate_Cate,EP_Cate_KP)values" + "('{0}',NOW(),'{1}'," + "'{2}','{3}','{4}','{5}','{6}','{7}')" , Cate_Username, Cate_Status, sheet_name, hr.GetCell(0), hr.GetCell(1), hr.GetCell(2), hr.GetCell(3), hr.GetCell(4)); string excel_sql = sheet_name +"|"+ hr.GetCell(0) + "|" + hr.GetCell(1) + "|" + hr.GetCell(2) + "|" + hr.GetCell(3) + "|" + hr.GetCell(4); Label1.Text = dt.ToString("yyyy/MM/dd hh:mm:ss"); time = Label1.Text; if (jude_npiepcategory_data(excel_sql, sheet_name) == true) { if (db.QueryExecuteNonQuery(insert_cate) == true) { success_count++; sign = true; } else { fail_count++; history_cate.Add(hr.GetCell(0) + "|" + hr.GetCell(1) + "|" + hr.GetCell(2) + "|" + hr.GetCell(3) + "|" + hr.GetCell(4)); } debug_count++; } else { List_Inf_ID.Add(Session["value_ID"].ToString()); sign_repeat = true; sign_count = true; } Session.Clear(); debug_count = 0; } } wk = null; hst = null; hr = null; } else { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "您選擇的[" + fileName + "]無法匯入,請重新選擇Excel檔案或檢查Excel檔案內容!!"; } /*string strScript2 = string.Format("<script language='javascript'>alert('完成匯入\\n成功匯入筆數:" + success_count + "\\n匯入的Stage:" + count_sheet_name + "');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript2);*/ Lab_item.Text = success_count.ToString(); Lab_Stage.Text = count_sheet_name; lblMsg.Text = fileName + "上傳成功!!"; System.IO.File.Delete(filePath); if (sign_count == true) { for (int i = 0; i < List_Inf_ID.Count; i++) { inf_ID += List_Inf_ID[i]; } string[] spilit_inf_id = inf_ID.Split(','); string strScript2 = string.Format("<script language='javascript'>alert('重複資料筆數:"+List_Inf_ID.Count.ToString()+"\\n資料重複編號:" + str_id(spilit_inf_id) + "');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript2); } } catch (Exception exfile) { lblMsg.ForeColor = System.Drawing.Color.Red; excp.Text = exfile.ToString(); if (fileName == "") { lblMsg.Text = "[Import Error Message] 請選擇要匯入的Excel檔案!!"; } else { lblMsg.Text = "[Import Error Message]您選擇的[" + fileName + "]無法匯入,請重新選擇Excel檔案或檢查Excel檔案內容!!"; } } finally { /*string strScript = string.Format("<script language='javascript'>alert('您沒有輸入Packge_Name!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);*/ } string sql_cate_datetime = "select * from npi_ep_category where npi_ep_category.npi_EP_Cate_UpdateTime >= DATE_FORMAT('" + time+ "', '%Y/%m/%d %H:%i:%s')"; //DATE_FORMAT('2016/04/28 11:26:00', '%Y/%m/%d %H:%i:%s') if (sign == true) { clsMySQL ds = new clsMySQL(); clsMySQL.DBReply dr = ds.QueryDS(sql_cate_datetime); gvRecord.DataSource = dr.dsDataSet.Tables[0].DefaultView; gvRecord.DataBind(); ds.Close(); } /*if(sign==true) { clsMySQL ds = new clsMySQL(); clsMySQL.DBReply dr = ds.QueryDS(sql_cate_datetime); gvRecord2.DataSource = dr.dsDataSet.Tables[0].DefaultView; gvRecord2.DataBind(); ds.Close(); }*/ }
protected void butSearch_Click(object sender, EventArgs e) { clsMySQL db = new clsMySQL(); string sql_category = ""; //sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + cate_Stage_DDL.SelectedValue + "'"; /*if (Text_Category.Text.Trim() != "" || Text_iit.Text.Trim() != "" || Text_sp.Text.Trim() != "" || * Text_md.Text.Trim() != "" || Text_kp.Text.Trim() != "") * { * * if (Text_Category.Text.Trim() != "") * { * sql_category += " and EP_Cate_Cate='" + Text_Category.Text + "'"; * } * if (Text_iit.Text.Trim() != "") * { * sql_category += " and EP_Cate_Iiitems='" + Text_iit.Text + "'"; * * } * if (Text_sp.Text.Trim() != "") * { * sql_category += " and EP_Cate_SpeChar='" + Text_sp.Text + "'"; * } * if (Text_md.Text.Trim() != "") * { * sql_category += " and EP_Cate_Md='" + Text_md.Text + "'"; * } * if (Text_kp.Text.Trim() != "") * { * sql_category += " and EP_Cate_KP='" + Text_kp.Text + "'"; * } * }*/ //global_sql_category = sql_category; //string stage_value = cate_Stage_DDL.SelectedValue; if (Stage == "") { string strScript = string.Format("<script language='javascript'>alert('Stage為必填項目!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else { clsMySQL.DBReply dr = db.QueryDS(global_sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); GD_CATE.PageIndex = 0; GridViewRow page = GD_CATE.BottomPagerRow; //如果要從GridView PagerTemplate抓取物件,使用此方法 Label mylabel = (Label)page.Cells[0].FindControl("lblcurPage"); mylabel.Text = Convert.ToString(GD_CATE.PageIndex + 1); if (GD_CATE.Rows.Count != 0) { ddlBind(GD_CATE); DropDownList ddlSelectPage = (DropDownList)GD_CATE.BottomPagerRow.FindControl("ddlSelectPage"); //ddlSelectPage.SelectedIndex = 0; Label label_page = (Label)GD_CATE.BottomPagerRow.FindControl("lblcurPage"); //label_page.Text = 1.ToString(); GD_CATE.PageIndex = 0; } db.Close(); } }
protected void Search_Device_Eptra_table(object sender, EventArgs e) { int count = 0; string str_eptraver_main = "select * from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='" + DDList_Status.SelectedValue + "'"; //string str_eptraver_main_count = "select count(Ver_No) from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='" + DDList_Status.SelectedValue + "'"; // string str_eptraver_main = "select * from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='Enable'"; count = count_eptramain(); if (Customer_TB.Text.Trim() != "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>error_msg('您沒輸入New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() != "") { string strScript = string.Format("<script language='javascript'>error_msg('您沒輸入New_Customer條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>error_msg('您沒輸入New_Customer與New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (jude_Query_EPTRA(str_eptraver_main) && count == 1) { /* Panel_EPTramain.Visible = true; receive_eptramain_data(str_eptraver_main); put_eptramain_data(); */ Panel_eptraview.Visible = true; clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(str_eptraver_main); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); } else if (jude_Query_EPTRA(str_eptraver_main) && count > 1) { Panel_eptraview.Visible = true; clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(str_eptraver_main); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); } else { string strScript = string.Format("<script language='javascript'>error_msg('無此版本!!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } /* clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(str_eptraver_main); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); */ }
protected void Search_Lv_Click1(object sender, EventArgs e) { clsMySQL db = new clsMySQL(); //Connection MySQL string sql_rec_npieptra_main_status = "select * from npieptraver_main AS T1,npieptra_Main_Signoff_Status AS T2 where T1.Ver_New_Customer='" + Customer_TB.Text + "' and T1.Ver_New_Device='" + ND_TB.Text + "' and T1.Ver_Status=T2.TRA_Status "; string Str_Ver = jude_lv_Signoff_Status(sql_rec_npieptra_main_status); String[] Str_Ver_Spilt = Str_Ver.Split('|'); string ver_name = Str_Ver_Spilt[0]; string ver_sta = Str_Ver_Spilt[1]; string signoff_sta = Str_Ver_Spilt[2]; string process = Str_Ver_Spilt[3]; string sql_eptraver_main_sta = "select * from npieptra_Main_Signoff_Status where Ver_Name='" + ver_name + "' and Signoff_Status='NA' and Sign_Case='EP_TRA' and process='Compare' "; string sql_eptraver_main_sta_acc = "select * from npieptra_lv_main_Status where Ver_Name='" + ver_name + "' and LV_Signoff_Status='Acc'"; string sql_eptraver_main_sta_rej = "select * from npieptra_lv_main_Status where Ver_Name='" + ver_name + "' and LV_Signoff_Status='Rej'"; if (Customer_TB.Text.Trim() != "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>alert('您沒輸入New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() != "") { string strScript = string.Format("<script language='javascript'>alert('您沒輸入New_Customer條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>alert('您沒輸入New_Customer與New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (ver_name != "") { if (ver_sta == "Enable" && signoff_sta == "NA" && process == "Compare") { Panel_gv1.Visible = true; Panel_gv2.Visible = false; clsMySQL.DBReply dr = db.QueryDS(sql_eptraver_main_sta); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); set_sta_srt("gv1"); } else if (signoff_sta == "Acc" || signoff_sta == "Rej") { Panel_gv1.Visible = false; Panel_gv2.Visible = false; string strScript = string.Format("<script language='javascript'>alert('" + ver_name + "版本已簽核過!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } /*狀態為Acc or Rej*/ /* * clsMySQL.DBReply dr = db.QueryDS(sql_eptraver_main_sta); * GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; * GridView1.DataBind(); * db.Close(); * * * Panel_gv2.Visible = false; * Panel_gv1.Visible = true; * * string strScript = string.Format("<script language='javascript'>alert('" + ver_name + "版本已簽核過!');</script>"); * Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);*/ } else { string strScript = string.Format("<script language='javascript'>alert('此版本還未送審!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } }
protected void receive_Lv(string filename, string stage, string keyitem) { string SpeChar = ""; string md = ""; string cate = ""; string key = ""; string str_sql = "select DISTINCT EP_Cate_Iiitems,EP_Cate_Stage,EP_Cate_SpeChar from npi_ep_category where EP_Cate_Stage='" + stage + "' and EP_Cate_Iiitems='" + keyitem + "'"; clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(str_sql); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); for (int i = 0; i < GridView1.Rows.Count; i++) { SpeChar = GridView1.Rows[i].Cells[2].Text; //md = GridView1.Rows[i].Cells[1].Text; //cate = GridView1.Rows[i].Cells[2].Text; //key = GridView1.Rows[i].Cells[3].Text; if (jude_Lv(filename, stage, keyitem, SpeChar)) { DropDownList ddl_Lv = (DropDownList)GridView1.Rows[i].Cells[3].FindControl("Doe_Lv"); ddl_Lv.Items.Add(new ListItem("Lv.3", "Lv.3")); ddl_Lv.Items.Add(new ListItem("Lv.4", "Lv.4")); ddl_Lv.Items.Add(new ListItem("Lv.5", "Lv.5")); } else { DropDownList ddl_Lv = (DropDownList)GridView1.Rows[i].Cells[3].FindControl("Doe_Lv"); if (select_Lv(filename, stage, keyitem, SpeChar) == "Lv.3") { ddl_Lv.Items.Add(new ListItem("Lv.3", "Lv.3")); ddl_Lv.Items.Add(new ListItem("Lv.4", "Lv.4")); ddl_Lv.Items.Add(new ListItem("Lv.5", "Lv.5")); } else if (select_Lv(filename, stage, keyitem, SpeChar) == "Lv.4") { ddl_Lv.Items.Add(new ListItem("Lv.4", "Lv.4")); ddl_Lv.Items.Add(new ListItem("Lv.5", "Lv.5")); ddl_Lv.Items.Add(new ListItem("Lv.3", "Lv.3")); } else if (select_Lv(filename, stage, keyitem, SpeChar) == "Lv.5") { ddl_Lv.Items.Add(new ListItem("Lv.5", "Lv.5")); ddl_Lv.Items.Add(new ListItem("Lv.4", "Lv.4")); ddl_Lv.Items.Add(new ListItem("Lv.3", "Lv.3")); } } } //test.Items.Remove(test.Items.FindByValue("Lv.4")); }
protected void Search_Lv_Click1(object sender, EventArgs e) { Panel_gv2.Visible = false; Panel_gv1.Visible = true; string str_eptraver_main = "select * from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='Enable'"; //string str_eptraver_main_count = "select count(Ver_No) from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='" + DDList_Status.SelectedValue + "'"; // string str_eptraver_main = "select * from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='Enable'"; string Ver_name = rec_vername(str_eptraver_main); string sql_eptraver_main_sta = "select * from npieptra_lv_main_Status where Ver_Name='" + Ver_name + "' and LV_Signoff_Status='NA'"; string sql_eptraver_main_sta_acc = "select * from npieptra_lv_main_Status where Ver_Name='" + Ver_name + "' and LV_Signoff_Status='Acc'"; string sql_eptraver_main_sta_rej = "select * from npieptra_lv_main_Status where Ver_Name='" + Ver_name + "' and LV_Signoff_Status='Rej'"; if (Customer_TB.Text.Trim() != "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>alert('您沒輸入New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() != "") { string strScript = string.Format("<script language='javascript'>alert('您沒輸入New_Customer條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>alert('您沒輸入New_Customer與New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (jude_Query_EPTRA(sql_eptraver_main_sta, Ver_name) && !jude_Query_EPTRA(sql_eptraver_main_sta_acc,Ver_name) ) { /*狀態為NA*/ clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(sql_eptraver_main_sta); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); set_sta_srt("gv1"); } else if(!jude_Query_EPTRA(sql_eptraver_main_sta, Ver_name) && (jude_Query_EPTRA(sql_eptraver_main_sta_acc, Ver_name)||jude_Query_EPTRA(sql_eptraver_main_sta_rej, Ver_name))) { /*狀態為Acc or Rej*/ clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(sql_eptraver_main_sta); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); Panel_gv2.Visible = false; Panel_gv1.Visible = true; string strScript = string.Format("<script language='javascript'>alert('" + Ver_name + "版本已簽核過!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else { string strScript = string.Format("<script language='javascript'>alert('此版本還未送審!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } }
protected void GD_CATE_PageIndexChanged(object sender, EventArgs e) { string sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + cate_Stage_DDL.SelectedValue + "' OR ( EP_Cate_Cate='" + Text_Category.Text + "')"; clsMySQL db = new clsMySQL(); clsMySQL.DBReply dr = db.QueryDS(sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); db.Close(); }
protected void btnUpload_Click(object sender, EventArgs e) { String SavePath = "D:\\brunohuang\\FileUpload_Folder\\"; string sheet_name = ""; int sheet_num; int dLastNum; int cate_items = 0; String Cate_Username = "******"; String Cate_Status = "Y"; DateTime dt = DateTime.Now; string inf_ID = ""; List <string> List_Inf_ID = new List <string>(); Boolean sign_count = false; /*List<string> Cate_Iiitems = new List<string>(); * List<string> Cate_SpeChar = new List<string>(); * List<string> Cate_Md = new List<string>(); * List<string> Cate_Cate = new List<string>(); * List<string> Cate_KP = new List<string>(); */ List <int> success_insert = new List <int>(); List <int> fail_insert = new List <int>(); int success_count = 0; int fail_count = 0; List <string> history_cate = new List <string>(); string fileName = ""; string time = ""; string count_sheet_name = ""; int debug_count = 0; Boolean sign = false; clsMySQL db = new clsMySQL(); try { fileName = Path.GetFileName(FileUploadToServer.PostedFile.FileName); //string filePath = Server.MapPath("~\\bruno\\FileUpload_Folder\\") + Path.GetFileName(FileUploadToServer.PostedFile.FileName); string filePath = Server.MapPath("FileUpload_Folder\\") + Path.GetFileName(FileUploadToServer.PostedFile.FileName); FileUploadToServer.SaveAs(filePath); if (CheckExcelFile(fileName)) { /* * if (FileUploadToServer.HasFile) * { * * } */ XSSFWorkbook wk = new XSSFWorkbook(FileUploadToServer.FileContent); XSSFSheet hst; XSSFRow hr; DataTable myDT = new DataTable(); sheet_num = wk.NumberOfSheets; for (int k = 0; k < sheet_num; k++) //從每張工作表開始做 { hst = (XSSFSheet)wk.GetSheetAt(k); cate_items = hst.LastRowNum; //每一張工作表有幾筆資料 sheet_name = hst.SheetName; if (k != sheet_num - 1) //顯示匯入的Stage有哪些 { count_sheet_name += sheet_name + ","; } else { count_sheet_name += sheet_name; } hr = (XSSFRow)hst.GetRow(0); dLastNum = hr.LastCellNum; //每一列的欄位數 /* for (int i = hr.FirstCellNum; i < hr.LastCellNum; i++) * { * if (hr.GetCell(i) != null) * { * DataColumn myColumn = new DataColumn(hr.GetCell(i).StringCellValue); * myDT.Columns.Add(myColumn); * * } * * }*/ for (int j = 1; j <= cate_items; j++) { hr = (XSSFRow)hst.GetRow(j); //XSSFRow row = (XSSFRow) mySheet.GetRow(i); DataRow myrow = myDT.NewRow(); /*for(int i=1;i<dLastNum;i++) * { * //string strcell = hr.GetCell(i) == null ? "0" : hr.GetCell(i).ToString(); * myrow = * * }*/ String insert_cate = string.Format("insert into npi_ep_category" + "(npi_EP_Cate_Username,npi_EP_Cate_UpdateTime,npi_EP_Cate_Status," + "EP_Cate_Stage,EP_Cate_Iiitems,EP_Cate_SpeChar," + "EP_Cate_Md,EP_Cate_Cate,EP_Cate_KP)values" + "('{0}',NOW(),'{1}'," + "'{2}','{3}','{4}','{5}','{6}','{7}')" , Cate_Username, Cate_Status, sheet_name, hr.GetCell(0), hr.GetCell(1), hr.GetCell(2), hr.GetCell(3), hr.GetCell(4)); string excel_sql = sheet_name + "|" + hr.GetCell(0) + "|" + hr.GetCell(1) + "|" + hr.GetCell(2) + "|" + hr.GetCell(3) + "|" + hr.GetCell(4); Label1.Text = dt.ToString("yyyy/MM/dd hh:mm:ss"); time = Label1.Text; if (jude_npiepcategory_data(excel_sql) == true) { if (db.QueryExecuteNonQuery(insert_cate) == true) { success_count++; sign = true; } else { fail_count++; history_cate.Add(hr.GetCell(0) + "|" + hr.GetCell(1) + "|" + hr.GetCell(2) + "|" + hr.GetCell(3) + "|" + hr.GetCell(4)); } debug_count++; } else { List_Inf_ID.Add(Session["value_ID"].ToString() + "|"); sign_count = true; } Session.Clear(); } } wk = null; hst = null; hr = null; } else { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "您選擇的[" + fileName + "]無法匯入,請重新選擇Excel檔案或檢查Excel檔案內容!!"; } /*string strScript2 = string.Format("<script language='javascript'>alert('完成匯入\\n成功匯入筆數:" + success_count + "\\n匯入的Stage:" + count_sheet_name + "');</script>"); * Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript2);*/ Lab_item.Text = success_count.ToString(); Lab_Stage.Text = count_sheet_name; lblMsg.Text = fileName + "上傳成功!!"; if (sign_count == true) { for (int i = 0; i < List_Inf_ID.Count; i++) { inf_ID += List_Inf_ID[i]; } string strScript2 = string.Format("<script language='javascript'>alert('資料重複編號:" + inf_ID + "');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript2); } } catch (Exception exfile) { lblMsg.ForeColor = System.Drawing.Color.Red; if (fileName == "") { lblMsg.Text = "[Import Error Message] 請選擇要匯入的Excel檔案!!"; } else { lblMsg.Text = "[Import Error Message]您選擇的[" + fileName + "]無法匯入,請重新選擇Excel檔案或檢查Excel檔案內容!!"; } } finally { /*string strScript = string.Format("<script language='javascript'>alert('您沒有輸入Packge_Name!');</script>"); * Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);*/ } string sql_cate_datetime = "select * from npi_ep_category where npi_ep_category.npi_EP_Cate_UpdateTime >= DATE_FORMAT('" + time + "', '%Y/%m/%d %H:%i:%s')"; //DATE_FORMAT('2016/04/28 11:26:00', '%Y/%m/%d %H:%i:%s') if (sign == true) { clsMySQL ds = new clsMySQL(); clsMySQL.DBReply dr = ds.QueryDS(sql_cate_datetime); gvRecord.DataSource = dr.dsDataSet.Tables[0].DefaultView; gvRecord.DataBind(); ds.Close(); } }
protected void up_lv_signoff_sta(string sign,int rowindex,string com) { string ver = GridView1.Rows[rowindex].Cells[2].Text; string Lv_Sign = Lv_sign.Value; string sign_Name = "jj"; clsMySQL db = new clsMySQL(); String update_Lv = string.Format("UPDATE npieptra_lv_main_status " + "SET LV_Signoff_Status='{0}',LV_Signoff_Name='{1}',LV_Signoff_Time=NOW(),LV_Signoff_Command='{2}'" + "where Ver_Name='{3}' and LV_Signoff_Status='{4}' " ,sign, sign_Name,com, ver, "NA"); string str_eptraver_main_sta = "select * from npieptra_lv_main_Status where Ver_Name='" + ver + "'"; try { if (db.QueryExecuteNonQuery(update_Lv) == true) { if(Lv_Sign == "Acc") { string strScript = string.Format("<script language='javascript'>alert('"+ver+"簽核完成!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if(Lv_Sign == "Rej") { string strScript = string.Format("<script language='javascript'>alert('" + ver + "簽核完成!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } clsMySQL.DBReply dr = db.QueryDS(str_eptraver_main_sta); GridView2.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView2.DataBind(); set_sta_srt("gv2"); } else { lblError.Text = update_Lv; } } catch (Exception ex) { throw ex; } db.Close(); }
protected void Search_Device_Eptra_table(object sender, EventArgs e) { int count = 0; string str_eptraver_main = "select * from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='Enable'"; //string str_eptraver_main_count = "select count(Ver_No) from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='" + DDList_Status.SelectedValue + "'"; // string str_eptraver_main = "select * from npieptraver_main where Ver_New_Customer = '" + Customer_TB.Text + "'and Ver_New_Device= '" + ND_TB.Text + "' and Ver_Status ='Enable'"; count = count_eptramain(); string Ver_name = rec_vername(str_eptraver_main); string str_eptraver_main_sta = "select * from npieptra_lv_main_Status where Ver_Name='" + Ver_name + "'"; if (Customer_TB.Text.Trim() != "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>error_msg('您沒輸入New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() != "") { string strScript = string.Format("<script language='javascript'>error_msg('您沒輸入New_Customer條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>error_msg('您沒輸入New_Customer與New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (jude_Query_EPTRA(str_eptraver_main) && count == 1) { if(jude_ex_ver(str_eptraver_main_sta, Ver_name)) { /* Panel_EPTramain.Visible = true; receive_eptramain_data(str_eptraver_main); put_eptramain_data(); */ Panel_eptraview.Visible = true; clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(str_eptraver_main); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); } else { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('此版本已送審\\n請到LV_Singoff頁面,做串簽動作!');", true); //string strScript = string.Format("<script language='javascript'>alert('此版本已送審\n請到LV_Singoff頁面,做串簽動作!');</script>"); //Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } } else if (jude_Query_EPTRA(str_eptraver_main) && count > 1) { if (jude_ex_ver(str_eptraver_main_sta, Ver_name)) { Panel_eptraview.Visible = true; clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(str_eptraver_main); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); } else { Panel_eptraview.Visible = true; Response.Write("<script language=javascript>alert('"+Ver_name+"已送審!')</script>"); GridView1.EmptyDataText = "此版本已送審\n請到LV_Singoff頁面,做串簽動作!"; } } else { string strScript = string.Format("<script language='javascript'>error_msg('無此版本!!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } }
protected void Search_Device_Eptra_table(object sender, EventArgs e) { int count = 0; string Ver_Name = ""; //"select * from npieptraver_main AS T1,npieptra_lv_main_status AS T2 where T1.Ver_New_Customer='" + Customer_TB.Text + "' and T1.Ver_New_Device='" + ND_TB.Text + "' and T1.Ver_Status=T2.Ver_Status "; string sql_jude_Ver_Sta = "select * from npieptraver_main AS T1,npieptra_lv_main_status AS T2 where T1.Ver_New_Customer = '" + Customer_TB.Text + "'and T1.Ver_New_Device= '" + ND_TB.Text + "' and T1.Ver_Status = T2.Ver_Status and T2.LV_Signoff_Status='Acc'"; Ver_Name = rec_Ver_Name_Str(sql_jude_Ver_Sta); string sql_jude_Lv_Sta = "select * from npieptra_doe_signoff where Ver_Name='" + Ver_Name + "'"; if (Customer_TB.Text.Trim() != "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>error_msg('您沒輸入New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() != "") { string strScript = string.Format("<script language='javascript'>error_msg('您沒輸入New_Customer條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (Customer_TB.Text.Trim() == "" && ND_TB.Text.Trim() == "") { string strScript = string.Format("<script language='javascript'>error_msg('您沒輸入New_Customer與New_Device條件,請重新輸入!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (jude_Query_EPTRA(sql_jude_Ver_Sta) && jude_doe_signoff(sql_jude_Lv_Sta)) { Panel_eptraview.Visible = true; clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(sql_jude_Ver_Sta); DOE_gv1.DataSource = dr.dsDataSet.Tables[0].DefaultView; DOE_gv1.DataBind(); db.Close(); } else if (!jude_Query_EPTRA(sql_jude_Ver_Sta)) { string strScript = string.Format("<script language='javascript'>error_msg('" + Ver_Name + "還未做Level送審');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else if (!jude_doe_signoff(sql_jude_Lv_Sta)) { string strScript = string.Format("<script language='javascript'>error_msg('" + Ver_Name + "已做DOE送審');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } else { string strScript = string.Format("<script language='javascript'>error_msg('無此版本!!');</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); } /* * clsMySQL db = new clsMySQL(); //Connection MySQL * clsMySQL.DBReply dr = db.QueryDS(str_eptraver_main); * DOE_gv1.DataSource = dr.dsDataSet.Tables[0].DefaultView; * DOE_gv1.DataBind(); * db.Close(); */ }
protected void displaygv(string sql) { Panel_gv_signofflist.Visible = true; Panel_EPTRA.Visible = false; clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(sql); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); set_sta_srt(); set_sendpeople(); set_SignOffpeople(); jude_Enable_Lv_button(); }
protected void receive_Lv(string filename, string stage, string keyitem) { string SpeChar = ""; string md = ""; string cate = ""; string key = ""; string str_sql = "select DISTINCT EP_Cate_Iiitems,EP_Cate_Stage,EP_Cate_SpeChar from npieptraver_category where EP_Cate_Stage='" + stage + "' and EP_Cate_Iiitems='" + keyitem + "' and Ver_Name='" + filename + "'"; clsMySQL db = new clsMySQL(); //Connection MySQL clsMySQL.DBReply dr = db.QueryDS(str_sql); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); for (int i = 0; i < GridView1.Rows.Count; i++) { SpeChar = GridView1.Rows[i].Cells[2].Text; //md = GridView1.Rows[i].Cells[1].Text; //cate = GridView1.Rows[i].Cells[2].Text; //key = GridView1.Rows[i].Cells[3].Text; if (jude_Lv(filename, stage, keyitem, SpeChar)) { DropDownList ddl_Lv = (DropDownList)GridView1.Rows[i].Cells[3].FindControl("Doe_Lv"); ddl_Lv.Items.Add(new ListItem("RC(Lv.3)", "RC(Lv.3)")); ddl_Lv.Items.Add(new ListItem("MC(Lv.4)", "MC(Lv.4)")); ddl_Lv.Items.Add(new ListItem("LC(Lv.5)", "LC(Lv.5)")); } else { DropDownList ddl_Lv = (DropDownList)GridView1.Rows[i].Cells[3].FindControl("Doe_Lv"); if (select_Lv(filename, stage, keyitem, SpeChar) == "RC(Lv.3)") { ddl_Lv.Items.Add(new ListItem("RC(Lv.3)", "RC(Lv.3)")); ddl_Lv.Items.Add(new ListItem("MC(Lv.4)", "MC(Lv.4)")); ddl_Lv.Items.Add(new ListItem("LC(Lv.5)", "LC(Lv.5)")); } else if (select_Lv(filename, stage, keyitem, SpeChar) == "MC(Lv.4)") { ddl_Lv.Items.Add(new ListItem("MC(Lv.4)", "MC(Lv.4)")); ddl_Lv.Items.Add(new ListItem("LC(Lv.5)", "LC(Lv.5)")); ddl_Lv.Items.Add(new ListItem("RC(Lv.3)", "RC(Lv.3)")); } else if (select_Lv(filename, stage, keyitem, SpeChar) == "LC(Lv.5)") { ddl_Lv.Items.Add(new ListItem("LC(Lv.5)", "LC(Lv.5)")); ddl_Lv.Items.Add(new ListItem("MC(Lv.4)", "MC(Lv.4)")); ddl_Lv.Items.Add(new ListItem("RC(Lv.3)", "RC(Lv.3)")); } } } string strScript = string.Format("<script language='javascript'>gd();</script>"); Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript); //test.Items.Remove(test.Items.FindByValue("Lv.4")); }
protected void Search_por_Click(object sender, EventArgs e) { GridView1.Visible = true; clsMySQL db = new clsMySQL(); Boolean bisWhereExist = false; string strQuerySQL = ""; //lblError.Text = ""; if (PKG_TextBox.Text.Trim() != "" || WaferT_TextBox.Text.Trim() != "" || FAB.Text.Trim() != "" || WaferPSV_TextBox.Text.Trim() != "" || RVSI_TextBox.Text.Trim() != "" || Customer_TextBox.Text.Trim() != "" || ProductionSite_TextBox.Text.Trim() != "") { strQuerySQL = "Select * from npipor Where Stype='POR' "; bisWhereExist = true; } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('完全沒有輸入,Error~~')", true); } if (PKG_TextBox.Text.Trim() != "") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_02 like'" + PKG_TextBox.Text + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_01 like'" + PKG_TextBox.Text + "%' "; } } if (WaferT_TextBox.Text.Trim() != "") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_03 like'" + WaferT_TextBox.Text + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_03 like'" + WaferT_TextBox.Text + "%' "; } } if (FAB.Text.Trim() != "") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_04 like'" + FAB.Text + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_04 like'" + FAB.Text + "%' "; } } if (WaferPSV_TextBox.Text.Trim() != "") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_05 like'" + WaferPSV_TextBox.Text + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_04 like'" + WaferPSV_TextBox.Text + "%' "; } } if (RVSI_TextBox.Text.Trim() != "") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_11 like'" + RVSI_TextBox.Text + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_11 like'" + RVSI_TextBox.Text + "%'"; } } if (Customer_TextBox.Text.Trim() != "") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_14 like'" + Customer_TextBox.Text + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_14 like'" + Customer_TextBox.Text + "%' "; } } if (ProductionSite_TextBox.Text.Trim() != "") { if (bisWhereExist) { strQuerySQL = strQuerySQL + "and POR_01 like'" + ProductionSite_TextBox.Text + "%' "; } else { strQuerySQL = strQuerySQL + "Where POR_01 like'" + ProductionSite_TextBox.Text + "%' "; } } //lblError.Text = strQuerySQL; try { clsMySQL.DBReply dr = db.QueryDS(strQuerySQL); GridView1.DataSource = dr.dsDataSet.Tables[0].DefaultView; GridView1.DataBind(); db.Close(); } catch (Exception ex) { //lblError.Text = "[NPIPOR Function-Error Message, btn_Search_Click] : " + ex.ToString(); } }
protected void butSearch_Click(object sender, EventArgs e) { clsMySQL db = new clsMySQL(); //string sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + cate_Stage_DDL.SelectedValue + "' OR ( EP_Cate_Cate='" + Text_Category.Text + "')"; string sql_category = "select * from npi_ep_category where EP_Cate_Stage='" + cate_Stage_DDL.SelectedValue + "'"; //HttpContext.Current.Session["value_cate_stage"] = cate_Staege_DDL.SelectedValue; string stage_value = cate_Stage_DDL.SelectedValue; clsMySQL.DBReply dr = db.QueryDS(sql_category); GD_CATE.DataSource = dr.dsDataSet.Tables[0].DefaultView; GD_CATE.DataBind(); HttpContext.Current.Session["value_ddl_stage"] = stage_value; ddlBind(GD_CATE); //bindDDL_gridview_countpage(); db.Close(); }