You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
2.5 KiB
111 lines
2.5 KiB
1 month ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Data;
|
||
|
using System.Data.SqlClient;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
|
||
|
namespace MESClassLibrary.DAL
|
||
|
{
|
||
|
public class LocalDBService
|
||
|
{
|
||
|
// Token: 0x06000058 RID: 88 RVA: 0x00004839 File Offset: 0x00003839
|
||
|
public LocalDBService(string conn)
|
||
|
{
|
||
|
SqlHelper.sqlCommandTimeOut = 3000;
|
||
|
m_conn = conn;
|
||
|
}
|
||
|
|
||
|
// Token: 0x06000059 RID: 89 RVA: 0x00004863 File Offset: 0x00003863
|
||
|
public void BeginTrans()
|
||
|
{
|
||
|
this.m_connection = new SqlConnection(LocalDBService.m_conn);
|
||
|
this.m_connection.Open();
|
||
|
this.m_trans = this.m_connection.BeginTransaction();
|
||
|
this.IsInTrans = true;
|
||
|
}
|
||
|
|
||
|
// Token: 0x0600005A RID: 90 RVA: 0x0000489C File Offset: 0x0000389C
|
||
|
public void Commit()
|
||
|
{
|
||
|
if (this.IsInTrans)
|
||
|
{
|
||
|
this.m_trans.Commit();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Token: 0x0600005B RID: 91 RVA: 0x000048C8 File Offset: 0x000038C8
|
||
|
public void Rollback()
|
||
|
{
|
||
|
if (this.IsInTrans)
|
||
|
{
|
||
|
this.m_trans.Rollback();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Token: 0x0600005C RID: 92 RVA: 0x000048F1 File Offset: 0x000038F1
|
||
|
public void EndTrans()
|
||
|
{
|
||
|
this.m_connection.Close();
|
||
|
this.IsInTrans = false;
|
||
|
}
|
||
|
|
||
|
// Token: 0x0600005D RID: 93 RVA: 0x00004908 File Offset: 0x00003908
|
||
|
public DataSet Exec_DataSet(string sql)
|
||
|
{
|
||
|
DataSet result;
|
||
|
if (this.IsInTrans)
|
||
|
{
|
||
|
result = SqlHelper.ExecuteDataset(this.m_trans, CommandType.Text, sql);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
result = SqlHelper.ExecuteDataset(LocalDBService.m_conn, CommandType.Text, sql);
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
// Token: 0x0600005E RID: 94 RVA: 0x00004948 File Offset: 0x00003948
|
||
|
public object Exec_Object(string sql)
|
||
|
{
|
||
|
object result;
|
||
|
if (this.IsInTrans)
|
||
|
{
|
||
|
result = SqlHelper.ExecuteScalar(this.m_trans, CommandType.Text, sql);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
result = SqlHelper.ExecuteScalar(LocalDBService.m_conn, CommandType.Text, sql);
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
// Token: 0x0600005F RID: 95 RVA: 0x00004988 File Offset: 0x00003988
|
||
|
public bool Exec_NonQuery(string sql)
|
||
|
{
|
||
|
int num;
|
||
|
if (this.IsInTrans)
|
||
|
{
|
||
|
num = SqlHelper.ExecuteNonQuery(this.m_trans, CommandType.Text, sql);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
num = SqlHelper.ExecuteNonQuery(LocalDBService.m_conn, CommandType.Text, sql);
|
||
|
}
|
||
|
return num > 0;
|
||
|
}
|
||
|
|
||
|
// Token: 0x04000006 RID: 6
|
||
|
public static string m_conn = string.Empty;
|
||
|
|
||
|
// Token: 0x04000007 RID: 7
|
||
|
private SqlTransaction m_trans = null;
|
||
|
|
||
|
// Token: 0x04000008 RID: 8
|
||
|
private SqlConnection m_connection = null;
|
||
|
|
||
|
// Token: 0x04000009 RID: 9
|
||
|
private bool IsInTrans = false;
|
||
|
}
|
||
|
}
|