public override void CreateContent(string _ChannelId, string _ContentId, int _CurrentPage) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.SqlCmd = "SELECT [PhotoUrl],[FirstPage] FROM [jcms_module_photo] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId; DataTable dtContent = _doh.GetDataTable(); //图片地址分割处理 string PhotoUrl = dtContent.Rows[0]["PhotoUrl"].ToString().Replace("\r\n", "\r"); string ContentFirstPage = dtContent.Rows[0]["FirstPage"].ToString(); dtContent.Clear(); dtContent.Dispose(); if (PhotoUrl != "") { string[] PhotoUrlArr = PhotoUrl.Split(new string[] { "\r" }, StringSplitOptions.RemoveEmptyEntries); int pageCount = PhotoUrlArr.Length; if (ContentFirstPage.Length == 0) { _doh.Reset(); _doh.SqlCmd = "UPDATE [jcms_module_photo] SET [FirstPage]='" + Go2View(1, true, _ChannelId, _ContentId, false) + "' WHERE [ChannelId]=" + _ChannelId + " and [IsPass]=1 and [Id]=" + _ContentId; _doh.ExecuteSqlNonQuery(); } for (int j = 1; j < (pageCount + 1); j++) { JumboTCMS.Utils.DirFile.SaveFile(GetContent(_ChannelId, _ContentId, j), Go2View(j, true, _ChannelId, _ContentId, true)); } } } }
public virtual void CreateContent(string _ChannelId, string _ContentId, int _CurrentPage) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.SqlCmd = "SELECT [Content],[FirstPage] FROM [jcms_module_article] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId; DataTable dtContent = _doh.GetDataTable(); string ArticleContent = dtContent.Rows[0]["Content"].ToString(); string ContentFirstPage = dtContent.Rows[0]["FirstPage"].ToString(); dtContent.Clear(); dtContent.Dispose(); if (ArticleContent != "") { int pageCount = 1; //处理文章内容分页 if (ArticleContent.Contains("[Jumbot_PageBreak]")) { string[] ContentArr = ArticleContent.Split(new string[] { "[Jumbot_PageBreak]" }, StringSplitOptions.RemoveEmptyEntries); pageCount = ContentArr.Length; } if (ContentFirstPage.Length == 0) { _doh.Reset(); _doh.SqlCmd = "UPDATE [jcms_module_article] SET [FirstPage]='" + Go2View(1, true, _ChannelId, _ContentId, false) + "' WHERE [ChannelId]=" + _ChannelId + " and [IsPass]=1 and [Id]=" + _ContentId; _doh.ExecuteSqlNonQuery(); } for (int j = 1; j < (pageCount + 1); j++) { JumboTCMS.Utils.DirFile.SaveFile(GetContent(_ChannelId, _ContentId, j), Go2View(j, true, _ChannelId, _ContentId, true)); } } } }
/// <summary> /// 得到内容 /// </summary> /// <param name="_channeltype"></param> /// <param name="_contentid"></param> /// <returns></returns> public Normal_Digg GetDigg(string _channeltype, string _contentid) { using (DbOperHandler _doh = new Common().Doh()) { Normal_Digg digg = new Normal_Digg(); digg.ChannelType = _channeltype; digg.ContentId = Str2Int(_contentid); _doh.Reset(); _doh.ConditionExpress = "channeltype=@channeltype and contentid=@contentid"; _doh.AddConditionParameter("@channeltype", _channeltype); _doh.AddConditionParameter("@contentid", _contentid); if (!_doh.Exist("jcms_normal_digg")) { _doh.Reset(); _doh.AddFieldItem("ChannelType", _channeltype); _doh.AddFieldItem("ContentId", _contentid); _doh.AddFieldItem("DiggNum", 0); _doh.Insert("jcms_normal_digg"); } _doh.Reset(); _doh.ConditionExpress = "channeltype=@channeltype and contentid=@contentid"; _doh.AddConditionParameter("@channeltype", _channeltype); _doh.AddConditionParameter("@contentid", _contentid); digg.DiggNum = Str2Int(_doh.GetField("jcms_normal_digg", "DiggNum").ToString()); return digg; } }
/// <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; } }
/// <summary> /// 续费VIP /// </summary> /// <param name="_id">用户ID</param> /// <param name="_vipyears">续的年数</param> public void AddVIPYears(string _id, int _vipyears) { using (DbOperHandler _doh = new Common().Doh()) { DateTime LimitDate = DateTime.Now; _doh.Reset(); _doh.ConditionExpress = "id=" + _id; object[] values = _doh.GetFields("jcms_normal_user", "IsVIP,VIPTime"); bool _isvip = (JumboTCMS.Utils.Validator.StrToInt(values[0].ToString(), 0) == 1); if (!_isvip)//如果还不是VIP LimitDate = DateTime.Now.AddYears(_vipyears); else { if (JumboTCMS.Utils.Validator.ValidDate(values[1].ToString()))//如果已经过期 LimitDate = DateTime.Now.AddYears(_vipyears); else LimitDate = DateTime.Parse(values[1].ToString()).AddYears(_vipyears); } _doh.Reset(); _doh.ConditionExpress = "id=" + _id; _doh.AddFieldItem("IsVIP", 1); _doh.AddFieldItem("VIPTime", LimitDate); _doh.Update("jcms_normal_user"); } }
/// <summary> /// 批量操作插件 /// </summary> /// <param name="_act">行为</param> /// <param name="_ids">id,以,隔开</param> public bool BatchOper(string _act, string _ids) { using (DbOperHandler _doh = new Common().Doh()) { string[] idValue; idValue = _ids.Split(','); if (_act == "pass") { for (int i = 0; i < idValue.Length; i++) { _doh.Reset(); _doh.ConditionExpress = "id=@id"; _doh.AddConditionParameter("@id", idValue[i]); _doh.AddFieldItem("Enabled", 1); _doh.Update("jcms_normal_user_oauth"); } } else if (_act == "nopass") { for (int i = 0; i < idValue.Length; i++) { _doh.Reset(); _doh.ConditionExpress = "id=@id"; _doh.AddConditionParameter("@id", idValue[i]); _doh.AddFieldItem("Enabled", 0); _doh.Update("jcms_normal_user_oauth"); } } } return true; }
/// <summary> /// 批量操作插件 /// </summary> /// <param name="_act">行为</param> /// <param name="_ids">id,以,隔开</param> public bool BatchOper(string _act, string _ids) { using (DbOperHandler _doh = new Common().Doh()) { string[] idValue; idValue = _ids.Split(','); if (_act == "pass") { for (int i = 0; i < idValue.Length; i++) { _doh.Reset(); _doh.ConditionExpress = "id=@id"; _doh.AddConditionParameter("@id", idValue[i]); _doh.AddFieldItem("Enabled", 1); _doh.Update("jcms_normal_extends"); } } else if (_act == "nopass") { for (int i = 0; i < idValue.Length; i++) { _doh.Reset(); _doh.ConditionExpress = "id=@id"; _doh.AddConditionParameter("@id", idValue[i]); _doh.AddFieldItem("Enabled", 0); _doh.Update("jcms_normal_extends"); } } string TempStr = ""; _doh.Reset(); _doh.SqlCmd = JumboTCMS.Utils.SqlHelp.GetSql("[Title],[Name],[Type],[Enabled]", "jcms_normal_extends", "pId", 100, 1, "desc", ""); DataTable dt = _doh.GetDataTable(); for (int i = 0; i < dt.Rows.Count; i++) { if(dt.Rows[i]["Enabled"].ToString() =="1") TempStr += "\r\nvar Plugin" + dt.Rows[i]["Name"].ToString() + " = true;//" + dt.Rows[i]["Title"].ToString() + "插件"; else TempStr += "\r\nvar Plugin" + dt.Rows[i]["Name"].ToString() + " = false;//" + dt.Rows[i]["Title"].ToString() + "插件"; } string _globalJS = JumboTCMS.Utils.DirFile.ReadFile("~/_data/jcmsV5.js"); string _strBegin = "//<!--插件开关begin"; string _strEnd = "//-->插件开关end"; System.Collections.ArrayList TagArray = JumboTCMS.Utils.Strings.GetHtmls(_globalJS, _strBegin, _strEnd, true, true); if (TagArray.Count > 0)//标签存在 { _globalJS = _globalJS.Replace(TagArray[0].ToString(), _strBegin + "\r\n\r\n" + TempStr + "\r\n\r\n" + _strEnd); } JumboTCMS.Utils.DirFile.SaveFile(_globalJS, "~/_data/jcmsV5.js"); } return true; }
/// <summary> /// 得到列表 /// </summary> public Extends_Vote GetVote() { using (DbOperHandler _doh = new Common().Doh()) { Extends_Vote vote = new Extends_Vote(); _doh.Reset(); _doh.SqlCmd = "SELECT TOP 1 [Id],[Title],[VoteText],[VoteNum],[VoteTotal],[Type] FROM [jcms_extends_vote] WHERE [Lock]=0 ORDER BY Id Desc"; DataTable dtVote = _doh.GetDataTable(); if (dtVote.Rows.Count > 0) { vote.Id = dtVote.Rows[0]["Id"].ToString(); vote.Title = dtVote.Rows[0]["Title"].ToString(); vote.VoteTotal = Str2Int(dtVote.Rows[0]["VoteTotal"].ToString()); string[] itemtext = dtVote.Rows[0]["VoteText"].ToString().Split('|'); string[] itemclicks = dtVote.Rows[0]["VoteNum"].ToString().Split('|'); List<Extends_VoteItem> voteitems = new List<Extends_VoteItem>(); for (int i = 0; i < itemtext.Length; i++) { voteitems.Add(new Extends_VoteItem(itemtext[i], Str2Int(itemclicks[i]))); } vote.Item = voteitems; vote.Type = Str2Int(dtVote.Rows[0]["Type"].ToString()); } else vote.Id = "0"; dtVote.Clear(); dtVote.Dispose(); return vote; } }
/// <summary> /// 得到列表 /// </summary> public List<Normal_Link> LinkList() { using (DbOperHandler _doh = new Common().Doh()) { List<Normal_Link> links; links = new List<Normal_Link>(); _doh.Reset(); _doh.SqlCmd = "SELECT [Id],[Title],[Url],[ImgPath],[Info],[Style] FROM [jcms_normal_link] WHERE [State]=1 ORDER BY Style Desc,OrderNum Desc,Id Desc"; DataTable dtLink = _doh.GetDataTable(); if (dtLink.Rows.Count > 0) { for (int i = 0; i < dtLink.Rows.Count; i++) { links.Add(new Normal_Link(dtLink.Rows[i]["Id"].ToString(), dtLink.Rows[i]["Title"].ToString(), dtLink.Rows[i]["Url"].ToString(), dtLink.Rows[i]["ImgPath"].ToString(), dtLink.Rows[i]["Info"].ToString(), Str2Int(dtLink.Rows[i]["Style"].ToString()) )); } } dtLink.Clear(); dtLink.Dispose(); return links; } }
public override string GetContent(string _ChannelId, string _ContentId, int _CurrentPage) { using (DbOperHandler _doh = new Common().Doh()) { JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_ChannelId); if (_Channel.Enabled == false) { return "频道错误"; } _doh.Reset(); _doh.SqlCmd = "SELECT [ClassId] FROM [jcms_module_photo] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId; DataTable dtSearch = _doh.GetDataTable(); if (dtSearch.Rows.Count == 0) { dtSearch.Clear(); dtSearch.Dispose(); return "内容错误"; } string ClassId = dtSearch.Rows[0]["ClassId"].ToString(); dtSearch.Clear(); dtSearch.Dispose(); TemplateEngineDAL te = new TemplateEngineDAL(_ChannelId); _doh.Reset(); _doh.SqlCmd = "SELECT Id FROM [jcms_normal_class] WHERE [IsOut]=0 AND [ChannelId]=" + _ChannelId + " and [Id]=" + ClassId; if (_doh.GetDataTable().Rows.Count == 0) { return "栏目错误"; } string PageStr = string.Empty; _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [jcms_module_photo] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId; DataTable dtContent = _doh.GetDataTable(); string _FirstPage = dtContent.Rows[0]["FirstPage"].ToString(); System.Collections.ArrayList ContentList = new System.Collections.ArrayList(); p__GetChannel_Photo(te, dtContent, ref PageStr, ref ContentList, 0); te.ReplaceContentTag(ref PageStr, _ContentId); te.ReplaceContentLoopTag(ref PageStr);//主要解决通过tags关联 te.ExcuteLastHTML(ref PageStr); ContentList.Add(PageStr); p__replaceSinglePhoto(dtContent, ref _CurrentPage, ref PageStr, ref ContentList); int _TotalPage = Convert.ToInt16(ContentList[1].ToString());//总页数 dtContent.Clear(); dtContent.Dispose(); string _PrevLink = _CurrentPage == 1 ? "#" : Go2View(_CurrentPage - 1, (_Channel.IsHtml), _ChannelId, _ContentId, false); string _NextLink = _CurrentPage == _TotalPage ? "#" : Go2View(_CurrentPage + 1, (_Channel.IsHtml), _ChannelId, _ContentId, false); string _html = ContentList[0].ToString(); string[] ThisPhotoUrl = ContentList[2].ToString().Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries); string CurrentPhotoUrl = ThisPhotoUrl[ThisPhotoUrl.Length - 1]; string CurrentPhotoTitle = ThisPhotoUrl.Length == 1 ? "" : ThisPhotoUrl[0]; return _html .Replace("{$CurrentPage}", _CurrentPage.ToString()) .Replace("{$TotalPage}", ContentList[1].ToString()) .Replace("{$CurrentPhotoUrl}", CurrentPhotoUrl) .Replace("{$CurrentPhotoTitle}", CurrentPhotoTitle) .Replace("{$SlideJSON}", ContentList[3].ToString()) .Replace("{$PrevLink}", _PrevLink) .Replace("{$NextLink}", _NextLink); } }
/// <summary> /// 绑定数据到实体 /// </summary> /// <param name="_id"></param> public void BindData2Entity(string _id, JumboTCMS.Entity.Normal_Class _class) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [jcms_normal_class] WHERE [Id]=" + _id; DataTable dt = _doh.GetDataTable(); if (dt.Rows.Count > 0) { _class.Id = dt.Rows[0]["Id"].ToString(); _class.ChannelId = Validator.StrToInt(dt.Rows[0]["ChannelId"].ToString(), 0); _class.ParentId = Validator.StrToInt(dt.Rows[0]["ParentId"].ToString(), 0); _class.Title = dt.Rows[0]["Title"].ToString(); _class.Info = dt.Rows[0]["Info"].ToString(); _class.Img = dt.Rows[0]["Img"].ToString(); _class.FilePath = dt.Rows[0]["FilePath"].ToString(); _class.Code = dt.Rows[0]["Code"].ToString(); _class.IsPost = Validator.StrToInt(dt.Rows[0]["IsPost"].ToString(), 0) == 1; _class.IsTop = Validator.StrToInt(dt.Rows[0]["IsTop"].ToString(), 0) == 1; _class.TopicNum = Validator.StrToInt(dt.Rows[0]["TopicNum"].ToString(), 0); _class.TemplateId = Str2Str(dt.Rows[0]["TemplateId"].ToString()); _class.ContentTemp = Str2Str(dt.Rows[0]["ContentTemp"].ToString()); _class.PageSize = Validator.StrToInt(dt.Rows[0]["PageSize"].ToString(), 0); _class.IsOut = Validator.StrToInt(dt.Rows[0]["IsOut"].ToString(), 0) == 1; _class.FirstPage = dt.Rows[0]["FirstPage"].ToString(); _class.ReadGroup = Validator.StrToInt(dt.Rows[0]["ReadGroup"].ToString(), 0); } } }
/// <summary> /// 得到列表 /// </summary> public List<Extends_QQOnline> QQOnlineList() { using (DbOperHandler _doh = new Common().Doh()) { List<Extends_QQOnline> qqonlines; qqonlines = new List<Extends_QQOnline>(); _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [jcms_extends_qqonline] Where State=1 ORDER BY OrderNum Desc,Id Desc"; DataTable dtQQOnline = _doh.GetDataTable(); if (dtQQOnline.Rows.Count > 0) { for (int i = 0; i < dtQQOnline.Rows.Count; i++) { qqonlines.Add(new Extends_QQOnline(dtQQOnline.Rows[i]["Id"].ToString(), dtQQOnline.Rows[i]["QQID"].ToString(), dtQQOnline.Rows[i]["Title"].ToString(), dtQQOnline.Rows[i]["TColor"].ToString(), dtQQOnline.Rows[i]["face"].ToString() )); } } dtQQOnline.Clear(); dtQQOnline.Dispose(); return qqonlines; } }
/// <summary> /// 得到列表 /// </summary> public List<Extends_Placard> PlacardList() { using (DbOperHandler _doh = new Common().Doh()) { List<Extends_Placard> placards; placards = new List<Extends_Placard>(); _doh.Reset(); _doh.SqlCmd = "SELECT TOP 10 [Id],[Title],[AddTime] FROM [jcms_extends_placard] WHERE [State]=1 ORDER BY Id Desc"; DataTable dtPlacard = _doh.GetDataTable(); if (dtPlacard.Rows.Count > 0) { for (int i = 0; i < dtPlacard.Rows.Count; i++) { placards.Add(new Extends_Placard(dtPlacard.Rows[i]["Id"].ToString(), dtPlacard.Rows[i]["Title"].ToString(), "", Convert.ToDateTime(dtPlacard.Rows[i]["AddTime"].ToString()), 1 )); } } dtPlacard.Clear(); dtPlacard.Dispose(); return placards; } }
public override string GetContent(string _ChannelId, string _ContentId, int _CurrentPage) { using (DbOperHandler _doh = new Common().Doh()) { JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_ChannelId); if (_Channel.Enabled == false) { return "频道错误"; } _doh.Reset(); _doh.SqlCmd = "SELECT [ClassId] FROM [jcms_module_soft] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId; DataTable dtSearch = _doh.GetDataTable(); if (dtSearch.Rows.Count == 0) { dtSearch.Clear(); dtSearch.Dispose(); return "内容错误"; } string ClassId = dtSearch.Rows[0]["ClassId"].ToString(); dtSearch.Clear(); dtSearch.Dispose(); TemplateEngineDAL te = new TemplateEngineDAL(_ChannelId); _doh.Reset(); _doh.SqlCmd = "SELECT Id FROM [jcms_normal_class] WHERE [IsOut]=0 AND [ChannelId]=" + _ChannelId + " and [Id]=" + ClassId; if (_doh.GetDataTable().Rows.Count == 0) { return "栏目错误"; } string PageStr = string.Empty; _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [jcms_module_soft] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId; DataTable dtContent = _doh.GetDataTable(); System.Collections.ArrayList ContentList = new System.Collections.ArrayList(); p__GetChannel_Soft(te, dtContent, ref PageStr, ref ContentList, 0); te.ReplaceContentTag(ref PageStr, _ContentId); te.ReplaceContentLoopTag(ref PageStr);//主要解决通过tags关联 te.ExcuteLastHTML(ref PageStr); ContentList.Add(PageStr); p__replaceSingleSoft(dtContent, ref PageStr, ref ContentList); dtContent.Clear(); dtContent.Dispose(); return ContentList[0].ToString().Replace("{$DownUrl}", ContentList[1].ToString()); } }
/// <summary> /// 加博币 /// </summary> /// <param name="_id">用户ID</param> /// <param name="_points">博币</param> public void AddPoints(string _id, int _points) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "id=" + _id; _doh.Add("jcms_normal_user", "Points", _points); } }
/// <summary> /// 获得订单的总金额 /// </summary> /// <param name="_uid"></param> /// <param name="_ordernum"></param> /// <returns></returns> public float GetOrderMoney(string _uid, string _ordernum) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "OrderNum='" + _ordernum + "' and userid=" + _uid; return Convert.ToSingle(_doh.GetField("jcms_normal_user_order", "Money").ToString()); } }
/// <summary> /// 清空管理日志 /// </summary> public void DeleteLogs() { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "1=1"; _doh.Delete("jcms_normal_adminlogs"); } }
/// <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"); } }
/// <summary> /// 获得内容的某些属性(第一个是时间,第二个是内容页另名) /// </summary> /// <param name="_channelid">频道ID</param> /// <param name="_channeltype">频道模型</param> /// <param name="_contentid">内容ID</param> /// <returns></returns> public object[] GetSome(string _channelid, string _channeltype, string _contentid) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "ChannelId=" + _channelid + " and Id=" + _contentid; return _doh.GetFields("jcms_module_" + _channeltype, "AddDate,FirstPage,AliasPage"); } }
/// <summary> /// 获得某种商品的已有数量 /// </summary> /// <param name="_uid"></param> /// <returns></returns> public int GetGoodsCount(string _uid, string _productid) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "state=0 and UserId=" + _uid + " and ProductId=" + _productid; return Str2Int(_doh.GetField("jcms_normal_user_cart", "BuyCount").ToString()); } }
/// <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"); } }
public override void CreateContent(string _ChannelId, string _ContentId, int _CurrentPage) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.SqlCmd = "SELECT [FirstPage] FROM [jcms_module_soft] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId; DataTable dtContent = _doh.GetDataTable(); string ContentFirstPage = dtContent.Rows[0]["FirstPage"].ToString(); dtContent.Clear(); dtContent.Dispose(); if (ContentFirstPage.Length == 0) { _doh.Reset(); _doh.SqlCmd = "UPDATE [jcms_module_soft] SET [FirstPage]='" + Go2View(1, true, _ChannelId, _ContentId, false) + "' WHERE [ChannelId]=" + _ChannelId + " and [IsPass]=1 and [Id]=" + _ContentId; _doh.ExecuteSqlNonQuery(); } JumboTCMS.Utils.DirFile.SaveFile(GetContent(_ChannelId, _ContentId, 1), Go2View(1, true, _ChannelId, _ContentId, true)); } }
/// <summary> /// 删除一条数据 /// </summary> public bool DeleteByID(string _id) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "id=@id"; _doh.AddConditionParameter("@id", _id); int _del = _doh.Delete("jcms_normal_page"); return (_del == 1); } }
/// <summary> /// 增加标签点击数 /// </summary> /// <param name="_channelid"></param> /// <param name="_tagname"></param> public void AddClickTimes(string _channelid, string _tagname) { if (_tagname.Length == 0) return; using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "Title=@Title and ChannelId=" + _channelid; _doh.AddConditionParameter("@Title", _tagname); _doh.Add("jcms_normal_tag", "ClickTimes"); } }
/// <summary> /// 是否存在记录 /// </summary> /// <param name="_wherestr">条件</param> /// <returns></returns> public bool Exists(string _wherestr) { using (DbOperHandler _doh = new Common().Doh()) { int _ext = 0; _doh.Reset(); _doh.ConditionExpress = _wherestr; if (_doh.Exist("jcms_normal_page")) _ext = 1; return (_ext == 1); } }
/// <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"); } }
/// <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(); } }
/// <summary> /// 得到数据表 /// </summary> /// <param name="_channelid"></param> /// <returns></returns> public DataTable GetDataTable(string _channelid) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); if (_channelid == "0") _doh.SqlCmd = "SELECT ID,Title,iWidth,iHeight FROM [jcms_normal_thumbs] ORDER BY ChannelID,ID"; else _doh.SqlCmd = "SELECT ID,Title,iWidth,iHeight FROM [jcms_normal_thumbs] WHERE [ChannelId]=" + _channelid + " OR [ChannelId]=0 ORDER BY ChannelID,ID"; DataTable dt = _doh.GetDataTable(); return dt; } }
/// <summary> /// 保存用户日志 /// </summary> /// <param name="_uid">会员ID</param> /// <param name="_info">保存信息</param> /// <param name="_type">操作类型,1=分组移动,2=扣除博币,3=积分增加(2,3为系统操作),4=增加博币,5=VIP升级,6积分扣除(4,5,6为管理员操作)</param> public void SaveLog(string _uid, string _info, int _type) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.AddFieldItem("UserId", _uid); _doh.AddFieldItem("OperInfo", _info); _doh.AddFieldItem("OperType", _type); _doh.AddFieldItem("OperTime", DateTime.Now.ToString()); _doh.AddFieldItem("OperIP", IPHelp.ClientIP); _doh.Insert("jcms_normal_user_logs"); } }
/// <summary> /// 加为好友,如果已经存在返回false /// </summary> /// <param name="_userid">主动方ID</param> /// <param name="_username">主动方name</param> /// <param name="_friendid">被动方ID</param> /// <returns></returns> public bool AddFriend(string _userid, string _username, string _friendid) { if (Exists(_userid, _friendid)) return false;//已经存在 _username = _username == "" ? "user(id:" + _userid + ")" : _username; using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.AddFieldItem("FriendId", _friendid); _doh.AddFieldItem("UserId", _userid); _doh.AddFieldItem("AddDate", DateTime.Now.ToString()); _doh.Insert("jcms_normal_user_friends"); new JumboTCMS.DAL.Normal_UserNoticeDAL().SendNotite("加好友", "<a href=\"javascript:void(0);\" onclick=\"ShowUserPage(" + _userid + ");\">" + _username + "</a> 把你加为了好友", _friendid, "friend"); } return true; }