当前位置: 首页>>代码示例>>C#>>正文


C# Common.AddFieldItems方法代码示例

本文整理汇总了C#中JumboTCMS.DAL.Common.AddFieldItems方法的典型用法代码示例。如果您正苦于以下问题:C# Common.AddFieldItems方法的具体用法?C# Common.AddFieldItems怎么用?C# Common.AddFieldItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JumboTCMS.DAL.Common的用法示例。


在下文中一共展示了Common.AddFieldItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Register

 public int Register(string _username, string _nickname, string _userpass, bool isMD5Passwd, int _sex, string _email, string _birthday, string _usersign, string _adminname, string _adminpass, string _oauth_code, string _oauth_token)
 {
     if (_oauth_code == "") _oauth_code = "tencent";
     if (Exists(string.Format("username='{0}'", _username)))
         return 0;
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _md5pass = isMD5Passwd ? _userpass : JumboTCMS.Utils.MD5.Lower32(_userpass);
         string _md5pass2 = isMD5Passwd ? _adminpass : JumboTCMS.Utils.MD5.Lower32(_adminpass);
         int dPoints = Str2Int(JumboTCMS.Utils.XmlCOM.ReadConfig("~/_data/config/site", "DefaultPoints"), 0);
         int uState = site.CheckReg ? 0 : 1;
         object[,] addFields = new object[2, 19] {
                 {
                     "UserName", "NickName", "UserPass", "Sex", "Email", "Birthday",
                     "Group", "Points", "Login", "State", "AdminId", "Setting", "UserSign",
                     "AdminState", "IsVIP", "Integral","RegTime", "RegIp","Token_"+_oauth_code},
                 {
                     _username, _nickname, _md5pass, _sex,_email, _birthday,
                     1, dPoints, 0, uState,0, ",,", _usersign,
                     0,0, 0, DateTime.Now.ToString(),IPHelp.ClientIP,_oauth_token}
                 };
         _doh.Reset();
         _doh.AddFieldItems(addFields);
         int _uID = _doh.Insert("jcms_normal_user");
         #region 复制头像
         JumboTCMS.Utils.DirFile.CopyFile("~/_data/avatar/0_l.jpg", "~/_data/avatar/" + _uID + "_l.jpg", true);
         JumboTCMS.Utils.DirFile.CopyFile("~/_data/avatar/0_m.jpg", "~/_data/avatar/" + _uID + "_m.jpg", true);
         JumboTCMS.Utils.DirFile.CopyFile("~/_data/avatar/0_s.jpg", "~/_data/avatar/" + _uID + "_s.jpg", true);
         #endregion
         #region 同步升级为管理员
         if (_adminname.Length > 0 && _adminpass.Length > 0)
         {
             _doh.Reset();
             _doh.ConditionExpress = "id=" + _uID;
             _doh.AddFieldItem("State", 1);
             _doh.AddFieldItem("AdminState", 1);
             _doh.AddFieldItem("AdminId", _uID);
             _doh.AddFieldItem("AdminName", _adminname);
             _doh.AddFieldItem("AdminPass", _md5pass2);
             _doh.AddFieldItem("Group", site.AdminGroupId);
             _doh.Update("jcms_normal_user");
             _doh.Reset();
             _doh.ConditionExpress = "id=" + site.AdminGroupId;
             _doh.Add("jcms_normal_usergroup", "UserTotal");
         }
         else
         {
             _doh.Reset();
             _doh.ConditionExpress = "id=1";
             _doh.Add("jcms_normal_usergroup", "UserTotal");
         }
         #endregion
         #region 论坛同步注册
         if (site.ForumAPIKey != "")
         {
             string _ForumAutoRegister = JumboTCMS.Utils.XmlCOM.ReadConfig("~/_data/config/site", "ForumAutoRegister");
             if (_ForumAutoRegister == "true")//表示自动注册论坛用户
             {
                 JumboTCMS.API.Discuz.Toolkit.DiscuzSession ds = JumboTCMS.API.Discuz.DiscuzSessionHelper.GetSession();
                 int _userid = ds.Register(_username, _userpass, _email, isMD5Passwd);
                 if (_userid > 0)
                 {
                     //注册成功
                     _doh.Reset();
                     _doh.ConditionExpress = "id=" + _uID;
                     _doh.AddFieldItem("ForumName", _username);
                     _doh.AddFieldItem("ForumPass", _md5pass);
                     _doh.Update("jcms_normal_user");
                     return _uID;
                 }
                 return 0;
             }
             return _uID;
         }
         #endregion
         return _uID;
     }
 }
开发者ID:WZDotCMS,项目名称:WZDotCMS,代码行数:78,代码来源:UserDAL.cs


注:本文中的JumboTCMS.DAL.Common.AddFieldItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。