Esempio n. 1
0
 /// <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");
     }
 }
Esempio n. 2
0
 /// <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;
 }
Esempio n. 3
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. 4
0
 /// <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");
     }
 }
Esempio n. 5
0
 /// <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;
 }
Esempio n. 6
0
 /// <summary>
 /// 新增购物车商品信息
 /// </summary>
 /// <param name="_cart"></param>
 /// <returns></returns>
 public int NewGoods(JumboTCMS.Entity.Normal_UserCart _cart)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("UserId", _cart.UserId);
         _doh.AddFieldItem("ProductId", _cart.ProductId);
         _doh.AddFieldItem("ProductLink", _cart.ProductLink);
         _doh.AddFieldItem("BuyCount", _cart.BuyCount);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("CartTime", DateTime.Now.ToString());
         int _newid = _doh.Insert("jcms_normal_user_cart");
         return _newid;
     }
 }
Esempio n. 7
0
 /// <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;
 }
Esempio n. 8
0
 /// <summary>
 /// 发站内通知
 /// </summary>
 /// <param name="_Title">标题</param>
 /// <param name="_Content">内容</param>
 /// <param name="_ReceiveUserId">接收人ID,0表示所有人</param>
 /// <param name="_NoticeType">类型,比如:friend</param>
 public bool SendNotite(string _Title, string _Content, string _ReceiveUserId, string _NoticeType)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("Title", _Title);
         _doh.AddFieldItem("AddDate", DateTime.Now.ToString());
         _doh.AddFieldItem("Content", _Content);
         _doh.AddFieldItem("UserId", _ReceiveUserId);
         _doh.AddFieldItem("NoticeType", _NoticeType);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("ReadTime", DateTime.Now.ToString());
         _doh.Insert("jcms_normal_user_notice");
         return true;
     }
 }
Esempio n. 9
0
 /// <summary>
 ///  新增充值信息
 /// </summary>
 /// <param name="_uid"></param>
 /// <param name="_points">博币</param>
 /// <param name="_payway">如:alipay、tenpay等</param>
 /// <returns></returns>
 public string NewOrder(string _uid, int _points, string _payway)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _ordernum = GetProductOrderNum();//订单号
         _doh.Reset();
         _doh.AddFieldItem("UserId", _uid);
         _doh.AddFieldItem("OrderNum", _ordernum);
         _doh.AddFieldItem("Points", _points);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("PaymentWay", _payway);
         _doh.AddFieldItem("OrderTime", DateTime.Now.ToString());
         _doh.AddFieldItem("OrderIP", IPHelp.ClientIP);
         _doh.Insert("jcms_normal_recharge");
         return _ordernum;
     }
 }
Esempio n. 10
0
 /// <summary>
 /// 发站内短信
 /// </summary>
 /// <param name="_Title">标题</param>
 /// <param name="_Content">内容</param>
 /// <param name="_SendUserId">发送人ID</param>
 /// <param name="_ReceiveUserId">接收人ID,多个用逗号隔开</param>
 /// <param name="_ReceiveUserName">接收人用户名,多个用逗号隔开</param>
 public bool SendMessage(string _Title, string _Content, string _SendUserId, string _ReceiveUserId, string _ReceiveUserName)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string[] _uId = _ReceiveUserId.Split(',');
         string[] _uName = _ReceiveUserName.Split(',');
         for (int i = 0; i < _uId.Length; i++)
         {
             _doh.Reset();
             _doh.AddFieldItem("Title", _Title);
             _doh.AddFieldItem("AddDate", DateTime.Now.ToString());
             _doh.AddFieldItem("Content", _Content);
             _doh.AddFieldItem("SendIP", IPHelp.ClientIP);
             _doh.AddFieldItem("SendUserId", _SendUserId);
             _doh.AddFieldItem("ReceiveUserId", _uId[i]);
             _doh.AddFieldItem("ReceiveUserName", _uName[i]);
             _doh.AddFieldItem("State", 0);
             _doh.Insert("jcms_normal_user_message");
         }
         return true;
     }
 }
