Esempio n. 1
0
        /// <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;
            }
        }
Esempio n. 2
0
 /// <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());
     }
 }
Esempio n. 3
0
 /// <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());
     }
 }
Esempio n. 4
0
 /// <summary>
 /// 在线支付成功,给会员充博币
 /// </summary>
 /// <param name="_uid"></param>
 /// <param name="_ordernum"></param>
 /// <param name="_payway">如:支付宝、财付通等</param>
 /// <returns></returns>
 public bool UpdateOrder(string _uid, string _ordernum, string _payway)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "OrderNum='" + _ordernum + "' and state=0 and userid=" + _uid;
         int _points = Str2Int(_doh.GetField("jcms_normal_recharge", "Points").ToString());
         if (_points > 0)//充值的博币
         {
             new Normal_UserDAL().AddPoints(_uid, _points);
             _doh.Reset();
             _doh.ConditionExpress = "OrderNum='" + _ordernum + "' and state=0 and userid=" + _uid;
             _doh.AddFieldItem("State", 1);
             _doh.AddFieldItem("PaymentWay", _payway);
             _doh.Update("jcms_normal_recharge");
             return true;
         }
         else
         {
             return false;
         }
     }
 }
Esempio n. 5
0
        /// <summary>
        /// 移动
        /// </summary>
        /// <param name="_id"></param>
        /// <param name="_isup">true代表向上移动</param>
        /// <param name="_response"></param>
        /// <returns></returns>
        public bool Move(string _id, bool _isup, ref string _response)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                if (_id == "0")
                {
                    _response = "ID错误";
                    return false;
                }
                _doh.Reset();
                _doh.ConditionExpress = "id=@id";
                _doh.AddConditionParameter("@id", _id);
                string pId = _doh.GetField("jcms_normal_user_oauth", "pId").ToString();

                string temp;
                _doh.Reset();
                if (_isup)
                {
                    _doh.ConditionExpress = "pId<@pId ORDER BY pId desc";
                    _doh.AddConditionParameter("@pId", pId);
                }
                else
                {
                    _doh.ConditionExpress = "pId>@pId ORDER BY pId";
                    _doh.AddConditionParameter("@pId", pId);
                }
                temp = _doh.GetField("jcms_normal_user_oauth", "pId").ToString();
                if (temp == "")
                {
                    _response = "无须移动";
                    return false;
                }
                else
                {
                    _doh.Reset();
                    _doh.ConditionExpress = "pId=@pId";
                    _doh.AddConditionParameter("@pId", temp);
                    _doh.AddFieldItem("pId", "-100000");
                    _doh.Update("jcms_normal_user_oauth");
                    _doh.Reset();
                    _doh.ConditionExpress = "id=@id";
                    _doh.AddConditionParameter("@id", _id);
                    _doh.AddFieldItem("pId", temp);
                    _doh.Update("jcms_normal_user_oauth");
                    _doh.Reset();
                    _doh.ConditionExpress = "pId=@pId";
                    _doh.AddConditionParameter("@pId", "-100000");
                    _doh.AddFieldItem("pId", pId);
                    _doh.Update("jcms_normal_user_oauth");

                }
                return true;
            }
        }
