public List <AuditResult> GetData(AuditResultReq d, SqlTransaction transac = null, string conStr = null) { DynamicParameters param = new DynamicParameters(); sql = " SELECT * FROM [dbo].[FC_AuditResults] ("; sql += " " + QuoteStr(d.COMPANY); sql += " ," + QuoteStr(d.YR); sql += " ," + QuoteStr(d.MN); sql += " ) where 1 = 1"; if (!String.IsNullOrEmpty(d.DEPMST)) { sql += " and DEPMST = " + QuoteStr(d.DEPMST); } if (!String.IsNullOrEmpty(d.SQNO)) { sql += " and SQNO = " + QuoteStr(d.SQNO); } if (!String.IsNullOrEmpty(d.CUTDT)) { sql += " and DATEADD(dd, 0, DATEDIFF(dd, 0, cutdt)) = DATEADD(dd, 0, DATEDIFF(dd, 0, " + QuoteStr(d.CUTDT) + "))"; } if (!String.IsNullOrEmpty(d.YRMN)) { sql += " and YRMN = " + QuoteStr(d.YRMN); } var res = Query <AuditResult>(sql, param, conStr).ToList(); return(res); }
public List <AuditAcc> GetData(AuditResultReq d, SqlTransaction transac = null, string conStr = null) { DynamicParameters param = new DynamicParameters(); string USERID = d.INPID; sql = " SELECT C.* "; sql += " ,(select NAMEMPT from [CENTRALDB].[centraldb].[dbo].[vTEMPLOY] where [CODEMPID]= C.STID) as STNAME"; sql += " ,(select NAMEMPT from [CENTRALDB].[centraldb].[dbo].[vTEMPLOY] where [CODEMPID]= C.MGR1ID) as MGR1NAME"; sql += " ,(select NAMEMPT from [CENTRALDB].[centraldb].[dbo].[vTEMPLOY] where [CODEMPID]= C.MGR2ID) as MGR2NAME"; sql += " FROM [dbo].[FC_AuditACC] ("; sql += " " + QuoteStr(d.COMPANY); sql += " ," + QuoteStr(d.YR); sql += " ," + QuoteStr(d.MN); sql += " ," + QuoteStr(USERID); sql += " ," + QuoteStr(d.YRMN); sql += " ) as C where 1 = 1"; if (!String.IsNullOrEmpty(d.DEPMST)) { sql += " and DEPMST = " + QuoteStr(d.DEPMST); } if (!String.IsNullOrEmpty(d.SQNO)) { sql += " and SQNO = " + QuoteStr(d.SQNO); } if (!String.IsNullOrEmpty(d.CUTDT)) { sql += " and DATEADD(dd, 0, DATEDIFF(dd, 0, cutdt)) = DATEADD(dd, 0, DATEDIFF(dd, 0, " + QuoteStr(d.CUTDT) + "))"; } if (!String.IsNullOrEmpty(d.YRMN)) { sql += " and YRMN = '" + d.YRMN + "'"; } var res = Query <AuditAcc>(sql, param, conStr).ToList(); return(res); }