//批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("outlet_user_level", Vincent._DTcms.DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.users bll = new BLL.users();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
                       Vincent._DTcms.Utils.CombUrlTxt("outlet_user_details.aspx", "group_id={0}&keywords={1}", this.group_id.ToString(), this.keywords), "Success");
        }
Exemplo n.º 2
0
        public void CallBack2(string out_trade_no)
        {
            if (out_trade_no.Contains("_"))
            {
                string[] tradeList = out_trade_no.Split('_');

                int user_id = Vincent._Convert.ToInt(tradeList[0], 0);


                if (user_id > 0)
                {
                    BLL.users   bll   = new BLL.users();
                    Model.users model = bll.GetModel(user_id);
                    model.group_id = 2;
                    model.IsBuwei  = 1;
                    model.reg_time = DateTime.Now;
                    model.pay_time = DateTime.Now.AddYears(1);


                    if (bll.UpdateCallBack(model))
                    {
                    }


                    //  var outId = BuysingooShop.BLL.OrdersBLL.p_update_users(id);
                }
            }
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!WEBUserCurrent.IsLogin)
     {
         HtmlisLogin = 0;
         this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('如果你已經本站會員,請先登入');window.location.href='login.aspx'</script>");
     }
     if (!IsPostBack)
     {
         int UID = WEBUserCurrent.UserID;
         if (UID != 0)
         {
             BLL.users   BLLUser = new BLL.users();
             Model.users User    = new Model.users();
             User = BLLUser.GetModel(UID);
             if (User != null)
             {
                 txtEmail.Value    = User.email;
                 txtPhone.Value    = User.mobile;
                 txtTel.Value      = User.telphone;
                 txtUserName.Value = User.user_name;
             }
         }
     }
 }
Exemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            BLL.users bll         = new BLL.users();
            string    oldpassword = context.Request.Form["oldpass"];
            string    newpassword = context.Request.Form["newpass"];

            Model.users user = null;
            if (context.Session[DTKeys.SESSION_USER_INFO] != null)
            {
                user = context.Session[DTKeys.SESSION_USER_INFO] as Model.users;
                user = bll.GetModel(user.user_name, oldpassword, 0, 0, true);
                if (user != null)
                {
                    user.salt     = Utils.GetCheckCode(6);
                    user.password = DESEncrypt.Encrypt(newpassword, user.salt);
                    if (bll.Update(user))
                    {
                        context.Response.Write("1");
                    }
                    else
                    {
                        context.Response.Write("2");
                    }
                }
                else
                {
                    context.Response.Write("0");
                }
            }
        }
Exemplo n.º 5
0
        //批次刪除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevelEdit("user_list", "Edit");
            //ChkAdminLevel("user_list", TWEnums.ActionEnum.Delete.ToString()); //檢查許可權
            int sucCount   = 0;
            int errorCount = 0;

            BLL.users bll = new BLL.users();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(TWEnums.ActionEnum.Delete.ToString(), "刪除用戶" + sucCount + "條,失敗" + errorCount + "條"); //記錄日誌
            JscriptMsg("刪除成功" + sucCount + "條,失敗" + errorCount + "條!",
                       Utils.CombUrlTxt("user_list.aspx", "group_id={0}&keywords={1}", this.group_id.ToString(), this.keywords));
        }
Exemplo n.º 6
0
        public HttpResponseMessage GetToken()
        {
            string json = "{\"status\": 0, \"msg\": \"错误提示:请输入账号或密码!\"}";
            string name = DTRequest.GetFormString("name");
            string pwd  = DTRequest.GetFormString("pwd");

            if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(pwd))
            {
                json = "{\"status\": 0, \"msg\": \"错误提示:请输入账号或密码!\"}";
            }
            BLL.users   bll   = new BLL.users();
            Model.users model = bll.GetModel(name, pwd, userConfig.emaillogin, userConfig.mobilelogin, true);
            if (model == null)
            {
                json = "{\"status\":0, \"msg\":\"用户名或密码错误,请重试!\"}";
            }
            //检查用户是否通过验证
            if (model.status == 1) //待验证
            {
                json = "{\"status\":0, \"msg\":\"尚未通过验证!\"}";
            }
            else if (model.status == 2) //待审核
            {
                json = "{\"status\":0, \"msg\":\"尚未通过审核!\"}";
            }
            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录");
            string token = CreateToken(model.id);

            json = "{\"status\":1, \"msg\":\"" + token + "\"}";
            return(new HttpResponseMessage {
                Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
            });
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string turl       = DTcms.Common.DTRequest.GetString("turl");
            int    inviter_id = DTcms.Common.DTRequest.GetQueryInt("inviterfrom");

            if (!string.IsNullOrEmpty(turl))
            {
                Common.Utils.WriteCookie(Common.DTKeys.COOKIE_URL_REFERRER, turl);
            }
            if (inviter_id > 0)
            {
                BLL.users userBll = new BLL.users();
                if (userBll.Exists(inviter_id))
                {
                    Model.users userModel = userBll.GetModel(inviter_id);
                    if (userModel.inviter_id > 0)
                    {
                        Common.Utils.WriteCookie("inviter", inviter_id.ToString());
                    }
                }
            }
            Response.Write("inviter:" + Common.Utils.GetCookie("inviter"));
            Response.Write("<br />turl:" + Common.Utils.GetCookie(Common.DTKeys.COOKIE_URL_REFERRER));

            Response.Redirect(GetCodeUrl(appId, Server.UrlEncode("http://www.yuedujing.com/wx_share_init.aspx")));
        }
Exemplo n.º 8
0
        //审核通过
        protected void btnAudit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("user_audit", Vincent._DTcms.DTEnums.ActionEnum.Audit.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.users bll = new BLL.users();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.UpdateField(id, "status=0") > 0)
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Audit.ToString(), "审核用户成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("审核通过" + sucCount + "条,失败" + errorCount + "条!",
                       Vincent._DTcms.Utils.CombUrlTxt("user_audit.aspx", "keywords={0}", this.keywords), "Success");
        }
Exemplo n.º 9
0
        //获取用户id
        protected int Getuserid(string username)
        {
            int user_id = 0;

            user_id = new BLL.users().Getid(username);
            return(user_id);
        }
Exemplo n.º 10
0
        public string CreateUserToken(string username, decimal seconds, string ipAddress, string deviceId)
        {
            var bll     = new BLL.UserToken();
            var userbll = new BLL.users();

            var model = new Model.UserToken();
            var user  = userbll.GetModel(username);

            model.UserName    = username;
            model.UserId      = user.id.ToString();
            model.CreateTime  = DateTime.Now;
            model.DeviceId    = deviceId;
            model.IsOverdue   = 0;
            model.IPAddress   = ipAddress;
            model.OverdueTime = DateTime.Now.AddSeconds(double.Parse(seconds.ToString()));
            model.Token       = Guid.NewGuid().ToString();

            try
            {
                bll.Add(model);
            }
            catch (Exception ex)
            {
                return("{err:" + ex.Message + "}");
            }
            return(model.Token);
        }