Esempio n. 6
0
 private void p__GetChannel_Soft(TemplateEngineDAL te, DataTable dt, ref string PageStr, ref System.Collections.ArrayList ContentList, int i)
 {
     string TempId, ClassName;
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "IsOut=0 AND id=" + dt.Rows[i]["ClassId"].ToString();
         TempId = _doh.GetField("jcms_normal_class", "ContentTemp").ToString();
         ClassName = _doh.GetField("jcms_normal_class", "Title").ToString();
     }
     string pId = string.Empty;
     //得到模板方案组ID/主题ID/模板内容
     new JumboTCMS.DAL.Normal_TemplateDAL().GetTemplateContent(TempId, ref pId, ref PageStr);
     te.PageNav = "<script type=\"text/javascript\" src=\"" + site.Dir + te.MainChannel.Dir + "/js/classnav_" + dt.Rows[i]["ClassId"].ToString() + ".js\"></script>";
     if (te.MainChannel.IsTop)
         te.PageTitle = dt.Rows[i]["Title"] + "_" + ClassName + "_" + te.MainChannel.Title + "_" + site.Name + site.TitleTail;
     else
         te.PageTitle = dt.Rows[i]["Title"] + "_" + ClassName + "_" + site.Name + site.TitleTail;
     te.PageKeywords = JumboTCMS.Utils.WordSpliter.GetKeyword(dt.Rows[i]["Title"].ToString()) + "," + site.Keywords;
     te.PageDescription = JumboTCMS.Utils.Strings.SimpleLineSummary(dt.Rows[i]["Summary"].ToString());
     te.ReplacePublicTag(ref PageStr);
     te.ReplaceChannelTag(ref PageStr, dt.Rows[i]["ChannelId"].ToString());
     te.ReplaceChannelClassLoopTag(ref PageStr);
     te.ReplaceClassTag(ref PageStr, dt.Rows[i]["ClassId"].ToString());
     //te.ReplaceContentLoopTag(ref PageStr);
 }
Esempio n. 7
0
 /// <summary>
 /// 判断内容阅读权限(频道ID只能从外部传入,不支持跨频道)
 /// 假设内容ID和栏目ID都已经正确
 /// </summary>
 /// <param name="_contentid"></param>
 /// <param name="_classid"></param>
 /// <returns></returns>
 public bool CanReadContent(string _contentid, string _classid)
 {
     if (Cookie.GetValue(site.CookiePrev + "admin") != null)//管理员直接可以看
         return true;
     int _usergroup = 0;
     if (Cookie.GetValue(site.CookiePrev + "user") != null)
         _usergroup = Str2Int(Cookie.GetValue(site.CookiePrev + "user", "groupid"));
     int _ContentReadGroup, _ClassReadGroup;
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "id=" + _contentid;
         _ContentReadGroup = Str2Int(_doh.GetField("jcms_module_" + this.MainChannel.Type, "ReadGroup").ToString());
         _doh.Reset();
         _doh.ConditionExpress = "id=" + _classid;
         _ClassReadGroup = Str2Int(_doh.GetField("jcms_normal_class", "ReadGroup").ToString());
     }
     if (_ContentReadGroup > -1)//说明不是继承栏目
     {
         if (_ContentReadGroup > _usergroup)
             return false;
         else
             return true;
     }
     else
     {
         if (_ClassReadGroup > _usergroup)
             return false;
         else
             return true;
     }
 }
Esempio n. 8
0
 /// <summary>
 /// 获得栏目名称
 /// </summary>
 /// <param name="_id"></param>
 /// <returns></returns>
 public string GetClassName(string _id)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "id=" + _id;
         string _classname = _doh.GetField("jcms_normal_class", "Title").ToString();
         return _classname;
     }
 }
Esempio n. 9
0
        /// <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 = "username=@username";
                _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 = "id=@id 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 = "id=@id 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 "帐号不存在";
                }

            }
        }
Esempio n. 10
0
 /// <summary>
 /// 修改指定用户的密码
 /// </summary>
 /// <param name="_userid"></param>
 /// <param name="_originalPassword">原始密码</param>
 /// <param name="_newPassword">新密码</param>
 /// <returns></returns>
 public bool ChangeUserPassword(string _userid, string _originalPassword, string _newPassword)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "id=@id and state=1";
         _doh.AddConditionParameter("@id", _userid);
         object pass = _doh.GetField("jcms_normal_user", "UserPass");
         if (pass != null)//用户存在
         {
             if (pass.ToString().ToLower() == JumboTCMS.Utils.MD5.Lower32(_originalPassword) || pass.ToString().ToLower() == JumboTCMS.Utils.MD5.Lower16(_originalPassword)) //验证旧密码
             {
                 _doh.Reset();
                 _doh.ConditionExpress = "id=@id and state=1";
                 _doh.AddConditionParameter("@id", _userid);
                 _doh.AddFieldItem("UserPass", JumboTCMS.Utils.MD5.Lower32(_newPassword));
                 _doh.Update("jcms_normal_user");
                 return true;
             }
             else
                 return false;
         }
         else
             return false;
     }
 }