Пример #1
0
        /// <summary>
        /// 得到评论列表
        /// </summary>
        /// <param name="_thispage">当前页码</param>
        /// <param name="_pagesize">每页记录条数</param>
        /// <param name="_channelid">频道ID</param>
        /// <param name="_contentid">内容ID</param>
        public string GetTopList(int _thispage, int _pagesize, string _channelid, string _contentid)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                string sqlStr = "";
                int countNum = 0;
                string whereStr = "[IsPass]=1 AND [ParentId]=0";
                if (_channelid != "0") whereStr += " AND [ChannelId]=" + _channelid;
                if (_contentid != "0") whereStr += " AND [ContentId]=" + _contentid;
                _doh.Reset();
                _doh.ConditionExpress = whereStr;
                countNum = _doh.Count("jcms_normal_review");

                sqlStr = JumboTCMS.Utils.SqlHelp.GetSql("Id,ChannelId,ContentId,IP,UserName,AddDate,Content", "jcms_normal_review", "id", _pagesize, _thispage, "desc", whereStr);
                _doh.Reset();
                _doh.SqlCmd = sqlStr;
                DataTable dt = _doh.GetDataTable();
                string ResponseStr = "";
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    ResponseStr += "<li><a href=\"" + site.Dir + "review/default.aspx?ccid=" + dt.Rows[j]["ChannelId"].ToString() + "&id=" + dt.Rows[j]["ContentId"].ToString() + "#c" + dt.Rows[j]["Id"].ToString() + "\" target=\"_blank\">" + dt.Rows[j]["Content"].ToString() + "</a></li>";
                }
                dt.Clear();
                dt.Dispose();
                return ResponseStr;
            }
        }
Пример #2
0
 /// <summary>
 /// 统计会员的购物车商品种类
 /// </summary>
 /// <param name="_uid"></param>
 /// <returns></returns>
 public int GetNewGoods(string _uid)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "state=0 and userid=" + _uid;
         return _doh.Count("jcms_normal_user_cart");
     }
 }
Пример #3
0
 /// <summary>
 /// 统计会员的购物量
 /// </summary>
 /// <param name="_uid"></param>
 /// <returns></returns>
 public int CountGoods(string _uid)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "OrderNum='' and userid=" + _uid;
         return _doh.Count("jcms_normal_user_goods");
     }
 }
Пример #4
0
 /// <summary>
 /// 统计会员的订单数
 /// </summary>
 /// <param name="_uid"></param>
 /// <param name="_state">状态:-1表示所有</param>
 /// <returns></returns>
 public int GetOrderTotal(string _uid, int _state)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         if (_state < 0)
             _doh.ConditionExpress = "userid=" + _uid;
         else
             _doh.ConditionExpress = "state=" + _state + " and userid=" + _uid;
         return _doh.Count("jcms_normal_user_order");
     }
 }
Пример #5
0
 /// <summary>
 /// 得到列表JSON数据
 /// </summary>
 /// <param name="_thispage">当前页码</param>
 /// <param name="_pagesize">每页记录条数</param>
 /// <param name="_joinstr">关联条件</param>
 /// <param name="_wherestr1">外围条件(带A.)</param>
 /// <param name="_wherestr2">分页条件(不带A.)</param>
 /// <param name="_jsonstr">返回值</param>
 public void GetListJSON(int _thispage, int _pagesize, string _joinstr, string _wherestr1, string _wherestr2, ref string _jsonstr)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = _wherestr2;
         string sqlStr = "";
         int _countnum = _doh.Count("jcms_normal_adminlogs");
         sqlStr = JumboTCMS.Utils.SqlHelp.GetSql("A.id as id,A.AdminId as AdminId,B.[AdminName] as AdminName,A.OperInfo as OperInfo,A.OperTime as OperTime,A.OperIP as OperIP", "jcms_normal_adminlogs", "jcms_normal_user", "Id", _pagesize, _thispage, "desc", _joinstr, _wherestr1, _wherestr2);
         _doh.Reset();
         _doh.SqlCmd = sqlStr;
         DataTable dt = _doh.GetDataTable();
         _jsonstr = "{result :\"1\"," +
             "returnval :\"操作成功\"," +
             "pagerbar :\"" + JumboTCMS.Utils.HtmlPager.GetPageBar(3, "js", 2, _countnum, _pagesize, _thispage, "javascript:ajaxList(<#page#>);") + "\"," +
             JumboTCMS.Utils.dtHelp.DT2JSON(dt, (_pagesize * (_thispage - 1))) +
             "}";
         dt.Clear();
         dt.Dispose();
     }
 }
