本文整理汇总了C#中JumboTCMS.DAL.Common类的典型用法代码示例。如果您正苦于以下问题:C# Common类的具体用法?C# Common怎么用?C# Common使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Common类属于JumboTCMS.DAL命名空间,在下文中一共展示了Common类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTopList
/// <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: BatchOper
/// <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 = "[email protected]";
_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 = "[email protected]";
_doh.AddConditionParameter("@id", idValue[i]);
_doh.AddFieldItem("Enabled", 0);
_doh.Update("jcms_normal_user_oauth");
}
}
}
return true;
}
示例3: PlacardList
/// <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;
}
}
示例4: CreateContent
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));
}
}
}
}
示例5: GetContent
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);
}
}
示例6: CreateContent
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));
}
}
}
}
示例7: BindData2Entity
/// <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);
}
}
}
示例8: GetVote
/// <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;
}
}
示例9: GetDigg
/// <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 = "[email protected] and [email protected]";
_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 = "[email protected] and [email protected]";
_doh.AddConditionParameter("@channeltype", _channeltype);
_doh.AddConditionParameter("@contentid", _contentid);
digg.DiggNum = Str2Int(_doh.GetField("jcms_normal_digg", "DiggNum").ToString());
return digg;
}
}
示例10: LinkList
/// <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;
}
}
示例11: AddVIPYears
/// <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");
}
}
示例12: QQOnlineList
/// <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;
}
}
示例13: CountGoods
/// <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");
}
}
示例14: GetOrderMoney
/// <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());
}
}
示例15: AddPoints
/// <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);
}
}