protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        //----編輯模式----
        GridView1.EditIndex = e.NewEditIndex;
        GridViewRow gvrow = GridView1.Rows[e.NewEditIndex];
        clsMySQL    db    = new clsMySQL();

        FormView1.Visible = true;
        Panel2.Visible    = true;

        if (!FormView1.Visible)
        {
            return;
        }

        switch (FormView1.CurrentMode)
        {
        case FormViewMode.ReadOnly:
            FormView1.ChangeMode(FormViewMode.ReadOnly);
            break;

        case FormViewMode.Edit:
            FormView1.ChangeMode(FormViewMode.Edit);
            break;
        }

        //string strSQL = "select * from npiPOR where POR_Customer = '" + gvrow.Cells[1].Text + "' and POR_Device = '" + gvrow.Cells[2].Text + "'";
        string strSQL = string.Format("select * from npipor where POR_Customer='{0}' and POR_Device='{1}' and POR_01='{2}' and POR_02='{3}' and POR_03='{4}' and POR_04='{5}' " +
                                      "and POR_05='{6}' and POR_11='{7}'",
                                      gvrow.Cells[1].Text, gvrow.Cells[2].Text, gvrow.Cells[3].Text, gvrow.Cells[4].Text, gvrow.Cells[5].Text, gvrow.Cells[6].Text,
                                      gvrow.Cells[7].Text, gvrow.Cells[8].Text);

        FormView1.DataSource = db.QueryDataSet(strSQL);
        FormView1.DataBind();
    }
Beispiel #2
0
    protected Boolean jude_doe_signoff(string sql)/*判斷doe_signoff裡是不是有Ver_Name的紀錄*/
    {
        string   Ver_Name = "";
        clsMySQL db       = new clsMySQL();

        MySqlConnection MySqlConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQL"].ConnectionString);

        MySqlConn.Open();

        MySqlCommand    MySqlCmd = new MySqlCommand(sql, MySqlConn);
        MySqlDataReader mydr     = MySqlCmd.ExecuteReader();

        while (mydr.Read())
        {
            Ver_Name = (String)mydr["Ver_Name"];
        }

        if (Ver_Name == "")
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
 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();
     }
 }
Beispiel #4
0
    /*
     * protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
     * {
     *  int index;
     *  int i = 0;
     *  index = Convert.ToInt32(e.CommandArgument);
     *  GridViewRow selecteRow = GridView1.Rows[index];
     *  TableCell productName_Device = selecteRow.Cells[1];
     *  TableCell productName_Production_Site = selecteRow.Cells[2];
     *  TableCell productName_PKG = selecteRow.Cells[3];
     *  TableCell productName_Wafer = selecteRow.Cells[4];
     *  TableCell productName_fab = selecteRow.Cells[5];
     *  TableCell productWaferPSV = selecteRow.Cells[6];
     *  TableCell productRVSI = selecteRow.Cells[7];
     *  TableCell productCustomer = selecteRow.Cells[8];
     *
     *
     *
     *  if (e.CommandName == "search")
     *  {
     *
     *
     *
     *
     *
     *
     *  }
     * }
     */

    protected Boolean jude_Query_EPTRA(string sql)
    {
        string   Temp_Cus = "";
        string   Temp_New = "";
        clsMySQL db       = new clsMySQL();

        MySqlConnection MySqlConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQL"].ConnectionString);

        MySqlConn.Open();

        MySqlCommand    MySqlCmd = new MySqlCommand(sql, MySqlConn);
        MySqlDataReader mydr     = MySqlCmd.ExecuteReader();

        while (mydr.Read())
        {
            Temp_Cus = (String)mydr["Ver_New_Customer"];
            Temp_New = (String)mydr["Ver_New_Device"];
        }

        if (Temp_Cus == Customer_TB.Text && Temp_New == ND_TB.Text)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
    protected Boolean jude_Query_EPTRA(string sql, string vername)
    {
        string   Lv_main_vername = "";
        clsMySQL db = new clsMySQL();

        MySqlConnection MySqlConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQL"].ConnectionString);

        MySqlConn.Open();

        MySqlCommand    MySqlCmd = new MySqlCommand(sql, MySqlConn);
        MySqlDataReader mydr     = MySqlCmd.ExecuteReader();

        while (mydr.Read())
        {
            Lv_main_vername = (String)mydr["Ver_Name"];
        }

        mydr.Close();
        MySqlConn.Close();

        if (Lv_main_vername == vername)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Beispiel #6
0
    protected void GD_CAP_RowDeleting1(object sender, GridViewDeleteEventArgs e)
    {
        clsMySQL db = new clsMySQL();

        try
        {
            GridViewRow gvrow = GD_CAP.Rows[e.RowIndex];

            //lblError.Text = gvrow.Cells[1].Text + "////" + gvrow.Cells[2].Text;
            string strSQL_Delete = string.Format("Delete from npiManual where CAP_EP_Name='{0}'",
                                                 gvrow.Cells[1].Text.Trim());

            if (db.QueryExecuteNonQuery(strSQL_Delete))
            {
                RegisterStartupScript("訊息通知", "<script> alert('資料已刪除,成功!!');</script>");
                //ChangeViewMode();
            }
            else
            {
                //lblError.Text = strSQL_Delete;
                RegisterStartupScript("訊息通知", "<script> alert('資料刪除,失敗!!');</script>");
            }
        }
        catch (FormatException ex)
        {
            lblError.Text = "[Error Message::NPI Manual Form Delete Function]: " + ex.ToString();
        }
    }
Beispiel #7
0
    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();
        }
    }
Beispiel #8
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        //lblError.Text = e.Keys["C_Code"].ToString() + "////" + e.Values.ToString();
        clsMySQL db = new clsMySQL();

        try
        {
            GridViewRow gvrow = GridView1.Rows[e.RowIndex];

            lblError.Text = gvrow.Cells[1].Text + "////" + gvrow.Cells[2].Text;
            string strSQL_Delete = string.Format("Delete from npiManual where New_Customer='{0}' and  New_Device='{1}'",
                                                 gvrow.Cells[1].Text.Trim(), gvrow.Cells[2].Text.Trim());

            if (db.QueryExecuteNonQuery(strSQL_Delete))
            {
                RegisterStartupScript("訊息通知", "<script> alert('資料已刪除,成功!!');</script>");
                ChangeViewMode();
            }
            else
            {
                //lblError.Text = strSQL_Delete;
                RegisterStartupScript("訊息通知", "<script> alert('資料刪除,失敗!!');</script>");
            }
        }
        catch (FormatException ex)
        {
            lblError.Text = "[Error Message::NPI Manual Form Delete Function]: " + ex.ToString();
        }
    }
    protected void GD_CATE_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        clsMySQL db = new clsMySQL();

        try
        {
            GridViewRow gvrow    = GD_CATE.Rows[e.RowIndex];
            string      stage    = gvrow.Cells[1].Text;
            string      Input    = gvrow.Cells[2].Text;
            string      sp       = gvrow.Cells[3].Text;
            string      md       = gvrow.Cells[4].Text;
            string      category = gvrow.Cells[5].Text;
            string      kp       = gvrow.Cells[6].Text;


            if (Input == "&nbsp;")
            {
                Input = "";
            }
            if (sp == "&nbsp;")
            {
                sp = "";
            }
            if (md == "&nbsp;")
            {
                md = "";
            }
            if (category == "&nbsp;")
            {
                category = "";
            }
            if (kp == "&nbsp;")
            {
                kp = "";
            }



            //lblError.Text = gvrow.Cells[1].Text + "////" + gvrow.Cells[2].Text;

            string strSQL_Delete = string.Format("Delete from npi_ep_category where EP_Cate_Stage='{0}' and EP_Cate_Iiitems='{1}' and EP_Cate_SpeChar='{2}' and  EP_Cate_Md='{3}' and EP_Cate_Cate='{4}' and  EP_Cate_KP='{5}'",
                                                 stage, Input, sp, md, category, kp);

            if (db.QueryExecuteNonQuery(strSQL_Delete))
            {
                RegisterStartupScript("訊息通知", "<script> alert('資料已刪除,成功!!');</script>");
                Response.Redirect(Request.Url.AbsoluteUri);
                DBint(stage);
            }
            else
            {
                //lblError.Text = strSQL_Delete;
                RegisterStartupScript("訊息通知", "<script> alert('資料刪除,失敗!!');</script>");
            }
        }
        catch (FormatException ex)
        {
            lblError.Text = "[Error Message::NPI Category Form Delete Function]: " + ex.ToString();
        }
    }
Beispiel #10
0
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        //----編輯模式----
        GridView1.EditIndex = e.NewEditIndex;
        GridViewRow gvrow = GridView1.Rows[e.NewEditIndex];
        clsMySQL    db    = new clsMySQL();

        FormView1.Visible = true;
        Panel2.Visible    = true;

        if (!FormView1.Visible)
        {
            return;
        }

        switch (FormView1.CurrentMode)
        {
        case FormViewMode.ReadOnly:
            FormView1.ChangeMode(FormViewMode.ReadOnly);
            break;

        case FormViewMode.Edit:
            FormView1.ChangeMode(FormViewMode.Edit);
            break;
        }

        string strSQL = "select * from npiManual where New_Customer = '" + gvrow.Cells[1].Text + "' and New_Device = '" + gvrow.Cells[2].Text + "'";

        FormView1.DataSource = db.QueryDataSet(strSQL);
        FormView1.DataBind();
    }
    protected void GD_CATE_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string   temp = "";
        clsMySQL db   = new clsMySQL();

        receiver_CATE_data_Update(e.RowIndex);
    }