Exemplo n.º 11
0
 //审核通过
 protected void btnAudit_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("user_audit", MXEnums.ActionEnum.Audit.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.users bll = new BLL.users();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             if (bll.UpdateField(id, "status=0") > 0)
             {
                 sucCount += 1;
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(MXEnums.ActionEnum.Audit.ToString(), "审核用户成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("审核通过" + sucCount + "条,失败" + errorCount + "条!",
         Utils.CombUrlTxt("user_audit.aspx", "keywords={0}", this.keywords), "Success");
 }
Exemplo n.º 12
0
 /// <summary>
 /// 判断用户是否已经登录(解决Session超时问题)
 /// </summary>
 public bool IsUserLogin()
 {
     //如果Session为Null
     if (HttpContext.Current.Session[MXKeys.SESSION_USER_INFO] != null)
     {
         return true;
     }
     else
     {
         //检查Cookies
         string username = Utils.GetCookie(MXKeys.COOKIE_USER_NAME_REMEMBER, "MxWeiXinPF");
         string password = Utils.GetCookie(MXKeys.COOKIE_USER_PWD_REMEMBER, "MxWeiXinPF");
         if (username != "" && password != "")
         {
             BLL.users bll = new BLL.users();
             Model.users model = bll.GetModel(username, password, 0, 0, false);
             if (model != null)
             {
                 HttpContext.Current.Session[MXKeys.SESSION_USER_INFO] = model;
                 return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 13
0
 public bool IsUserLogin()
 {
     //如果Session为Null
     if (HttpContext.Current.Session[DTKeys.SESSION_USER_INFO] != null)
     {
         return(true);
     }
     else
     {
         //检查Cookies
         string username = Utils.GetCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms");
         string password = Utils.GetCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms");
         if (username != "" && password != "")
         {
             BLL.users   bll   = new BLL.users();
             Model.users model = bll.GetModel(username, password, 0, 0, false);
             if (model != null)
             {
                 HttpContext.Current.Session[DTKeys.SESSION_USER_INFO] = model;
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 14
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            if (this.site_id > 0)
            {
                this.ddlSiteId.SelectedValue = this.site_id.ToString();
            }
            if (this.group_id > 0)
            {
                this.ddlGroupId.SelectedValue = this.group_id.ToString();
            }
            this.txtStartTime.Text = this.start_time;
            this.txtEndTime.Text   = this.end_time;
            this.txtKeywords.Text  = this.keywords;
            BLL.users bll = new BLL.users();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("user_list.aspx", "site_id={0}&group_id={1}&start_time={2}&end_time={3}&keywords={4}&page={5}",
                                              this.site_id.ToString(), this.group_id.ToString(), this.start_time, this.end_time, this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemplo n.º 15
0
        private void ShowInfo(int _id)
        {
            if (_id < 1)
            {
                return;
            }

            BLL.buyersite_config bll = new BLL.buyersite_config();
            var ds = bll.GetList(" id=" + _id.ToString());

            if (ds.Tables[0].Rows.Count == 0)
            {
                return;
            }

            DataRow dr = ds.Tables[0].Rows[0];

            cbIsLock.Checked = dr["stat"].ToString() == "1" ? true : false;

            txtSiteName.Text   = dr["site_name"].ToString();
            txtSiteDomain.Text = dr["site_domain"].ToString();
            txtSiteConfig.Text = dr["site_config"].ToString();
            var bu = new BLL.users().GetModel(Convert.ToInt32(dr["user_id"].ToString()));

            txtUserName.Text = bu == null ? "" : bu.user_name;
        }
Exemplo n.º 16
0
        public void CalculationPoint()
        {
            int UID = WEBUserCurrent.UserID;

            if (!string.IsNullOrEmpty(UID.ToString()))
            {
                BLL.users   User = new BLL.users();
                Model.users mod  = new Model.users();

                mod = User.GetModel(UID);
                if (mod != null)
                {
                    point      = mod.point.ToString();
                    pointMoney = point;
                    if (mod.point > 150)
                    {
                        pointMoney = "150";
                    }
                    else
                    {
                        pointMoney = point;
                    }
                    hidePoint.Value = pointMoney;
                    BLL.point_log   points = new BLL.point_log();
                    Model.point_log model  = new Model.point_log();
                    model.user_id   = UID;
                    model.user_name = orderNo;
                    model.value     = Utils.StringToNum(pointMoney);
                    model.remark    = "購物時折抵點數";
                    model.add_time  = DateTime.Now;
                    model.type      = 2;//2標誌點數是減少
                    int m = points.Add(model);
                }
            }
        }
Exemplo n.º 17
0
        public List <CommentModel> CommentList(CommentListPostModel model)
        {
            int totalcount;

            if (model.articleId == 0 || model.pageSize == 0)
            {
                throw new Exception("获取失败,传输参数有误!");
            }
            BLL.article_comment bll = new BLL.article_comment();
            DataSet             ds  = bll.GetList(model.pageSize, model.pageIndex, string.Format("is_lock=0 and article_id={0}", model.articleId.ToString()), "add_time asc", out totalcount);
            var list = new List <CommentModel>();

            //如果记录存在
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr      = ds.Tables[0].Rows[i];
                    var     comment = new CommentModel();
                    comment.user_id   = int.Parse(dr["user_id"].ToString());
                    comment.user_name = dr["user_name"].ToString();
                    if (Convert.ToInt32(dr["user_id"]) > 0)
                    {
                        Model.users userModel = new BLL.users().GetModel(Convert.ToInt32(dr["user_id"]));
                        if (userModel != null)
                        {
                            comment.avatar = userModel.avatar;
                        }
                    }
                    comment.content = dr["content"].ToString();
                }
            }
            return(list);
        }
Exemplo n.º 18
0
        private void user_verify_email(HttpContext context)
        {
            string username = Vincent._DTcms.DTRequest.GetFormString("username");
            //检查是否过快
            string cookie = Vincent._DTcms.Utils.GetCookie("user_reg_email");

            if (cookie == username)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"发送邮件间隔为20分钟,您刚才已经提交过啦,休息一下再来吧!\"}");
                return;
            }
            Model.users model = new BLL.users().GetModel(username);
            if (model == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"该用户不存在或已删除!\"}");
                return;
            }
            if (model.status != 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"该用户无法进行邮箱验证!\"}");
                return;
            }
            string result = verify_email(model);

            if (result != "success")
            {
                context.Response.Write(result);
                return;
            }
            context.Response.Write("{\"status\":1, \"msg\":\"邮件已经发送成功啦!\"}");
            Vincent._DTcms.Utils.WriteCookie("user_reg_email", username, 20); //20分钟内无重复发送
            return;
        }
Exemplo n.º 19
0
        /// <summary>
        /// 根据卡片类别调用名称和用户名,为用户创建卡片
        /// </summary>
        /// <param name="callindex">卡片类别调用名称</param>
        /// <param name="username">用户名</param>
        /// <param name="token">token</param>
        /// <returns></returns>
        public int CreateUserCard(string callindex, string username)
        {
            BLL.Card         cardBll         = new BLL.Card();
            BLL.CardCategory cardCategoryBll = new BLL.CardCategory();
            BLL.UserCard     ucBLL           = new BLL.UserCard();
            BLL.users        usersBll        = new BLL.users();

            var user         = usersBll.GetModel(username);
            var cardCategory = cardCategoryBll.GetModel(callindex);
            var card         = new Model.Card();

            card.CardCategoryId = cardCategory.CardCategoryId;
            card.Code           = Common.Utils.GetCheckCode(7);
            card.CreateDate     = DateTime.Now;
            card.StartDate      = DateTime.Now;
            card.EndDate        = card.StartDate.AddDays(double.Parse(cardCategory.Duration.ToString()));

            int cardId = cardBll.Add(card);
            var uc     = new Model.UserCard();

            uc.CardId         = cardId;
            uc.UserId         = user.id;
            uc.CardCategoryId = cardCategory.CardCategoryId;
            return(ucBLL.Add(uc));
        }
Exemplo n.º 20
0
        private bool DoAdd()
        {
            Model.users userModel = new BLL.users().GetModel(txtUserName.Text.Trim());
            if (userModel == null)
            {
                return false;
            }

            bool result = false;
            Model.user_recharge model = new Model.user_recharge();
            BLL.user_recharge bll = new BLL.user_recharge();

            model.user_id = userModel.id;
            model.user_name = userModel.user_name;
            model.recharge_no = "R" + txtRechargeNo.Text.Trim(); //订单号R开头为充值订单
            model.payment_id = Utils.StrToInt(ddlPaymentId.SelectedValue, 0);
            model.amount = Utils.StrToDecimal(txtAmount.Text.Trim(), 0);
            model.status = 1;
            model.add_time  = DateTime.Now;
            model.complete_time = DateTime.Now;

            if (bll.Recharge(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "给会员:" + model.user_name + ",充值:" + model.amount + "元"); //记录日志
                result = true;
            }
            return result;
        }
Exemplo n.º 21
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("user_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.users bll = new BLL.users();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             if (bll.Delete(id))
             {
                 sucCount += 1;
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
         Utils.CombUrlTxt("user_list.aspx", "group_id={0}&keywords={1}", this.group_id.ToString(), this.keywords));
 }
Exemplo n.º 22
0
        /// <summary>
        /// 根据卡片类别调用名称和用户名,检查用户卡片是否有效
        /// </summary>
        /// <param name="callIndex">卡片类别调用名称</param>
        /// <param name="username">用户名</param>
        /// <returns></returns>
        public bool CheckUserCard(string callIndex, string username)
        {
            bool check = false;

            BLL.Card         cardBll         = new BLL.Card();
            BLL.CardCategory cardCategoryBll = new BLL.CardCategory();
            BLL.UserCard     ucBLL           = new BLL.UserCard();
            BLL.users        usersBll        = new BLL.users();

            var user                  = usersBll.GetModel(username);
            var cardCategory          = cardCategoryBll.GetModel(callIndex);
            var uclist                = ucBLL.GetModelList("UserId=" + user.id);
            var cardList              = cardBll.GetModelList("CardCategoryId=" + cardCategory.CardCategoryId);
            List <Model.UserCard> ucl = (from uc in uclist
                                         join c in cardList on uc.CardId equals c.CardId
                                         select new Model.UserCard()
            {
                UserId = uc.UserId,
                CardId = uc.CardId,
                UserCardId = uc.UserCardId,
                CardCategoryId = cardCategory.CardCategoryId
            }).ToList();

            foreach (var uc in ucl)
            {
                var card = cardBll.GetModel(uc.CardId);
                if (card.StartDate <= DateTime.Now && card.EndDate >= DateTime.Now)
                {
                    check = true;
                }
            }
            return(check);
        }
Exemplo n.º 23
0
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            int Uid = 0;

            ChkAdminLevel("users", DTEnums.ActionEnum.Delete.ToString()); //檢查許可權
            BLL.users bll = new BLL.users();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    Model.users mod = bll.GetModel(id);
                    if (mod != null)
                    {
                        string    JiShaoRen = mod.dianming;
                        DataTable dtUser    = bll.GetUser_Info(JiShaoRen);
                        if (dtUser != null)
                        {
                            int UserPoint = 0;
                            Uid = Utils.StringToNum(dtUser.Rows[0]["ID"].ToString());
                            int GroupID = Utils.StringToNum(dtUser.Rows[0]["group_id"].ToString());
                            switch (mod.group_id)
                            {
                            case 1:
                                UserPoint = 0;
                                break;

                            case 2:
                                UserPoint = 50;
                                break;

                            case 3:
                                UserPoint = 100;
                                break;

                            case 4:
                                UserPoint = 150;
                                break;
                            }
                            int bk = bll.UpJianPoint(Uid, UserPoint);
                            if (bk > 0)
                            {
                                BLL.point_log   points = new BLL.point_log();
                                Model.point_log model  = new Model.point_log();
                                model.user_id   = Uid;
                                model.user_name = "";
                                model.value     = UserPoint;
                                model.remark    = "取消朋友成為會員回饋點數";
                                model.add_time  = DateTime.Now;
                                model.type      = 2;//2標誌點數是減少
                                int m = points.Add(model);
                            }
                        }
                    }
                }
            }
            JscriptMsg("批次更改成功啦!", Utils.CombUrlTxt("regFee.aspx", "group_id={0}&keywords={1}",
                                                    this.group_id.ToString(), this.keywords), "Success");
        }
Exemplo n.º 24
0
        private void DoAdd()
        {
            Model.users model = new Model.users();
            BLL.users   bll   = new BLL.users();

            model.group_id = 1;
            model.status   = 0;
            //检测用户名是否重复
            //if (bll.Exists(txtUserName.Value.Trim()))
            //{
            //    return;
            //}
            model.user_name = Utils.DropHTML(tel.Value.Trim());
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password = DESEncrypt.Encrypt(txtPassword.Value.Trim(), model.salt);
            model.reg_time = DateTime.Now;
            model.reg_ip   = DTRequest.GetIP();
            model.mobile   = tel.Value.Trim();
            if (bll.Add(model) > 0)
            {
                Session[DTKeys.SESSION_USER_INFO] = bll.GetModel(tel.Value.Trim());
                //AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                Response.Redirect("/web/member.aspx");
            }
            //return result;
        }
Exemplo n.º 25
0
        public ActionResult UserList(int page_index, int page_size)
        {
            int    recordCount = 0;
            int    selectId    = Convert.ToInt32(HttpContext.Request.Form["select_id"]);
            string strTxt      = HttpContext.Request.Form["value"];
            string strWhere    = "1=1";

            if (!string.IsNullOrWhiteSpace(strTxt))
            {
                strWhere += " and NickName like '%" + strTxt + "%'";
            }
            if (selectId != 0)
            {
                strWhere += " and BloodTypeId=" + selectId;
            }
            //获取所有users数据
            DataTable dt       = new BLL.users().GetList(page_size, page_index, strWhere, "Id asc", out recordCount).Tables[0];
            var       JsonData = new
            {
                count      = recordCount,
                page_index = page_index,
                row        = dt,
            };

            return(Content(JsonHelper.ToJson(JsonData)));
        }
Exemplo n.º 26
0
        /// <summary>
        /// 获取用户的有效期内的卡片
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public List <Model.Card> GetCards(string username)
        {
            BLL.Card         cardBll         = new BLL.Card();
            BLL.CardCategory cardCategoryBll = new BLL.CardCategory();
            BLL.UserCard     ucBLL           = new BLL.UserCard();
            BLL.users        usersBll        = new BLL.users();

            var user           = usersBll.GetModel(username);
            var uclist         = ucBLL.GetModelList("UserId=" + user.id);
            var categoryIdlist = from uc in uclist
                                 group uc by uc.CardCategoryId into g
                                 select new { id = g.Key };
            List <Model.Card> cardList = new List <Model.Card>();

            foreach (var i in categoryIdlist)
            {
                var cc   = cardCategoryBll.GetModel(i.id);
                var card = GetUsersCard(cc.CallIndex, user.user_name);
                if (card != null)
                {
                    cardList.Add(card);
                }
            }
            return(cardList);
        }
Exemplo n.º 27
0
        private bool DoAdd()
        {
            Model.users userModel = new BLL.users().GetModel(txtUserName.Text.Trim());
            if (userModel == null)
            {
                return(false);
            }

            bool result = false;

            Model.user_recharge model = new Model.user_recharge();
            BLL.user_recharge   bll   = new BLL.user_recharge();

            model.user_id       = userModel.id;
            model.user_name     = userModel.user_name;
            model.recharge_no   = "R" + txtRechargeNo.Text.Trim(); //订单号R开头为充值订单
            model.payment_id    = Utils.StrToInt(ddlPaymentId.SelectedValue, 0);
            model.amount        = Utils.StrToDecimal(txtAmount.Text.Trim(), 0);
            model.status        = 1;
            model.add_time      = DateTime.Now;
            model.complete_time = DateTime.Now;

            if (bll.Recharge(model))
            {
                AddAdminLog(PLEnums.ActionEnum.Add.ToString(), "给会员:" + model.user_name + ",充值:" + model.amount + "元"); //记录日志
                result = true;
            }
            return(result);
        }
Exemplo n.º 28
0
        /// 注册
        /// </summary>
        public void regist(HttpContext context)
        {
            string outmsg    = "{\"status\":1,\"msg\":\"注册成功!\"}";
            string mobile    = _Request.GetString("mobile");
            string usersname = _Request.GetString("usersname");
            string password  = _Request.GetString("password");
            string usersaera = _Request.GetString("usersaera");
            string usernick  = _Request.GetString("usernick");//y用户昵称



            string userPwd1 = Vincent._MD5Encrypt.GetMD5(password.Trim());

            Model.users model = new Model.users();
            BLL.users   bll   = new BLL.users();
            model.user_name    = mobile;
            model.mobile       = mobile;
            model.isEmail      = 0;
            model.isMobile     = 0;
            model.Parentid     = 0;
            model.Leftor_right = 0;
            model.MarketId     = 0;
            model.OrganizeId   = 0;
            model.PreId        = 0;
            model.nick_name    = usernick;//用户昵称
            //model.password = Vincent._DESEncrypt.Encrypt(password.Trim());
            //model.password = Vincent._DESEncrypt.Encrypt(password.Trim());
            model.salt     = Vincent._DTcms.Utils.GetCheckCode(6); //获得6位的salt加密字符串
            model.password = _DESEncrypt.Encrypt(password, model.salt);
            if (!bll.ExistsMobile(mobile))
            {
                int id = bll.AddPc(model);
                if (id > 0)
                {
                    DataTable dt = bll.GetList(0, "id  =" + id + " ", "id asc").Tables[0];
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        outmsg = CreateJsonParameters(dt);
                    }
                    //// 保存session值
                    context.Session[DTKeys.SESSION_USER_INFO] = model;
                    context.Session.Timeout = 45;
                    context.Response.Clear();
                    context.Response.Write(outmsg);
                    context.Response.End();
                }
                else
                {
                    context.Response.Clear();
                    context.Response.Write("{\"status\":0,\"msg\":\"注册未成功!\"}");
                    context.Response.End();
                }
            }
            else
            {
                context.Response.Clear();
                context.Response.Write("{\"status\":0,\"msg\":\"注册未成功!\"}");
                context.Response.End();
            }
        }
