Beispiel #1
0
 /// <summary>
 /// 新增数据 ,若不存在直接建表建库
 /// </summary>
 /// <param 数据对象="baseProfile"></param>
 /// <param 表名="tableName"></param>
 /// <returns></returns>
 public result AddReflowerTesterProfile(ReflowerTesterProfile baseProfile, string tableName)
 {
     if (baseProfile == null)
     {
         return(result.fail);
     }
     if (!AccessDBBase.ExistMysqlDB())
     {
         return(result.notFoundMySql);
     }
     if (RTDBApply.CreateTable(tableName))
     {
         if (RTDBApply.InsertBaseProfile(tableName, baseProfile.Line, baseProfile.ReflowerName, baseProfile.ProductName, baseProfile.StartTime, baseProfile.EndTime, baseProfile.TechnologyType, baseProfile.TechnologyName, baseProfile.ProcessName, baseProfile.ReflowerTechName, baseProfile.SolderName, baseProfile.PtsFileName, baseProfile.PtsFilePath, baseProfile.ImgPath))
         {
             return(result.success);
         }
         else
         {
             return(result.fail);
         }
     }
     else
     {
         return(result.fail);
     }
 }
Beispiel #2
0
        public static bool CreateTable(string tableName)
        {
            bool issuc = true;

            try
            {
                //**判断数据库是否存在,以及数据库是否创建成功*/

                if (!AccessDBBase.ExistDB("reflowertester", "root", "pempenn", GlobalData.MySqlPort))
                {
                    if (!AccessDBBase.CreateDB("reflowertester", "root", "pempenn"))
                    {
                        LogClass.WriteLogFile("创建数据库失败->");
                    }
                    return(false);
                }

                //**建表*/
                if (!AccessDBBase.ExecuteCommand("reflowertester", "root", "pempenn", GlobalData.MySqlPort, SqlCmd_baseProfile_m(tableName)))//sqlCmd_baseProfile
                {
                    // LogClass.WriteLogFile("创建表baseprofile失败");
                    LogClass.WriteLogFile("创建表RTfile失败->" + tableName);
                    return(false);
                }
            }
            catch (MySqlException ex)
            {
                // LogClass.WriteLogFile(ex.Message);
                LogClass.WriteLogFile(ex.Message);
                return(false);
            }
            return(issuc);
        }
Beispiel #3
0
        /// <summary>
        /// 去重查询字段下数据(只限字符字段)
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public static List <string> selectAllLineData(string tableName, string field)
        {
            List <string> listStr = new List <string>();

            try
            {
                using (MySqlConnection connection = AccessDBBase.getMySqlCon("ReflowerTester", "root", "pempenn", GlobalData.MySqlPort))
                {
                    connection.Open();
                    MySqlCommand    cmd    = new MySqlCommand(sqlCmd_selectAllLine(tableName, field), connection);
                    MySqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        listStr.Add(reader[0].ToString());
                    }
                    reader.Close();
                }
            }
            catch (MySqlException ex)
            {
                LogClass.WriteLogFile("Reflower Tester:去重查询Line数据失败" + ex.Message);
                listStr = null;
            }

            return(listStr);
        }
Beispiel #4
0
 public static bool DeleteData_baseProfile(string tableName, string line, string productName)
 {
     try
     {
         if (!AccessDBBase.ExecuteCommand("ReflowerTester", "root", "pempenn", GlobalData.MySqlPort, SqlCmd_deleteData_baseprofile2(tableName, line, productName)))
         {
             LogClass.WriteLogFile("Reflower Tester:清除时间段内数据失败2");
         }
     }
     catch (MySqlException ex)
     {
         LogClass.WriteLogFile("Reflower Tester:清除时间段内数据失败_2" + ex.Message);
         return(false);
     }
     return(true);
 }
Beispiel #5
0
        public static DataTable SelectDataTable_baseProfile(string tableName, string line, string productName, string beginTime, string overTime)
        {
            DataTable Dt = new DataTable();

            try
            {
                using (MySqlConnection connection = AccessDBBase.getMySqlCon("ReflowerTester", "root", "pempenn", GlobalData.MySqlPort))
                {
                    connection.Open();
                    Dt = AccessDBBase.GetDataTable(connection, SqlCmd_selectDataTable4(tableName, line, productName), new MySqlParameter(@"beginTime", beginTime), new MySqlParameter(@"overTime", overTime));
                }
            }
            catch (MySqlException ex)
            {
                LogClass.WriteLogFile("Reflower Tester:查询成DataTable数据4失败" + ex.Message);
                Dt = null;
            }

            return(Dt);
        }
Beispiel #6
0
        public static DataTable SelectDataTable_baseProfile(string tableName, string lineOrProductName, bool isLine)
        {
            DataTable Dt = new DataTable();

            try
            {
                using (MySqlConnection connection = AccessDBBase.getMySqlCon("ReflowerTester", "root", "pempenn", GlobalData.MySqlPort))
                {
                    connection.Open();
                    Dt = AccessDBBase.GetDataTable(connection, SqlCmd_selectDataTable1(tableName, lineOrProductName, isLine));
                }
            }
            catch (MySqlException ex)
            {
                LogClass.WriteLogFile("Reflower Tester:查询成DataTable数据1失败" + ex.Message);
                Dt = null;
            }

            return(Dt);
        }
Beispiel #7
0
        public static DataTable SelectDataTable_baseProfileUsePage(string tableName, string line, string productName, string beginIndex, string num)
        {
            DataTable Dt = new DataTable();

            try
            {
                using (MySqlConnection connection = AccessDBBase.getMySqlCon("ReflowerTester", "root", "pempenn", GlobalData.MySqlPort))
                {
                    connection.Open();
                    Dt = AccessDBBase.GetDataTable(connection, SqlCmd_selectDataTable2UsePage(tableName, line, productName, beginIndex, num));
                }
            }
            catch (MySqlException ex)
            {
                LogClass.WriteLogFile("Reflower Tester:查询成DataTable数据2失败(分页)" + ex.Message);
                Dt = null;
            }

            return(Dt);
        }
Beispiel #8
0
        public static bool InsertBaseProfile(string tableName, string Line, string ReflowerName, string ProductName, DateTime StartTime, DateTime EndTime, string TechnologyType, string TechnologyName, string ProcessName, string ReflowerTechName, string SolderName, string PtsFileName, string PtsFilePath, string ImgPath)
        {
            string startTime        = string.Format("{0:yyyy-MM-dd HH:mm:ss}", StartTime);
            string endTime          = string.Format("{0:yyyy-MM-dd HH:mm:ss}", EndTime);
            string getCommandInsert = string.Format(baseProfile_insertFormat(tableName), "'" + Line + "'", "'" + ReflowerName + "'", "'" + ProductName + "'", "'" + startTime + "'", "'" + endTime + "'", "'" + TechnologyType + "'", "'" + TechnologyName + "'", "'" + ProcessName + "'", "'" + ReflowerTechName + "'", "'" + SolderName + "'", "'" + PtsFileName + "'", "'" + PtsFilePath + "'", "'" + ImgPath + "'");

            try
            {
                if (AccessDBBase.ExecuteCommand("ReflowerTester", "root", "pempenn", GlobalData.MySqlPort, getCommandInsert))
                {
                    return(true);
                }
                else
                {
                    LogClass.WriteLogFile("Reflower Tester:baseProfile插入数据失败");
                    return(false);
                }
            }
            catch (MySqlException ex)
            {
                LogClass.WriteLogFile("Reflower Tester:baseProfile插入数据失败" + ex.Message);
                return(false);
            }
        }