Beispiel #12
0
    protected void insert_cate(int item_num, List <string> Cate_Iiitems, List <string> Cate_SpeChar, List <string> Cate_Md, List <string> Cate_Cate, List <string> Cate_KP, string name, string status, string stage)
    {
        clsMySQL      db             = new clsMySQL();
        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>();

        for (int i = 0; i < item_num; i++)
        {
            String insert_cate = string.Format("insert into npi_cap_ep" +
                                               "(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}')"
                                               , name, status, stage, Cate_Iiitems[i], Cate_SpeChar[i], Cate_Md[i], Cate_Cate[i], Cate_KP[i]);
            if (db.QueryExecuteNonQuery(insert_cate) == true)
            {
                success_count++;
            }
            else
            {
                fail_count++;
                history_cate.Add(Cate_Iiitems[i] + "|" + Cate_SpeChar[i] + "|" + Cate_Md[i] + "|" + Cate_Cate[i] + "|" + Cate_KP[i]);
            }
        }



        /*
         * try
         * {
         *  /*if (Text_Packge_insert.Text.Trim() == "")
         *  {
         *      string strScript = string.Format("<script language='javascript'>alert('您沒有輸入Packge_Name!');</script>");
         *      Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);
         *  }
         *  if ()
         *  {
         *      string strScript = string.Format("<script language='javascript'>alert('Category新增成功');</script>");
         *      Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);
         *
         *  }
         *  else
         *  {
         *      string strScript = string.Format("<script language='javascript'>alert('Category新增成功');</script>");
         *      Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);
         *  }
         * }
         * catch (Exception ex)
         * {
         *  throw ex;
         * }
         *
         */
    }
Beispiel #13
0
    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();
    }
Beispiel #14
0
    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();
    }
Beispiel #15
0
    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();
    }
Beispiel #16
0
    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 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 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();
    }
Beispiel #19
0
    public static string Insert_An_Manual(string strConjData)
    {
        string strError = "";

        string[] strData = new string[25];
        strData = strConjData.Split('|');

        ArrayList arSQL = new ArrayList();

        arSQL.Clear();
        clsMySQL db = new clsMySQL();
        DataSet  ds;
        string   strSQL_Query = "select * from npiManual where New_Customer = '" + strData[0] + "' and New_Device = '" + strData[1] + "'";

        ds = db.QueryDataSet(strSQL_Query);
        if (ds.Tables[0].Rows.Count > 0)
        {
            strError = "Insert Error Message: New_Customer = [" + strData[0] + "]/ New_Device = [" + strData[1] + "]的資料已存在!!');";
        }
        else
        {
            try
            {
                string strSQL_Insert = string.Format("Insert into npiManual " +
                                                     "(New_Customer, New_Device, Stype, UpdateTime, npiUser, Man_Status," +
                                                     "Man_01, Man_02, Man_03, Man_04, Man_05, Man_06, Man_07, Man_08, Man_09, Man_10," +
                                                     "Man_11, Man_12, Man_13, Man_14, Man_15, Man_16, Man_17, Man_18, Man_19, Man_20, Man_21, Man_22" +
                                                     ") values " +
                                                     "('{0}','{1}','Man',NOW(),'{24}','Y','{2}','{3}','{4}'," +
                                                     "'{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}'," +
                                                     "'{22}','{23}')",
                                                     strData[0], strData[1], strData[2], strData[3], strData[4],
                                                     strData[5], strData[6], strData[7], strData[8], strData[9],
                                                     strData[10], strData[11], strData[12], strData[13], strData[14],
                                                     strData[15], strData[16], strData[17], strData[18], strData[19],
                                                     strData[20], strData[21], strData[22].Trim(), strData[23], strData[24]);
                arSQL.Add(strSQL_Insert);
                strSQL_Insert = strSQL_Insert.Replace("'", "''");
                string strHisSQL = string.Format("Insert into npiHistory (His_Time, npiUser, npiFun, His_SQL) values (NOW(),'{0}','npiMan_Add','{1}') ", strData[24], strSQL_Insert);
                arSQL.Add(strHisSQL);

                //if (!db.QueryExecuteNonQuery(strSQL_Insert))
                if (!db.myBatchNonQuery(arSQL))
                {
                    strError = "Error Message:[NPI ManualForm] Insert Fail !!! ";
                }
            }
            catch (Exception ex)
            {
                //lblError.Text = "[Error Message::NPI Manual Form Update Function]: " + ex.ToString();
                strError = "Insert Error Message:[NPI ManualForm] " + ex.ToString();
            }
        }
        return(strError);
    }
    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();
    }
Beispiel #21
0
    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();
    }
Beispiel #22
0
    protected void Delete_CAP(string sql)
    {
        clsMySQL db             = new clsMySQL();
        string   sql_delete_cap = "Delete from npi_cap_ep where CAP_EP_Name='" + sql + "'";

        if (db.dbQueryExecuteNonQuery(sql_delete_cap) == true)
        {
            string strScript = string.Format("<script language='javascript'>alert('未刪除!');</script>");
            Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);
        }
    }
    protected void Delete_CAP(string sql)
    {
        clsMySQL db = new clsMySQL();
        string sql_delete_cap = "Delete from npi_cap_ep where CAP_EP_Name='" + sql + "'";
        if(db.dbQueryExecuteNonQuery(sql_delete_cap)==true)
        {
            string strScript = string.Format("<script language='javascript'>alert('未刪除!');</script>");
            Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);
        }

    }
    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();
        
    }
Beispiel #25
0
    protected void GD_CAP_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        clsMySQL db = new clsMySQL();


        GridViewRow gvrow = GD_CAP.Rows[e.RowIndex];

        string temp = gvrow.Cells[1].Text.Trim();

        HttpContext.Current.Session["value_cap_pkgname"] = temp;
        receiver_CAP_data_Update(temp);
    }
Beispiel #26
0
    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);
        }
    }
 public static string[] GetNewDevice(string prefix)
 {
     List<string> New_Device = new List<string>();
     string strSQL = " select DISTINCT npiapp.New_Device from npiapp where npiapp.New_Device like '" + prefix + "%' union  select  npiimportdata.New_Device from  npiimportdata where   npiimportdata.New_Device like '" + prefix + "%' union select  npimanual.New_Device from npimanual where npimanual.New_Device like'" + prefix + "%'";
     clsMySQL db = new clsMySQL();
     foreach (DataRow dr in db.QueryDataSet(strSQL).Tables[0].Rows)
     {
         //customers.Add(string.Format("{0},{1}", dr["new_customer"], dr["new_device"]));
         New_Device.Add(string.Format("{0}", dr["New_Device"]));
     }
     return New_Device.ToArray();
 }
    protected void but_Save_lv_Click(object sender, EventArgs e)
    {
        clsMySQL db = new clsMySQL();

        string SpeChar = "";
        string md      = "";
        string cate    = "";
        string key     = "";

        string t = "";
        string f = "";


        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            SpeChar = GridView1.Rows[i].Cells[0].Text;
            md      = GridView1.Rows[i].Cells[1].Text;
            cate    = GridView1.Rows[i].Cells[2].Text;
            key     = GridView1.Rows[i].Cells[3].Text;
            DropDownList ddl_Lv     = (DropDownList)GridView1.Rows[i].Cells[4].FindControl("Doe_Lv");
            String       insert_cap = string.Format("insert into npi_eptra_doe_lv" +
                                                    "(Lv_filename,Lv_stage,Lv_SpecChar," +
                                                    "Lv_Iiitems,Lv_md,Lv_cate," +
                                                    "Lv_kp,Lv_TraLv)values" +
                                                    "('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')",
                                                    "ver.1", "PI1", SpeChar, "PI Thickness (um)", md,
                                                    cate, key, ddl_Lv.SelectedItem);



            try
            {
                if (db.QueryExecuteNonQuery(insert_cap) == true)
                {
                    t += Convert.ToString(i) + ",";
                }
                else
                {
                    f += Convert.ToString(i) + ",";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }



        //string strScript = string.Format("<script language='javascript'>alert("+f+"\n"+t+");</script>");
        //Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);
    }
    public static string[] GetNewDevice(string prefix)
    {
        List <string> New_Device = new List <string>();
        string        strSQL     = " select DISTINCT npiapp.New_Device from npiapp where npiapp.New_Device like '" + prefix + "%' union  select  npiimportdata.New_Device from  npiimportdata where   npiimportdata.New_Device like '" + prefix + "%' union select  npimanual.New_Device from npimanual where npimanual.New_Device like'" + prefix + "%'";
        clsMySQL      db         = new clsMySQL();

        foreach (DataRow dr in db.QueryDataSet(strSQL).Tables[0].Rows)
        {
            //customers.Add(string.Format("{0},{1}", dr["new_customer"], dr["new_device"]));
            New_Device.Add(string.Format("{0}", dr["New_Device"]));
        }
        return(New_Device.ToArray());
    }
Beispiel #30
0
    public static string[] GetNewCustomer(string prefix)
    {
        List <string> customers = new List <string>();
        string        strSQL    = "select DISTINCT new_customer from npimanual Where new_customer Like '" + prefix + "%'";
        clsMySQL      db        = new clsMySQL();

        foreach (DataRow dr in db.QueryDataSet(strSQL).Tables[0].Rows)
        {
            //customers.Add(string.Format("{0},{1}", dr["new_customer"], dr["new_device"]));
            customers.Add(string.Format("{0}", dr["new_customer"]));
        }
        return(customers.ToArray());
    }
Beispiel #31
0
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        //-----View Mode----
        GridViewRow gvrow = GridView1.SelectedRow;
        clsMySQL    db    = new clsMySQL();

        FormView1.Visible = true;
        Panel2.Visible    = true;
        string strSQL = "select * from npiManual where New_Customer = '" + gvrow.Cells[1].Text + "' and New_Device = '" + gvrow.Cells[2].Text + "'";

        FormView1.DataSource = db.QueryDataSet(strSQL);
        FormView1.DataBind();
    }
    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 GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        GridViewRow gvrow = GridView1.Rows[e.NewSelectedIndex];
        clsMySQL    db    = new clsMySQL();
        //string strSQL = "select * from npipor where POR_Customer = '" + gvrow.Cells[1].Text + "' and POR_Device = '" + gvrow.Cells[2].Text + "'" + " and POR_01 = '" + gvrow.Cells[3].Text + "'";
        string strSQL = string.Format("select * from npipor where POR_Customer='{0}' and POR_Device='{1}' and POR_01='{2}' and POR_02='{3}' and POR_03='{4}' and POR_04='{5}' " +
                                      "and POR_05='{6}' and POR_11='{7}'",
                                      gvrow.Cells[1].Text, gvrow.Cells[2].Text, gvrow.Cells[3].Text, gvrow.Cells[4].Text, gvrow.Cells[5].Text, gvrow.Cells[6].Text,
                                      gvrow.Cells[7].Text, gvrow.Cells[8].Text);

        FormView1.Visible    = true;
        Panel2.Visible       = true;
        FormView1.DataSource = db.QueryDataSet(strSQL);
        FormView1.DataBind();
    }
    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();
    }