Exemplo n.º 29
0
        private void validate_username(HttpContext context)
        {
            string username = Vincent._DTcms.DTRequest.GetString("param");

            //如果为Null,退出
            if (string.IsNullOrEmpty(username))
            {
                context.Response.Write("{ \"info\":\"用户名不可为空\", \"status\":\"n\" }");
                return;
            }
            //过滤注册用户名字符
            string[] strArray = userConfig.regkeywords.Split(',');
            foreach (string s in strArray)
            {
                if (s.ToLower() == username.ToLower())
                {
                    context.Response.Write("{ \"info\":\"该用户名不可用\", \"status\":\"n\" }");
                    return;
                }
            }
            BLL.users bll = new BLL.users();
            //查询数据库
            if (!bll.Exists(username.Trim()))
            {
                context.Response.Write("{ \"info\":\"该用户名可用\", \"status\":\"y\" }");
                return;
            }
            context.Response.Write("{ \"info\":\"该用户名已被注册\", \"status\":\"n\" }");
            return;
        }
Exemplo n.º 30
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("user_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.users bll = new BLL.users();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("user_list.aspx",
                                                                                        "site_id={0}&group_id={1}&start_time={2}&end_time={3}&keywords={4}",
                                                                                        this.site_id.ToString(), this.group_id.ToString(), this.start_time, this.end_time, this.keywords));
        }
Exemplo n.º 31
0
        private bool DoAdd()
        {
            bool result = true;

            Model.users model = new Model.users();
            BLL.users   bll   = new BLL.users();

            model.group_id = Utils.StringToNum(ddlGroupId.SelectedValue);
            switch (model.group_id)
            {
            case 1:
                model.point = 0;
                break;

            case 2:
                model.point = 50;
                break;

            case 3:
                model.point = 100;
                break;

            case 4:
                model.point = 150;
                break;
            }
            model.isVip = 0;
            if (chkVip.Checked == true)
            {
                model.isVip = 1;
            }
            model.is_lock   = Utils.StringToNum(rblIsLock.SelectedValue);
            model.user_name = txtUserName.Text.Trim();
            model.password  = DESEncrypt.Encrypt(txtPassword.Text);
            model.email     = txtEmail.Text;
            model.nick_name = txtNickName.Text;
            model.avatar    = txtAvatar.Text;
            model.sex       = rblSex.SelectedValue;
            DateTime _birthday;

            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.telphone = txtTelphone.Text.Trim();
            model.mobile   = txtMobile.Text.Trim();
            model.qq       = txtQQ.Text;
            model.address  = txtAddress.Text.Trim();
            model.amount   = decimal.Parse(txtAmount.Text.Trim());
            //model.exp = Utils.StringToNum(txtExp.Text.Trim());
            model.reg_time = DateTime.Now;
            model.reg_ip   = DTRequest.GetIP();

            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return(result);
        }
Exemplo n.º 32
0
        public string UserRegedit(string username, string msgcode, string password)
        {
            string outresult = "{\"status\":\"y\",\"info\":\"恭喜你,注册成功\"}";

            BLL.users   bll   = new BLL.users();
            Model.users model = new Model.users();

            if (username == "")
            {
                outresult = "{\"status\":\"n\",\"info\":\"用户名不能为空\"}";
                return(outresult);
            }
            //if (bll.Exists(username.Trim()))
            //{
            //    outresult = "{\"status\":\"n\",\"info\":\"该用户名已被注册\"}";
            //    return outresult;
            //}
            //保存注册信息
            model.group_id     = 0; //未购买的普通用户
            model.Parentid     = 0; //未购买的用户,不排网络
            model.Leftor_right = 0; //未购买的用户,不排网络区域

            model.mobile   = username;
            model.salt     = Vincent._DTcms.Utils.GetCheckCode(6); //获得6位的salt加密字符串
            model.password = _DESEncrypt.Encrypt(password, model.salt);
            model.reg_time = DateTime.Now;
            model.strcode  = Vincent._DTcms.Utils.GetCheckCode(20); //生成随机码
            model.status   = 0;                                     //正常
            model.isMobile = 1;

            //Random ro = new Random();
            //var no = ro.Next(1000, 9999); //随机一个数

            model.user_name = username; // "jd_" + no.ToString();

            int newId = bll.Add(model);

            if (newId < 1)
            {
                outresult = "{\"status\":\"n\",\"info\":\"系统故障,请联系网站管理员!\"}";
                return(outresult);
            }
            model = bll.GetModel(newId);
            if (model != null)
            {
                //防止Session提前过期
                Vincent._DTcms.Utils.WriteCookie(Vincent._DTcms.DTKeys.COOKIE_USER_NAME_REMEMBER, "SimpleLife", model.user_name);
                Vincent._DTcms.Utils.WriteCookie(Vincent._DTcms.DTKeys.COOKIE_USER_PWD_REMEMBER, "SimpleLife", model.password);

                //写入登录日志
                new BLL.user_login_log().Add(model.id, model.user_name, "会员登录");
                return(ObjectToJSON(model));
            }
            else
            {
                outresult = "{\"status\":0, \"msg\":\"注册失败!\"}";
                return(outresult);
            }
        }
Exemplo n.º 33
0
        private bool DoAdd()
        {
            bool result = false;

            Model.users model = new Model.users();
            BLL.users   bll   = new BLL.users();

            model.group_id = int.Parse(ddlGroupId.SelectedValue);

            //只允许加团长
            //if(model.group_id != 4){
            //    JscriptMsg("只允许添加团长级别的用户!", "", "Error");
            //    return false;
            //}
            model.PreId        = 0; // int.Parse(DropDownList1.SelectedValue); ;         //团长只允许放在 公司下面
            model.Leftor_right = 0; //团长不区分左右区

            model.Provinces = this.provinces1.Value;
            model.City      = this.city1.Value;

            model.status = int.Parse(rblStatus.SelectedValue);
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return(false);
            }
            model.user_name = Vincent._DTcms.Utils.DropHTML(txtUserName.Text.Trim());
            //获得6位的salt加密字符串
            model.salt = Vincent._DTcms.Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password  = _DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.email     = Vincent._DTcms.Utils.DropHTML(txtEmail.Text);
            model.nick_name = Vincent._DTcms.Utils.DropHTML(txtNickName.Text);
            model.avatar    = Vincent._DTcms.Utils.DropHTML(txtAvatar.Text);
            model.sex       = rblSex.SelectedValue;
            DateTime _birthday;

            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.telphone = Vincent._DTcms.Utils.DropHTML(txtTelphone.Text.Trim());
            model.mobile   = Vincent._DTcms.Utils.DropHTML(txtMobile.Text.Trim());
            model.qq       = Vincent._DTcms.Utils.DropHTML(txtQQ.Text);
            model.address  = Vincent._DTcms.Utils.DropHTML(txtAddress.Text.Trim());
            model.amount   = decimal.Parse(txtAmount.Text.Trim());
            model.point    = int.Parse(txtPoint.Text.Trim());
            //model.exp = int.Parse(txtExp.Text.Trim());
            model.reg_time = DateTime.Now;
            model.reg_ip   = Vincent._DTcms.DTRequest.GetIP();

            if (bll.Add(model, 1) > 0)
            {
                AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                result = true;
            }
            return(result);
        }
Exemplo n.º 34
0
 /// <summary>
 /// 返回用户头像图片地址
 /// </summary>
 /// <param name="user_name">用户名</param>
 /// <returns>String</returns>
 protected string get_user_avatar(string user_name)
 {
     BLL.users bll = new BLL.users();
     if (!bll.Exists(user_name))
     {
         return "";
     }
     return bll.GetModel(user_name).avatar;
 }
