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.
78 lines
2.9 KiB
78 lines
2.9 KiB
using ICSSoft.Common;
|
|
using ICSSoft.Entity;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ICSSoft.DataProject
|
|
{
|
|
/// <summary>
|
|
/// 管控方式
|
|
/// </summary>
|
|
public class ICSControlModeService
|
|
{
|
|
private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
private static string connString = System.Configuration.ConfigurationManager.AppSettings["ConnStr"];
|
|
private static string ERPDB = System.Configuration.ConfigurationManager.AppSettings["ERPDB"];
|
|
DataTable table = null;
|
|
SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString);
|
|
string sql = string.Empty;
|
|
string sqlInfo = string.Empty;
|
|
VerificationMethod verification = new VerificationMethod();
|
|
|
|
/// <summary>
|
|
/// 获取当前启用的管控方式
|
|
/// </summary>
|
|
/// <param name="cmd"></param>
|
|
/// <param name="language"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="Exception"></exception>
|
|
public static List<ControlMode> GetControlModes()
|
|
{
|
|
using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString))
|
|
{
|
|
conn.Open();
|
|
SqlCommand cmd = new SqlCommand();
|
|
SqlTransaction sqlTran = conn.BeginTransaction();
|
|
cmd.Transaction = sqlTran;
|
|
cmd.Connection = conn;
|
|
try
|
|
{
|
|
string sql = @"SELECT F_ItemCode as itemCode,F_ItemName as itemName,F_EnabledMark as enableMark FROM [dbo].[Sys_SRM_ItemsDetail] WHERE F_ItemCode='ControlMode01' OR F_ItemCode='ControlMode02'";
|
|
|
|
sql = string.Format(sql, cmd);
|
|
DataTable table = DBHelper.SQlReturnData(sql, cmd);
|
|
string json = JsonConvert.SerializeObject(table);
|
|
//ControlMode model = JsonConvert.DeserializeObject<ControlMode>(json);
|
|
List<ControlMode> model = JsonConvert.DeserializeObject<List<ControlMode>>(json);
|
|
cmd.Transaction.Commit();
|
|
return model;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (cmd.Transaction != null)
|
|
cmd.Transaction.Rollback();
|
|
log.Error(ex.Message);
|
|
throw new Exception(ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
if (conn.State == ConnectionState.Open)
|
|
{
|
|
conn.Close();
|
|
}
|
|
conn.Dispose();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|