Beispiel #35
0
    protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        GridViewRow gvrow = GridView1.Rows[e.NewSelectedIndex];

        clsMySQL db = new clsMySQL();

        FormView1.Visible = true;
        Panel2.Visible    = true;
        string strSQL = "select * from npiManual where New_Customer = '" + gvrow.Cells[1].Text + "' and New_Device = '" + gvrow.Cells[2].Text + "'";

        HttpContext.Current.Session["value_temp_sql"] = strSQL;

        FormView1.DataSource = db.QueryDataSet(strSQL);
        FormView1.DataBind();
    }
    protected Boolean jude_Query_EPTRA(string sql,string vername)
    {
        string Lv_main_vername = "";
        clsMySQL db = new clsMySQL();

        MySqlConnection MySqlConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQL"].ConnectionString);
        MySqlConn.Open();

        MySqlCommand MySqlCmd = new MySqlCommand(sql, MySqlConn);
        MySqlDataReader mydr = MySqlCmd.ExecuteReader();

        while (mydr.Read())
        {
           Lv_main_vername = (String)mydr["Ver_Name"];           
        }

        mydr.Close();
        MySqlConn.Close();

        if (Lv_main_vername==vername)
        {
            return true;
        }
        else
            return false;



    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //SqlConnection Conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["SHDBConnectionString"].ConnectionString.ToString());
        //Conn.Open();       
        //string strSQL = "select User_Code,User_Name,user_flag from users where user_acc = '"+ username.Text +"' and user_pw='"+ password.Text +"'";
        //SqlCommand cmd = new SqlCommand(strSQL, Conn);
        //SqlDataReader dr = cmd.ExecuteReader();
        //if (dr.HasRows)
        //{
        //    dr.Read();
        //    Session["usercode"] = dr["User_Code"];//dr.GetOrdinal("user_code");
        //    Session["username"] = dr["User_Name"];//dr.GetOrdinal("user_name");
        //    Session["userflag"] = dr["User_flag"]; //0:離職 1:普通使用者 3:可以看不可修改 5:最大權限 
        //    Session["login"] = "******";
        //    Response.Redirect("~/Pages/Home.aspx");
        //    cmd.Cancel();
        //    dr.Close();
        //    Conn.Close();
        //}
        //else
        //{
        //    Label1.Text = "您輸入的帳號/密碼有誤!";
        //    cmd.Cancel();
        //    dr.Close();
        //    Conn.Close();
        //}
        //Session["usercode"] = "twshao";//dr.GetOrdinal("user_code");
        //Session["username"] = "******";//dr.GetOrdinal("user_name");
        //Session["userflag"] = "1"; //0:離職 1:普通使用者 3:可以看不可修改 5:最大權限 
        //Session["userpassword"] = "******";   
        clsMySQL db = new clsMySQL();
        MySqlDataReader dr;
        //DataSet ds;
        //DataRow dr;
        if (username.Text == "") 
        {
            lblError.Text = "請輸入工號!"; 
        }
        else if (password.Text == "")
        {
            lblError.Text = "請輸入密碼!"; 
        }
        else {
            string strQuerySQL = "Select * from infor_personal where workno ='" + username.Text.Trim() + "' and password = '******'";            
            //lblError.Text = strQuerySQL +"<br>";
            try
            {
                //ds = db.QueryDataSet(strQuerySQL);
                dr = db.dbQueryDR(strQuerySQL);
                if (dr.HasRows)
                //if (ds.Tables[0].Rows.Count > 0)
                {
                    //dr = ds.Tables[0].Rows[0];
                    dr.Read();
                    Session["Workno"] = dr["WorkNo"].ToString();
                    Session["chinesename"] = dr["ChineseName"].ToString();
                    Session["departname"] = dr["DepartName"].ToString();
                    Response.Redirect("~/test/Home.aspx");
                    //lblError.Text = "WorkNo:" + Session["WorkNo"].ToString() +"/ Chinesename :"+ Session["chinesename"].ToString() ;
                }
                else
                {
                    lblError.Text = "您輸入的工號/密碼不正確!";
                }     
                db.Close();
            }
            catch (Exception ex)
            {
                lblError.Text = "[Login Error Message] : " + ex.ToString();
                db.Close();
            }


            //if (username.Text == "twshao" && password.Text == "1234")
            //{
            //    Session["username"] = "******";
            //    Session["usercode"] = "twshao";
            //    Response.Redirect("~/test/Home.aspx");              
            //}
            //else
            //{
            //    lblError.Text = "您輸入的帳號/密碼不正確!";
            //}        
        }      
    }
    protected void receive_eptramain_data(string sql_eptramain)
    {

        clsMySQL db = new clsMySQL();

        MySqlConnection MySqlConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQL"].ConnectionString);
        MySqlConn.Open();

        MySqlCommand MySqlCmd = new MySqlCommand(sql_eptramain, MySqlConn);
        MySqlDataReader mydr = MySqlCmd.ExecuteReader();




        while (mydr.Read())
        {

            eptramain_data.Add((String)mydr["Ver_Name"]);
            eptramain_data.Add(Convert.ToString((DateTime)mydr["UpdateTime"]));
            eptramain_data.Add((String)mydr["UserName"]);
            eptramain_data.Add((String)mydr["Ver_Status"]);
            eptramain_data.Add((String)mydr["Ver_POR_Customer"]);
            eptramain_data.Add((String)mydr["Ver_POR_Device"]);
            eptramain_data.Add((String)mydr["Ver_POR_Site"]);
            eptramain_data.Add((String)mydr["Ver_POR_PKG"]);
            eptramain_data.Add((String)mydr["Ver_POR_WT"]);
            eptramain_data.Add((String)mydr["Ver_POR_FAB"]);
            eptramain_data.Add((String)mydr["Ver_POR_PSV"]);
            eptramain_data.Add((String)mydr["Ver_POR_RVSI"]);

            eptramain_data.Add((String)mydr["Ver_New_Customer"]);
            eptramain_data.Add((String)mydr["Ver_New_Device"]);

        }



    }
    protected void all_lv_setting(string lv_sign, string keyitem, string stage, string SpeChar)
    {
        clsMySQL db = new clsMySQL();
        string insert_sign = "";
        String insert_lv = string.Format("insert into npieptra_lv_main" +
                               "(Ver_Name,EPTRA_KeyItem,EPTRA_LV_Stage,EPTRA_LV_SpecChar,EPTRA_LV)Values" +
                               "('{0}','{1}','{2}','{3}','{4}')" +
                               "ON DUPLICATE KEY UPDATE EPTRA_KeyItem='{1}',EPTRA_LV_Stage='{2}',EPTRA_LV_SpecChar='{3}',EPTRA_LV='{4}'",
                               global_Ver_Name, keyitem, stage, SpeChar, lv_sign);


        try
        {

            if (db.QueryExecuteNonQuery(insert_lv) == true)
            {

                //t += Convert.ToString(i) + ",";
                insert_sign = "true";

            }
            else
            {
                //f += Convert.ToString(i) + ",";
                insert_sign = "false";
                lblError.Text = insert_lv + db.ToString();

            }
        }
        catch (Exception ex)
        {
            lblError.Text = ex.ToString();
            throw ex;
        }


    }
    protected void cmdFilter_Click(object sender, EventArgs e)
    {


        string CreateName = "cre_CIM";
        string UpName = "up_CIM";
        string Signoff_SendName = "sing_CIM";
        clsMySQL db = new clsMySQL();

        String insert_lv = string.Format("insert into npieptra_lv_main_status" +
                       "(Ver_Name,Ver_No,Ver_Status,CreateTime,CreateName,UpdateTime,UpdateName," +
                       "LV_Signoff_Status,LV_Signoff_SendName,LV_Signoff_SendTime)Values" +
                       "('{0}','{1}','{2}',NOW(),'{3}',NOW(),'{4}','{5}','{6}',NOW())"+
                        "ON DUPLICATE KEY UPDATE LV_Signoff_SendName='{6}',LV_Signoff_SendTime=NOW(),UpdateTime=NOW(),UpdateName='{4}',LV_Signoff_Status='{5}'",
                       global_Ver_Name, global_Ver_No, global_Ver_Sta, CreateName, UpName, "NA", Signoff_SendName);

        if (!db.QueryExecuteNonQuery(insert_lv))
        {
            lblError.Text = insert_lv;
            string strScript = string.Format("<script language='javascript'>alert('送審失敗!');</script>");
            Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);


        }
        else
        {
            Response.Write("<script language=javascript>alert('送審成功!')</script>");
            Response.Write("<script language=javascript>window.location.href='EPTRA_LV_SigoffList.aspx'</script>");
            
        }
    }
    protected void GD_CATE_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        clsMySQL db = new clsMySQL();
        try
        {
            GridViewRow gvrow = GD_CATE.Rows[e.RowIndex];
            string stage = gvrow.Cells[1].Text;
            string Input = gvrow.Cells[2].Text;
            string sp = gvrow.Cells[3].Text;
            string md = gvrow.Cells[4].Text;
            string category = gvrow.Cells[5].Text;
            string kp = gvrow.Cells[6].Text;


            if (Input == "&nbsp;")
                Input = "";
            if (sp == "&nbsp;")
                sp = "";
            if (md == "&nbsp;")
                 md = "";
            if (category == "&nbsp;")
                category = "";
            if (kp == "&nbsp;")
                kp = "";
           


            //lblError.Text = gvrow.Cells[1].Text + "////" + gvrow.Cells[2].Text;

            string strSQL_Delete = string.Format("Delete from npi_ep_category where EP_Cate_Stage='{0}' and EP_Cate_Iiitems='{1}' and EP_Cate_SpeChar='{2}' and  EP_Cate_Md='{3}' and EP_Cate_Cate='{4}' and  EP_Cate_KP='{5}'",
                                     stage,Input,sp,md,category,kp);

            if (db.QueryExecuteNonQuery(strSQL_Delete))
            {
                RegisterStartupScript("訊息通知", "<script> alert('資料已刪除,成功!!');</script>");
                Response.Redirect(Request.Url.AbsoluteUri);
                DBint(stage);
            }
            else
            {
                //lblError.Text = strSQL_Delete;
                RegisterStartupScript("訊息通知", "<script> alert('資料刪除,失敗!!');</script>");
            }
        }
        catch (FormatException ex)
        {
            lblError.Text = "[Error Message::NPI Category Form Delete Function]: " + ex.ToString();
        }
    }
    protected void GD_CATE_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string strScript = "";
        clsMySQL db = new clsMySQL();
        int index = 0;


        switch (e.CommandName)
        {

            case "Update":
                Panel_update_category.Visible = true;
                Panel_Category.Visible = false;

                break;

            case "View":
                Panel_Category.Visible = false;
                Panel_update_category.Visible = false;
                Panel_Add_Category.Visible = false;
                Panel_Category_View.Visible = true;
                index = Convert.ToInt32(e.CommandArgument);
                view_category(index);
                //Session.Clear();
                //HttpContext.Current.Session["value_view_index"] = index;
                break;

            case "btnDelete":
                index = Convert.ToInt32(e.CommandArgument);
                GridViewRow selecteRow = GD_CATE.Rows[index];
                string category_inf = selecteRow.Cells[1].Text + "|" + selecteRow.Cells[2].Text + "|" + selecteRow.Cells[3].Text + "|" + selecteRow.Cells[4].Text + "|" + selecteRow.Cells[5].Text + "|" + selecteRow.Cells[6].Text;
                strScript = string.Format("<script language='javascript'>ConfirmDelManual('確定刪除_FCU?','" + category_inf + "');</script>", category_inf);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);

                break;


        }
    }
    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 int count_eptramain()
    {

        int count = 0;
        string sql_eptramain_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 ='Enable'";
        clsMySQL db = new clsMySQL();

        MySqlConnection MySqlConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQL"].ConnectionString);
        MySqlConn.Open();

        MySqlCommand MySqlCmd = new MySqlCommand(sql_eptramain_count, MySqlConn);
        MySqlDataReader mydr = MySqlCmd.ExecuteReader();




        while (mydr.Read())
        {

            count = int.Parse(mydr[0].ToString()); //猛猛der,Parse到底是什麼,怎麼可以這樣轉~~

            //int.Parse(myReader[0].ToString());

        }
        mydr.Close();
        MySqlConn.Close();

        return count;

    }
    protected Boolean jude_Query_EPTRA(string sql)
    {
        string Temp_Cus = "";
        string Temp_New = "";
        clsMySQL db = new clsMySQL();

        MySqlConnection MySqlConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQL"].ConnectionString);
        MySqlConn.Open();

        MySqlCommand MySqlCmd = new MySqlCommand(sql, MySqlConn);
        MySqlDataReader mydr = MySqlCmd.ExecuteReader();

        while (mydr.Read())
        {
            Temp_Cus = (String)mydr["Ver_New_Customer"];
            Temp_New = (String)mydr["Ver_New_Device"];

        }

        mydr.Close();
        MySqlConn.Close();

        if (Temp_Cus == Customer_TB.Text && Temp_New == ND_TB.Text)
        {
            return true;
        }
        else
            return false;

       

    }
    public static string DEL_Category(string str_stage)
    {
        string strError = "";
        string[] category_spilit_inf = new string[6];
        category_spilit_inf = str_stage.Split('|');

        for (int i = 0; i < category_spilit_inf.Length; i++)
        {
            if (category_spilit_inf[i] == "&nbsp;")
            {
                category_spilit_inf[i] = "";
            }
        }


        string strSQL_Delete = string.Format("Delete from npi_ep_category where EP_Cate_Stage='{0}' and EP_Cate_Iiitems='{1}' and EP_Cate_SpeChar='{2}' and  EP_Cate_Md='{3}' and EP_Cate_Cate='{4}' and  EP_Cate_KP='{5}'",
                                               category_spilit_inf[0], category_spilit_inf[1], category_spilit_inf[2], category_spilit_inf[3], category_spilit_inf[4], category_spilit_inf[5]);


        clsMySQL db = new clsMySQL();
        if (db.QueryExecuteNonQuery(strSQL_Delete))
        {
            strError = "刪除成功!";
            //DBint(category_spilit_inf[0]);

            HttpContext.Current.Session["value_del_stage"] = category_spilit_inf[0];
            db.Close();
        }
        else
        {
            strError = "Error Message:[NPI ManualForm] Delete Fail!!";
        }
        return strError;

    }
    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 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();



    }
    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 LinkButton_Insert_Add_Click(object sender, EventArgs e)
    {
        clsMySQL db = new clsMySQL();

        string Status = "Y";
        string User_Name = "CIM";
        String insert_cap = 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}')",
                            text_ad_cate_user.Text, Status, text_ad_cate_stage.Text, text_ad_cate_input.Text,
                            text_ad_cate_sp.Text, text_ad_cate_md.Text, text_ad_cate_cate.Text, text_ad_cate_kp.Text);



        try
        {
            if (text_ad_cate_stage.Text.Trim() == "")
            {
                string strScript = string.Format("<script language='javascript'>alert('您沒有輸入Stage,請重新輸入!');</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);
                Panel_Add_Category.Visible = true;
                Panel_Category_View.Visible = false;
                Panel_update_category.Visible = false;
                Panel_Category.Visible = false;
                
            }
            else if (db.QueryExecuteNonQuery(insert_cap) == true)
            {
                string strScript = string.Format("<script language='javascript'>alert('Stage:" + text_ad_cate_stage.Text + "新增成功');</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);
                Panel_Add_Category.Visible = false;
                Panel_update_category.Visible = false;
                Panel_Category.Visible = true;
                Response.Redirect(Request.Url.AbsoluteUri);
                DBint(text_ad_cate_stage.Text);
            }
            else
            {
                string strScript = string.Format("<script language='javascript'>alert('新增失敗');</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    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 Setting_Panel_Lv(Panel temp_Lv,Panel temp_stage,Panel temp_pot, string keyitem,string Lv_sign,Label lab_stage, Label lab_pot)
    {

        List<int> amount_Poten = new List<int>(); // 存放count_EffectLabel_stage 值
        int amount_stage = count_Effectstage(keyitem);
        //int b = count_EffectLabel(keyitem);
        string temp_effect_name = "";
        string temp_pot_name = "";
        string br = "";
        string temp_pot_name2 = "";

       

        if (jude_keyitem(keyitem) == true)
        {
            for (int i = 0; i < amount_stage; i++)
            {
                Label effect = new Label();
                ImageButton TraLv = new ImageButton();
                Label Tratext = new Label();

                temp_effect_name = display_Effectstage(keyitem, i);
                effect.ID ="KeyItem_"+ keyitem +"stage_" + temp_effect_name;
                TraLv.ID = "Imagebutton_" + keyitem + "_" + temp_effect_name;
                amount_Poten.Add(count_EffectLabel_stage(keyitem, temp_effect_name));

                for (int j = 0; j < amount_Poten[i] + 1; j++)
                {
                    br += "<br>";

                }
                count_white_lamp++;
                effect.Text = temp_effect_name + br;
                temp_stage.Controls.Add(effect);

               

                Label Potential = new Label();
                string str = "";

                for (int k = 0; k < amount_Poten[i]; k++) /**/
                {

                    temp_pot_name = display_EffectLabel(keyitem, temp_effect_name, k);
                    temp_pot_name2 += temp_pot_name + "<br />";
                    if (k != (amount_Poten[i] - 1))
                    {
                        str += temp_pot_name + "|";
                    }
                    else
                    {
                        str += temp_pot_name;
                    }


                    if (amount_Poten[i] - 1 == k)
                    {
                        Potential.Text += "<br>";
                    }


                   

                    //Potential.Attributes.Remove("href");
                    //temp_pot.Controls.Add(Potential);
                    all_lv_setting(Lv_sign, keyitem, temp_effect_name, temp_pot_name);
                }

                


                if (Lv_sign == "自行選擇LV")
                {
                    TraLv.ImageUrl = "icon/white.gif";
                }
                else if (Lv_sign== "RC(Lv.3)")
                {
                    TraLv.ImageUrl = "icon/red.gif";
                }
                else if (Lv_sign == "MC(Lv.4)")
                {
                    TraLv.ImageUrl = "icon/red.gif";
                    
                }
                else if (Lv_sign == "LC(Lv.5)")
                {
                    TraLv.ImageUrl = "icon/green.gif";
                    
                }
                



                string session = "filename=" + global_Ver_Name + "&" + "keyitem=" + keyitem + "&" + "stage=" + temp_effect_name + "";


                //TraLv.OnClientClick = "test(" + "\"" + session + "\"" + ");";
                TraLv.OnClientClick = "AddWork_Lv_Setting('" + global_Ver_Name+"','" + keyitem+"','"+temp_effect_name+"')";
                TraLv.Attributes.Add("onclick", "return false;");

                TraLv.Width = Unit.Pixel(30);
                TraLv.Height = Unit.Pixel(30);
                temp_Lv.Controls.Add(TraLv);



                Tratext.Text = br;

                temp_Lv.Controls.Add(Tratext);


                br = "";

                //string redirect = "File_Name='" + Version_name + "'&" + "keyitem='" + keyitem + "'&" + "stage='" + temp_effect_name + "'&" + "SpeChar='" + temp_pot_name + "'";
                //string redirect = "File_Name='" + Version_name + "'&" + "keyitem='" + keyitem + "'&" + "stage='" + temp_effect_name + "'";
                //string url = "DOE_yes.aspx?" + redirect;

                //Potential.NavigateUrl = url;
                //Potential.Target = "_self";
                Potential.ID = "KeyItem" + "_" + keyitem + "Potential_" + temp_pot_name;
                Potential.Text = temp_pot_name2 + "<br />";
                temp_pot_name2 = "";
                temp_pot.Controls.Add(Potential);
            }

        }
        else
        {
            lab_stage.Text = "Not Defined!";
            lab_stage.ForeColor = System.Drawing.Color.Red;
            lab_pot.Text = "Not Defined!";
            lab_pot.ForeColor = System.Drawing.Color.Red;

        }

    }



    protected void all_lv_setting_update(string lv_sign, string keyitem, string stage, string SpeChar)
    {
        clsMySQL db = new clsMySQL();
        string insert_sign = "";
        String insert_lv = string.Format("insert into npieptra_lv_main" +
                               "(Ver_Name,EPTRA_KeyItem,EPTRA_LV_Stage,EPTRA_LV_SpecChar,EPTRA_LV)Values" +
                               "('{0}','{1}','{2}','{3}','{4}')" +
                               "ON DUPLICATE KEY UPDATE EPTRA_KeyItem='{1}',EPTRA_LV_Stage='{2}',EPTRA_LV_SpecChar='{3}',EPTRA_LV='{4}'",
                               global_Ver_Name, keyitem, stage, SpeChar, lv_sign);





        try
        {

            if (db.QueryExecuteNonQuery(insert_lv) == true)
            {

                //t += Convert.ToString(i) + ",";
                insert_sign = "true";

            }
            else
            {
                //f += Convert.ToString(i) + ",";
                insert_sign = "false";
                lblError.Text = insert_lv + db.ToString();

            }
        }
        catch (Exception ex)
        {
            lblError.Text = ex.ToString();
            throw ex;
        }


    }






    protected void all_lv_setting(string lv_sign,string keyitem,string stage,string SpeChar)
    {
        clsMySQL db = new clsMySQL();
        string insert_sign = "";
        String insert_lv = string.Format("insert into npieptra_lv_main" +
                               "(Ver_Name,EPTRA_KeyItem,EPTRA_LV_Stage,EPTRA_LV_SpecChar,EPTRA_LV)Values" +
                               "('{0}','{1}','{2}','{3}','{4}')"+
                               "ON DUPLICATE KEY UPDATE EPTRA_KeyItem='{1}',EPTRA_LV_Stage='{2}',EPTRA_LV_SpecChar='{3}',EPTRA_LV='{4}'",                              
                               global_Ver_Name, keyitem, stage, SpeChar, lv_sign);





        try
        {

            if (db.QueryExecuteNonQuery(insert_lv) == true)
            {

                //t += Convert.ToString(i) + ",";
                insert_sign = "true";
                
            }
            else
            {
                //f += Convert.ToString(i) + ",";
                insert_sign = "false";
                lblError.Text = insert_lv+ db.ToString();
                
            }
        }
        catch (Exception ex)
        {
            lblError.Text = ex.ToString();
            throw ex;
        }
      

    }




    protected void all_lv_put_keyitem_data(string Lv_Sign)
    {

        if (lab_gap1.Text == "Y")
        {
            lab_Eff_01.Text = "--";
            lab_Pot_01.Text = "--";
        }
        else
        {
            lab_Eff_01.Text = "--";
            lab_Pot_01.Text = "--";
        }
        if (lab_gap2.Text == "Y")
        {
            lab_Eff_01.Text = "--";
            lab_Pot_01.Text = "--";
        }
        else
        {
            lab_Eff_01.Text = "--";
            lab_Pot_01.Text = "--";
        }
        if (lab_gap3.Text == "Y")
        {
            lab_Eff_01.Text = "--";
            lab_Pot_01.Text = "--";
        }
        else
        {
            lab_Eff_01.Text = "--";
            lab_Pot_01.Text = "--";
        }
        if (lab_gap4.Text == "Y")
        {
            lab_gap4.Text = "Y";
            lab_gap4.ForeColor = System.Drawing.Color.Red;
           
            Setting_Panel_Lv(Panel_Lv_4, Panel_Eff_04, Panel_Pot_04, Lab_keyitem_04.Text, Lv_Sign, lab_Eff_04, lab_Pot_04);

        }
        else
        {
            lab_gap4.Text = "N";
            lab_gap4.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_04.Text = "--";
            lab_Pot_04.Text = "--";

        }

        if (lab_gap5.Text == "Y")
        {
            lab_gap5.Text = "Y";
            lab_gap5.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_5, Panel_Eff_05, Panel_Pot_05, Lab_keyitem_05.Text, Lv_Sign, lab_Eff_05, lab_Pot_05);
            
        }
        else
        {
            lab_gap5.Text = "N";
            lab_gap5.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_05.Text = "--";
            lab_Pot_05.Text = "--";
        }

        if (lab_gap6.Text == "Y")
        {
            lab_gap6.Text = "Y";
            lab_gap6.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_6, Panel_Eff_06, Panel_Pot_06, Lab_keyitem_06.Text, Lv_Sign, lab_Eff_06, lab_Pot_06);
        }
        else
        {
            lab_gap6.Text = "N";
            lab_gap6.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_06.Text = "--";
            lab_Pot_06.Text = "--";
        }
        if (lab_gap7.Text == "Y")
        {
            lab_gap7.Text = "Y";
            lab_gap7.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_7, Panel_Eff_07, Panel_Pot_07, Lab_keyitem_07.Text, Lv_Sign, lab_Eff_07, lab_Pot_07);
        }
        else
        {
            lab_gap7.Text = "N";
            lab_gap7.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_07.Text = "--";
            lab_Pot_07.Text = "--";
        }
        if (lab_gap8.Text == "Y")
        {
            lab_gap8.Text = "Y";
            lab_gap8.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_8, Panel_Eff_08, Panel_Pot_08, Lab_keyitem_08.Text, Lv_Sign, lab_Eff_08, lab_Pot_08);
        }
        else
        {
            lab_gap8.Text = "N";
            lab_gap8.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_08.Text = "--";
            lab_Pot_08.Text = "--";
        }
        if (lab_gap9.Text == "Y")
        {
            lab_gap9.Text = "Y";
            lab_gap9.ForeColor = System.Drawing.Color.Red;

            Setting_Panel_Lv(Panel_Lv_9, Panel_Eff_09, Panel_Pot_09, Lab_keyitem_09.Text, Lv_Sign, lab_Eff_09, lab_Pot_09);
        }
        else
        {
            lab_gap9.Text = "N";
            lab_gap9.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_09.Text = "--";
            lab_Pot_09.Text = "--";
        }
        if (lab_gap10.Text == "Y")
        {
            lab_gap10.Text = "Y";
            lab_gap10.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_10, Panel_Eff_10, Panel_Pot_10, Lab_keyitem_10.Text, Lv_Sign, lab_Eff_10, lab_Pot_10);
        }
        else
        {
            lab_gap10.Text = "N";
            lab_gap10.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_10.Text = "--";
            lab_Pot_10.Text = "--";
        }
        if (lab_gap11.Text == "Y")
        {
            lab_gap11.Text = "Y";
            lab_gap11.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_11, Panel_Eff_11, Panel_Pot_11, Lab_keyitem_11.Text, Lv_Sign, lab_Eff_11, lab_Pot_11);
        }
        else
        {
            lab_gap11.Text = "N";
            lab_gap11.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_11.Text = "--";
            lab_Pot_11.Text = "--";
        }
        if (lab_gap12.Text == "Y")
        {
            lab_gap12.Text = "Y";
            lab_gap12.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_12, Panel_Eff_12, Panel_Pot_12, Lab_keyitem_12.Text, Lv_Sign, lab_Eff_12, lab_Pot_12);
        }
        else
        {
            lab_gap12.Text = "N";
            lab_gap12.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_12.Text = "--";
            lab_Pot_12.Text = "--";
        }
        if (lab_gap13.Text == "Y")
        {
            lab_gap13.Text = "Y";
            lab_gap13.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_13, Panel_Eff_13, Panel_Pot_13, Lab_keyitem_13.Text, Lv_Sign, lab_Eff_13, lab_Pot_13);
        }
        else
        {
            lab_gap13.Text = "N";
            lab_gap13.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_13.Text = "--";
            lab_Pot_13.Text = "--";
        }

        if (lab_gap14.Text == "Y")
        {
            lab_gap14.Text = "Y";
            lab_gap14.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_14, Panel_Eff_14, Panel_Pot_14, Lab_keyitem_14.Text, Lv_Sign, lab_Eff_14, lab_Pot_14);
        }
        else
        {
            lab_gap14.Text = "N";
            lab_gap14.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_14.Text = "--";
            lab_Pot_14.Text = "--";
        }
        if (lab_gap15.Text == "Y")
        {
            lab_gap15.Text = "Y";
            lab_gap15.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_15, Panel_Eff_15, Panel_Pot_15, Lab_keyitem_15.Text, Lv_Sign, lab_Eff_15, lab_Pot_15);
        }
        else
        {
            lab_gap15.Text = "N";
            lab_gap15.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_15.Text = "--";
            lab_Pot_15.Text = "--";
        }
        if (lab_gap16.Text == "Y")
        {
            lab_gap16.Text = "Y";
            lab_gap16.ForeColor = System.Drawing.Color.Red;
            ///PI Thickness (um)
            Setting_Panel_Lv(Panel_Lv_16, Panel_Eff_16, Panel_Pot_16, Lab_keyitem_16.Text, Lv_Sign, lab_Eff_16, lab_Pot_16);

        }
        else
        {
            lab_gap16.Text = "N";
            lab_gap16.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_16.Text = "--";
            lab_Pot_16.Text = "--";
        }

        if (lab_gap17.Text == "Y")
        {
            lab_gap17.Text = "Y";
            lab_gap17.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_17, Panel_Eff_17, Panel_Pot_17, Lab_keyitem_17.Text, Lv_Sign, lab_Eff_17, lab_Pot_17);
        }
        else
        {
            lab_gap17.Text = "N";
            lab_gap17.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_17.Text = "--";
            lab_Pot_17.Text = "--";
        }

        if (lab_gap18.Text == "Y")
        {
            lab_gap18.Text = "Y";
            lab_gap18.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_18, Panel_Eff_18, Panel_Pot_18, Lab_keyitem_18.Text, Lv_Sign, lab_Eff_18, lab_Pot_18);
        }
        else
        {
            lab_gap18.Text = "N";
            lab_gap18.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_18.Text = "--";
            lab_Pot_18.Text = "--";
        }

        if (lab_gap19.Text == "Y")
        {
            lab_gap19.Text = "Y";
            lab_gap19.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_19, Panel_Eff_19, Panel_Pot_19, Lab_keyitem_19.Text, Lv_Sign, lab_Eff_19, lab_Pot_19);
        }

        else
        {
            lab_gap19.Text = "N";
            lab_gap19.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_19.Text = "--";
            lab_Pot_19.Text = "--";
        }

        if (lab_gap20.Text == "Y")
        {
            lab_gap20.Text = "Y";
            lab_gap20.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_20, Panel_Eff_20, Panel_Pot_20, Lab_keyitem_20.Text, Lv_Sign, lab_Eff_20, lab_Pot_20);
        }
        else
        {
            lab_gap20.Text = "N";
            lab_gap20.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_20.Text = "--";
            lab_Pot_20.Text = "--";
        }

        if (lab_gap21.Text == "Y")
        {
            lab_gap21.Text = "Y";
            lab_gap21.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_21, Panel_Eff_21, Panel_Pot_21, Lab_keyitem_21.Text, Lv_Sign, lab_Eff_21, lab_Pot_21);
        }
        else
        {
            lab_gap21.Text = "N";
            lab_gap21.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_21.Text = "--";
            lab_Pot_21.Text = "--";
        }

        if (lab_gap22.Text == "Y")
        {
            lab_gap22.Text = "Y";
            lab_gap22.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_22, Panel_Eff_22, Panel_Pot_22, Lab_keyitem_22.Text, Lv_Sign, lab_Eff_22, lab_Pot_22);
            
        }
        else
        {
            lab_gap22.Text = "N";
            lab_gap22.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_22.Text = "--";
            lab_Pot_22.Text = "--";
        }

        if (lab_gap23.Text == "Y")
        {
            lab_gap23.Text = "Y";
            lab_gap23.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_23, Panel_Eff_23, Panel_Pot_23, Lab_keyitem_23.Text, Lv_Sign, lab_Eff_23, lab_Pot_23);
           
        }
        else
        {
            lab_gap23.Text = "N";
            lab_gap23.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_23.Text = "--";
            lab_Pot_23.Text = "--";
        }
        if (lab_gap24.Text == "Y")
        {
            lab_gap24.Text = "Y";
            lab_gap24.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_24, Panel_Eff_24, Panel_Pot_24, Lab_keyitem_24.Text, Lv_Sign, lab_Eff_24, lab_Pot_24);
        }
        else
        {
            lab_gap24.Text = "N";
            lab_gap24.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_24.Text = "--";
            lab_Pot_24.Text = "--";
        }

        if (lab_gap25.Text == "Y")
        {
            lab_gap25.Text = "Y";
            lab_gap25.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_25, Panel_Eff_25, Panel_Pot_25, Lab_keyitem_25.Text, Lv_Sign, lab_Eff_25, lab_Pot_25);
        }
        else
        {
            lab_gap25.Text = "N";
            lab_gap25.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_25.Text = "--";
            lab_Pot_25.Text = "--";
        }

        if (lab_gap26.Text == "Y")
        {
            lab_gap26.Text = "Y";
            lab_gap26.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_26, Panel_Eff_26, Panel_Pot_26, Lab_keyitem_26.Text, Lv_Sign, lab_Eff_26, lab_Pot_26);
        }
        else
        {
            lab_gap26.Text = "N";
            lab_gap26.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_26.Text = "--";
            lab_Pot_26.Text = "--";
        }

        if (lab_gap27.Text == "Y")
        {
            lab_gap27.Text = "Y";
            lab_gap27.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_27, Panel_Eff_27, Panel_Pot_27, Lab_keyitem_27.Text, Lv_Sign, lab_Eff_27, lab_Pot_27);

        }
        else
        {
            lab_gap27.Text = "N";
            lab_gap27.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_27.Text = "--";
            lab_Pot_27.Text = "--";
        }

        if (lab_gap28.Text == "Y")
        {
            lab_gap28.Text = "Y";
            lab_gap28.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_28, Panel_Eff_28, Panel_Pot_28, Lab_keyitem_28.Text, Lv_Sign, lab_Eff_28, lab_Pot_28);
        }
        else
        {
            lab_gap28.Text = "N";
            lab_gap28.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_28.Text = "--";
            lab_Pot_28.Text = "--";
        }

        if (lab_gap29.Text == "Y")
        {
            lab_gap29.Text = "Y";
            lab_gap29.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_29, Panel_Eff_29, Panel_Pot_29, Lab_keyitem_29.Text, Lv_Sign, lab_Eff_29, lab_Pot_29);
        }
        else
        {
            lab_gap29.Text = "N";
            lab_gap29.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_29.Text = "--";
            lab_Pot_29.Text = "--";
        }

        if (lab_gap30.Text == "Y")
        {
            lab_gap30.Text = "Y";
            lab_gap30.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_30, Panel_Eff_30, Panel_Pot_30, Lab_keyitem_30.Text, Lv_Sign, lab_Eff_30, lab_Pot_30);
        }
        else
        {
            lab_gap30.Text = "N";
            lab_gap30.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_30.Text = "--";
            lab_Pot_30.Text = "--";
        }

        if (lab_gap31.Text == "Y")
        {
            lab_gap31.Text = "Y";
            lab_gap31.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_31, Panel_Eff_31, Panel_Pot_31, Lab_keyitem_31.Text, Lv_Sign, lab_Eff_31, lab_Pot_31);
        }
        else
        {
            lab_gap31.Text = "N";
            lab_gap31.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_31.Text = "--";
            lab_Pot_31.Text = "--";
        }

        if (lab_gap32.Text == "Y")
        {
            lab_gap32.Text = "Y";
            lab_gap32.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_32, Panel_Eff_32, Panel_Pot_32, Lab_keyitem_32.Text, Lv_Sign, lab_Eff_32, lab_Pot_32);
        }
        else
        {
            lab_gap32.Text = "N";
            lab_gap32.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_32.Text = "--";
            lab_Pot_32.Text = "--";
        }

        if (lab_gap33.Text == "Y")
        {
            lab_gap33.Text = "Y";
            lab_gap33.ForeColor = System.Drawing.Color.Red;
            lab_Eff_33.Text = "--";
            lab_Pot_33.Text = "--";
            Setting_Panel_Lv(Panel_Lv_33, Panel_Eff_33, Panel_Pot_33, Lab_keyitem_33.Text, Lv_Sign, lab_Eff_33, lab_Pot_33);
        }
        else
        {
            lab_gap33.Text = "N";
            lab_gap33.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_33.Text = "--";
            lab_Pot_33.Text = "--";
        }

        if (lab_gap34.Text == "Y")
        {
            lab_gap34.Text = "Y";
            lab_gap34.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_34, Panel_Eff_34, Panel_Pot_34, Lab_keyitem_34.Text, Lv_Sign, lab_Eff_34, lab_Pot_34);
        }
        else
        {
            lab_gap34.Text = "N";
            lab_gap34.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_34.Text = "--";
            lab_Pot_34.Text = "--";
        }

        if (lab_gap35.Text == "Y")
        {
            lab_gap35.Text = "Y";
            lab_gap35.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_35, Panel_Eff_35, Panel_Pot_35, Lab_keyitem_35.Text, Lv_Sign, lab_Eff_35, lab_Pot_35);
        }
        else
        {
            lab_gap35.Text = "N";
            lab_gap35.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_35.Text = "--";
            lab_Pot_35.Text = "--";
        }

        if (lab_gap36.Text == "Y")
        {
            lab_gap36.Text = "Y";
            lab_gap36.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_36, Panel_Eff_36, Panel_Pot_36, Lab_keyitem_36.Text, Lv_Sign, lab_Eff_36, lab_Pot_36);
        }
        else
        {
            lab_gap36.Text = "N";
            lab_gap36.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_36.Text = "--";
            lab_Pot_36.Text = "--";
        }

        if (lab_gap37.Text == "Y")
        {
            lab_gap37.Text = "Y";
            lab_gap37.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_37, Panel_Eff_37, Panel_Pot_37, Lab_keyitem_37.Text, Lv_Sign, lab_Eff_37, lab_Pot_37);
        }
        else
        {
            lab_gap37.Text = "N";
            lab_gap37.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_37.Text = "--";
            lab_Pot_37.Text = "--";
        }

        if (lab_gap38.Text == "Y")
        {
            lab_gap38.Text = "Y";
            lab_gap38.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_38, Panel_Eff_38, Panel_Pot_38, Lab_keyitem_38.Text, Lv_Sign, lab_Eff_38, lab_Pot_38);
        }
        else
        {
            lab_gap38.Text = "N";
            lab_gap38.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_38.Text = "--";
            lab_Pot_38.Text = "--";
        }

        if (lab_gap39.Text == "Y")
        {
            lab_gap39.Text = "Y";
            lab_gap39.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_39, Panel_Eff_39, Panel_Pot_39, Lab_keyitem_39.Text, Lv_Sign, lab_Eff_39, lab_Pot_39);
        }
        else
        {
            lab_gap39.Text = "N";
            lab_gap39.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_39.Text = "--";
            lab_Pot_39.Text = "--";
        }


        if (lab_gap40.Text == "Y")
        {
            lab_gap40.Text = "Y";
            lab_gap40.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_40, Panel_Eff_40, Panel_Pot_40, Lab_keyitem_40.Text, Lv_Sign, lab_Eff_40, lab_Pot_40);
        }
        else
        {
            lab_gap40.Text = "N";
            lab_gap40.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_40.Text = "--";
            lab_Pot_40.Text = "--";
        }


        if (lab_gap41.Text == "Y")
        {
            lab_gap41.Text = "Y";
            lab_gap41.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_41, Panel_Eff_41, Panel_Pot_41, Lab_keyitem_41.Text, Lv_Sign, lab_Eff_41, lab_Pot_41);
        }
        else
        {

            lab_gap41.Text = "N";
            lab_gap41.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_41.Text = "--";
            lab_Pot_41.Text = "--";
        }

        if (lab_gap42.Text == "Y")
        {
            lab_gap42.Text = "Y";
            lab_gap42.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_42, Panel_Eff_42, Panel_Pot_42, Lab_keyitem_42.Text, Lv_Sign, lab_Eff_42, lab_Pot_42);
        }
        else
        {
            lab_gap42.Text = "N";
            lab_gap42.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_42.Text = "--";
            lab_Pot_42.Text = "--";
        }

        if (lab_gap43.Text == "Y")
        {
            lab_gap43.Text = "Y";
            lab_gap43.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_43, Panel_Eff_43, Panel_Pot_43, Lab_keyitem_43.Text, Lv_Sign, lab_Eff_43, lab_Pot_43);
        }
        else
        {
            lab_gap43.Text = "N";
            lab_gap43.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_43.Text = "--";
            lab_Pot_43.Text = "--";
        }

        if (lab_gap44.Text == "Y")
        {
            lab_gap44.Text = "Y";
            lab_gap44.ForeColor = System.Drawing.Color.Red;
            //Setting_Panel_Lv(Panel_Lv_23, Panel_Eff_23, Panel_Pot_23, Lab_keyitem_23.Text, Lv_Sign, lab_Eff_23, lab_Pot_23);
        }
        else
        {
            lab_gap44.Text = "N";
            lab_gap44.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_44.Text = "--";
            lab_Pot_44.Text = "--";
        }

        if (lab_gap45.Text == "Y")
        {
            lab_gap45.Text = "Y";
            lab_gap45.ForeColor = System.Drawing.Color.Red;
            //Setting_Panel_Lv(Panel_Lv_23, Panel_Eff_23, Panel_Pot_23, Lab_keyitem_23.Text, Lv_Sign, lab_Eff_23, lab_Pot_23);
        }
        else
        {
            lab_gap45.Text = "N";
            lab_gap45.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_45.Text = "--";
            lab_Pot_45.Text = "--";
        }

        if (lab_gap46.Text == "Y")
        {
            lab_gap46.Text = "Y";
            lab_gap46.ForeColor = System.Drawing.Color.Red;
            //Setting_Panel_Lv(Panel_Lv_23, Panel_Eff_23, Panel_Pot_23, Lab_keyitem_23.Text, Lv_Sign, lab_Eff_23, lab_Pot_23);
        }
        else
        {
            lab_gap46.Text = "N";
            lab_gap46.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_46.Text = "--";
            lab_Pot_46.Text = "--";
        }


        if (lab_gap47.Text == "Y")
        {
            lab_gap47.Text = "Y";
            lab_gap47.ForeColor = System.Drawing.Color.Red;
            //Setting_Panel_Lv(Panel_Lv_23, Panel_Eff_23, Panel_Pot_23, Lab_keyitem_23.Text, Lv_Sign, lab_Eff_23, lab_Pot_23);
        }
        else
        {
            lab_gap47.Text = "N";
            lab_gap47.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_47.Text = "--";
            lab_Pot_47.Text = "--";

        }

        if (lab_gap48.Text == "Y")
        {
            lab_gap48.Text = "Y";
            lab_gap48.ForeColor = System.Drawing.Color.Red;
            //Setting_Panel_Lv(Panel_Lv_23, Panel_Eff_23, Panel_Pot_23, Lab_keyitem_23.Text, Lv_Sign, lab_Eff_23, lab_Pot_23);
        }
        else
        {
            lab_gap48.Text = "N";
            lab_gap48.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_48.Text = "--";
            lab_Pot_48.Text = "--";
        }

        if (lab_gap49.Text == "Y")
        {
            lab_gap49.Text = "Y";
            lab_gap49.ForeColor = System.Drawing.Color.Red;
            //Setting_Panel_Lv(Panel_Lv_23, Panel_Eff_23, Panel_Pot_23, Lab_keyitem_23.Text, Lv_Sign, lab_Eff_23, lab_Pot_23);
        }
        else
        {
            lab_gap49.Text = "N";
            lab_gap49.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_49.Text = "--";
            lab_Pot_49.Text = "--";
        }






        if (lab_gap51.Text == "Y")
        {
            lab_gap51.Text = "Y";
            lab_gap51.ForeColor = System.Drawing.Color.Red;
            //Setting_Panel_Lv(Panel_Lv_23, Panel_Eff_23, Panel_Pot_23, Lab_keyitem_23.Text, Lv_Sign, lab_Eff_23, lab_Pot_23);
        }
        else
        {
            lab_gap51.Text = "N";
            lab_gap51.ForeColor = System.Drawing.Color.Blue;
            lab_Pot_51.Text = "--";
            lab_Eff_51.Text = "--";
        }

        if (lab_gap52.Text == "Y")
        {
            lab_gap52.Text = "Y";
            lab_gap52.ForeColor = System.Drawing.Color.Red;
            //Setting_Panel_Lv(Panel_Lv_23, Panel_Eff_23, Panel_Pot_23, Lab_keyitem_23.Text, Lv_Sign, lab_Eff_23, lab_Pot_23);
        }
        else
        {
            lab_gap52.Text = "N";
            lab_gap52.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_52.Text = "--";
            lab_Pot_52.Text = "--";
        }

        if (lab_gap53.Text == "Y")
        {
            lab_gap53.Text = "Y";
            lab_gap53.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_23, Panel_Eff_23, Panel_Pot_23, Lab_keyitem_23.Text, Lv_Sign, lab_Eff_23, lab_Pot_23);
        }
        else
        {
            lab_gap53.Text = "N";
            lab_gap53.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_53.Text = "--";
            lab_Pot_53.Text = "--";
        }

        if (lab_gap54.Text == "Y")
        {
            lab_gap54.Text = "Y";
            lab_gap54.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_54, Panel_Eff_54, Panel_Pot_54, Lab_keyitem_45_4.Text, Lv_Sign, lab_Eff_54, lab_Pot_54);
        }
        else
        {
            lab_gap54.Text = "N";
            lab_gap54.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_54.Text = "--";
            lab_Pot_54.Text = "--";
        }

        if (lab_gap55.Text == "Y")
        {
            lab_gap55.Text = "Y";
            lab_gap55.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_55, Panel_Eff_55, Panel_Pot_55, Lab_keyitem_46.Text, Lv_Sign, lab_Eff_55, lab_Pot_55);
        }
        else
        {
            lab_gap55.Text = "N";
            lab_gap55.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_55.Text = "--";
            lab_Pot_55.Text = "--";
        }

        if (lab_gap56.Text == "Y")
        {
            lab_gap56.Text = "Y";
            lab_gap56.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_56, Panel_Eff_56, Panel_Pot_56, Lab_keyitem_47.Text, Lv_Sign, lab_Eff_56, lab_Pot_56);
        }
        else
        {
            lab_gap56.Text = "N";
            lab_gap56.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_56.Text = "--";
            lab_Pot_56.Text = "--";
        }

        if (lab_gap57.Text == "Y")
        {
            lab_gap57.Text = "Y";
            lab_gap57.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_57, Panel_Eff_57, Panel_Pot_57, Lab_keyitem_48.Text, Lv_Sign, lab_Eff_57, lab_Pot_57);
        }
        else
        {
            lab_gap57.Text = "N";
            lab_gap57.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_57.Text = "--";
            lab_Pot_57.Text = "--";
        }

        if (lab_gap58.Text == "Y")
        {
            lab_gap58.Text = "Y";
            lab_gap58.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_58, Panel_Eff_58, Panel_Pot_58, Lab_keyitem_49.Text, Lv_Sign, lab_Eff_58, lab_Pot_58);
        }
        else
        {
            lab_gap58.Text = "N";
            lab_gap58.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_58.Text = "--";
            lab_Pot_58.Text = "--";
        }


        if (lab_gap59.Text == "Y")
        {
            lab_gap59.Text = "Y";
            lab_gap59.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_59, Panel_Eff_59, Panel_Pot_59, Lab_keyitem_59.Text, Lv_Sign, lab_Eff_59, lab_Pot_59);

        }
        else
        {
            lab_gap59.Text = "N";
            lab_gap59.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_59.Text = "--";
            lab_Pot_59.Text = "--";
        }


        if (lab_gap60.Text == "Y")
        {
            lab_gap60.Text = "Y";
            lab_gap60.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_60, Panel_Eff_60, Panel_Pot_60, Lab_keyitem_60.Text, Lv_Sign, lab_Eff_60, lab_Pot_60);
        }
        else
        {
            lab_gap60.Text = "N";
            lab_gap60.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_60.Text = "--";
            lab_Pot_60.Text = "--";
        }

        if (lab_gap61.Text == "Y")
        {
            lab_gap61.Text = "Y";
            lab_gap61.ForeColor = System.Drawing.Color.Red;
            Setting_Panel_Lv(Panel_Lv_61, Panel_Eff_61, Panel_Pot_61, Lab_keyitem_61.Text, Lv_Sign, lab_Eff_61, lab_Pot_61);
        }
        else
        {
            lab_gap61.Text = "N";
            lab_gap61.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_61.Text = "--";
            lab_Pot_61.Text = "--";
        }

        if (lab_gap62.Text == "Y")
        {
            lab_gap62.Text = "Y";
            lab_gap62.ForeColor = System.Drawing.Color.Red;
            lab_Eff_62.Text = "--";
            lab_Pot_62.Text = "--";
        }
        else
        {
            lab_gap62.Text = "N";
            lab_gap62.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_62.Text = "--";
            lab_Pot_62.Text = "--";
        }

        if (lab_gap63.Text == "Y")
        {
            lab_gap63.Text = "Y";
            lab_gap63.ForeColor = System.Drawing.Color.Red;
            lab_Eff_63.Text = "--";
            lab_Pot_63.Text = "--";
        }
        else
        {
            lab_gap63.Text = "N";
            lab_gap63.ForeColor = System.Drawing.Color.Blue;
            lab_Pot_63.Text = "--";
            lab_Eff_63.Text = "--";
        }

        if (lab_gap64.Text == "Y")
        {
            lab_gap64.Text = "Y";
            lab_gap64.ForeColor = System.Drawing.Color.Red;
            lab_Eff_64.Text = "--";
            lab_Pot_64.Text = "--";
        }
        else
        {
            lab_gap64.Text = "N";
            lab_gap64.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_64.Text = "--";
            lab_Pot_64.Text = "--";
        }

        if (lab_gap65.Text == "Y")
        {
            lab_gap65.Text = "Y";
            lab_gap65.ForeColor = System.Drawing.Color.Red;
            lab_Eff_65.Text = "--";
            lab_Pot_65.Text = "--";
        }
        else
        {
            lab_gap65.Text = "N";
            lab_gap65.ForeColor = System.Drawing.Color.Blue;
            lab_Eff_65.Text = "--";
            lab_Pot_65.Text = "--";
        }





    }





    [System.Web.Services.WebMethod]
    
    public static void  jyny(string prefix)
    {
        //Response.Redirect("EP_TRA.aspx");
        int i = 0;
    }








    protected void ddl_select_alllv_SelectedIndexChanged(object sender, EventArgs e)
    {
        clsMySQL db = new clsMySQL();
        string lv_sign = ddl_select_alllv.SelectedValue;
        

        switch(lv_sign)
        {

            case "自行選擇LV":
                //ddl_select_alllv.SelectedIndex = 3;

                
                string strScript = string.Format("<script language='javascript'>ALL_Level('" + lv_sign + "','" + select_lv_before + "');</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);

                select_lv_before = ddl_select_alllv.SelectedValue;
              
                break;
            case "RC(Lv.3)":


                string strScript2 = string.Format("<script language='javascript'>ALL_Level('" + lv_sign + "','" + select_lv_before + "');</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript2);
                hf_Lvsign.Value = lv_sign;

                /*if(hf_sign.Value=="t")
                {
                    all_lv_put_keyitem_data(select_lv_before);
                }*/


                select_lv_before = ddl_select_alllv.SelectedValue;
                           
                
                
                break;
            case "MC(Lv.4)":


                string strScript3 = string.Format("<script language='javascript'>ALL_Level('" + lv_sign + "','" + select_lv_before + "');</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript3);
                hf_Lvsign.Value = lv_sign;

                /*if (hf_sign.Value == "t")
                {
                    all_lv_put_keyitem_data(select_lv_before);
                }*/

                select_lv_before = ddl_select_alllv.SelectedValue;
                

            
                
                break;
            case "LC(Lv.5)":


                string strScript4 = string.Format("<script language='javascript'>ALL_Level('" + lv_sign + "','" + select_lv_before + "');</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript4);
                hf_Lvsign.Value = lv_sign;
                /*if (hf_sign.Value == "t")
                {
                    all_lv_put_keyitem_data(select_lv_before);
                }*/

                select_lv_before = ddl_select_alllv.SelectedValue;
               
              
                
                break;
        }




    }

    







    

    protected void cmdFilter_Click(object sender, EventArgs e)
    {
        
        
            string CreateName = "cre_CIM";
            string UpName = "up_CIM";
            string Signoff_SendName = "sing_CIM";
            clsMySQL db = new clsMySQL();

            String insert_lv = string.Format("insert into npieptra_lv_main_status" +
                           "(Ver_Name,Ver_No,Ver_Status,CreateTime,CreateName,UpdateTime,UpdateName," +
                           "LV_Signoff_Status,LV_Signoff_SendName,LV_Signoff_SendTime)Values" +
                           "('{0}','{1}','{2}',NOW(),'{3}',NOW(),'{4}','{5}','{6}',NOW())",
                           global_Ver_Name, global_Ver_No, global_Ver_Sta, CreateName, UpName, "NA", Signoff_SendName);

            if (!db.QueryExecuteNonQuery(insert_lv))
            {
                lblError.Text = insert_lv;
                string strScript = string.Format("<script language='javascript'>alert('送審失敗!');</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript);


            }
            else
            {
                Response.Write("<script language=javascript>alert('送審成功!')</script>");
                Response.Write("<script language=javascript>window.location.href='EPTRA_LV_Setting.aspx'</script>");

            }
     }
    protected void GD_CATE_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string temp = "";
        clsMySQL db = new clsMySQL();

        receiver_CATE_data_Update(e.RowIndex);
    }
    protected void but_lv_int_Click(object sender, EventArgs e)
    {

        //string parameter = Request["__EVENTARGUMENT"];
        //string[] allParams = parameter.Split('|');

        clsMySQL db = new clsMySQL();
        string del_str = "delete from npieptra_lv_main where Ver_Name='" + global_Ver_Name + "'";

        if (!db.QueryExecuteNonQuery(del_str))
        {
            lblError.Text = del_str;

        }

        count_white_lamp = 0;
        gap_compare();

        string strScript_count = string.Format("<script language='javascript'>var count_lamp =" + count_white_lamp + ";</script>");
        Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript_count);



        Hide_Value.Value = count_white_lamp.ToString();
        count_white_lamp = 0;

    }
    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 Button_Cancel_Click(object sender, EventArgs e)
    {
        clsMySQL db = new clsMySQL();

        Panel_gv_signofflist.Visible = false;
        Panel_EPTRA.Visible = false;
        Panel_SignoffList.Visible = true;
       

    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        clsMySQL db = new clsMySQL();

        int index;
        int i = 0;
        index = Convert.ToInt32(e.CommandArgument);
        GridViewRow selecteRow = GridView1.Rows[index];
        TableCell Version = selecteRow.Cells[1];
        TableCell Update_Time  = selecteRow.Cells[2];
        TableCell User = selecteRow.Cells[3];
        TableCell Status = selecteRow.Cells[4];
        TableCell Customer = selecteRow.Cells[5];
        TableCell Device = selecteRow.Cells[6];
        TableCell Site = selecteRow.Cells[7];
        TableCell PKG = selecteRow.Cells[8];
        TableCell WT = selecteRow.Cells[9];
        TableCell FAB = selecteRow.Cells[10];
        TableCell RVSI = selecteRow.Cells[11];
        TableCell New_Customer = selecteRow.Cells[12];
        TableCell New_Device = selecteRow.Cells[13];

        if (e.CommandName == "Setting")
        {
            HttpContext.Current.Session["Version_Name"] = Version.Text ;
            global_Ver_Name = Version.Text;
            string sql_porgodlen = "select * from npieptraver_por where Ver_Name='" + Version.Text + "'";
            string sql_newdevice = "select * from npieptraver_new where Ver_Name='" + Version.Text + "'";
            string sql_gap = "select * from npieptraver_gap where Ver_Name='" + Version.Text + "'";
            string sql_capability = "select * from npieptraver_cap where Ver_Name='" + Version.Text + "'";
            string sql_no = "select * from npieptraver_main where Ver_Name = '" + Version.Text + "'";


            ddl_select_alllv.SelectedIndex = 0;


            string del_str = "delete from npieptra_lv_main where Ver_Name='" + global_Ver_Name + "'";

            if (!db.QueryExecuteNonQuery(del_str))
            {
                lblError.Text = del_str;

            }


            Panel_EPTRA.Visible = true;
            display_PORGOlden_data(sql_porgodlen);
            display_NewDevice_data(sql_newdevice);
            display_Capability_data(sql_capability);
            display_gap_data(sql_gap);
            gap_compare();

            Hide_Value.Value =count_white_lamp.ToString();
            


            string strScript2 = string.Format("<script language='javascript'>var count_lamp =" + count_white_lamp + ";</script>");
            Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", strScript2);
            count_white_lamp = 0;
            string str_no_sta = search_no_sta(sql_no);
            string[] temp_str = str_no_sta.Split('|');
            global_Ver_No = Convert.ToInt32(temp_str[0]);
            global_Ver_Sta = temp_str[1];

           

            Panel_Query_Vername.Visible = false;
            Panel_eptraview.Visible = false;

        }
    }
    protected void Button_Cancel_Click(object sender, EventArgs e)
    {
        clsMySQL db = new clsMySQL();
        Panel_Query_Vername.Visible = true;
        Panel_eptraview.Visible = true;
        Panel_EPTRA.Visible = false;
       
        string del_str = "delete from npieptra_lv_main where Ver_Name='" + global_Ver_Name + "'";

        if (!db.QueryExecuteNonQuery(del_str))
        {
            lblError.Text = del_str;

        }
       


    }
    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();
    }
    /*public void getData()
    {
        DataTable aTb = WebUtility.GetSQLdata("select * from product where id='0';", "teachDB");

        if (aTb.Rows.Count == 0)
        {

            aTb.Rows.Add(aTb.NewRow());

            GridView1.DataSource = aTb;
            GridView1.DataBind();


            int columnCount = GridView1.Rows[0].Cells.Count;
            GridView1.Rows[0].Cells.Clear();
            GridView1.Rows[0].Cells.Add(new TableCell());

            GridView1.Rows[0].Cells[0].ColumnSpan = columnCount;
            GridView1.Rows[0].Cells[0].Text = "無資料!";
            GridView1.RowStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
        }
        else
        {
            GridView1.DataSource = aTb;
            GridView1.DataBind();
        }


    }*/



    protected void Button_Update_Click(object sender, EventArgs e)
    {
        clsMySQL db = new clsMySQL();
        int index;
        string Status = "Y";
        index = Convert.ToInt32(Session["gvrow_index"].ToString());
        GridViewRow gvrow = GD_CATE.Rows[index];
        Session.Clear();




        String update_cate = string.Format("update  npi_ep_category set " +
            "npi_EP_Cate_Username='******',npi_EP_Cate_UpdateTime=NOW(),npi_EP_Cate_Status='{1}'," +
            "EP_Cate_Stage='{2}',EP_Cate_Iiitems='{3}',EP_Cate_SpeChar='{4}'," +
            "EP_Cate_Md='{5}',EP_Cate_Cate='{6}',EP_Cate_KP='{7}' " +
            "where EP_Cate_Stage='{8}' and  EP_Cate_Iiitems='{9}' and EP_Cate_SpeChar='{10}'" +
            "and EP_Cate_Md='{11}'and EP_Cate_Cate='{12}' and EP_Cate_KP='{13}' "
            , text_up_cate_user.Text, Status, text_cate_stage.Text, text_cate_input.Text
            , text_cate_sp.Text, text_cate_md.Text, text_cate_cate.Text, text_cate_kp.Text
            , gvrow.Cells[1].Text.Trim(), gvrow.Cells[2].Text.Trim(), gvrow.Cells[3].Text.Trim()
            , gvrow.Cells[4].Text.Trim(), gvrow.Cells[5].Text.Trim(), gvrow.Cells[6].Text.Trim());


        try
        {

            if (db.QueryExecuteNonQuery(update_cate))
            {
                RegisterStartupScript("訊息通知", "<script> alert('資料更新,成功!!');</script>");
                Panel_update_category.Visible = false;
                Panel_Category.Visible = true;
                DBint(text_cate_stage.Text);
                //ChangeViewMode();
            }
            else
            {
                //lblError.Text = strSQL_Delete;
                RegisterStartupScript("訊息通知", "<script> alert('資料更新,失敗!!');</script>");
            }
        }
        catch (FormatException ex)
        {
            lblError.Text = "[Error Message::NPI Manual Form Delete Function]: " + ex.ToString();
        }

    }