Exemplo n.º 35
0
 /// <summary>
 /// 返回用户头像图片地址
 /// </summary>
 /// <param name="user_name">用户名</param>
 /// <returns>String</returns>
 protected string get_user_avatar(string user_name)
 {
     BLL.users bll = new BLL.users();
     if (!bll.Exists(user_name))
     {
         return("");
     }
     return(bll.GetModel(user_name).avatar);
 }
Exemplo n.º 36
0
 /// <summary>
 /// 获取用户真实姓名
 /// </summary>
 /// <param name="user_id"></param>
 /// <returns></returns>
 protected string get_real_name(int user_id)
 {
     BLL.users bll = new BLL.users();
     Model.users model = bll.GetModel(user_id);
     if (model != null)
     {
         return model.real_name;
     }
     else {
         return "";
     }
 }
Exemplo n.º 37
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            this.txtKeywords.Text = this.keywords;
            BLL.users bll = new BLL.users();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("user_audit.aspx", "keywords={0}&page={1}",
                this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemplo n.º 38
0
 /// <summary>
 /// 取得用户信息
 /// </summary>
 public Model.users GetUserInfo()
 {
     if (IsUserLogin())
     {
         Model.users model = HttpContext.Current.Session[DTKeys.SESSION_USER_INFO] as Model.users;
         if (model != null)
         {
             //为了能查询到最新的用户信息,必须查询最新的用户资料
             model = new BLL.users().GetModel(model.id);
             return model;
         }
     }
     return null;
 }
Exemplo n.º 39
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("users", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.users bll = new BLL.users();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             bll.Delete(id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("user_list.aspx", "group_id={0}&keywords={1}",
         this.group_id.ToString(), this.keywords), "Success");
 }
Exemplo n.º 40
0
 private string GetGroupMobile(ArrayList al)
 {
     StringBuilder str = new StringBuilder();
     foreach (Object obj in al)
     {
         DataTable dt = new BLL.users().GetList(0, "group_id=" + Convert.ToInt32(obj), "reg_time desc,id desc").Tables[0];
         foreach (DataRow dr in dt.Rows)
         {
             if (!string.IsNullOrEmpty(dr["mobile"].ToString()))
             {
                 str.Append(dr["mobile"].ToString() + ",");
             }
         }
     }
     return Utils.DelLastComma(str.ToString());
 }
Exemplo n.º 41
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            BLL.users userService = new BLL.users();
            string userName = txtUserName.Text.Trim();
            string password = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtPassword.Text.Trim(), ConfigHelper.GetConfigString("PassWordEncrypt"));
            //string password = txtPassword.Text.Trim();
            DataTable userList = userService.GetList("userName='******' and password='******' and roleId in (4,10,11)").Tables[0];
            if (userList.Rows.Count > 0)
            {

                if (userList.Rows[0]["status"].ToString() == "0")
                {
                    MessageBox.Show(this, "此用户名已被冻结,无法登陆!");
                    return;
                }
                //写入Cookie
                try
                {
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_UserId, 2, userList.Rows[0]["userId"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_UserName, 2, txtUserName.Text.Trim());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_TrueName, 2, DESEncrypt.Encrypt(userList.Rows[0]["trueName"].ToString()));
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_RoleId, 2, userList.Rows[0]["roleId"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_RoleName, 2, DESEncrypt.Encrypt(userList.Rows[0]["roleName"].ToString()));
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_DeptId, 2, userList.Rows[0]["deptId"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_IsAdmin, 2, userList.Rows[0]["isAdmin"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_Avatar, 2, userList.Rows[0]["avatar_small"].ToString());
                    Common.Cookie.SetObject(StatusHelpercs.Cookie_Admin_LastLoginTime, 2, DateTime.Parse(userList.Rows[0]["lastLoginTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"));
                }
                catch
                {
                    //Session["userName"] = txtUserName.Text.Trim();
                    //Session["userType"] = ddrUserTyp.SelectedValue;
                    //Session["orgId"] = userList.Rows[0]["orgId"].ToString();
                }
                //更新最后登陆时间
                Model.users userModel = userService.GetModel(int.Parse(userList.Rows[0]["userId"].ToString()));
                userModel.lastLoginTime = DateTime.Now;
                userService.Update(userModel);

                Response.Redirect("index.aspx");
                //MessageBox.ShowAndRedirect(this, "登录成功!", "index.html");
            }
            else
            {
                MessageBox.Show(this, "用户名或密码错误!");
            }
        }
Exemplo n.º 42
0
        private bool DoAdd()
        {
            bool result = false;
            Model.users model = new Model.users();
            BLL.users bll = new BLL.users();

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.status = int.Parse(rblStatus.SelectedValue);
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return false;
            }
            model.user_name = Utils.DropHTML(txtUserName.Text.Trim());
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.email = Utils.DropHTML(txtEmail.Text);
            model.nick_name = Utils.DropHTML(txtNickName.Text);
            model.avatar = Utils.DropHTML(txtAvatar.Text);
            model.sex = rblSex.SelectedValue;
            DateTime _birthday;
            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.telphone = Utils.DropHTML(txtTelphone.Text.Trim());
            model.mobile = Utils.DropHTML(txtMobile.Text.Trim());
            model.qq = Utils.DropHTML(txtQQ.Text);
            model.msn = Utils.DropHTML(txtMsn.Text);
            model.address = Utils.DropHTML(txtAddress.Text.Trim());
            model.amount = decimal.Parse(txtAmount.Text.Trim());
            model.point = int.Parse(txtPoint.Text.Trim());
            model.exp = int.Parse(txtExp.Text.Trim());
            model.reg_time = DateTime.Now;
            model.reg_ip = DTRequest.GetIP();

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                result = true;
            }
            return result;
        }
Exemplo n.º 43
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = MXRequest.GetQueryInt("page", 1);
            if (this.group_id > 0)
            {
                this.ddlGroupId.SelectedValue = this.group_id.ToString();
            }
            this.txtKeywords.Text = this.keywords;
            BLL.users bll = new BLL.users();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("user_list.aspx", "group_id={0}&keywords={1}&page={2}",
                this.group_id.ToString(), this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemplo n.º 44
0
        /// <summary>
        /// OnInit事件,检查用户是否已经登录
        /// </summary>
        void UserPage_Init(object sender, EventArgs e)
        {
            turl = Utils.GetCookie(MXKeys.COOKIE_URL_REFERRER);
            if (string.IsNullOrEmpty(turl) || turl == HttpContext.Current.Request.Url.ToString().ToLower())
            {
                turl = linkurl("usercenter", "index");
            }
            if (IsUserLogin())
            {
                //自动登录,跳转URL
                HttpContext.Current.Response.Redirect(turl);
                return;
            }
            //检查是否已授权
            if (HttpContext.Current.Session["oauth_name"] == null || HttpContext.Current.Session["oauth_access_token"] == null || HttpContext.Current.Session["oauth_openid"] == null)
            {
                HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("登录失败,用户授权已过期,请重新登录!")));
                return;
            }
            Model.user_oauth oauthModel = new BLL.user_oauth().GetModel(HttpContext.Current.Session["oauth_name"].ToString(), HttpContext.Current.Session["oauth_openid"].ToString());
            if (oauthModel != null)
            {
                //检查用户是否存在
                Model.users model = new BLL.users().GetModel(oauthModel.user_name);
                if (model == null)
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("登录失败,授权用户不存在或已被删除!")));
                    return;
                }

                //记住登录状态,防止Session提前过期
                HttpContext.Current.Session[MXKeys.SESSION_USER_INFO] = model;
                HttpContext.Current.Session.Timeout = 45;
                Utils.WriteCookie(MXKeys.COOKIE_USER_NAME_REMEMBER, "MxWeiXinPF", model.user_name);
                Utils.WriteCookie(MXKeys.COOKIE_USER_PWD_REMEMBER, "MxWeiXinPF", model.password);
                //更新最新的Access Token
                oauthModel.oauth_access_token = HttpContext.Current.Session["oauth_access_token"].ToString();
                new BLL.user_oauth().Update(oauthModel);
                //自动登录,跳转URL
                HttpContext.Current.Response.Redirect(turl);
                return;
            }
        }
Exemplo n.º 45
0
 /// <summary>
 /// 如果有该openid已经注册过会员卡信息,则拼接cardno=卡号
 /// </summary>
 /// <param name="openid"></param>
 /// <returns></returns>
 public string cardnoStr(int wid,string openid)
 {
     string ret = "";
     if (openid == null || openid.Trim() == "")
     {
         return "";
     }
     BLL.users ubll = new BLL.users();
     string cardno = ubll.getCardnoByOpenId(wid,openid);
     if (cardno == "")
     {
         ret = "";
     }
     else
     {
         ret = "&cardno=" + cardno;
     }
     return ret;
 }
Exemplo n.º 46
0
        private void ShowInfo(int _id)
        {
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblStatus.SelectedValue = model.status.ToString();
            txtUserName.Text = model.user_name;
            txtUserName.ReadOnly = true;
            txtUserName.Attributes.Remove("ajaxurl");
            if (!string.IsNullOrEmpty(model.password))
            {
                txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword;
            }
            txtEmail.Text = model.email;
            txtNickName.Text = model.nick_name;
            txtAvatar.Text = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            }
            txtTelphone.Text = model.telphone;
            txtMobile.Text = model.mobile;
            txtQQ.Text = model.qq;
            txtMsn.Text = model.msn;
            txtAddress.Text = model.address;
            txtAmount.Text = model.amount.ToString();
            txtPoint.Text = model.point.ToString();
            txtExp.Text = model.exp.ToString();
            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text = model.reg_ip.ToString();
            //查找最近登录信息
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text = logModel.login_ip;
            }
        }
Exemplo n.º 47
0
        //发送手机短信
        protected void btnSmsPost_Click(object sender, EventArgs e)
        {
            BLL.users bll = new BLL.users();
            StringBuilder str = new StringBuilder();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    Model.users model = bll.GetModel(id);
                    if (model != null && !string.IsNullOrEmpty(model.mobile))
                    {
                        str.Append(model.mobile + ",");
                    }
                }
            }
            if (!string.IsNullOrEmpty(str.ToString()))
            {
                Response.Redirect("user_sms.aspx?mobiles=" + Utils.UrlEncode(Utils.DelLastComma(str.ToString())));
            }
        }
Exemplo n.º 48
0
        private void ShowInfo(int _id)
        {
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(_id);

            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblIsLock.SelectedValue = model.is_lock.ToString();
            txtUserName.Enabled = false;
            txtUserName.Text = model.user_name;
            hidUserName.Value = model.user_name;
            txtPassword.Attributes["value"] = model.password;
            txtEmail.Text = model.email;
            txtNickName.Text = model.nick_name;
            txtAvatar.Text = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-M-d");
            }
            txtTelphone.Text = model.telphone;
            txtMobile.Text = model.mobile;
            txtQQ.Text = model.qq;
            txtAddress.Text = model.address;
            txtAmount.Text = model.amount.ToString();
            txtPoint.Text = model.point.ToString();
            txtExp.Text = model.exp.ToString();
            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text = model.reg_ip.ToString();
            //查找最近登录信息
            Model.user_login_log logModel = new BLL.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text = logModel.login_ip;
            }
        }
