示例#1
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 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();
    }
示例#3
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);
    }
 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();
 }
示例#5
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());
    }
示例#6
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();
    }
    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 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();
    }
示例#9
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();
    }
示例#10
0
    public static string[] GetPKG(string prefix)
    {
        List <string> PKG = new List <string>();

        string strSQL = " select DISTINCT POR_02 from npipor where POR_02 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"]));
            PKG.Add(string.Format("{0}", dr["POR_02"]));
        }
        return(PKG.ToArray());
    }
示例#11
0
    public static string[] GetCustomer()
    {
        List <string> Customer = new List <string>();

        string strSQL = "select EP_Cate_KP from npi_ep_category where EP_Cate_Stage='PI1' and  EP_Cate_SpeChar='PI Thickness(ASI)' and EP_Cate_Iiitems='Wafer PSV type / Thickness'";


        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"]));
            Customer.Add(string.Format("{0}", dr["EP_Cate_KP"]));
        }

        return(Customer.ToArray());
    }
示例#12
0
    public static string[] GetNewDevice(string prefix)
    {
        List <string> devices = new List <string>();
        string        strSQL  = "select DISTINCT new_device from npimanual Where new_device Like '" + prefix + "%'";
        clsMySQL      db      = new clsMySQL();

        try
        {
            foreach (DataRow dr in db.QueryDataSet(strSQL).Tables[0].Rows)
            {
                //customers.Add(string.Format("{0},{1}", dr["new_customer"], dr["new_device"]));
                devices.Add(string.Format("{0}", dr["new_device"]));
            }
            //return customers.ToArray();
        }
        catch (Exception ex)
        {
        }
        return(devices.ToArray());
    }
    protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        DropDownList myddPOR_01 = (DropDownList)FormView1.FindControl("ddPOR01");   //Porduction Site
        DropDownList myddPOR_02 = (DropDownList)FormView1.FindControl("ddPOR02");   //PKG
        TextBox      myPOR_03   = (TextBox)FormView1.FindControl("text_POR03");     //WaferTech
        //TextBox myPOR_04 = (TextBox)FormView1.FindControl("text_POR04");
        DropDownList myddPOR_04 = (DropDownList)FormView1.FindControl("ddPOR04");   //FAB
        //TextBox myPOR_05 = (TextBox)FormView1.FindControl("text_POR05");
        DropDownList myddPOR_05 = (DropDownList)FormView1.FindControl("ddPOR05");   //WaferPSVTypeThickness
        TextBox      myPOR_06   = (TextBox)FormView1.FindControl("text_POR06");     //PRType
        DropDownList myddPOR_07 = (DropDownList)FormView1.FindControl("ddPOR07");   //TietchingChemical
        DropDownList myddPOR_08 = (DropDownList)FormView1.FindControl("ddPOR08");   //TinShellBake
        DropDownList myddPOR_09 = (DropDownList)FormView1.FindControl("ddPOR09");   //PIRougness
        DropDownList myddPOR_10 = (DropDownList)FormView1.FindControl("ddPOR10");   //BumpResistanceCapability
        DropDownList myddPOR_11 = (DropDownList)FormView1.FindControl("ddPOR11");   //推大球
        DropDownList myddPOR_12 = (DropDownList)FormView1.FindControl("ddPOR12");   //LowK
        DropDownList myddPOR_13 = (DropDownList)FormView1.FindControl("ddPOR13");   //PRThickness
        DropDownList myddPOR_14 = (DropDownList)FormView1.FindControl("ddPOR14");   //Customer
        //------------POR_15 For Pord---------------------------
        Label        mylab_Pord = (Label)FormView1.FindControl("lab_Pord");
        DropDownList myddPord   = (DropDownList)FormView1.FindControl("ddPord");
        TextBox      mytext_No  = (TextBox)FormView1.FindControl("text_No");
        string       myPOR_15   = mylab_Pord.Text + "-" + myddPord.SelectedValue.ToString() + "-" + mytext_No.Text;
        //------------For Pord End-----------------------
        DropDownList myddPOR_16 = (DropDownList)FormView1.FindControl("ddPOR16");       //UBMTypeThickness
        TextBox      myPOR_17   = (TextBox)FormView1.FindControl("text_POR17");         //Device
        Label        myPOR_18   = (Label)FormView1.FindControl("labPOR18");
        TextBox      myPOR_19   = (TextBox)FormView1.FindControl("text_POR19");
        DropDownList myddPOR_20 = (DropDownList)FormView1.FindControl("ddPOR20");
        DropDownList myddPOR_21 = (DropDownList)FormView1.FindControl("ddPOR21");
        TextBox      myPOR_22   = (TextBox)FormView1.FindControl("text_POR22");
        DropDownList myddPOR_23 = (DropDownList)FormView1.FindControl("ddPOR23");
        DropDownList myddPOR_24 = (DropDownList)FormView1.FindControl("ddPOR24");
        DropDownList myddPOR_25 = (DropDownList)FormView1.FindControl("ddPOR25");
        DropDownList myddPOR_26 = (DropDownList)FormView1.FindControl("ddPOR26");
        TextBox      myPOR_27   = (TextBox)FormView1.FindControl("text_POR27");
        DropDownList myddPOR_28 = (DropDownList)FormView1.FindControl("ddPOR28");
        TextBox      myPOR_29   = (TextBox)FormView1.FindControl("text_POR29");
        TextBox      myPOR_30   = (TextBox)FormView1.FindControl("text_POR30");
        TextBox      myPOR_31   = (TextBox)FormView1.FindControl("text_POR31");
        TextBox      myPOR_32   = (TextBox)FormView1.FindControl("text_POR32");
        DropDownList myddPOR_33 = (DropDownList)FormView1.FindControl("ddPOR33");
        TextBox      myPOR_34   = (TextBox)FormView1.FindControl("text_POR34");
        TextBox      myPOR_35   = (TextBox)FormView1.FindControl("text_POR35");
        TextBox      myPOR_36   = (TextBox)FormView1.FindControl("text_POR36");
        TextBox      myPOR_37   = (TextBox)FormView1.FindControl("text_POR37");
        //POR38,POR39,POR40,POR41 Default Text = "NA"-----------------------------------------------
        TextBox myPOR_38 = (TextBox)FormView1.FindControl("text_POR38");

        myPOR_38.Text = "NA";
        TextBox myPOR_39 = (TextBox)FormView1.FindControl("text_POR39");

        myPOR_39.Text = "NA";
        TextBox myPOR_40 = (TextBox)FormView1.FindControl("text_POR40");

        myPOR_40.Text = "NA";
        TextBox myPOR_41 = (TextBox)FormView1.FindControl("text_POR41");

        myPOR_41.Text = "NA";
        //------------------------------------------------------------------
        TextBox      myPOR_42   = (TextBox)FormView1.FindControl("text_POR42");
        TextBox      myPOR_43   = (TextBox)FormView1.FindControl("text_POR43");
        TextBox      myPOR_44   = (TextBox)FormView1.FindControl("text_POR44");
        TextBox      myPOR_45   = (TextBox)FormView1.FindControl("text_POR45");
        DropDownList myddPOR_46 = (DropDownList)FormView1.FindControl("ddPOR46");
        TextBox      myPOR_47   = (TextBox)FormView1.FindControl("text_POR47");
        Label        myPOR_48   = (Label)FormView1.FindControl("labPOR48"); //套公式: POR19-POR45
        Label        myPOR_49   = (Label)FormView1.FindControl("labPOR49"); //套公式: POR29/POR36
        Label        myPOR_50   = (Label)FormView1.FindControl("labPOR50"); //套公式: (Math.PI * (POR29 * POR29/4) * POR53) / (POR51 * POR52) * 1000000
        TextBox      myPOR_51   = (TextBox)FormView1.FindControl("text_POR51");
        TextBox      myPOR_52   = (TextBox)FormView1.FindControl("text_POR52");
        TextBox      myPOR_53   = (TextBox)FormView1.FindControl("text_POR53");
        TextBox      myPOR_54   = (TextBox)FormView1.FindControl("text_POR54");
        TextBox      myPOR_55   = (TextBox)FormView1.FindControl("text_POR55");

        clsMySQL db = new clsMySQL();
        DataSet  ds;

        if (myddPOR_14.SelectedValue.ToString() == "")
        {
            RegisterStartupScript("訊息通知", "<script> alert('必須填寫POR Customer!!');</script>");
        }
        else
        {
            if (myPOR_17.Text == "")
            {
                RegisterStartupScript("訊息通知", "<script> alert('必須填寫POR Device!!');</script>");
            }
            else
            {
                if (myddPOR_01.SelectedValue.ToString() == "")
                {
                    RegisterStartupScript("訊息通知", "<script> alert('必須填寫Production Site!!');</script>");
                }
                else
                {
                    string strSQL_Query = "select * from npipor where POR_Customer = '" + myddPOR_14.SelectedValue.ToString() + "' and POR_Device = '" + myPOR_17.Text + "' and POR_01 = '" + myddPOR_01.SelectedValue.ToString() + "'";
                    ds = db.QueryDataSet(strSQL_Query);
                    try
                    {
                        string strSQL_Insert = string.Format("Insert into npiPor " +
                                                             "(POR_Customer, POR_Device, Stype, UpdateTime, npiUser, POR_Status," +
                                                             "POR_01, POR_02, POR_03, POR_04, POR_05, POR_06, POR_07, POR_08, POR_09, POR_10," +
                                                             "POR_11, POR_12, POR_13, POR_14, POR_15, POR_16, POR_17, POR_18, POR_19, POR_20, POR_21, POR_22," +
                                                             "POR_23, POR_24, POR_25, POR_26, POR_27, POR_28, POR_29, POR_30, POR_31, POR_32, POR_33, POR_34," +
                                                             "POR_35, POR_36, POR_37, POR_38, POR_39, POR_40, POR_41, POR_42, POR_43, POR_44, POR_45, POR_46," +
                                                             "POR_47, POR_48, POR_49, POR_50, POR_51, POR_52, POR_53, POR_54, POR_55)values " +
                                                             "('{13}','{16}','POR',NOW(),'','Y','{0}','{1}','{2}','{3}','{4}'," +
                                                             "'{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}'," +
                                                             "'{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}','{33}','{34}','{35}','{36}','{37}'," +
                                                             "'{38}','{39}','{40}','{41}','{42}','{43}','{44}','{45}','{46}','{47}','{48}','{49}','{50}','{51}','{52}','{53}'," +
                                                             "'{54}')",
                                                             myddPOR_01.SelectedValue.ToString().Trim(), myddPOR_02.SelectedValue.ToString().Trim(), myPOR_03.Text.Trim(), myddPOR_04.SelectedValue.ToString().Trim(),
                                                             myddPOR_05.SelectedValue.ToString().Trim(), myPOR_06.Text.Trim(), myddPOR_07.SelectedValue.ToString().Trim(), myddPOR_08.SelectedValue.ToString().Trim(),
                                                             myddPOR_09.SelectedValue.ToString().Trim(), myddPOR_10.SelectedValue.ToString().Trim(), myddPOR_11.SelectedValue.ToString().Trim(), myddPOR_12.SelectedValue.ToString().Trim(),
                                                             myddPOR_13.SelectedValue.ToString().Trim(), myddPOR_14.SelectedValue.ToString().Trim(), myPOR_15.Trim(), myddPOR_16.SelectedValue.ToString().Trim(), myPOR_17.Text.Trim(),
                                                             myPOR_18.Text.Trim(), myPOR_19.Text.Trim(), myddPOR_20.SelectedValue.ToString().Trim(), myddPOR_21.SelectedValue.ToString().Trim(), myPOR_22.Text.Trim(),
                                                             myddPOR_23.SelectedValue.ToString().Trim(), myddPOR_24.SelectedValue.ToString().Trim(), myddPOR_25.SelectedValue.ToString().Trim(), myddPOR_26.SelectedValue.ToString().Trim(),
                                                             myPOR_27.Text.Trim(), myddPOR_28.SelectedValue.ToString().Trim(), myPOR_29.Text.Trim(), myPOR_30.Text.Trim(), myPOR_31.Text.Trim(), myPOR_32.Text.Trim(),
                                                             myddPOR_33.SelectedValue.ToString().Trim(), myPOR_34.Text.Trim(), myPOR_35.Text.Trim(), myPOR_36.Text.Trim(), myPOR_37.Text.Trim(), myPOR_38.Text.Trim(),
                                                             myPOR_39.Text.Trim(), myPOR_40.Text.Trim(), myPOR_41.Text.Trim(), myPOR_42.Text.Trim(), myPOR_43.Text.Trim(), myPOR_44.Text.Trim(), myPOR_45.Text.Trim(),
                                                             myddPOR_46.SelectedValue.ToString().Trim(), myPOR_47.Text.Trim(), myPOR_48.Text.Trim(), myPOR_49.Text.Trim(), myPOR_50.Text.Trim(), myPOR_51.Text.Trim(),
                                                             myPOR_52.Text.Trim(), myPOR_53.Text.Trim(), myPOR_54.Text.Trim(), myPOR_55.Text.Trim());

                        //lblError.Text = strSQL_Insert;
                        if (db.QueryExecuteNonQuery(strSQL_Insert))
                        {
                            RegisterStartupScript("訊息通知", "<script> alert('POR資料新增,成功!!');</script>");
                            ClearTextBox();
                            ChangeViewMode();
                        }
                        else
                        {
                            //lblError.Text = strSQL_Insert;
                            RegisterStartupScript("訊息通知", "<script> alert('POR資料新增,失敗!!');</script>");
                        }
                    }
                    catch (Exception ex)
                    {
                        ClearTextBox();
                        lblError.Text = "[POR Insert Error Message]:" + ex.ToString();
                    }
                }
            }
        }
    }
    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();        
    }
 public static string[] GetNewDevice(string prefix)
 {
     List<string> devices = new List<string>();
     string strSQL = "select DISTINCT new_device from npimanual Where new_device Like '" + prefix + "%'";
     clsMySQL db = new clsMySQL();
     try
     {
         foreach (DataRow dr in db.QueryDataSet(strSQL).Tables[0].Rows)
         {
             //customers.Add(string.Format("{0},{1}", dr["new_customer"], dr["new_device"]));
             devices.Add(string.Format("{0}", dr["new_device"]));
         }
         //return customers.ToArray();
     }
     catch (Exception ex)
     {
     }
     return devices.ToArray();
 }
 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();
 }
    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 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 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();
    }