Esempio n. 11
0
 /// <summary>
 /// 插入GUID
 /// </summary>
 /// <param name="_id"></param>
 public string InsertGUID(string _id, DbOperHandler doh)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _guid = "";
         _doh.Reset();
         _doh.SqlCmd = "SELECT [GUID] FROM [jcms_normal_user] WHERE [Id]=" + _id;
         DataTable dt = _doh.GetDataTable();
         if (dt.Rows.Count > 0)
         {
             _guid = dt.Rows[0][0].ToString();
         }
         if (_guid.Length != 36)
         {
             _guid = Guid.NewGuid().ToString();
             _doh.ConditionExpress = "id=" + _id;
             _doh.AddFieldItem("guid", _guid);
             _doh.Update("jcms_normal_user");
         }
         return _guid;
     }
 }
Esempio n. 12
0
 /// <summary>
 /// 更新购物车商品信息
 /// </summary>
 /// <param name="_productid">根据产品查询</param>
 /// <param name="_buycount"></param>
 /// <param name="_state">1表示状态发生了变化</param>
 /// <returns></returns>
 public bool UpdateGoods(string _uid, string _productid, int _buycount, int _state)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         int _num = 0;
         if (_state == 0)
         {
             _doh.Reset();
             _doh.ConditionExpress = "ProductId=" + _productid + " and state=0 and userid=" + _uid;
             _doh.AddFieldItem("BuyCount", _buycount);
             _doh.AddFieldItem("CartTime", DateTime.Now.ToString());
             _num = _doh.Update("jcms_normal_user_cart");
         }
         else if (_state == 1)
         {
             _doh.Reset();
             _doh.ConditionExpress = "ProductId=" + _productid + " and state=1 and userid=" + _uid;
             _doh.AddFieldItem("State", 1);
             _num = _doh.Update("jcms_normal_user_cart");
         }
         return (_num == 1);
     }
 }
Esempio n. 13
0
 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='******'", _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;
     }
 }
Esempio n. 14
0
 /// <summary>
 /// 自动增添Tag标签到数据库
 /// </summary>
 /// <param name="_channelid">频道ID</param>
 /// <param name="_tags">要增加的Tag,多个Tag以,隔开</param>
 public void InsertTags(string _channelid, string _tags)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         if (_tags.Length == 0) return;
         string[] tag = _tags.Split(',');
         for (int i = 0; i < tag.Length; i++)
         {
             if (!ExistTitle(tag[i].ToString(), "0", "ChannelId=" + _channelid))
             {
                 _doh.Reset();
                 _doh.AddFieldItem("Title", tag[i].ToString());
                 _doh.AddFieldItem("ClickTimes", "0");
                 _doh.AddFieldItem("ChannelId", _channelid);
                 _doh.Insert("jcms_normal_tag");
             }
         }
     }
 }
Esempio n. 15
0
 /// <summary>
 /// 修改密码
 /// </summary>
 /// <param name="_id">用户ID</param>
 /// <param name="_pass">修改后的密码</param>
 public void ChangePsd(string _id, string _pass)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "id=" + _id;
         _doh.AddFieldItem("UserPass", _pass);
         _doh.Update("jcms_normal_user");
     }
 }
