hskartono

Untitled

Nov 30th, 2021
637
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public String GetDelayReceivingJsp(string day = "")
  2.         {
  3.             try
  4.             {
  5.                 string sqlday = " and  1=1";
  6.                 if (!string.IsNullOrEmpty(sqlday))
  7.                 {
  8.                     if (day == "one")
  9.                     {
  10.                         sqlday = "and DATEDIFF(DAY, eta, convert(date,getdate())) = 3";
  11.                     }
  12.                     else if (day == "mid")
  13.                     {
  14.                         sqlday = "and DATEDIFF(DAY, eta, convert(date,getdate())) BETWEEN 4 AND 5";
  15.                     }
  16.                     else if (day == "more")
  17.                     {
  18.                         sqlday = "and DATEDIFF(DAY, eta, convert(date,getdate())) > 6";
  19.                     }
  20.                 }
  21.                 string sql = @"
  22.                SELECT count(*) AS delay_receiving_jsp FROM (
  23.                SELECT container_no FROM SsDelayReceiving WITH (NOLOCK)
  24.                WHERE source = 'JSP' " + sqlday +
  25.                " GROUP BY container_no ) AS tbl";
  26.  
  27.                 DataTable result = mSharedHelper.SqlToDataTable(sql);
  28.  
  29.                 return result != null ? result.Rows[0]["delay_receiving_jsp"].ToString() : "0";
  30.             }
  31.             catch (Exception ex)
  32.             {
  33.                 throw new AMNDaoException(base.ErrorMethodInfo(System.Reflection.MethodBase.GetCurrentMethod()) + " " + ex.Message, ex);
  34.             }
  35.         }
RAW Paste Data