using MESClassLibrary.BLL.Log; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Reflection; using System.Text; namespace MESClassLibrary.DAL.Keep { public class KeepRecordDAL { public DataTable SearhByKeepPlanID(string KeepPlanID) { try { string sql = @"SELECT l.KeepLevel,d.DeviceName,i.KeepItems,r.result,kv.Version FROM [dbo].[tb_KeepRecord] r left join tb_KeepPlan p on r.KeepPlanID = p.ID left join tb_Device d on p.DeviceID =d.DeviceID left join tb_KeepLevel l on p.KeepLevelID =l.ID left join tb_KeepItemsVersion v on r.KeepItemsVersionID = v.id left join tb_KeepItems i on v.KeepItemsID=i.ID left join tb_KeepVersion kv on v.VersionID = kv.id where r.KeepPlanID =@KeepPlanID"; SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@KeepPlanID", SqlDbType.VarChar); param[0].Value = KeepPlanID; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return null; } } } }