12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using RDIFramework.Utilities;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- namespace TimedUpload.utils
- {
- public class DataBaseHelper
- {
- static IDbProvider dbHelper
- {
- get
- {
- var DbDefine = DbFactoryProvider.GetProvider(CurrentDbType.SqlServer, SystemConfig.pipeLineDbConn);
- return DbDefine;
- }
- }
- public static bool CheckTableExiste(string strTableName)
- {
- string strSql = "select * from sysobjects where name='" + strTableName + "'";
- if (CreateDataSet(strSql).Tables[0].Rows.Count == 0)
- {
- return false;
- }
- return true;
- }
- public static DataSet CreateDataSet(string strSql)
- {
- DataSet dataSet = new DataSet();
- try
- {
- dataSet = new DataSet();
- dbHelper.Fill(dataSet, strSql, "checkTable");
- }
- catch (Exception exception)
- {
- //log.Error("checkTable:" + exception.Message);
- }
- return dataSet;
- }
- public static string DataFormat(object value)
- {
- if (value == null)
- {
- return "NULL";
- }
- if (string.IsNullOrEmpty(value.ToString()))
- {
- return "NULL";
- }
- if (value.ToString() == "正常")
- {
- return "0";
- }
- if (value.ToString() == "停止")
- {
- return "1";
- }
- if (value.ToString() == "运行")
- {
- return "0";
- }
- if (value.ToString() == "故障")
- {
- return "1";
- }
- if (value.ToString() == "报警")
- {
- return "1";
- }
- return value.ToString();
- }
- }
- }
|