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.
|
|
using ICSSoft.Common; using ICSSoft.Entity; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace ICSSoft.DataProject { /// <summary>
/// pda版本
/// </summary>
public class ICSWMSVersions { 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(); public List<ICSVersions> Get (ICSVersions JsonData) { conn.Open(); SqlTransaction sqlTran = conn.BeginTransaction(); SqlCommand cmd = new SqlCommand(); cmd.Transaction = sqlTran; cmd.Connection = conn; try { sql = @"select top(1)* from ICSVersions where 1=1"; if (!string.IsNullOrWhiteSpace(JsonData.ProjectName)) { sql += " and ProjectName='{0}'"; } sql = string.Format(sql, JsonData.ProjectName); table = DBHelper.SQlReturnData(sql, cmd); string json = JsonConvert.SerializeObject(table); List<ICSVersions> model = JsonConvert.DeserializeObject<List<ICSVersions>>(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(); }
}
public List<ICSWorkPoint> GetWorkPoint(ICSWorkPoint JsonData) { conn.Open(); SqlTransaction sqlTran = conn.BeginTransaction(); SqlCommand cmd = new SqlCommand(); cmd.Transaction = sqlTran; cmd.Connection = conn; try { sql = @"select * from Sys_WorkPoint where 1=1"; if (!string.IsNullOrWhiteSpace(JsonData.WorkPointCode)) { sql += " and WorkPointCode='{0}'"; } sql = string.Format(sql, JsonData.WorkPointCode); table = DBHelper.SQlReturnData(sql, cmd); string json = JsonConvert.SerializeObject(table); List<ICSWorkPoint> model = JsonConvert.DeserializeObject<List<ICSWorkPoint>>(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(); }
} } }
|