Esempio n. 1
0
        public DataTable getShopCollectTime()
        {
            string    strSql = "SELECT * FROM ShopCollectTime";
            DataTable dt     = SqlDbmanager.queryBySql(SqlExtension.GetSelectSqlCmdByParams(strSql));

            return(dt);
        }
Esempio n. 2
0
        public DataTable GetShopCollectDt(ShopCollectDailyFilter shopCollectDailyFilter)
        {
            SqlCommand cmd = new SqlCommand();

            string strSql = @"SELECT 
                                SCD03 AS '日期',
                                SCD04 AS '店取短名',
                                SCD05 AS '郵遞區號',
                                SCD06 AS '地址1',
                                SCD07 AS '地址2',
                                SCD08 AS '店家名稱',
                                SCD09 AS '包裹放置天數',
                                SCD10 AS '店取類型',
                                SCD13 AS '國家' 
                                FROM ShopCollectDaily 
                                WHERE SCD12=1 AND SCD03 BETWEEN @ST AND @ET AND SCD13=@CODE ";

            if (!string.IsNullOrEmpty(shopCollectDailyFilter.ShortName))
            {
                strSql += " AND SCD04=@SCD04";
                cmd.Parameters.Add(SafeSQL.CreateInputParam("SCD04", SqlDbType.VarChar, shopCollectDailyFilter.ShortName));
            }
            if (!string.IsNullOrEmpty(shopCollectDailyFilter.PostCode))
            {
                strSql += " AND SCD05=@SCD05";
                cmd.Parameters.Add(SafeSQL.CreateInputParam("SCD05", SqlDbType.VarChar, shopCollectDailyFilter.PostCode));
            }
            cmd.CommandText = strSql;
            cmd.Parameters.Add(SafeSQL.CreateInputParam("ST", SqlDbType.Date, shopCollectDailyFilter.STime.ToString("yyyy-MM-dd")));
            cmd.Parameters.Add(SafeSQL.CreateInputParam("ET", SqlDbType.Date, shopCollectDailyFilter.ETime.ToString("yyyy-MM-dd")));
            cmd.Parameters.Add(SafeSQL.CreateInputParam("CODE", SqlDbType.VarChar, shopCollectDailyFilter.Country));
            return(SqlDbmanager.queryBySql(cmd, System.Web.Configuration.WebConfigurationManager.ConnectionStrings["NormalConn"].ConnectionString));
        }