本文整理汇总了C#中JumboTCMS.DAL.Common.GetFields方法的典型用法代码示例。如果您正苦于以下问题:C# Common.GetFields方法的具体用法?C# Common.GetFields怎么用?C# Common.GetFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JumboTCMS.DAL.Common
的用法示例。
在下文中一共展示了Common.GetFields方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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");
}
}
示例2: GetSome
/// <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");
}
}
示例3: DeleteContent
/// <summary>
/// 删除内容页
/// </summary>
/// <param name="_ChannelId"></param>
/// <param name="_ContentId"></param>
public void DeleteContent(string _ChannelId, string _ContentId)
{
JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_ChannelId);
using (DbOperHandler _doh = new Common().Doh())
{
_doh.Reset();
_doh.ConditionExpress = "[ChannelId]=" + _ChannelId + " AND [Id]=" + _ContentId;
object[] _value = _doh.GetFields("jcms_module_" + _Channel.Type, "AddDate,FirstPage");
string _date = _value[0].ToString();
string _firstpage = _value[1].ToString();
if (_firstpage.Length > 0 && _Channel.IsHtml)
{
string _folderName = String.Format("/{0}{1}/{2}",
DateTime.Parse(_date).ToString("yyyy"),
DateTime.Parse(_date).ToString("MM"),
DateTime.Parse(_date).ToString("dd")
);
if (System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(site.Dir + _Channel.Dir + _folderName)))
{
string htmFile = HttpContext.Current.Server.MapPath(Go2View(1, true, _ChannelId, _ContentId, true));
if (System.IO.File.Exists(htmFile))
System.IO.File.Delete(htmFile);
string[] htmFiles = System.IO.Directory.GetFiles(HttpContext.Current.Server.MapPath(site.Dir + _Channel.Dir + _folderName), _ContentId + "_*" + site.StaticExt);
foreach (string fileName in htmFiles)
{
if (System.IO.File.Exists(fileName))
System.IO.File.Delete(fileName);
}
}
_doh.Reset();
_doh.SqlCmd = "UPDATE [jcms_module_" + _Channel.Type + "] SET [FirstPage]='' WHERE [ChannelId]=" + _ChannelId + " AND [Id]=" + _ContentId;
_doh.ExecuteSqlNonQuery();
}
}
}
示例4: DeleteByID
/// <summary>
/// 删除一个插件
/// </summary>
/// <param name="_id"></param>
/// <param name="_err">返回错误信息</param>
/// <returns></returns>
public bool DeleteByID(string _id, ref string _err)
{
using (DbOperHandler _doh = new Common().Doh())
{
if (_id != "" && _id != "0")
{
_doh.Reset();
_doh.ConditionExpress = "[email protected]";
_doh.AddConditionParameter("@id", _id);
object[] _values = _doh.GetFields("jcms_normal_extends", "Name,Locked,Enabled,BaseTable");
string eName = _values[0].ToString();
string eLocked = _values[1].ToString();
string eEnabled = _values[2].ToString();
string _delTables = _values[3].ToString();
if (eLocked == "1")
{
_err = "锁定的插件不可删";
return false;
}
if (eEnabled == "1")
{
_err = "先把插件禁用再卸载";
return false;
}
if (_delTables.Trim().Length > 0)//需要删除插件表
{
string[] _delTable = _delTables.Split(',');
for (int i = 0; i < _delTable.Length; i++)
{
_doh.Reset();
_doh.DropTable(_delTable[i]);
}
}
//删除插件整个目录
JumboTCMS.Utils.DirFile.DeleteDir(site.Dir + "extends/" + eName + "/");
_doh.Reset();
_doh.ConditionExpress = "[email protected]";
_doh.AddConditionParameter("@id", _id);
_doh.Delete("jcms_normal_extends");
}
else
{
_err = "参数错误";
return false;
}
return true;
}
}
示例5: ChkUserLogin
/// <summary>
/// 会员登录
/// </summary>
/// <param name="_username"></param>
/// <param name="_userpass"></param>
/// <param name="iExpires"></param>
/// <param name="isMD5Passwd"></param>
/// <returns></returns>
public string ChkUserLogin(string _username, string _userpass, int iExpires, bool isMD5Passwd)
{
if (!isMD5Passwd)
_userpass = JumboTCMS.Utils.MD5.Lower32(_userpass);
using (DbOperHandler _doh = new Common().Doh())
{
_username = _username.Replace("\'", "");
_doh.Reset();
_doh.ConditionExpress = "[email protected]";
_doh.AddConditionParameter("@username", _username);
string _userid = _doh.GetField("jcms_normal_user", "id").ToString();
if (_userid != "")
{
JumboTCMS.Entity.Normal_User _User = new JumboTCMS.DAL.Normal_UserDAL().GetEntity(_userid);
if (_User.UserPass != _userpass)
{
return "密码错误";
}
if (_User.State != 1)
{
return "帐号被锁定";
}
_doh.Reset();
_doh.SqlCmd = "SELECT [id],[GroupName],[IsLogin],[Setting] FROM [jcms_normal_usergroup] WHERE [Id]=" + _User.Group;
DataTable dtUserGroup = _doh.GetDataTable();
if (dtUserGroup.Rows.Count == 0)
{
return "用户组有误";
}
if (dtUserGroup.Rows[0]["IsLogin"].ToString() != "1")
{
return "帐号禁止登录";
}
string _userGroupid = dtUserGroup.Rows[0]["Id"].ToString();
string _userGroupname = dtUserGroup.Rows[0]["GroupName"].ToString();
string _userSetting = dtUserGroup.Rows[0]["Setting"].ToString();
dtUserGroup.Clear();
dtUserGroup.Dispose();
string _userCookies = "c" + (new Random().Next(10000000, 99999999)).ToString();
//设置Cookies
System.Collections.Specialized.NameValueCollection myCol = new System.Collections.Specialized.NameValueCollection();
myCol.Add("id", _userid);
myCol.Add("name", _User.UserName);
myCol.Add("nickname", _User.NickName);
myCol.Add("password", _User.UserPass);
myCol.Add("email", _User.Email);
myCol.Add("groupid", _userGroupid);
myCol.Add("groupname", _userGroupname);
myCol.Add("setting", _userSetting);
myCol.Add("cookies", _userCookies);
JumboTCMS.Utils.Cookie.SetObj(site.CookiePrev + "user", 60 * 60 * 24 * iExpires, myCol, site.CookieDomain, site.CookiePath);
//更新User登陆信息
_doh.Reset();
_doh.ConditionExpress = "[email protected] and state=1";
_doh.AddConditionParameter("@id", _userid);
_doh.AddFieldItem("Cookies", _userCookies);
_doh.AddFieldItem("LastTime", DateTime.Now.ToString());
_doh.AddFieldItem("LastIP", IPHelp.ClientIP);
_doh.AddFieldItem("UserSign", "");
_doh.Update("jcms_normal_user");
if (site.ForumAPIKey != "")
{
bool _AutoLogining = false;
string _ForumAutoRegister = JumboTCMS.Utils.XmlCOM.ReadConfig("~/_data/config/site", "ForumAutoRegister");
if (_ForumAutoRegister == "true")//表示自动注册论坛用户
_AutoLogining = true;
if (_AutoLogining == true)
{
//登陆社区
_doh.Reset();
_doh.ConditionExpress = "[email protected] and state=1";
_doh.AddConditionParameter("@id", _userid);
object[] _forumInfo = _doh.GetFields("jcms_normal_user", "ForumName,ForumPass");
if (_forumInfo[0].ToString().Length > 0 && _forumInfo[1].ToString().Length > 0)
{
JumboTCMS.API.Discuz.Toolkit.DiscuzSession ds = JumboTCMS.API.Discuz.DiscuzSessionHelper.GetSession();
ds.Login(ds.GetUserID(_forumInfo[0].ToString()), _forumInfo[1].ToString(), true, iExpires, site.CookieDomain);
}
}
}
return "ok";
}
else
{
return "帐号不存在";
}
}
}