Пример #6
0
 /// <summary>
 /// 得到列表JSON数据
 /// </summary>
 /// <param name="_thispage">当前页码</param>
 /// <param name="_pagesize">每页记录条数</param>
 /// <param name="_wherestr">搜索条件</param>
 /// <param name="_jsonstr">返回值</param>
 public void GetListJSON(int _thispage, int _pagesize, string _wherestr, ref string _jsonstr)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = _wherestr;
         string sqlStr = "";
         int _countnum = _doh.Count("jcms_normal_page");
         sqlStr = JumboTCMS.Utils.SqlHelp.GetSql("*", "jcms_normal_page", "Id", _pagesize, _thispage, "desc", _wherestr);
         _doh.Reset();
         _doh.SqlCmd = sqlStr;
         DataTable dt = _doh.GetDataTable();
         _jsonstr = "{result :\"1\"," +
             "returnval :\"操作成功\"," +
             "pagerbar :\"" + JumboTCMS.Utils.HtmlPager.GetPageBar(3, "js", 2, _countnum, _pagesize, _thispage, "javascript:ajaxList(<#page#>);") + "\"," +
             JumboTCMS.Utils.dtHelp.DT2JSON(dt) +
             "}";
         dt.Clear();
         dt.Dispose();
     }
 }
Пример #7
0
        /// <summary>
        /// 替换频道栏目循环标签(不支持跨频道)
        /// </summary>
        /// <param name="_pagestr"></param>
        private void replaceTag_ChannelClassLoop(ref string _pagestr)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                string RegexString = "<jcms:classloop (?<tagcontent>.*?)>(?<tempstr>.*?)</jcms:classloop>";
                string[] _tagcontent = JumboTCMS.Utils.Strings.GetRegValue(_pagestr, RegexString, "tagcontent", false);
                string[] _tempstr = JumboTCMS.Utils.Strings.GetRegValue(_pagestr, RegexString, "tempstr", false);
                if (_tagcontent.Length > 0)//标签存在
                {
                    string _loopbody = string.Empty;
                    string _replacestr = string.Empty;
                    string _viewstr = string.Empty;
                    string _tagrepeatnum, _tagselectids, _tagdepth, _tagparentid, _tagwherestr, _tagorderfield, _tagordertype, _hascontent = string.Empty;
                    for (int i = 0; i < _tagcontent.Length; i++)
                    {
                        _loopbody = "<jcms:classloop " + _tagcontent[i] + ">" + _tempstr[i] + "</jcms:classloop>";
                        string _tagchannelid = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "channelid");
                        _tagrepeatnum = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "repeatnum");
                        _tagselectids = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "selectids");
                        _tagdepth = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "depth");
                        _tagparentid = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "parentid");
                        _tagwherestr = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "wherestr");
                        _tagorderfield = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "orderfield");
                        if (_tagorderfield == "") _tagorderfield = "code";
                        _tagordertype = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "ordertype");
                        if (_tagordertype == "") _tagordertype = "asc";
                        if (_tagrepeatnum == "") _tagrepeatnum = "0";
                        _hascontent = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "hascontent");
                        if (_hascontent == "") _hascontent = "0";
                        if (_tagdepth == "") _tagdepth = "0";
                        string pStr = " [Id],[Title],[Info],[TopicNum],[Code],[ChannelId] FROM [jcms_normal_class] WHERE [IsOut]=0 AND [ChannelId]=" + _tagchannelid;
                        string oStr = " ORDER BY code asc";
                        if (_tagorderfield.ToLower() != "code")
                            oStr = " ORDER BY " + _tagorderfield + " " + _tagordertype + ",code asc";
                        else
                            oStr = " ORDER BY " + _tagorderfield + " " + _tagordertype;
                        _doh.Reset();
                        if (_tagdepth != "-1" && _tagdepth != "0")
                            pStr += " AND Len(Code)=" + (Str2Int(_tagdepth, 0) * 4);
                        if (_tagrepeatnum != "0")
                            pStr = " top " + _tagrepeatnum + pStr;
                        if (_tagparentid != "" && _tagparentid != "0")
                            pStr += " AND [ParentId]=" + _tagparentid;
                        if (_hascontent == "1")
                            pStr += " AND [TopicNum]>0";
                        if (_tagwherestr != "")
                            pStr += " AND " + _tagwherestr.Replace("小于", "<").Replace("大于", ">").Replace("不等于", "<>");
                        if (_tagselectids != "")
                            pStr += " AND [id] IN (" + _tagselectids.Replace("|", ",") + ")";

                        _doh.SqlCmd = "select" + pStr + oStr;
                        DataTable _dt = _doh.GetDataTable();
                        StringBuilder sb = new StringBuilder();
                        for (int j = 0; j < _dt.Rows.Count; j++)
                        {
                            if (_tagdepth == "-1")
                            {
                                _doh.Reset();
                                _doh.ConditionExpress = "[IsOut]=0 AND [ChannelId]=" + _tagchannelid + " AND [ParentId]=" + _dt.Rows[j]["Id"].ToString();
                                int countNum = _doh.Count("jcms_normal_class");
                                if (countNum > 1)//表示非末级栏目,直接跳过
                                    continue;
                            }
                            _viewstr = _tempstr[i];
                            _viewstr = _viewstr.Replace("{$ClassNO}", (j + 1).ToString());
                            executeTag_Class(ref _viewstr, _dt.Rows[j]["Id"].ToString());
                            sb.Append(_viewstr);
                        }
                        _pagestr = _pagestr.Replace(_loopbody, sb.ToString());
                        _dt.Clear();
                        _dt.Dispose();
                    }
                }
            }
        }
