예제 #1
0
 public List<Site> GetSite(Site query)
 {
     try
     {
         return _siteDao.GetSite(query);
     }
     catch (Exception ex)
     {
         throw new Exception("SiteMgr-->GetSite-->" + ex.Message, ex);
     }
 }
예제 #2
0
 public List<Site> Query(Site query)
 {
     StringBuilder stb = new StringBuilder();
     try
     {
         query.Replace4MySQL();
         stb.Append("select site_id,site_name,domain,cart_delivery from site where 1=1 ");
         if (!string.IsNullOrEmpty(query.Site_Name))
         {
             stb.AppendFormat(" and site_name like N'%{0}%'", query.Site_Name);
         }
         if (query.Site_Id != 0)
         {
             stb.AppendFormat(" and site_id={0}", query.Site_Id);
         }
         return _access.getDataTableForObj<Site>(stb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("SiteDao-->Query-->" + ex.Message + stb.ToString(), ex);
     }
 }
예제 #3
0
 public List<Site> GetSite(Site query)
 {
     query.Replace4MySQL();
     StringBuilder sql = new StringBuilder();
     sql.AppendFormat("select site_id,site_name from site where site_status=1 ");
     GroupAuthMapQuery groupAuthMapModel = new GroupAuthMapQuery();
     groupAuthMapModel.table_name = "site";
     groupAuthMapModel.user_id = query.Create_Userid;
     sql.Append(_groupAuthMapMgr.Query(groupAuthMapModel));
     try
     {
         return _access.getDataTableForObj<Site>(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("SiteDao-->GetSite-->" + ex.Message + sql.ToString(), ex);
     }
 }
        /// <summary>
        /// 獲取site
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase GetSite()
        {

            List<Site> stores = new List<Site>();
            string json = string.Empty;
            try
            {
                int totalCount = 0;
                Site query = new Site();
                stores = _siteMgr.Query(query);
                json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores) + "}";//返回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:false,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
        public HttpResponseBase GetTryEatDiscountList()
        {
            List<PromotionsAmountGiftQuery> store = new List<PromotionsAmountGiftQuery>();
            string json = string.Empty;
            try
            {
                PromotionsAmountGiftQuery query = new PromotionsAmountGiftQuery();
                #region 獲取query對象數據
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");

                if (!string.IsNullOrEmpty(Request.Form["limit"]))
                {
                    query.Limit = Convert.ToInt32(Request.Params["limit"]);
                }

                if (!string.IsNullOrEmpty(Request.Params["ddlSel"]))
                {
                    query.expired = Convert.ToInt32(Request.Params["ddlSel"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["serchcontent"]))
                {
                    query.selcon = Request.Params["serchcontent"];
                }
                if (!string.IsNullOrEmpty(Request.Params["timestart"]))
                {
                    query.start = DateTime.Parse(Request.Params["timestart"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["timeend"]))
                {
                    query.end = DateTime.Parse(Request.Params["timeend"]);
                }
                #endregion

                _promoAmountGiftMgr = new PromotionsAmountGiftMgr(mySqlConnectionString);

                int totalCount = 0;
                string type = "'G3','G0','G4'";
                store = _promoAmountGiftMgr.Query(query, out totalCount, type);
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";

                foreach (var item in store)
                {
                    if (!string.IsNullOrEmpty(item.delivery_category.ToString()))
                    {
                        string[] arrySite = item.delivery_category.Split(',');//將siteid轉化為site_name
                        item.delivery_category = "";
                        for (int i = 0; i < arrySite.Length; i++)
                        {
                            Site querySite = new Site();
                            querySite.Site_Id = Convert.ToUInt32(arrySite[i]);
                            item.delivery_category += _siteMgr.Query(querySite).FirstOrDefault().Site_Name;
                            if (i != arrySite.Length - 1)
                            {
                                item.delivery_category += ",";
                            }
                        }
                    }
                    if (item.banner_image != "")
                    {
                        item.banner_image = imgServerPath + promoPath + item.banner_image;
                    }
                    else
                    {
                        item.banner_image = defaultImg;
                    }
                    if (!string.IsNullOrEmpty(item.payment_code))
                    {
                        _parasrcMgr = new ParameterMgr(mySqlConnectionString);
                        string[] arryPayment = item.payment_code.Split(',');//將payment_code轉化為payment
                        for (int i = 0; i < arryPayment.Length; i++)
                        {
                            if (arryPayment[i] != "0")
                            {
                                string nameStr = _parasrcMgr.QueryUsed(new Parametersrc { ParameterType = "payment", Used = 1, ParameterCode = arryPayment[i] }).FirstOrDefault().parameterName;
                                if (!string.IsNullOrEmpty(nameStr))
                                {
                                    item.payment += nameStr;
                                }

                                if (i != arryPayment.Length - 1)
                                {
                                    item.payment += ",";
                                }
                            }
                        }
                    }
                }
                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:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
예제 #6
0
        public HttpResponseBase GetSite()
        {
            List<Site> store = new List<Site>();
            string json = string.Empty;
            try
            {
                _siteMgr = new SiteMgr(mySqlConnectionString);
                Site site = new Site();
                site.Create_Userid = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                store = _siteMgr.GetSite(site);

                json = "{success:true,data:" + JsonConvert.SerializeObject(store, Formatting.Indented) + "}";
            }
            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,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }