コード例 #1
0
ファイル: PromoAllDao.cs プロジェクト: lxh2014/gigade-net
        /// <summary>
        /// 根據查詢條件獲取促銷活動列表
        /// </summary>
        /// <param name="query">條件model</param>
        /// <returns>促銷活動列表</returns>
        public List<PromoAll> GetList(PromoAllQuery query)
        {
            StringBuilder sbSql = new StringBuilder();
            sbSql.Append("select rid,event_id,event_type,brand_id,class_id,category_id,product_id,start as startTime,end,kuser,kdate,muser,mdate,status ");
            sbSql.Append(" from promo_all where 1=1 ");
            if (query.status != 0)
            {
                sbSql.AppendFormat(" and status={0} ", query.status);
            }
            if (query.brand_id != 0)
            {
                sbSql.AppendFormat(" and brand_id={0} ", query.brand_id);
            }
            if (query.category_id != 0)
            {
                sbSql.AppendFormat(" and category_id={0} ", query.category_id);
            }
            try
            {
                return _access.getDataTableForObj<PromoAll>(sbSql.ToString());
            }
            catch (Exception ex)
            {

                throw new Exception("PromoAllDao-->GetList-->" + ex.Message + sbSql.ToString(), ex);
            }
            
        } 
コード例 #2
0
ファイル: PromoAllMgr.cs プロジェクト: lxh2014/gigade-net
 /// <summary>
 /// 根據條件獲取促銷列表
 /// </summary>
 /// <param name="query">查詢條件model</param>
 /// <returns>促銷信息列表</returns>
 public List<PromoAll> GetList(PromoAllQuery query)
 {
     try
     {
         return _paDao.GetList(query);
     }
     catch (Exception ex)
     {
         throw new Exception("PromoAllMgr-->GetList-->" + ex.Message, ex);
     }
 } 
コード例 #3
0
        /// <summary>
        /// 根據查詢條件獲取促銷活動列表
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase GetPromoAllList()
        {
            string json = string.Empty;
            int totalCount = 0;
            string brandId = Request["brandId"];
            List<PromoAll> store = new List<PromoAll>();
            PromoAllQuery query = new PromoAllQuery();
            query.status = 1;
            if (!string.IsNullOrEmpty(brandId))
            {
                query.brand_id = Convert.ToInt32(brandId);
            }
            try
            {
                store = _promAllMgr.GetList(query);
                totalCount = store.Count;
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                //listUser是准备转换的对象
                json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回json數據
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:true,totalCount:0,data:[]}";
            }

            Response.Clear();
            Response.Write(json);
            Response.End();
            return this.Response;
        }