Esempio n. 1
0
        public List<SiteQuery> QuerryAll(SiteQuery site, out int totalCount) 
        {
            try
            {
                return _siteDao.QuerryAll(site,out totalCount);
            }
            catch (Exception ex)
            {

                throw new Exception("SiteMgr-->QuerryAll-->" + ex.Message, ex);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// chaojie_zz添加於2014/10/14
        /// </summary>
        /// <param name="site"></param>
        /// <param name="totalCount"></param>


        #region site站臺列表
        /// <summary>
        /// site站臺列表
        /// </summary>
        /// <param name="site"></param>
        /// <param name="totalCount"></param>
        /// <returns>List</returns>
        public List<SiteQuery> QuerryAll(SiteQuery site, out int totalCount)
        {
            StringBuilder stb = new StringBuilder();
            StringBuilder sqlCondi = new StringBuilder();
            StringBuilder sqlWhere = new StringBuilder();
            site.Replace4MySQL();
            try
            {
                sqlCondi.AppendFormat(@"select site.site_id,site.site_name,site.domain,site.cart_delivery,st.site_name as csitename,site.online_user,");
                sqlCondi.AppendFormat(@"site.max_user,site.page_location,site.site_status,site.site_createdate,site.site_updatedate,site.create_userid,site.update_userid ");
                stb.AppendFormat(@"from site  left join site st on site.cart_delivery=st.site_id ");

                GroupAuthMapQuery groupAuthMapModel = new GroupAuthMapQuery();
                groupAuthMapModel.table_name = "site";
                groupAuthMapModel.user_id = site.create_userid;
                stb.Append(_groupAuthMapMgr.Query(groupAuthMapModel));

                //if (site.site_id != 0)
                //{
                //    strcondition.AppendFormat(@" and site.site_id='{0}' ", site.site_id);
                //}
                if (!string.IsNullOrEmpty(site.site_name))
                {
                    sqlWhere.AppendFormat(" and site.site_name like N'%{0}%' ", site.site_name);
                }
                totalCount = 0;
                if (sqlWhere.Length != 0)
                {
                    stb.Append(" WHERE ");
                    stb.Append(sqlWhere.ToString().TrimStart().Remove(0, 3));
                }
                if (site.IsPage)
                {
                    System.Data.DataTable _dt = _access.getDataTable(" select  count(site.site_id) as totalcount " + stb.ToString());

                    if (_dt != null && _dt.Rows.Count > 0)
                    {
                        totalCount = Convert.ToInt32(_dt.Rows[0]["totalcount"]);
                    }
                    stb.AppendFormat(" order by site.site_id desc limit {0},{1}", site.Start, site.Limit);
                }
                return _access.getDataTableForObj<SiteQuery>(sqlCondi.ToString() + stb.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("SiteDao-->QuerryAll-->" + ex.Message + sqlCondi.ToString() + stb.ToString(), ex);
            }

        }
Esempio n. 3
0
        /// <summary>
        /// 獲取Site詳情表頁
        /// </summary>
        /// <returns>json數組列表頁</returns>
        public HttpResponseBase SiteList()
        {
            List<SiteQuery> stores = new List<SiteQuery>();

            string json = string.Empty;
            try
            {
                SiteQuery query = new SiteQuery();
                if (!string.IsNullOrEmpty(Request.Params["serchcontent"]))
                {
                    query.site_name = Request.Params["serchcontent"];
                }
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "20");//用於分頁的變量
                query.create_userid = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                _siteMgr = new SiteMgr(mySqlConnectionString);
                int totalCount = 0;

                stores = _siteMgr.QuerryAll(query, out totalCount);
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                //listUser是准备转换的对象
                json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores, 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;
        }