Exemplo n.º 49
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //读取站点配置信息
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig();

            //=============================获得订单信息================================
            string order_no = DTRequest.GetFormString("pay_order_no").ToUpper();
            decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0);
            string user_name = DTRequest.GetFormString("pay_user_name");
            string subject = DTRequest.GetFormString("pay_subject");
            //以下收货人信息
            string receive_name = string.Empty; //收货人姓名
            string receive_address = string.Empty; //收货人地址
            string receive_zip = string.Empty; //收货人邮编
            string receive_phone = string.Empty; //收货人电话
            string receive_mobile = string.Empty; //收货人手机
            //检查参数是否正确
            if (string.IsNullOrEmpty(order_no) || order_amount == 0)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!")));
                return;
            }
            if (order_no.StartsWith("R")) //R开头为在线充值订单
            {
                Model.user_recharge model = new BLL.user_recharge().GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!")));
                    return;
                }
                if (model.amount != order_amount)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!")));
                    return;
                }
                //取得用户信息
                Model.users userModel = new BLL.users().GetModel(model.user_id);
                if (userModel == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,用户账户不存在或已删除!")));
                    return;
                }
                receive_name = userModel.nick_name;
                receive_address = userModel.address;
                receive_phone = userModel.telphone;
                receive_mobile = userModel.mobile;
            }
            else //B开头为商品订单
            {
                Model.orders model = new BLL.orders().GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!")));
                    return;
                }
                if (model.order_amount != order_amount)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!")));
                    return;
                }
                receive_name = model.accept_name;
                receive_address = model.address;
                receive_zip = model.post_code;
                receive_phone = model.telphone;
                receive_mobile = model.mobile;
            }
            if (user_name != "")
            {
                user_name = "支付会员:" + user_name;
            }
            else
            {
                user_name = "匿名用户";
            }

            //===============================请求参数==================================

            //判断担保或是即时到帐接口
            if (Config.Type == "1") //即时到帐
            {
                //把请求参数打包成数组
                SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>();
                sParaTemp.Add("payment_type", "1"); //收款类型1商品购买
                sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址
                sParaTemp.Add("out_trade_no", order_no); //网站订单号
                sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称
                sParaTemp.Add("body", user_name); //订单描述
                sParaTemp.Add("total_fee", order_amount.ToString()); //订单总金额
                sParaTemp.Add("paymethod", ""); //默认支付方式
                sParaTemp.Add("defaultbank", ""); //默认网银代号
                sParaTemp.Add("anti_phishing_key", ""); //防钓鱼时间戳
                sParaTemp.Add("exter_invoke_ip", DTRequest.GetIP()); ////获取客户端的IP地址
                sParaTemp.Add("buyer_email", ""); //默认买家支付宝账号
                sParaTemp.Add("royalty_type", "");
                sParaTemp.Add("royalty_parameters", "");

                //构造即时到帐接口表单提交HTML数据,无需修改
                Service ali = new Service();
                string sHtmlText = ali.Create_direct_pay_by_user(sParaTemp);
                Response.Write(sHtmlText);
            }
            else //担保交易
            {
                //把请求参数打包成数组
                SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>();
                sParaTemp.Add("payment_type", "1"); //收款类型1商品购买
                sParaTemp.Add("out_trade_no", order_no); //网站订单号
                sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称
                sParaTemp.Add("price", order_amount.ToString()); //付款金额
                sParaTemp.Add("quantity", "1"); //建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品
                sParaTemp.Add("logistics_fee", "0.00"); //物流费用
                sParaTemp.Add("logistics_type", "EXPRESS"); //物流类型,EXPRESS(快递)、POST(平邮)、EMS(EMS)
                sParaTemp.Add("logistics_payment", "SELLER_PAY"); //物流支付方式,SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
                sParaTemp.Add("body", user_name); //订单描述
                sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址
                sParaTemp.Add("receive_name", receive_name); //收货人姓名
                sParaTemp.Add("receive_address", receive_address); //收货人地址
                sParaTemp.Add("receive_zip", receive_zip); //收货人邮编
                sParaTemp.Add("receive_phone", receive_phone); //收货人电话号码
                sParaTemp.Add("receive_mobile", receive_mobile); //收货人手机号码
                //构造即时到帐接口表单提交HTML数据,无需修改
                Service ali = new Service();
                string sHtmlText = ali.Create_partner_trade_by_buyer(sParaTemp);
                Response.Write(sHtmlText);
            }
        }
Exemplo n.º 50
0
        private void user_oauth_register(HttpContext context)
        {
            //检查URL参数
            if (context.Session["oauth_name"] == null)
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:授权参数不正确!\"}");
                return;
            }
            //获取授权信息
            string result = Utils.UrlExecute(siteConfig.webpath + "api/oauth/" + context.Session["oauth_name"].ToString() + "/result_json.aspx");
            if (result.Contains("error"))
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:请检查URL是否正确!\"}");
                return;
            }
            //反序列化JSON
            Dictionary<string, object> dic = JsonMapper.ToObject<Dictionary<string, object>>(result);
            if (dic["ret"].ToString() != "0")
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误代码:" + dic["ret"] + "," + dic["msg"] + "\"}");
                return;
            }

            string password = DTRequest.GetFormString("txtPassword").Trim();
            string email = DTRequest.GetFormString("txtEmail").Trim();
            string userip = DTRequest.GetIP();
            //检查用户名
            BLL.users bll = new BLL.users();
            Model.users model = new Model.users();
            //检查默认组别是否存在
            Model.user_groups modelGroup = new BLL.user_groups().GetDefault();
            if (modelGroup == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统尚未分组,请联系管理员设置会员分组!\"}");
                return;
            }
            //保存注册信息
            model.group_id = modelGroup.id;
            model.user_name = bll.GetRandomName(10);
            model.password = DESEncrypt.Encrypt(password);
            model.email = email;
            if (!string.IsNullOrEmpty(dic["nick"].ToString()))
            {
                model.nick_name = dic["nick"].ToString();
            }
            if (dic["avatar"].ToString().StartsWith("http://"))
            {
                model.avatar = dic["avatar"].ToString();
            }
            if (!string.IsNullOrEmpty(dic["sex"].ToString()))
            {
                model.sex = dic["sex"].ToString();
            }
            if (!string.IsNullOrEmpty(dic["birthday"].ToString()))
            {
                model.birthday = DateTime.Parse(dic["birthday"].ToString());
            }
            model.reg_ip = userip;
            model.reg_time = DateTime.Now;
            model.is_lock = 0; //设置为对应状态
            int newId = bll.Add(model);
            if (newId < 1)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统故障,注册失败,请联系网站管理员!\"}");
                return;
            }
            model = bll.GetModel(newId);
            //赠送积分金额
            if (modelGroup.point > 0)
            {
                new BLL.point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分");
            }
            if (modelGroup.amount > 0)
            {
                new BLL.amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1);
            }
            //判断是否发送站内短消息
            if (userConfig.regmsgstatus == 1)
            {
                new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt);
            }
            //绑定到对应的授权类型
            Model.user_oauth oauthModel = new Model.user_oauth();
            oauthModel.oauth_name = dic["oauth_name"].ToString();
            oauthModel.user_id = model.id;
            oauthModel.user_name = model.user_name;
            oauthModel.oauth_access_token = dic["oauth_access_token"].ToString();
            oauthModel.oauth_openid = dic["oauth_openid"].ToString();
            new BLL.user_oauth().Add(oauthModel);

            context.Session[DTKeys.SESSION_USER_INFO] = model;
            context.Session.Timeout = 45;
            //记住登录状态,防止Session提前过期
            Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
            Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);
            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录", DTRequest.GetIP());
            //返回URL
            context.Response.Write("{\"msg\":1, \"msgbox\":\"会员登录成功!\"}");
            return;
        }
Exemplo n.º 51
0
        private void user_oauth_bind(HttpContext context)
        {
            //检查URL参数
            if (context.Session["oauth_name"] == null)
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:授权参数不正确!\"}");
                return;
            }
            //获取授权信息
            string result = Utils.UrlExecute(siteConfig.webpath + "api/oauth/" + context.Session["oauth_name"].ToString() + "/result_json.aspx");
            if (result.Contains("error"))
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误提示:请检查URL是否正确!\"}");
                return;
            }
            //反序列化JSON
            Dictionary<string, object> dic = JsonMapper.ToObject<Dictionary<string, object>>(result);
            if (dic["ret"].ToString() != "0")
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"错误代码:" + dic["ret"] + ",描述:" + dic["msg"] + "\"}");
                return;
            }

            //检查用户名密码
            string username = DTRequest.GetString("txtUserName");
            string password = DTRequest.GetString("txtPassword");
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"温馨提示:请输入用户名或密码!\"}");
                return;
            }
            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(username, DESEncrypt.Encrypt(password), userConfig.emaillogin);
            if (model == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"错误提示:用户名或密码错误,请重试!\"}");
                return;
            }
            //开始绑定
            Model.user_oauth oauthModel = new Model.user_oauth();
            oauthModel.oauth_name = dic["oauth_name"].ToString();
            oauthModel.user_id = model.id;
            oauthModel.user_name = model.user_name;
            oauthModel.oauth_access_token = dic["oauth_access_token"].ToString();
            oauthModel.oauth_openid = dic["oauth_openid"].ToString();
            int newId = new BLL.user_oauth().Add(oauthModel);
            if (newId < 1)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"错误提示:绑定过程中出现错误,请重新登录授权!\"}");
                return;
            }
            context.Session[DTKeys.SESSION_USER_INFO] = model;
            context.Session.Timeout = 45;
            //记住登录状态,防止Session提前过期
            Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
            Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);
            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录", DTRequest.GetIP());
            //返回URL
            context.Response.Write("{\"msg\":1, \"msgbox\":\"会员登录成功!\"}");
            return;
        }