Esempio n. 16
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. 17
0
 /// <summary>
 /// 新增订单信息
 /// </summary>
 /// <param name="_uid"></param>
 /// <param name="_truename"></param>
 /// <param name="_address"></param>
 /// <param name="_zipcode"></param>
 /// <param name="_mobiletel"></param>
 /// <returns></returns>
 public bool NewOrder(string _uid, string _truename, string _address, string _zipcode, string _mobiletel)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _ordernum = GetProductOrderNum();//订单号
         int page = 1;
         int PSize = 1000;
         int countNum = 0;
         string sqlStr = "";
         string joinStr = "A.[ProductId]=B.Id";
         string whereStr1 = "A.State=0 AND A.UserId=" + _uid;
         string whereStr2 = "State=0 AND UserId=" + _uid;
         _doh.Reset();
         _doh.ConditionExpress = whereStr2;
         countNum = _doh.Count("jcms_normal_user_cart");
         sqlStr = JumboTCMS.Utils.SqlHelp.GetSql("A.*,b.points as unitprice,(b.points*a.buycount) as totalprice,b.id as productid,b.title as productname,b.img as productimg", "jcms_normal_user_cart", "jcms_module_product", "Id", PSize, page, "desc", joinStr, whereStr1, whereStr2);
         _doh.Reset();
         _doh.SqlCmd = sqlStr;
         DataTable dt = _doh.GetDataTable();
         if (dt.Rows.Count == 0)
             return false;
         float _money = 0;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             JumboTCMS.Entity.Normal_UserGoods _goods = new JumboTCMS.Entity.Normal_UserGoods();
             _goods.UserId = Str2Int(_uid);
             _goods.OrderNum = _ordernum;
             _goods.ProductId = Str2Int(dt.Rows[i]["ProductId"].ToString());
             _goods.ProductName = dt.Rows[i]["ProductName"].ToString();
             _goods.ProductImg = dt.Rows[i]["ProductImg"].ToString();
             _goods.ProductLink = dt.Rows[i]["ProductLink"].ToString();
             _goods.UnitPrice = Convert.ToSingle(dt.Rows[i]["UnitPrice"].ToString());
             _goods.BuyCount = Str2Int(dt.Rows[i]["BuyCount"].ToString());
             _goods.TotalPrice = Convert.ToSingle(dt.Rows[i]["TotalPrice"].ToString());
             new JumboTCMS.DAL.Normal_UserGoodsDAL().NewGoods(_goods);
             _money += _goods.TotalPrice;
         }
         dt.Clear();
         dt.Dispose();
         _doh.Reset();
         _doh.AddFieldItem("UserId", _uid);
         _doh.AddFieldItem("OrderNum", _ordernum);
         _doh.AddFieldItem("TrueName", _truename);
         _doh.AddFieldItem("Address", _address);
         _doh.AddFieldItem("ZipCode", _zipcode);
         _doh.AddFieldItem("MobileTel", _mobiletel);
         _doh.AddFieldItem("Money", _money);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("OrderTime", DateTime.Now.ToString());
         _doh.AddFieldItem("OrderIP", IPHelp.ClientIP);
         _doh.Insert("jcms_normal_user_order");
         _doh.Reset();
         _doh.SqlCmd = string.Format("UPDATE [jcms_normal_user_cart] SET [State]=1 WHERE UserId={0}", _uid);
         _doh.ExecuteSqlNonQuery();
         return true;
     }
 }
Esempio n. 18
0
 /// <summary>
 /// 新增购物信息
 /// </summary>
 /// <param name="_goods"></param>
 /// <returns></returns>
 public int NewGoods(JumboTCMS.Entity.Normal_UserGoods _goods)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("UserId", _goods.UserId);
         _doh.AddFieldItem("OrderNum", _goods.OrderNum);
         _doh.AddFieldItem("ProductId", _goods.ProductId);
         _doh.AddFieldItem("ProductName", _goods.ProductName);
         _doh.AddFieldItem("ProductImg", _goods.ProductImg);
         _doh.AddFieldItem("ProductLink", _goods.ProductLink);
         _doh.AddFieldItem("UnitPrice", _goods.UnitPrice);
         _doh.AddFieldItem("BuyCount", _goods.BuyCount);
         _doh.AddFieldItem("TotalPrice", _goods.TotalPrice);
         _doh.AddFieldItem("State", 0);
         _doh.AddFieldItem("GoodsTime", DateTime.Now.ToString());
         int _newid = _doh.Insert("jcms_normal_user_goods");
         return _newid;
     }
 }
