using MesDataFunction; using MesWork; using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MesDataFunction { public class Print_Sql { public static bool Select_Print_Template(out DataTable dt_Print_Template) { /* SELECT [IDG],[TemplateName],[TemplateContent],[DefSelect],[UpdateTime] FROM [OL_Repair_Print_Template] */ bool success = false; var sql = @" SELECT [IDG],[TemplateName],[DefSelect],[UpdateTime] FROM [OL_Repair_Print_Template] ORDER BY [UpdateTime] "; success = DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, PP.ConnectionString_MES, out DataTable dt, out string err2); dt_Print_Template = dt; return success; } public static bool Select_Print_TemplateStr(string IDG, out string templateStr) { /* SELECT [IDG],[TemplateName],[TemplateContent],[DefSelect],[UpdateTime] FROM [OL_Repair_Print_Template] */ templateStr = ""; bool success = false; var sql = $" DECLARE @IDG nvarchar(50) = '{IDG}'" + @" SELECT [TemplateContent] FROM [OL_Repair_Print_Template] WHERE [IDG] = @IDG "; success = DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, PP.ConnectionString_MES, out DataTable dt, out string err2); if (dt.Rows.Count > 0) { templateStr = dt.Rows[0]["TemplateContent"].ToString(); } return success; } public static bool Select_Print_Template_Def(out string templateStr) { /* SELECT [IDG],[TemplateName],[TemplateContent],[DefSelect],[UpdateTime] FROM [OL_Repair_Print_Template] */ templateStr = ""; bool success = false; var sql = @" SELECT top 1 [TemplateContent] FROM [OL_Repair_Print_Template] WHERE [DefSelect]= 'True' "; success = DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, PP.ConnectionString_MES, out DataTable dt, out string err2); if (dt.Rows.Count > 0) { templateStr = dt.Rows[0]["TemplateContent"].ToString(); } return success; } } }