Exemplo n.º 52
0
        private void edit_order_status(HttpContext context)
        {
            //取得管理员登录信息
            Model.manager adminInfo = new Web.UI.ManagePage().GetAdminInfo();
            if (adminInfo == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"未登录或已超时,请重新登录!\"}");
                return;
            }
            //取得站点配置信息
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig();
            //取得订单配置信息
            Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();

            string order_no = MXRequest.GetString("order_no");
            string edit_type = MXRequest.GetString("edit_type");
            if (order_no == "")
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"传输参数有误,无法获取订单号!\"}");
                return;
            }
            if (edit_type == "")
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"无法获取修改订单类型!\"}");
                return;
            }

            BLL.orders bll = new BLL.orders();
            Model.orders model = bll.GetModel(order_no);
            if (model == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"订单号不存在或已被删除!\"}");
                return;
            }
            switch (edit_type.ToLower())
            {
                case "order_confirm": //确认订单
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认订单的权限!\"}");
                        return;
                    }
                    if (model.status > 1)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能重复处理!\"}");
                        return;
                    }
                    model.status = 2;
                    model.confirm_time = DateTime.Now;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单确认失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认订单号:" + model.order_no); //记录日志
                    #region 发送短信或邮件
                    if (orderConfig.confirmmsg > 0)
                    {
                        switch (orderConfig.confirmmsg)
                        {
                            case 1: //短信通知
                                if (string.IsNullOrEmpty(model.mobile))
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}");
                                    return;
                                }
                                Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.confirmcallindex); //取得短信内容
                                if (smsModel == null)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}");
                                    return;
                                }
                                //替换标签
                                string msgContent = smsModel.content;
                                msgContent = msgContent.Replace("{webname}", siteConfig.webname);
                                msgContent = msgContent.Replace("{username}", model.user_name);
                                msgContent = msgContent.Replace("{orderno}", model.order_no);
                                msgContent = msgContent.Replace("{amount}", model.order_amount.ToString());
                                //发送短信
                                string tipMsg = string.Empty;
                                bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg);
                                if (!sendStatus)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}");
                                    return;
                                }
                                break;
                            case 2: //邮件通知
                                //取得用户的邮箱地址
                                if (model.user_id > 0)
                                {
                                    Model.users userModel = new BLL.users().GetModel(model.user_id);
                                    if (userModel == null || string.IsNullOrEmpty(userModel.email))
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}");
                                        return;
                                    }
                                    //取得邮件模板内容
                                    Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.confirmcallindex);
                                    if (mailModel == null)
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}");
                                        return;
                                    }
                                    //替换标签
                                    string mailTitle = mailModel.maill_title;
                                    mailTitle = mailTitle.Replace("{username}", model.user_name);
                                    string mailContent = mailModel.content;
                                    mailContent = mailContent.Replace("{webname}", siteConfig.webname);
                                    mailContent = mailContent.Replace("{weburl}", siteConfig.weburl);
                                    mailContent = mailContent.Replace("{webtel}", siteConfig.webtel);
                                    mailContent = mailContent.Replace("{username}", model.user_name);
                                    mailContent = mailContent.Replace("{orderno}", model.order_no);
                                    mailContent = mailContent.Replace("{amount}", model.order_amount.ToString());
                                    //发送邮件
                                    MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                                        siteConfig.emailfrom, userModel.email, mailTitle, mailContent);
                                }
                                break;
                        }
                    }
                    #endregion
                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功!\"}");
                    break;
                case "order_payment": //确认付款
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认付款的权限!\"}");
                        return;
                    }
                    if (model.status > 1 || model.payment_status == 2)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已确认,不能重复处理!\"}");
                        return;
                    }
                    model.payment_status = 2;
                    model.payment_time = DateTime.Now;
                    model.status = 2;
                    model.confirm_time = DateTime.Now;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单确认付款失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认付款订单号:" + model.order_no); //记录日志
                    #region 发送短信或邮件
                    if (orderConfig.confirmmsg > 0)
                    {
                        switch (orderConfig.confirmmsg)
                        {
                            case 1: //短信通知
                                if (string.IsNullOrEmpty(model.mobile))
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}");
                                    return;
                                }
                                Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.confirmcallindex); //取得短信内容
                                if (smsModel == null)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}");
                                    return;
                                }
                                //替换标签
                                string msgContent = smsModel.content;
                                msgContent = msgContent.Replace("{webname}", siteConfig.webname);
                                msgContent = msgContent.Replace("{username}", model.user_name);
                                msgContent = msgContent.Replace("{orderno}", model.order_no);
                                msgContent = msgContent.Replace("{amount}", model.order_amount.ToString());
                                //发送短信
                                string tipMsg = string.Empty;
                                bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg);
                                if (!sendStatus)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}");
                                    return;
                                }
                                break;
                            case 2: //邮件通知
                                //取得用户的邮箱地址
                                if (model.user_id > 0)
                                {
                                    Model.users userModel = new BLL.users().GetModel(model.user_id);
                                    if (userModel == null || string.IsNullOrEmpty(userModel.email))
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}");
                                        return;
                                    }
                                    //取得邮件模板内容
                                    Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.confirmcallindex);
                                    if (mailModel == null)
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}");
                                        return;
                                    }
                                    //替换标签
                                    string mailTitle = mailModel.maill_title;
                                    mailTitle = mailTitle.Replace("{username}", model.user_name);
                                    string mailContent = mailModel.content;
                                    mailContent = mailContent.Replace("{webname}", siteConfig.webname);
                                    mailContent = mailContent.Replace("{weburl}", siteConfig.weburl);
                                    mailContent = mailContent.Replace("{webtel}", siteConfig.webtel);
                                    mailContent = mailContent.Replace("{username}", model.user_name);
                                    mailContent = mailContent.Replace("{orderno}", model.order_no);
                                    mailContent = mailContent.Replace("{amount}", model.order_amount.ToString());
                                    //发送邮件
                                    MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                                        siteConfig.emailfrom, userModel.email, mailTitle, mailContent);
                                }
                                break;
                        }
                    }
                    #endregion
                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认付款成功!\"}");
                    break;
                case "order_express": //确认发货
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认发货的权限!\"}");
                        return;
                    }
                    if (model.status > 2 || model.express_status == 2)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已完成或已发货,不能重复处理!\"}");
                        return;
                    }
                    int express_id = MXRequest.GetFormInt("express_id");
                    string express_no = MXRequest.GetFormString("express_no");
                    if (express_id == 0)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"请选择配送方式!\"}");
                        return;
                    }
                    model.express_id = express_id;
                    model.express_no = express_no;
                  
                    model.express_time = DateTime.Now;
                    string ret = "";
                    if (model.payment_id == 3 && model.express_status != 2)
                    { 
                        //通知微信支付,改变发货状态
                        FaHuoProc fahuo = new FaHuoProc();

                        BLL.wx_payment_wxpay payBll = new BLL.wx_payment_wxpay();
                        Model.wx_payment_wxpay paymentInfo = payBll.GetModelByWid(model.wid.Value);
                        Dictionary<string, object> fahuoDict = fahuo.fahuomgr(paymentInfo, model);
                        string errcode = fahuoDict["errcode"].ToString();
                        string errmsg = fahuoDict["errmsg"].ToString();
                        model.fahuoCode = errcode;
                        model.fahuoMsg = errmsg;
                        if (errcode == "0")
                        {
                            model.express_status = 2;
                        }
                        else
                        {
                            ret = "通知微信支付,改变发货状态失败:"+errmsg;
                        }
                    }
                    model.express_status = 2;
                    if (!bll.Update(model))
                    {
                        ret += "订单发货失败!";
                        context.Response.Write("{\"status\": 0, \"msg\": \"" + ret + "\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认发货订单号:" + model.order_no); //记录日志
                    #region 发送短信或邮件
                    if (orderConfig.expressmsg > 0)
                    {
                        switch (orderConfig.expressmsg)
                        {
                            case 1: //短信通知
                                if (string.IsNullOrEmpty(model.mobile))
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}");
                                    return;
                                }
                                Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.expresscallindex); //取得短信内容
                                if (smsModel == null)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}");
                                    return;
                                }
                                //替换标签
                                string msgContent = smsModel.content;
                                msgContent = msgContent.Replace("{webname}", siteConfig.webname);
                                msgContent = msgContent.Replace("{username}", model.user_name);
                                msgContent = msgContent.Replace("{orderno}", model.order_no);
                                msgContent = msgContent.Replace("{amount}", model.order_amount.ToString());
                                //发送短信
                                string tipMsg = string.Empty;
                                bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg);
                                if (!sendStatus)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}");
                                    return;
                                }
                                break;
                            case 2: //邮件通知
                                //取得用户的邮箱地址
                                if (model.user_id > 0)
                                {
                                    Model.users userModel = new BLL.users().GetModel(model.user_id);
                                    if (userModel == null || string.IsNullOrEmpty(userModel.email))
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}");
                                        return;
                                    }
                                    //取得邮件模板内容
                                    Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.expresscallindex);
                                    if (mailModel == null)
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}");
                                        return;
                                    }
                                    //替换标签
                                    string mailTitle = mailModel.maill_title;
                                    mailTitle = mailTitle.Replace("{username}", model.user_name);
                                    string mailContent = mailModel.content;
                                    mailContent = mailContent.Replace("{webname}", siteConfig.webname);
                                    mailContent = mailContent.Replace("{weburl}", siteConfig.weburl);
                                    mailContent = mailContent.Replace("{webtel}", siteConfig.webtel);
                                    mailContent = mailContent.Replace("{username}", model.user_name);
                                    mailContent = mailContent.Replace("{orderno}", model.order_no);
                                    mailContent = mailContent.Replace("{amount}", model.order_amount.ToString());
                                    //发送邮件
                                    MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                                        siteConfig.emailfrom, userModel.email, mailTitle, mailContent);
                                }
                                break;
                        }
                    }
                    #endregion
                    context.Response.Write("{\"status\": 1, \"msg\": \"订单发货成功!\"}");
                    break;
                case "order_complete": //完成订单=========================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认完成订单的权限!\"}");
                        return;
                    }
                    if (model.status > 2)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经完成,不能重复处理!\"}");
                        return;
                    }
                    model.status = 3;
                    model.complete_time = DateTime.Now;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"确认订单完成失败!\"}");
                        return;
                    }
                    //给会员增加积分检查升级
                    if (model.user_id > 0 && model.point > 0)
                    {
                        new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "购物获得积分,订单号:" + model.order_no, true);
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认交易完成订单号:" + model.order_no); //记录日志
                    #region 发送短信或邮件
                    if (orderConfig.completemsg > 0)
                    {
                        switch (orderConfig.completemsg)
                        {
                            case 1: //短信通知
                                if (string.IsNullOrEmpty(model.mobile))
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}");
                                    return;
                                }
                                Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.completecallindex); //取得短信内容
                                if (smsModel == null)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}");
                                    return;
                                }
                                //替换标签
                                string msgContent = smsModel.content;
                                msgContent = msgContent.Replace("{webname}", siteConfig.webname);
                                msgContent = msgContent.Replace("{username}", model.user_name);
                                msgContent = msgContent.Replace("{orderno}", model.order_no);
                                msgContent = msgContent.Replace("{amount}", model.order_amount.ToString());
                                //发送短信
                                string tipMsg = string.Empty;
                                bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg);
                                if (!sendStatus)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}");
                                    return;
                                }
                                break;
                            case 2: //邮件通知
                                //取得用户的邮箱地址
                                if (model.user_id > 0)
                                {
                                    Model.users userModel = new BLL.users().GetModel(model.user_id);
                                    if (userModel == null || string.IsNullOrEmpty(userModel.email))
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}");
                                        return;
                                    }
                                    //取得邮件模板内容
                                    Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.completecallindex);
                                    if (mailModel == null)
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}");
                                        return;
                                    }
                                    //替换标签
                                    string mailTitle = mailModel.maill_title;
                                    mailTitle = mailTitle.Replace("{username}", model.user_name);
                                    string mailContent = mailModel.content;
                                    mailContent = mailContent.Replace("{webname}", siteConfig.webname);
                                    mailContent = mailContent.Replace("{weburl}", siteConfig.weburl);
                                    mailContent = mailContent.Replace("{webtel}", siteConfig.webtel);
                                    mailContent = mailContent.Replace("{username}", model.user_name);
                                    mailContent = mailContent.Replace("{orderno}", model.order_no);
                                    mailContent = mailContent.Replace("{amount}", model.order_amount.ToString());
                                    //发送邮件
                                    MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                                        siteConfig.emailfrom, userModel.email, mailTitle, mailContent);
                                }
                                break;
                        }
                    }
                    #endregion
                    context.Response.Write("{\"status\": 1, \"msg\": \"确认订单完成成功!\"}");
                    break;
                case "order_cancel": //取消订单==========================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Cancel.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有取消订单的权限!\"}");
                        return;
                    }
                    if (model.status > 2)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经完成,不能取消订单!\"}");
                        return;
                    }
                    model.status = 4;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"取消订单失败!\"}");
                        return;
                    }
                    int check_revert1 = MXRequest.GetFormInt("check_revert");
                    if (check_revert1 == 1)
                    {
                        //如果存在积分换购则返还会员积分
                        if (model.user_id > 0 && model.point < 0)
                        {
                            new BLL.user_point_log().Add(model.user_id, model.user_name, (model.point * -1), "取消订单返还积分,订单号:" + model.order_no, false);
                        }
                        //如果已支付则退还金额到会员账户
                        if (model.user_id > 0 && model.payment_status == 2 && model.order_amount > 0)
                        {
                            new BLL.user_amount_log().Add(model.user_id, model.user_name, MXEnums.AmountTypeEnum.BuyGoods.ToString(), model.order_amount, "取消订单退还金额,订单号:" + model.order_no);
                        }
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Cancel.ToString(), "取消订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"取消订单成功!\"}");
                    break;
                case "order_invalid": //作废订单==========================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Invalid.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有作废订单的权限!\"}");
                        return;
                    }
                    if (model.status != 3)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单尚未完成,不能作废订单!\"}");
                        return;
                    }
                    model.status = 5;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"作废订单失败!\"}");
                        return;
                    }
                    int check_revert2 = MXRequest.GetFormInt("check_revert");
                    if (check_revert2 == 1)
                    {
                        //扣除购物赠送的积分
                        if (model.user_id > 0 && model.point > 0)
                        {
                            new BLL.user_point_log().Add(model.user_id, model.user_name, (model.point * -1), "作废订单扣除积分,订单号:" + model.order_no, false);
                        }
                        //退还金额到会员账户
                        if (model.user_id > 0 && model.order_amount > 0)
                        {
                            new BLL.user_amount_log().Add(model.user_id, model.user_name, MXEnums.AmountTypeEnum.BuyGoods.ToString(), model.order_amount, "取消订单退还金额,订单号:" + model.order_no);
                        }
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Invalid.ToString(), "作废订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"作废订单成功!\"}");
                    break;
                case "edit_accept_info": //修改收货信息====================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有修改收货信息的权限!\"}");
                        return;
                    }
                    if (model.express_status == 2)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经发货,不能修改收货信息!\"}");
                        return;
                    }
                    string accept_name = MXRequest.GetFormString("accept_name");
                    string province = MXRequest.GetFormString("province");
                    string city = MXRequest.GetFormString("city");
                    string area = MXRequest.GetFormString("area");
                    string address = MXRequest.GetFormString("address");
                    string post_code = MXRequest.GetFormString("post_code");
                    string mobile = MXRequest.GetFormString("mobile");
                    string telphone = MXRequest.GetFormString("telphone");

                    if (accept_name == "")
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"请填写收货人姓名!\"}");
                        return;
                    }
                    if (area == "")
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"请选择所在地区!\"}");
                        return;
                    }
                    if (address == "")
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"请填写详细的送货地址!\"}");
                        return;
                    }
                    if (mobile == "" && telphone == "")
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"联系手机或电话至少填写一项!\"}");
                        return;
                    }

                    model.accept_name = accept_name;
                    model.area = province + "," + city + "," + area;
                    model.address = address;
                    model.post_code = post_code;
                    model.mobile = mobile;
                    model.telphone = telphone;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"修改收货人信息失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改收货信息,订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"修改收货人信息成功!\"}");
                    break;
                case "edit_order_remark": //修改订单备注=================================
                    string remark = MXRequest.GetFormString("remark");
                    if (remark == "")
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"请填写订单备注内容!\"}");
                        return;
                    }
                    model.remark = remark;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"修改订单备注失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改订单备注,订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"修改订单备注成功!\"}");
                    break;
                case "edit_real_amount": //修改商品总金额================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有修改商品金额的权限!\"}");
                        return;
                    }
                    if (model.status > 1)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能修改金额!\"}");
                        return;
                    }
                    decimal real_amount = MXRequest.GetFormDecimal("real_amount", 0);
                    model.real_amount = real_amount;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"修改商品总金额失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改商品金额,订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"修改商品总金额成功!\"}");
                    break;
                case "edit_express_fee": //修改配送费用==================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有配送费用的权限!\"}");
                        return;
                    }
                    if (model.status > 1)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能修改金额!\"}");
                        return;
                    }
                    decimal express_fee = MXRequest.GetFormDecimal("express_fee", 0);
                    model.express_fee = express_fee;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"修改配送费用失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改配送费用,订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"修改配送费用成功!\"}");
                    break;
                case "edit_payment_fee": //修改支付手续费=================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有修改支付手续费的权限!\"}");
                        return;
                    }
                    if (model.status > 1)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能修改金额!\"}");
                        return;
                    }
                    decimal payment_fee = MXRequest.GetFormDecimal("payment_fee", 0);
                    model.payment_fee = payment_fee;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"修改支付手续费失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改支付手续费,订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"修改支付手续费成功!\"}");
                    break;
            }

        }