Esempio n. 19
0
 /// <summary>
 /// 内容加入专题
 /// </summary>
 /// <param name="_specialid">专题ID</param>
 /// <param name="_channelid">频道ID</param>
 /// <param name="_channeltype">频道类型,也就是内容的模型</param>
 /// <param name="_contentids">内容ID,以,隔开</param>
 public bool Move2Special(int _specialid, string _channelid, string _channeltype, string _contentids)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _contentid = string.Empty;
         string _title = string.Empty;
         _doh.Reset();
         _doh.SqlCmd = "SELECT [Id],[Title] FROM [jcms_module_" + _channeltype + "] WHERE [ChannelId]=" + _channelid + " AND [Id] In (" + _contentids + ")";
         DataTable dt = _doh.GetDataTable();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             _contentid = dt.Rows[i]["Id"].ToString();
             _title = dt.Rows[i]["Title"].ToString();
             _doh.Reset();
             _doh.ConditionExpress = "sid=@sid and contentid=@contentid and channelid=@channelid";
             _doh.AddConditionParameter("@sid", _specialid);
             _doh.AddConditionParameter("@contentid", _contentid);
             _doh.AddConditionParameter("@channelid", _channelid);
             if (!_doh.Exist("jcms_normal_specialcontent"))
             {
                 _doh.Reset();
                 _doh.AddFieldItem("Title", _title);
                 _doh.AddFieldItem("sId", _specialid);
                 _doh.AddFieldItem("ChannelId", _channelid);
                 _doh.AddFieldItem("ContentId", _contentid);
                 _doh.Insert("jcms_normal_specialcontent");
             }
         }
     }
     return true;
 }
Esempio n. 20
0
 /// <summary>
 /// 更新起/始IP整型值
 /// </summary>
 /// <param name="_id">编号</param>
 /// <param name="_startip">开始IP</param>
 /// <param name="_endip">结束IP</param>
 public bool UpdateIPData(string _id, string _startip, string _endip)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "id=@id";
         _doh.AddConditionParameter("@id", _id);
         _doh.AddFieldItem("StartIP", JumboTCMS.Utils.IPHelp.IP2Long(System.Net.IPAddress.Parse(_startip)));
         _doh.AddFieldItem("EndIP", JumboTCMS.Utils.IPHelp.IP2Long(System.Net.IPAddress.Parse(_endip)));
         _doh.AddFieldItem("Enabled", 1);
         int _update = _doh.Update("jcms_normal_forbidip");
         return (_update == 1);
     }
 }
Esempio n. 21
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. 22
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;
     }
 }
Esempio n. 23
0
 /// <summary>
 /// 安装插件
 /// </summary>
 /// <param name="_name"></param>
 /// <param name="_response">返回信息</param>
 public bool Install(string _name, ref string _response)
 {
     if (!JumboTCMS.Utils.DirFile.FileExists(site.Dir + "extends/" + _name + "/install.config"))
     {
         _response = "插件的安装文件损坏或不存在";
         return false;
     }
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "1=1";
         int pId = _doh.MaxValue("jcms_normal_extends", "pId");
         string _Title = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "Title");
         string _Author = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "Author");
         string _Info = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "Info");
         string _Type = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "Type");
         string _BaseTable = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "BaseTable");
         string _ManageUrl = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "ManageUrl");
         int _Locked = JumboTCMS.Utils.Validator.StrToInt(JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "Locked"), 0);
         if (_BaseTable != "")//需要安装数据库
         {
             string _SqlScriptText = JumboTCMS.Utils.XmlCOM.ReadConfig(site.Dir + "extends/" + _name + "/install", "SqlScript" + base.DBType);
             string _SqlScriptFile = site.Dir + "extends/" + _name + "/install.sql";
             JumboTCMS.Utils.DirFile.SaveFile(_SqlScriptText, _SqlScriptFile);
             if (!ExecuteSqlInFile(HttpContext.Current.Server.MapPath(_SqlScriptFile)))
             {
                 _response = "数据表创建有误,可能已存在";
                 return false;
             }
         }
         _doh.Reset();
         _doh.AddFieldItem("Title", _Title);
         _doh.AddFieldItem("Name", _name);
         _doh.AddFieldItem("Author", _Author);
         _doh.AddFieldItem("Info", _Info);
         _doh.AddFieldItem("Type", _Type);
         _doh.AddFieldItem("BaseTable", _BaseTable);
         _doh.AddFieldItem("ManageUrl", _ManageUrl);
         _doh.AddFieldItem("Locked", _Locked);
         _doh.AddFieldItem("Enabled", 0);
         _doh.AddFieldItem("pId", pId + 1);
         _doh.Insert("jcms_normal_extends");
         _response = "插件安装成功";
     }
     return true;
 }