Пример #8
0
 /// <summary>
 /// 获得栏目页内容(频道ID只能从外部传入,频道ID不能为0)
 /// </summary>
 /// <param name="_classid"></param>
 /// <param name="_currentpage"></param>
 /// <returns></returns>
 public string GetSiteClassPage(string _classid, int _currentpage)
 {
     Normal_Class _class = new JumboTCMS.DAL.Normal_ClassDAL().GetEntity(_classid, "[IsOut]=0 AND [ChannelId]=" + this.MainChannel.Id);
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         string pStr = " [ClassId] in (Select id FROM [jcms_normal_class] WHERE [IsOut]=0 AND [Code] LIKE '" + _class.Code + "%') and [IsPass]=1 AND [ChannelId]=" + this.MainChannel.Id;
         _doh.ConditionExpress = pStr;
         int _totalcount = _doh.Count("jcms_module_" + this.MainChannel.Type);
         int _pagecount = JumboTCMS.Utils.Int.PageCount(_totalcount, _class.PageSize);
         System.Collections.ArrayList ContentList = getClassSinglePage(_class, _pagecount, _currentpage);
         string _pagestr = ContentList[0].ToString();
         if (ContentList.Count > 2)
         {
             string ViewStr = ContentList[1].ToString();
             _pagestr = _pagestr.Replace(ViewStr, ContentList[2].ToString());
         }
         _pagestr = _pagestr.Replace("{$_getPageBar()}",
             getPageBar(1, "html", 2, _totalcount, _class.PageSize, _currentpage, Go2Class(1, this.MainChannel.IsHtml, this.MainChannel.Id.ToString(), _classid, false), Go2Class(-1, this.MainChannel.IsHtml, this.MainChannel.Id.ToString(), _classid, false), Go2Class(-1, false, this.MainChannel.Id.ToString(), _classid, false), site.CreatePages)
             );
         ExcuteLastHTML(ref _pagestr);
         return _pagestr;
     }
 }
Пример #9
0
 /// <summary>
 /// 获得指定栏目内容页数
 /// </summary>
 /// <param name="_channelid">频道ID</param>
 /// <param name="_classid">栏目ID</param>
 /// <param name="_includechild">是否包含子类内容</param>
 /// <returns></returns>
 public int GetContetPageCount(string _channelid, string _classid, bool _includechild)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _channeltype = new Normal_ChannelDAL().GetChannelType(_channelid);
         if (_channeltype.Length == 0) return 0;
         _doh.Reset();
         _doh.SqlCmd = "SELECT [PageSize],[Code] FROM [jcms_normal_class] WHERE [ChannelId]=" + _channelid + " AND [Id]=" + _classid;
         int _pagesize = JumboTCMS.Utils.Validator.StrToInt(_doh.GetDataTable().Rows[0]["PageSize"].ToString(), 0);
         string _classcode = _doh.GetDataTable().Rows[0]["Code"].ToString();
         if (_pagesize == 0) _pagesize = 20;
         string _pstr = string.Empty;
         if (!_includechild)
             _pstr = " [ClassID]=" + _classid + " AND [IsPass]=1 AND [ChannelId]=" + _channelid;
         else
             _pstr = " [ClassID] in (Select id FROM [jcms_normal_class] WHERE [Code] LIKE '" + _classcode + "%') AND [IsPass]=1 AND [ChannelId]=" + _channelid;
         _doh.Reset();
         _doh.ConditionExpress = _pstr;
         int _totalcount = _doh.Count("jcms_module_" + _channeltype);
         return JumboTCMS.Utils.Int.PageCount(_totalcount, _pagesize);
     }
 }