Exemplo n.º 53
0
 private void user_getpassword(HttpContext context)
 {
     string code = DTRequest.GetFormString("txtCode");
     string username = DTRequest.GetFormString("txtUserName").Trim();
     //检查用户名是否正确
     if (string.IsNullOrEmpty(username))
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户名不可为空!\"}");
         return;
     }
     //校检验证码
     string result = verify_code(context, code);
     if (result != "success")
     {
         context.Response.Write(result);
         return;
     }
     //检查用户信息
     BLL.users bll = new BLL.users();
     Model.users model = bll.GetModel(username);
     if (model == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您输入的用户名不存在!\"}");
         return;
     }
     if (string.IsNullOrEmpty(model.email))
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"您尚未设置邮箱地址,无法使用取回密码功能!\"}");
         return;
     }
     //生成随机码
     string strcode = Utils.GetCheckCode(20);
     //获得邮件内容
     Model.mail_template mailModel = new BLL.mail_template().GetModel("getpassword");
     if (mailModel == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"邮件发送失败,邮件模板内容不存在!\"}");
         return;
     }
     //检查是否重复提交
     BLL.user_code codeBll = new BLL.user_code();
     Model.user_code codeModel;
     codeModel = codeBll.GetModel(username, DTEnums.CodeEnum.RegVerify.ToString());
     if (codeModel == null)
     {
         codeModel = new Model.user_code();
         //写入数据库
         codeModel.user_id = model.id;
         codeModel.user_name = model.user_name;
         codeModel.type = DTEnums.CodeEnum.Password.ToString();
         codeModel.str_code = strcode;
         codeModel.eff_time = DateTime.Now.AddDays(1);
         codeModel.add_time = DateTime.Now;
         codeBll.Add(codeModel);
     }
     //替换模板内容
     string titletxt = mailModel.maill_title;
     string bodytxt = mailModel.content;
     titletxt = titletxt.Replace("{webname}", siteConfig.webname);
     titletxt = titletxt.Replace("{username}", model.user_name);
     bodytxt = bodytxt.Replace("{webname}", siteConfig.webname);
     bodytxt = bodytxt.Replace("{username}", model.user_name);
     bodytxt = bodytxt.Replace("{linkurl}", Utils.DelLastChar(siteConfig.weburl, "/") + new BasePage().linkurl("repassword1", "reset", strcode)); //此处需要修改
     //发送邮件
     try
     {
         DTMail.sendMail(siteConfig.emailstmp,
             siteConfig.emailusername,
             DESEncrypt.Decrypt(siteConfig.emailpassword),
             siteConfig.emailnickname,
             siteConfig.emailfrom,
             model.email,
             titletxt, bodytxt);
     }
     catch
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"邮件发送失败,请联系本站管理员!\"}");
         return;
     }
     context.Response.Write("{\"msg\":1, \"msgbox\":\"邮件发送成功,请登录您的邮箱找回登录密码!\"}");
     return;
 }
Exemplo n.º 54
0
        private void comment_list(HttpContext context)
        {
            int article_id = DTRequest.GetQueryInt("article_id");
            int page_index = DTRequest.GetQueryInt("page_index");
            int page_size = DTRequest.GetQueryInt("page_size");
            int totalcount;
            StringBuilder strTxt = new StringBuilder();

            if (article_id == 0 || page_size == 0)
            {
                context.Response.Write("获取失败,传输参数有误!");
                return;
            }

            BLL.article_comment bll = new BLL.article_comment();
            DataSet ds = bll.GetList(page_size, page_index, string.Format("is_lock=0 and article_id={0}", article_id.ToString()), "add_time asc", out totalcount);
            //如果记录存在
            if (ds.Tables[0].Rows.Count > 0)
            {
                strTxt.Append("[");
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    //strTxt.Append("<li>\n");
                    //strTxt.Append("<div class=\"title\"><span>" + dr["add_time"] + "</span>" + dr["user_name"] + "</div>");
                    //strTxt.Append("<div class=\"box\">" + dr["content"] + "</div>");
                    //if (Convert.ToInt32(dr["is_reply"]) == 1)
                    //{
                    //    strTxt.Append("<div class=\"reply\">");
                    //    strTxt.Append("<strong>管理员回复:</strong>" + dr["reply_content"].ToString());
                    //    strTxt.Append("<span class=\"time\">" + dr["reply_time"].ToString() + "</span>");
                    //    strTxt.Append("</div>");
                    //}
                    //strTxt.Append("</li>\n");

                    strTxt.Append("{");
                    strTxt.Append("\"user_id\":" + dr["user_id"]);
                    strTxt.Append(",\"user_name\":\"" + dr["user_name"] + "\"");
                    if (Convert.ToInt32(dr["user_id"]) > 0)
                    {
                        Model.users userModel = new BLL.users().GetModel(Convert.ToInt32(dr["user_id"]));
                        if (userModel != null)
                        {
                            strTxt.Append(",\"avatar\":\"" + userModel.avatar + "\"");
                        }
                    }
                    strTxt.Append("");
                    strTxt.Append(",\"content\":\"" + Microsoft.JScript.GlobalObject.escape(dr["content"]) + "\"");
                    strTxt.Append(",\"add_time\":\"" + dr["add_time"] + "\"");
                    strTxt.Append(",\"is_reply\":" + dr["is_reply"]);
                    if (Convert.ToInt32(dr["is_reply"]) == 1)
                    {
                        strTxt.Append(",\"reply_content\":\"" + Microsoft.JScript.GlobalObject.escape(dr["reply_content"]) + "\"");
                        strTxt.Append(",\"reply_time\":\"" + dr["reply_time"] + "\"");
                    }
                    strTxt.Append("}");
                    //是否加逗号
                    if (i < ds.Tables[0].Rows.Count - 1)
                    {
                        strTxt.Append(",");
                    }

                }
                strTxt.Append("]");
            }
            //else
            //{
            //    strTxt.Append("<p>暂无评论,快来抢沙发吧!</p>");
            //}
            context.Response.Write(strTxt.ToString());
        }