Esempio n. 24
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. 25
0
 /// <summary>
 /// 更新购物信息
 /// </summary>
 /// <param name="_uid"></param>
 /// <param name="_ids"></param>
 /// <param name="_ordernum"></param>
 /// <param name="_state"></param>
 /// <returns></returns>
 public int UpdateGoods(string _uid, string _ids, int _state)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         int _num = 0;
         if (_state == 1)
         {
             _doh.Reset();
             _doh.ConditionExpress = "Id in (" + _ids + ") and state=0 and userid=" + _uid;
             _doh.AddFieldItem("State", 1);
             _num = _doh.Update("jcms_normal_user_goods");
         }
         else if (_state == 2)
         {
             _doh.Reset();
             _doh.ConditionExpress = "Id in (" + _ids + ") and state=1 and userid=" + _uid;
             _doh.AddFieldItem("State", 2);
             _num = _doh.Update("jcms_normal_user_goods");
         }
         return _num;
     }
 }
Esempio n. 26
0
 /// <summary>
 /// 保存发信日志
 /// </summary>
 /// <param name="_adminid">管理员ID</param>
 /// <param name="_title">发信标题</param>
 /// <param name="_users">发信收信人</param>
 public void SaveLog(string _adminid, string _title, string _users)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("AdminId", _adminid);
         _doh.AddFieldItem("SendTitle", _title);
         _doh.AddFieldItem("SendUsers", _users);
         _doh.AddFieldItem("SendTime", DateTime.Now.ToString());
         _doh.AddFieldItem("SendIP", IPHelp.ClientIP);
         _doh.Insert("jcms_normal_emaillogs");
     }
 }
Esempio n. 27
0
 /// <summary>
 /// 更新订单
 /// </summary>
 /// <param name="_uid"></param>
 /// <param name="_ordernum">通过订单号棋查询</param>
 /// <param name="_state">1表示付款;2表示交易完成(货收到了)</param>
 /// <param name="_payway">如:alipay、tenpay等</param>
 /// <returns></returns>
 public int UpdateOrder(string _uid, string _ordernum, int _state, string _payway)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         int _num = 0;
         if (_state == 1)
         {
             _doh.Reset();
             _doh.ConditionExpress = "OrderNum='" + _ordernum + "' and state=0 and userid=" + _uid;
             _doh.AddFieldItem("State", 1);
             _doh.AddFieldItem("PaymentWay", _payway);
             _num = _doh.Update("jcms_normal_user_order");
         }
         else if (_state == 2)
         {
             _doh.Reset();
             _doh.ConditionExpress = "OrderNum='" + _ordernum + "' and state=1 and userid=" + _uid;
             _doh.AddFieldItem("State", 2);
             _num = _doh.Update("jcms_normal_user_order");
         }
         return _num;
     }
 }