コード例 #1
0
ファイル: usercenter.cs プロジェクト: gonziy/readplan2
        /// <summary>
        /// 重写虚方法,此方法在Init事件执行
        /// </summary>
        protected override void InitPage()
        {
            action = DTRequest.GetQueryString("action");

            //获得最后登录日志
            DataTable dt = new BLL.user_login_log().GetList(2, "user_name='" + userModel.user_name + "'", "id desc").Tables[0];

            if (dt.Rows.Count == 2)
            {
                curr_login_ip  = dt.Rows[0]["login_ip"].ToString();
                pre_login_ip   = dt.Rows[1]["login_ip"].ToString();
                pre_login_time = dt.Rows[1]["login_time"].ToString();
            }
            else if (dt.Rows.Count == 1)
            {
                curr_login_ip = dt.Rows[0]["login_ip"].ToString();
            }
            //未完成订单
            total_order = new BLL.orders().GetCount("user_name='" + userModel.user_name + "' and status<3");
            //未读短信息
            total_msg = new BLL.user_message().GetCount("accept_user_name='" + userModel.user_name + "' and is_read=0");

            //退出登录==========================================================
            if (action == "exit")
            {
                //清险Session
                HttpContext.Current.Session[DTKeys.SESSION_USER_INFO] = null;
                //清除Cookies
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", -43200);
                Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", -43200);
                Utils.WriteCookie("UserName", "DTcms", -1);
                Utils.WriteCookie("Password", "DTcms", -1);
                //自动登录,跳转URL
                HttpContext.Current.Response.Redirect(linkurl("login"));
            }
            DTcms.Model.UserPay userPay = new DTcms.Model.UserPay();
            if (!string.IsNullOrEmpty(DTcms.Common.Utils.GetCookie("inviter")))
            {
                Model.users user = new BLL.users().GetModel(int.Parse(DTcms.Common.Utils.GetCookie("inviter")));
                if (user != null)
                {
                    userPay.inviter_id = user.id;
                    InviterName        = user.nick_name;
                }
            }

            userPay.add_time = DateTime.Now;
            userPay.amount   = 988M;
            userPay.id       = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            userPay.openid   = "";
            userPay.status   = 0;
            new DTcms.BLL.UserPay().Add(userPay);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DTcms.Model.UserPay userPay = new DTcms.Model.UserPay();
            userPay.add_time = DateTime.Now;
            userPay.amount   = 9.28M;
            userPay.id       = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            userPay.openid   = "";
            userPay.status   = 0;
            new DTcms.BLL.UserPay().Add(userPay);

            if (!string.IsNullOrEmpty(DTcms.Common.Utils.GetCookie("inviter")))
            {
                Model.users user = new BLL.users().GetModel(int.Parse(DTcms.Common.Utils.GetCookie("inviter")));
                if (user != null)
                {
                    InviterName = user.nick_name;
                }
            }
        }