Exemplo n.º 55
0
 private void validate_username(HttpContext context)
 {
     string username = DTRequest.GetString("username");
     //如果为Null,退出
     if (string.IsNullOrEmpty(username))
     {
         context.Response.Write("null");
         return;
     }
     //过滤注册用户名字符
     string[] strArray = userConfig.regkeywords.Split(',');
     foreach (string s in strArray)
     {
         if (s.ToLower() == username.ToLower())
         {
             context.Response.Write("lock");
             return;
         }
     }
     BLL.users bll = new BLL.users();
     //查询数据库
     if (!bll.Exists(username.Trim()))
     {
         context.Response.Write("true");
         return;
     }
     context.Response.Write("false");
     return;
 }
Exemplo n.º 56
0
 private void user_verify_email(HttpContext context)
 {
     string username = DTRequest.GetFormString("username");
     //检查是否过快
     string cookie = Utils.GetCookie("user_reg_email");
     if (cookie == username)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"发送邮件间隔为20分钟,您刚才已经提交过啦,休息一下再来吧!\"}");
         return;
     }
     Model.users model = new BLL.users().GetModel(username);
     if (model == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户不存在或已删除!\"}");
         return;
     }
     if (model.is_lock != 1)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户无法进行邮箱验证!\"}");
         return;
     }
     string result = verify_email(model);
     if (result != "success")
     {
         context.Response.Write(result);
         return;
     }
     context.Response.Write("{\"msg\":1, \"msgbox\":\"邮件已经发送成功啦!\"}");
     Utils.WriteCookie("user_reg_email", username, 20); //20分钟内无重复发送
     return;
 }
Exemplo n.º 57
0
        private void user_repassword(HttpContext context)
        {
            string code = context.Request.Form["txtCode"];
            string strcode = context.Request.Form["hideCode"];
            string password = context.Request.Form["txtPassword"];

            //校检验证码
            string result = verify_code(context, code);
            if (result != "success")
            {
                context.Response.Write(result);
                return;
            }
            //检查验证字符串
            if (string.IsNullOrEmpty(strcode))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统找不到邮件验证的字符串!\"}");
                return;
            }
            //检查输入的新密码
            if (string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"请输入您的新密码!\"}");
                return;
            }

            BLL.user_code codeBll = new BLL.user_code();
            Model.user_code codeModel = codeBll.GetModel(strcode);
            if (codeModel == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"邮件验证的字符串不存在或已过期!\"}");
                return;
            }
            //验证用户是否存在
            BLL.users userBll = new BLL.users();
            if (!userBll.Exists(codeModel.user_id))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户不存在或已被删除!\"}");
                return;
            }
            Model.users userModel = userBll.GetModel(codeModel.user_id);
            //执行修改操作
            userModel.password = DESEncrypt.Encrypt(password);
            userBll.Update(userModel);
            //更改验证字符串状态
            codeModel.count = 1;
            codeModel.status = 1;
            codeBll.Update(codeModel);
            context.Response.Write("{\"msg\":1, \"msgbox\":\"修改密码成功,请记住您的新密码!\"}");
            return;
        }
Exemplo n.º 58
0
        private void user_register(HttpContext context)
        {
            string code = DTRequest.GetFormString("txtCode").Trim();
            string invitecode = DTRequest.GetFormString("txtInviteCode").Trim();
            string username = DTRequest.GetFormString("txtUserName").Trim();
            string password = DTRequest.GetFormString("txtPassword").Trim();
            string email = DTRequest.GetFormString("txtEmail").Trim();
            string userip = DTRequest.GetIP();

            #region 检查各项并提示
            //检查是否开启会员功能
            if (siteConfig.memberstatus == 0)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,会员功能已被关闭,无法注册新会员!\"}");
                return;
            }
            if (userConfig.regstatus == 0)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,系统暂不允许注册新用户!\"}");
                return;
            }
            //校检验证码
            string result = verify_code(context, code);
            if (result != "success")
            {
                context.Response.Write(result);
                return;
            }
            //检查用户输入信息是否为空
            if (username == "" || password == "")
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"用户名和密码不能为空!\"}");
                return;
            }
            if (email == "")
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"电子邮箱不能为空!\"}");
                return;
            }

            //检查用户名
            BLL.users bll = new BLL.users();
            Model.users model = new Model.users();
            if (bll.Exists(username))
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"该用户名已经存在!\"}");
                return;
            }
            //检查同一IP注册时隔
            if (userConfig.regctrl > 0)
            {
                if (bll.Exists(userip, userConfig.regctrl))
                {
                    context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,同一IP在" + userConfig.regctrl + "小时内不能注册多个用户!\"}");
                    return;
                }
            }
            //不允许同一Email注册不同用户
            if (userConfig.regemailditto == 0)
            {
                if (bll.ExistsEmail(email))
                {
                    context.Response.Write("{\"msg\":0, \"msgbox\":\"Email不允许重复注册,如果你忘记用户名,请找回密码!\"}");
                    return;
                }
            }
            //检查默认组别是否存在
            Model.user_groups modelGroup = new BLL.user_groups().GetDefault();
            if (modelGroup == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统尚未分组,请联系管理员设置会员分组!\"}");
                return;
            }
            //检查是否通过邀请码注册
            if (userConfig.regstatus == 2)
            {
                string result1 = verify_invite_reg(username, invitecode);
                if (result1 != "success")
                {
                    context.Response.Write(result1);
                    return;
                }
            }
            #endregion

            //保存注册信息
            model.group_id = modelGroup.id;
            model.user_name = username;
            model.password = DESEncrypt.Encrypt(password);
            model.email = email;
            model.reg_ip = userip;
            model.reg_time = DateTime.Now;
            model.is_lock = userConfig.regverify; //设置为对应状态
            int newId = bll.Add(model);
            if (newId < 1)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"系统故障,注册失败,请联系网站管理员!\"}");
                return;
            }
            model = bll.GetModel(newId);
            //赠送积分金额
            if (modelGroup.point > 0)
            {
                new BLL.point_log().Add(model.id, model.user_name, modelGroup.point, "注册赠送积分");
            }
            if (modelGroup.amount > 0)
            {
                new BLL.amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.SysGive.ToString(), modelGroup.amount, "注册赠送金额", 1);
            }
            //判断是否发送站内短消息
            if (userConfig.regmsgstatus == 1)
            {
                new BLL.user_message().Add(1, "", model.user_name, "欢迎您成为本站会员", userConfig.regmsgtxt);
            }
            //需要Email验证
            if (userConfig.regverify == 1)
            {
                string result2 = verify_email(model);
                if (result2 != "success")
                {
                    context.Response.Write(result2);
                    return;
                }
                context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=sendmail&username="******"\", \"msgbox\":\"注册成功,请进入邮箱验证激活账户!\"}");
            }
            //需要人工审核
            else if (userConfig.regverify == 2)
            {
                context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=verify&username="******"\", \"msgbox\":\"注册成功,请等待审核通过!\"}");
            }
            else
            {
                context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=succeed&username="******"\", \"msgbox\":\"恭喜您,注册成功啦!\"}");
            }
            return;
        }
Exemplo n.º 59
0
        private void user_login(HttpContext context)
        {
            string username = DTRequest.GetFormString("txtUserName");
            string password = DTRequest.GetFormString("txtPassword");
            string remember = DTRequest.GetFormString("chkRemember");
            //检查用户名密码
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"温馨提示:请输入用户名或密码!\"}");
                return;
            }

            BLL.users bll = new BLL.users();
            Model.users model = bll.GetModel(username, DESEncrypt.Encrypt(password), userConfig.emaillogin);
            if (model == null)
            {
                context.Response.Write("{\"msg\":0, \"msgbox\":\"错误提示:用户名或密码错误,请重试!\"}");
                return;
            }
            //检查用户是否通过验证
            if (model.is_lock == 1) //待验证
            {
                context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=sendmail&username="******"\", \"msgbox\":\"会员尚未通过验证!\"}");
                return;
            }
            else if (model.is_lock == 2) //待审核
            {
                context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("register") + "?action=verify&username="******"\", \"msgbox\":\"会员尚未通过审核!\"}");
                return;
            }
            context.Session[DTKeys.SESSION_USER_INFO] = model;
            context.Session.Timeout = 45;
            //记住登录状态下次自动登录
            if (remember.ToLower() == "true")
            {
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name, 43200);
                Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password, 43200);
            }
            else
            {
                //防止Session提前过期
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "DTcms", model.user_name);
                Utils.WriteCookie(DTKeys.COOKIE_USER_PWD_REMEMBER, "DTcms", model.password);
            }

            //写入登录日志
            new BLL.user_login_log().Add(model.id, model.user_name, "会员登录", DTRequest.GetIP());
            //返回URL
            context.Response.Write("{\"msg\":1, \"msgbox\":\"会员登录成功!\"}");
            return;
        }
Exemplo n.º 60
0
 private void validate_username(HttpContext context)
 {
     string username = DTRequest.GetFormString("username");
     string oldusername = DTRequest.GetFormString("oldusername");
     //如果为Null,退出
     if (string.IsNullOrEmpty(username))
     {
         context.Response.Write("false");
         return;
     }
     Model.userconfig userConfig = new BLL.userconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_USER_XML_CONFING));
     //过滤注册用户名字符
     string[] strArray = userConfig.regkeywords.Split(',');
     foreach (string s in strArray)
     {
         if (s.ToLower() == username.ToLower())
         {
             context.Response.Write("false");
             return;
         }
     }
     //检查是否修改操作
     if (username == oldusername)
     {
         context.Response.Write("true");
         return;
     }
     BLL.users bll = new BLL.users();
     //查询数据库
     if (bll.Exists(username.Trim()))
     {
         context.Response.Write("false");
         return;
     }
     context.Response.Write("true");
     return;
 }