示例#1
0
        public void CopyProjectDisposeFunc(string oldPNStr, string newPNStr, string oldXSStr, string newXSStr)
        {
            OleDbConnection connection  = null;
            OleDbDataReader dataReader  = null;
            OleDbConnection connection2 = null;

            this.projectInfoStruct.ProjectName = newPNStr;
            this.projectInfoStruct.bcCableName = newXSStr;
            string text    = "0";
            string nPIDStr = text;
            string nLIDStr = text;
            string oLIDStr = text;

            System.Collections.Generic.List <GroupTestParaStruct>            GTParaStructList = new System.Collections.Generic.List <GroupTestParaStruct>();
            System.Collections.Generic.List <TLineStructLibraryDetailStruct> lsldStructList   = new System.Collections.Generic.List <TLineStructLibraryDetailStruct>();
            TLineStructLibraryStruct lslStruct = new TLineStructLibraryStruct();

            lslStruct.LineStructName = this.projectInfoStruct.bcCableName;
            System.Collections.Generic.List <TLineStructJKIDStruct> lsjkIDStructList = new System.Collections.Generic.List <TLineStructJKIDStruct>();
            try
            {
                bool bExsitFlag = false;
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    string       sqlcommand;
                    OleDbCommand cmd;
                    try
                    {
                        sqlcommand = "select * from TLineStructLibrary where LineStructName = '" + oldXSStr + "'";
                        cmd        = new OleDbCommand(sqlcommand, connection);
                        dataReader = cmd.ExecuteReader();
                        if (dataReader.Read())
                        {
                            bExsitFlag           = true;
                            lslStruct.LID        = dataReader["LID"].ToString();
                            lslStruct.PlugInfo   = dataReader["PlugInfo"].ToString();
                            lslStruct.LinePinNum = System.Convert.ToInt32(dataReader["LinePinNum"].ToString());
                            lslStruct.Remark     = dataReader["Remark"].ToString();
                        }
                        dataReader.Close();
                        dataReader = null;
                        if (bExsitFlag)
                        {
                            sqlcommand = "select * from TLineStructLibraryDetail where LID = '" + lslStruct.LID + "'";
                            cmd        = new OleDbCommand(sqlcommand, connection);
                            dataReader = cmd.ExecuteReader();
                            while (dataReader.Read())
                            {
                                lsldStructList.Add(new TLineStructLibraryDetailStruct
                                {
                                    LID        = dataReader["LID"].ToString(),
                                    PlugName1  = dataReader["PlugName1"].ToString(),
                                    PinName1   = dataReader["PinName1"].ToString(),
                                    PlugName2  = dataReader["PlugName2"].ToString(),
                                    PinName2   = dataReader["PinName2"].ToString(),
                                    IsGround   = System.Convert.ToInt32(dataReader["IsGround"].ToString()),
                                    IsTestDT   = System.Convert.ToInt32(dataReader["IsTestDT"].ToString()),
                                    IsTestDL   = System.Convert.ToInt32(dataReader["IsTestDL"].ToString()),
                                    IsTestJY   = System.Convert.ToInt32(dataReader["IsTestJY"].ToString()),
                                    IsTestDDJY = System.Convert.ToInt32(dataReader["IsTestDDJY"].ToString()),
                                    IsTestNY   = System.Convert.ToInt32(dataReader["IsTestNY"].ToString())
                                });
                            }
                            dataReader.Close();
                            dataReader = null;
                            sqlcommand = "select * from TLineStructJKID where LID = '" + lslStruct.LID + "'";
                            cmd        = new OleDbCommand(sqlcommand, connection);
                            dataReader = cmd.ExecuteReader();
                            while (dataReader.Read())
                            {
                                lsjkIDStructList.Add(new TLineStructJKIDStruct
                                {
                                    LID  = dataReader["LID"].ToString(),
                                    JKID = dataReader["JKID"].ToString()
                                });
                            }
                            dataReader.Close();
                            dataReader = null;
                        }
                    }
                    catch (System.Exception arg_313_0)
                    {
                        KLineTestProcessor.ExceptionRecordFunc(arg_313_0.StackTrace);
                        if (dataReader != null)
                        {
                            dataReader.Close();
                            dataReader = null;
                        }
                    }
                    string lineStructName = lslStruct.LineStructName;
                    sqlcommand = "insert into TLineStructLibrary(LineStructName,PlugInfo,LinePinNum,Remark) values('" + lineStructName + "','" + lslStruct.PlugInfo + "'," + lslStruct.LinePinNum + ",'" + lslStruct.Remark + "')";
                    cmd        = new OleDbCommand(sqlcommand, connection);
                    cmd.ExecuteNonQuery();
                    System.Threading.Thread.Sleep(50);
                    sqlcommand = "select * from TLineStructLibrary where LineStructName = '" + lineStructName + "'";
                    cmd        = new OleDbCommand(sqlcommand, connection);
                    dataReader = cmd.ExecuteReader();
                    if (dataReader.Read())
                    {
                        nLIDStr = dataReader["LID"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    System.Threading.Thread.Sleep(50);
                    try
                    {
                        if (!string.IsNullOrEmpty(nLIDStr))
                        {
                            for (int i = 0; i < lsjkIDStructList.Count; i++)
                            {
                                sqlcommand = "insert into TLineStructJKID(LID,JKID) values('" + nLIDStr + "','" + lsjkIDStructList[i].JKID + "')";
                                cmd        = new OleDbCommand(sqlcommand, connection);
                                cmd.ExecuteNonQuery();
                            }
                        }
                    }
                    catch (System.Exception arg_45D_0)
                    {
                        KLineTestProcessor.ExceptionRecordFunc(arg_45D_0.StackTrace);
                    }
                    System.Threading.Thread.Sleep(50);
                    try
                    {
                        for (int j = 0; j < lsldStructList.Count; j++)
                        {
                            sqlcommand = "insert into TLineStructLibraryDetail(LID,PlugName1,PinName1,PlugName2,PinName2,IsGround,IsTestDT,IsTestDL,IsTestJY,IsTestDDJY,IsTestNY) values('" + nLIDStr + "','" + lsldStructList[j].PlugName1 + "','" + lsldStructList[j].PinName1 + "','" + lsldStructList[j].PlugName2 + "','" + lsldStructList[j].PinName2 + "'," + lsldStructList[j].IsGround + "," + lsldStructList[j].IsTestDT + "," + lsldStructList[j].IsTestDL + "," + lsldStructList[j].IsTestJY + "," + lsldStructList[j].IsTestDDJY + "," + lsldStructList[j].IsTestNY + ")";
                            cmd        = new OleDbCommand(sqlcommand, connection);
                            cmd.ExecuteNonQuery();
                        }
                    }
                    catch (System.Exception arg_5F5_0)
                    {
                        KLineTestProcessor.ExceptionRecordFunc(arg_5F5_0.StackTrace);
                    }
                    System.Threading.Thread.Sleep(50);
                    TProjectInfoStruct oldPNStr2 = this.projectInfoStruct;
                    string             str       = "','";
                    string             str2      = ",";
                    sqlcommand = "insert into TProjectInfo(ProjectName,iCommonProject,iTestModel,iDTTestModel,iJYTestModel,iNYTestModel,dDT_Threshold,dDT_DTVoltage,dDT_DTCurrent,dJY_Threshold," + "dJY_JYHoldTime,dJY_DCHighVolt,dJY_DCRiseTime,dNY_Threshold,dNY_NYHoldTime,dNY_ACHighVolt,other1,other2,iGroupTestFlag,batchMumberStr,bcCableName,Creator,Remark) values('" + oldPNStr2.ProjectName + "'," + oldPNStr2.iCommonProject + str2 + oldPNStr2.iTestModel + str2 + oldPNStr2.iDTTestModel + str2 + oldPNStr2.iJYTestModel + str2 + oldPNStr2.iNYTestModel + str2 + oldPNStr2.dDT_Threshold + str2 + oldPNStr2.dDT_DTVoltage + str2 + oldPNStr2.dDT_DTCurrent + str2 + oldPNStr2.dJY_Threshold + str2 + oldPNStr2.dJY_JYHoldTime + str2 + oldPNStr2.dJY_DCHighVolt + str2 + oldPNStr2.dJY_DCRiseTime + str2 + oldPNStr2.dNY_Threshold + str2 + oldPNStr2.dNY_NYHoldTime + str2 + oldPNStr2.dNY_ACHighVolt + str2 + oldPNStr2.other1 + str2 + oldPNStr2.other2 + str2 + oldPNStr2.iGroupTestFlag + ",'" + oldPNStr2.batchMumberStr + str + oldPNStr2.bcCableName + str + oldPNStr2.Creator + str + oldPNStr2.Remark + "')";
                    cmd        = new OleDbCommand(sqlcommand, connection);
                    cmd.ExecuteNonQuery();
                    System.Threading.Thread.Sleep(100);
                    sqlcommand = "select top 1 * from TProjectInfo where ProjectName = '" + newPNStr + "'";
                    cmd        = new OleDbCommand(sqlcommand, connection);
                    dataReader = cmd.ExecuteReader();
                    if (dataReader.Read())
                    {
                        nPIDStr = dataReader["ID"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    sqlcommand = "select top 1 * from TLineStructLibrary where LineStructName = '" + oldXSStr + "'";
                    cmd        = new OleDbCommand(sqlcommand, connection);
                    dataReader = cmd.ExecuteReader();
                    if (dataReader.Read())
                    {
                        oLIDStr = dataReader["LID"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    if (this.projectInfoStruct.iGroupTestFlag == 1)
                    {
                        try
                        {
                            sqlcommand = "select * from TGroupTestParaSet where PID='" + System.Convert.ToString(this.iCopyProjextID) + "' and LID='" + oLIDStr + "' order by ID asc";
                            cmd        = new OleDbCommand(sqlcommand, connection);
                            dataReader = cmd.ExecuteReader();
                            while (dataReader.Read())
                            {
                                GTParaStructList.Add(new GroupTestParaStruct
                                {
                                    PlugName1   = dataReader["PlugName1"].ToString(),
                                    PinName1    = dataReader["PinName1"].ToString(),
                                    PlugName2   = dataReader["PlugName2"].ToString(),
                                    PinName2    = dataReader["PinName2"].ToString(),
                                    DTThreshold = dataReader["DTThreshold"].ToString(),
                                    DTVoltage   = dataReader["DTVoltage"].ToString(),
                                    DTCurrent   = dataReader["DTCurrent"].ToString(),
                                    JYThreshold = dataReader["JYThreshold"].ToString(),
                                    JYTestTime  = dataReader["JYTestTime"].ToString(),
                                    JYVoltage   = dataReader["JYVoltage"].ToString(),
                                    JYUpTime    = dataReader["JYUpTime"].ToString(),
                                    NYThreshold = dataReader["NYThreshold"].ToString(),
                                    NYTestTime  = dataReader["NYTestTime"].ToString(),
                                    NYVoltage   = dataReader["NYVoltage"].ToString()
                                });
                            }
                            dataReader.Close();
                            dataReader = null;
                            for (int k = 0; k < GTParaStructList.Count; k++)
                            {
                                str        = "','";
                                sqlcommand = "insert into TGroupTestParaSet(PID,LID,PlugName1,PinName1,PlugName2,PinName2,DTThreshold,DTVoltage," + "DTCurrent,JYThreshold,JYTestTime,JYVoltage,JYUpTime,NYThreshold,NYTestTime,NYVoltage) values('" + nPIDStr + str + nLIDStr + str + GTParaStructList[k].PlugName1 + "','" + GTParaStructList[k].PinName1 + "','" + GTParaStructList[k].PlugName2 + "','" + GTParaStructList[k].PinName2 + "','" + GTParaStructList[k].DTThreshold + "','" + GTParaStructList[k].DTVoltage + "','" + GTParaStructList[k].DTCurrent + "','" + GTParaStructList[k].JYThreshold + "','" + GTParaStructList[k].JYTestTime + "','" + GTParaStructList[k].JYVoltage + "','" + GTParaStructList[k].JYUpTime + "','" + GTParaStructList[k].NYThreshold + "','" + GTParaStructList[k].NYTestTime + "','" + GTParaStructList[k].NYVoltage + "')";
                                cmd        = new OleDbCommand(sqlcommand, connection);
                                cmd.ExecuteNonQuery();
                            }
                        }
                        catch (System.Exception arg_C88_0)
                        {
                            KLineTestProcessor.ExceptionRecordFunc(arg_C88_0.StackTrace);
                            if (dataReader != null)
                            {
                                dataReader.Close();
                                dataReader = null;
                            }
                        }
                    }
                    connection.Close();
                    connection         = null;
                    this.bCopySuccFlag = true;
                }
                catch (System.Exception arg_CB9_0)
                {
                    this.bCopySuccFlag = false;
                    KLineTestProcessor.ExceptionRecordFunc(arg_CB9_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_CE7_0)
            {
                this.bCopySuccFlag = false;
                KLineTestProcessor.ExceptionRecordFunc(arg_CE7_0.StackTrace);
            }
            GTParaStructList.Clear();
            lsldStructList.Clear();
            lsjkIDStructList.Clear();
            this.FreeSystemMemoryResourcesFunc();
            if (!this.bCopySuccFlag)
            {
                try
                {
                    connection2 = new OleDbConnection();
                    connection2.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection2.Open();
                    string       sqlcommand2 = "delete from TLineStructLibrary where LineStructName = '" + newXSStr + "'";
                    OleDbCommand cmd2        = new OleDbCommand(sqlcommand2, connection2);
                    cmd2.ExecuteNonQuery();
                    System.Threading.Thread.Sleep(50);
                    sqlcommand2 = "delete from TLineStructLibraryDetail where LID = '" + nLIDStr + "'";
                    cmd2        = new OleDbCommand(sqlcommand2, connection2);
                    cmd2.ExecuteNonQuery();
                    System.Threading.Thread.Sleep(50);
                    sqlcommand2 = "delete from TLineStructJKID where LID = '" + nLIDStr + "'";
                    cmd2        = new OleDbCommand(sqlcommand2, connection2);
                    cmd2.ExecuteNonQuery();
                    System.Threading.Thread.Sleep(50);
                    sqlcommand2 = "delete from TProjectInfo where ProjectName = '" + newPNStr + "'";
                    cmd2        = new OleDbCommand(sqlcommand2, connection2);
                    cmd2.ExecuteNonQuery();
                    System.Threading.Thread.Sleep(50);
                    sqlcommand2 = "delete from TGroupTestParaSet where PID='" + nPIDStr + "' and LID='" + nLIDStr + "'";
                    cmd2        = new OleDbCommand(sqlcommand2, connection2);
                    cmd2.ExecuteNonQuery();
                    connection2.Close();
                    connection2 = null;
                }
                catch (System.Exception arg_E48_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_E48_0.StackTrace);
                    if (connection2 != null)
                    {
                        connection2.Close();
                    }
                }
            }
        }
示例#2
0
        public void CopyProjectDisposeFunc()
        {
            OleDbConnection connection  = null;
            OleDbDataReader dataReader  = null;
            OleDbConnection connection2 = null;

            this.bCopySuccFlag = true;
            string             tempPNStr         = "新项目_20001231_121314";
            string             text              = "0";
            string             nPIDStr           = text;
            string             nLIDStr           = text;
            TProjectInfoStruct projectInfoStruct = new TProjectInfoStruct();

            System.Collections.Generic.List <GroupTestParaStruct> GTParaStructList = new System.Collections.Generic.List <GroupTestParaStruct>();
            try
            {
                System.ValueType dt = System.DateTime.Now;
                string           tempMonthStr;
                if (((System.DateTime)dt).Month < 10)
                {
                    tempMonthStr = "0" + System.Convert.ToString(((System.DateTime)dt).Month);
                }
                else
                {
                    tempMonthStr = System.Convert.ToString(((System.DateTime)dt).Month);
                }
                string tempDayStr;
                if (((System.DateTime)dt).Day < 10)
                {
                    tempDayStr = "0" + System.Convert.ToString(((System.DateTime)dt).Day);
                }
                else
                {
                    tempDayStr = System.Convert.ToString(((System.DateTime)dt).Day);
                }
                string tempHourStr;
                if (((System.DateTime)dt).Hour < 10)
                {
                    tempHourStr = "0" + System.Convert.ToString(((System.DateTime)dt).Hour);
                }
                else
                {
                    tempHourStr = System.Convert.ToString(((System.DateTime)dt).Hour);
                }
                string tempMinuteStr;
                if (((System.DateTime)dt).Minute < 10)
                {
                    tempMinuteStr = "0" + System.Convert.ToString(((System.DateTime)dt).Minute);
                }
                else
                {
                    tempMinuteStr = System.Convert.ToString(((System.DateTime)dt).Minute);
                }
                string tempSecondStr;
                if (((System.DateTime)dt).Second < 10)
                {
                    tempSecondStr = "0" + System.Convert.ToString(((System.DateTime)dt).Second);
                }
                else
                {
                    tempSecondStr = System.Convert.ToString(((System.DateTime)dt).Second);
                }
                string tt   = System.Convert.ToString(((System.DateTime)dt).Year) + tempMonthStr + tempDayStr;
                string ttms = tempHourStr + tempMinuteStr + tempSecondStr;
                tempPNStr = "新项目_" + tt + "_" + ttms;
            }
            catch (System.Exception arg_1F7_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_1F7_0.StackTrace);
            }
            try
            {
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    string       sqlcommand = "select top 1 * from TProjectInfo where ID=" + this.iCopyProjextID;
                    OleDbCommand cmd        = new OleDbCommand(sqlcommand, connection);
                    dataReader = cmd.ExecuteReader();
                    if (dataReader.Read())
                    {
                        projectInfoStruct.iID            = System.Convert.ToInt32(dataReader["ID"].ToString());
                        projectInfoStruct.ProjectName    = dataReader["ProjectName"].ToString();
                        projectInfoStruct.iCommonProject = System.Convert.ToInt32(dataReader["iCommonProject"].ToString());
                        projectInfoStruct.iTestModel     = System.Convert.ToInt32(dataReader["iTestModel"].ToString());
                        projectInfoStruct.iDTTestModel   = System.Convert.ToInt32(dataReader["iDTTestModel"].ToString());
                        projectInfoStruct.iJYTestModel   = System.Convert.ToInt32(dataReader["iJYTestModel"].ToString());
                        projectInfoStruct.iNYTestModel   = System.Convert.ToInt32(dataReader["iNYTestModel"].ToString());
                        projectInfoStruct.dDT_Threshold  = System.Convert.ToDouble(dataReader["dDT_Threshold"].ToString());
                        projectInfoStruct.dDT_DTVoltage  = System.Convert.ToDouble(dataReader["dDT_DTVoltage"].ToString());
                        projectInfoStruct.dDT_DTCurrent  = System.Convert.ToDouble(dataReader["dDT_DTCurrent"].ToString());
                        projectInfoStruct.dJY_Threshold  = System.Convert.ToDouble(dataReader["dJY_Threshold"].ToString());
                        projectInfoStruct.dJY_JYHoldTime = System.Convert.ToDouble(dataReader["dJY_JYHoldTime"].ToString());
                        projectInfoStruct.dJY_DCHighVolt = System.Convert.ToDouble(dataReader["dJY_DCHighVolt"].ToString());
                        projectInfoStruct.dJY_DCRiseTime = System.Convert.ToDouble(dataReader["dJY_DCRiseTime"].ToString());
                        projectInfoStruct.dNY_Threshold  = System.Convert.ToDouble(dataReader["dNY_Threshold"].ToString());
                        projectInfoStruct.dNY_NYHoldTime = System.Convert.ToDouble(dataReader["dNY_NYHoldTime"].ToString());
                        projectInfoStruct.dNY_ACHighVolt = System.Convert.ToDouble(dataReader["dNY_ACHighVolt"].ToString());
                        projectInfoStruct.other1         = System.Convert.ToDouble(dataReader["other1"].ToString());
                        projectInfoStruct.other2         = System.Convert.ToDouble(dataReader["other2"].ToString());
                        projectInfoStruct.iGroupTestFlag = System.Convert.ToInt32(dataReader["iGroupTestFlag"].ToString());
                        projectInfoStruct.batchMumberStr = dataReader["batchMumberStr"].ToString();
                        projectInfoStruct.bcCableName    = dataReader["bcCableName"].ToString();
                        projectInfoStruct.Creator        = dataReader["Creator"].ToString();
                        projectInfoStruct.Remark         = dataReader["Remark"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    projectInfoStruct.ProjectName = tempPNStr;
                    string loginUserID = this.gLineTestProcessor.loginUserID;
                    projectInfoStruct.Creator = loginUserID;
                    string str            = "','";
                    string bcCableName    = projectInfoStruct.bcCableName;
                    int    iGroupTestFlag = projectInfoStruct.iGroupTestFlag;
                    string str2           = ",";
                    sqlcommand = "insert into TProjectInfo(ProjectName,iCommonProject,iTestModel,iDTTestModel,iJYTestModel,iNYTestModel,dDT_Threshold,dDT_DTVoltage,dDT_DTCurrent,dJY_Threshold," + "dJY_JYHoldTime,dJY_DCHighVolt,dJY_DCRiseTime,dNY_Threshold,dNY_NYHoldTime,dNY_ACHighVolt,other1,other2,iGroupTestFlag,batchMumberStr,bcCableName,Creator,Remark) values('" + tempPNStr + "'," + projectInfoStruct.iCommonProject + str2 + projectInfoStruct.iTestModel + str2 + projectInfoStruct.iDTTestModel + str2 + projectInfoStruct.iJYTestModel + str2 + projectInfoStruct.iNYTestModel + str2 + projectInfoStruct.dDT_Threshold + str2 + projectInfoStruct.dDT_DTVoltage + str2 + projectInfoStruct.dDT_DTCurrent + str2 + projectInfoStruct.dJY_Threshold + str2 + projectInfoStruct.dJY_JYHoldTime + str2 + projectInfoStruct.dJY_DCHighVolt + str2 + projectInfoStruct.dJY_DCRiseTime + str2 + projectInfoStruct.dNY_Threshold + str2 + projectInfoStruct.dNY_NYHoldTime + str2 + projectInfoStruct.dNY_ACHighVolt + str2 + projectInfoStruct.other1 + str2 + projectInfoStruct.other2 + str2 + iGroupTestFlag + ",'" + projectInfoStruct.batchMumberStr + str + bcCableName + str + loginUserID + str + projectInfoStruct.Remark + "')";
                    cmd        = new OleDbCommand(sqlcommand, connection);
                    cmd.ExecuteNonQuery();
                    System.Threading.Thread.Sleep(100);
                    sqlcommand = "select top 1 * from TProjectInfo where ProjectName = '" + tempPNStr + "'";
                    cmd        = new OleDbCommand(sqlcommand, connection);
                    dataReader = cmd.ExecuteReader();
                    if (dataReader.Read())
                    {
                        nPIDStr = dataReader["ID"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    sqlcommand = "select top 1 * from TLineStructLibrary where LineStructName = '" + bcCableName + "'";
                    cmd        = new OleDbCommand(sqlcommand, connection);
                    dataReader = cmd.ExecuteReader();
                    if (dataReader.Read())
                    {
                        nLIDStr = dataReader["LID"].ToString();
                    }
                    dataReader.Close();
                    dataReader = null;
                    if (iGroupTestFlag == 1)
                    {
                        try
                        {
                            sqlcommand = "select * from TGroupTestParaSet where PID='" + System.Convert.ToString(projectInfoStruct.iID) + "' and LID='" + nLIDStr + "' order by ID asc";
                            cmd        = new OleDbCommand(sqlcommand, connection);
                            dataReader = cmd.ExecuteReader();
                            while (dataReader.Read())
                            {
                                GTParaStructList.Add(new GroupTestParaStruct
                                {
                                    PlugName1   = dataReader["PlugName1"].ToString(),
                                    PinName1    = dataReader["PinName1"].ToString(),
                                    PlugName2   = dataReader["PlugName2"].ToString(),
                                    PinName2    = dataReader["PinName2"].ToString(),
                                    DTThreshold = dataReader["DTThreshold"].ToString(),
                                    DTVoltage   = dataReader["DTVoltage"].ToString(),
                                    DTCurrent   = dataReader["DTCurrent"].ToString(),
                                    JYThreshold = dataReader["JYThreshold"].ToString(),
                                    JYTestTime  = dataReader["JYTestTime"].ToString(),
                                    JYVoltage   = dataReader["JYVoltage"].ToString(),
                                    JYUpTime    = dataReader["JYUpTime"].ToString(),
                                    NYThreshold = dataReader["NYThreshold"].ToString(),
                                    NYTestTime  = dataReader["NYTestTime"].ToString(),
                                    NYVoltage   = dataReader["NYVoltage"].ToString()
                                });
                            }
                            dataReader.Close();
                            dataReader = null;
                            for (int i = 0; i < GTParaStructList.Count; i++)
                            {
                                str        = "','";
                                sqlcommand = "insert into TGroupTestParaSet(PID,LID,PlugName1,PinName1,PlugName2,PinName2,DTThreshold,DTVoltage," + "DTCurrent,JYThreshold,JYTestTime,JYVoltage,JYUpTime,NYThreshold,NYTestTime,NYVoltage) values('" + nPIDStr + str + nLIDStr + str + GTParaStructList[i].PlugName1 + "','" + GTParaStructList[i].PinName1 + "','" + GTParaStructList[i].PlugName2 + "','" + GTParaStructList[i].PinName2 + "','" + GTParaStructList[i].DTThreshold + "','" + GTParaStructList[i].DTVoltage + "','" + GTParaStructList[i].DTCurrent + "','" + GTParaStructList[i].JYThreshold + "','" + GTParaStructList[i].JYTestTime + "','" + GTParaStructList[i].JYVoltage + "','" + GTParaStructList[i].JYUpTime + "','" + GTParaStructList[i].NYThreshold + "','" + GTParaStructList[i].NYTestTime + "','" + GTParaStructList[i].NYVoltage + "')";
                                cmd        = new OleDbCommand(sqlcommand, connection);
                                cmd.ExecuteNonQuery();
                            }
                        }
                        catch (System.Exception arg_B4F_0)
                        {
                            KLineTestProcessor.ExceptionRecordFunc(arg_B4F_0.StackTrace);
                            if (dataReader != null)
                            {
                                dataReader.Close();
                                dataReader = null;
                            }
                        }
                    }
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_B79_0)
                {
                    this.bCopySuccFlag = false;
                    KLineTestProcessor.ExceptionRecordFunc(arg_B79_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_BA7_0)
            {
                this.bCopySuccFlag = false;
                KLineTestProcessor.ExceptionRecordFunc(arg_BA7_0.StackTrace);
            }
            if (!this.bCopySuccFlag)
            {
                try
                {
                    connection2 = new OleDbConnection();
                    connection2.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection2.Open();
                    string       sqlcommand2 = "delete from TProjectInfo where ProjectName = '" + tempPNStr + "'";
                    OleDbCommand cmd2        = new OleDbCommand(sqlcommand2, connection2);
                    cmd2.ExecuteNonQuery();
                    System.Threading.Thread.Sleep(50);
                    sqlcommand2 = "delete from TGroupTestParaSet where PID='" + nPIDStr + "' and LID='" + nLIDStr + "'";
                    cmd2        = new OleDbCommand(sqlcommand2, connection2);
                    cmd2.ExecuteNonQuery();
                    connection2.Close();
                    connection2 = null;
                }
                catch (System.Exception arg_C58_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_C58_0.StackTrace);
                    if (connection2 != null)
                    {
                        connection2.Close();
                    }
                }
            }
        }
示例#3
0
        private void ctFormProjectCopy_Load(object sender, System.EventArgs e)
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                TProjectInfoStruct tProjectInfoStruct = new TProjectInfoStruct();
                this.projectInfoStruct     = tProjectInfoStruct;
                tProjectInfoStruct.Creator = this.gLineTestProcessor.loginUserID;
                bool bExistFlag = false;
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select top 1 * from TProjectInfo where ID=" + this.iCopyProjextID, connection).ExecuteReader();
                    if (dataReader.Read())
                    {
                        this.projectInfoStruct.iID            = System.Convert.ToInt32(dataReader["ID"].ToString());
                        this.projectInfoStruct.ProjectName    = dataReader["ProjectName"].ToString();
                        this.projectInfoStruct.iCommonProject = System.Convert.ToInt32(dataReader["iCommonProject"].ToString());
                        this.projectInfoStruct.iTestModel     = System.Convert.ToInt32(dataReader["iTestModel"].ToString());
                        this.projectInfoStruct.iDTTestModel   = System.Convert.ToInt32(dataReader["iDTTestModel"].ToString());
                        this.projectInfoStruct.iJYTestModel   = System.Convert.ToInt32(dataReader["iJYTestModel"].ToString());
                        this.projectInfoStruct.iNYTestModel   = System.Convert.ToInt32(dataReader["iNYTestModel"].ToString());
                        this.projectInfoStruct.dDT_Threshold  = System.Convert.ToDouble(dataReader["dDT_Threshold"].ToString());
                        this.projectInfoStruct.dDT_DTVoltage  = System.Convert.ToDouble(dataReader["dDT_DTVoltage"].ToString());
                        this.projectInfoStruct.dDT_DTCurrent  = System.Convert.ToDouble(dataReader["dDT_DTCurrent"].ToString());
                        this.projectInfoStruct.dJY_Threshold  = System.Convert.ToDouble(dataReader["dJY_Threshold"].ToString());
                        this.projectInfoStruct.dJY_JYHoldTime = System.Convert.ToDouble(dataReader["dJY_JYHoldTime"].ToString());
                        this.projectInfoStruct.dJY_DCHighVolt = System.Convert.ToDouble(dataReader["dJY_DCHighVolt"].ToString());
                        this.projectInfoStruct.dJY_DCRiseTime = System.Convert.ToDouble(dataReader["dJY_DCRiseTime"].ToString());
                        this.projectInfoStruct.dNY_Threshold  = System.Convert.ToDouble(dataReader["dNY_Threshold"].ToString());
                        this.projectInfoStruct.dNY_NYHoldTime = System.Convert.ToDouble(dataReader["dNY_NYHoldTime"].ToString());
                        this.projectInfoStruct.dNY_ACHighVolt = System.Convert.ToDouble(dataReader["dNY_ACHighVolt"].ToString());
                        this.projectInfoStruct.other1         = System.Convert.ToDouble(dataReader["other1"].ToString());
                        this.projectInfoStruct.other2         = System.Convert.ToDouble(dataReader["other2"].ToString());
                        this.projectInfoStruct.iGroupTestFlag = System.Convert.ToInt32(dataReader["iGroupTestFlag"].ToString());
                        this.projectInfoStruct.batchMumberStr = dataReader["batchMumberStr"].ToString();
                        this.projectInfoStruct.bcCableName    = dataReader["bcCableName"].ToString();
                        this.projectInfoStruct.Remark         = dataReader["Remark"].ToString();
                        bExistFlag = true;
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_34D_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_34D_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
                if (bExistFlag)
                {
                    this.textBox_yxmmc.Text  = this.projectInfoStruct.ProjectName;
                    this.textBox_copyPN.Text = this.projectInfoStruct.ProjectName + "_副本";
                    this.textBox_ybcxs.Text  = this.projectInfoStruct.bcCableName;
                    this.textBox_CopyXS.Text = this.projectInfoStruct.bcCableName + "_副本";
                }
            }
            catch (System.Exception arg_3E0_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_3E0_0.StackTrace);
            }
            try
            {
                if (this.gLineTestProcessor.iUIDisplayMode == 0)
                {
                    base.WindowState = FormWindowState.Normal;
                }
            }
            catch (System.Exception arg_403_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_403_0.StackTrace);
            }
        }