Пример #10
0
 /// <summary>
 /// 新增订单信息
 /// </summary>
 /// <param name="_uid"></param>
 /// <param name="_truename"></param>
 /// <param name="_address"></param>
 /// <param name="_zipcode"></param>
 /// <param name="_mobiletel"></param>
 /// <returns></returns>
 public bool NewOrder(string _uid, string _truename, string _address, string _zipcode, string _mobiletel)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _ordernum = GetProductOrderNum();//订单号
         int page = 1;
         int PSize = 1000;
         int countNum = 0;
         string sqlStr = "";
         string joinStr = "A.[ProductId]=B.Id";
         string whereStr1 = "A.State=0 AND A.UserId=" + _uid;
         string whereStr2 = "State=0 AND UserId=" + _uid;
         _doh.Reset();
         _doh.ConditionExpress = whereStr2;
         countNum = _doh.Count("jcms_normal_user_cart");
         sqlStr = JumboTCMS.Utils.SqlHelp.GetSql("A.*,b.points as unitprice,(b.points*a.buycount) as totalprice,b.id as productid,b.title as productname,b.img as productimg", "jcms_normal_user_cart", "jcms_module_product", "Id", PSize, page, "desc", joinStr, whereStr1, whereStr2);
         _doh.Reset();
         _doh.SqlCmd = sqlStr;
         DataTable dt = _doh.GetDataTable();
         if (dt.Rows.Count == 0)
             return false;
         float _money = 0;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             JumboTCMS.Entity.Normal_UserGoods _goods = new JumboTCMS.Entity.Normal_UserGoods();
             _goods.UserId = Str2Int(_uid);
             _goods.OrderNum = _ordernum;
             _goods.ProductId = Str2Int(dt.Rows[i]["ProductId"].ToString());
             _goods.ProductName = dt.Rows[i]["ProductName"].ToString();
             _goods.ProductImg = dt.Rows[i]["ProductImg"].ToString();
             _goods.ProductLink = dt.Rows[i]["ProductLink"].ToString();
             _goods.UnitPrice = Convert.ToSingle(dt.Rows[i]["UnitPrice"].ToString());
             _goods.BuyCount = Str2Int(dt.Rows[i]["BuyCount"].ToString());
             _goods.TotalPrice = Convert.ToSingle(dt.Rows[i]["TotalPrice"].ToString());
             new JumboTCMS.DAL.Normal_UserGoodsDAL().NewGoods(_goods);
             _money += _goods.TotalPrice;
         }
         dt.Clear();
         dt.Dispose();
         _doh.Reset();
         _doh.AddFieldItem("UserId", _uid);
         _doh.AddFieldItem("OrderNum", _ordernum);
         _doh.AddFieldItem("TrueName", _truename);
         _doh.AddFieldItem("Address", _address);
         _doh.AddFieldItem("ZipCode", _zipcode);
         _doh.AddFieldItem("MobileTel", _mobiletel);
         _doh.AddFieldItem("Money", _money);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("OrderTime", DateTime.Now.ToString());
         _doh.AddFieldItem("OrderIP", IPHelp.ClientIP);
         _doh.Insert("jcms_normal_user_order");
         _doh.Reset();
         _doh.SqlCmd = string.Format("UPDATE [jcms_normal_user_cart] SET [State]=1 WHERE UserId={0}", _uid);
         _doh.ExecuteSqlNonQuery();
         return true;
     }
 }
Пример #11
0
 public DataTable GetUserList(int _thispage, int _pagesize, string _wherestr)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = _wherestr;
         string sqlStr = "";
         int _countnum = _doh.Count("jcms_normal_user");
         sqlStr = JumboTCMS.Utils.SqlHelp.GetSql("[ID],[UserName],[GUID]", "jcms_normal_user", "Id", _pagesize, _thispage, "desc", _wherestr);
         _doh.Reset();
         _doh.SqlCmd = sqlStr;
         DataTable dt = _doh.GetDataTable();
         return dt;
     }
 }