コード例 #1
0
        public async Task <StatusModel> CommentAdd(CommentAddModel amodel)
        {
            StringBuilder strTxt = new StringBuilder();

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

            if (amodel.articleId == 0)
            {
                return(new StatusModel {
                    status = 0, msg = "对不起,参数传输有误!"
                });
            }
            if (string.IsNullOrEmpty(amodel.content))
            {
                return(new StatusModel()
                {
                    status = 0, msg = "对不起,请输入评论的内容!"
                });
            }
            //检查该文章是否存在
            Model.article artModel = new BLL.article().GetModel(amodel.articleId);
            if (artModel == null)
            {
                return(new StatusModel()
                {
                    status = 0, msg = "对不起,主题不存在或已删除!"
                });
            }
            //检查用户是否登录
            int    user_id   = 0;
            string user_name = "匿名用户";
            var    user      = await UserManager.FindByIdAsync(int.Parse(User.Identity.GetUserId()));

            if (user != null)
            {
                user_id   = user.id;
                user_name = user.user_name;
            }
            model.channel_id = artModel.channel_id;
            model.article_id = artModel.id;
            model.content    = Utils.ToHtml(amodel.content);
            model.user_id    = user_id;
            model.user_name  = user_name;
            model.user_ip    = DTRequest.GetIP();
            model.is_lock    = siteConfig.commentstatus; //审核开关
            model.add_time   = DateTime.Now;
            model.is_reply   = 0;
            if (bll.Add(model) > 0)
            {
                return(new StatusModel()
                {
                    status = 1, msg = "留言提交成功!"
                });
            }
            return(new StatusModel()
            {
                status = 0, msg = "对不起,保存过程中发生错误!"
            });
        }
コード例 #2
0
        private Model.AjaxResult Action_Commit(HttpContext context, Model.AjaxResult jsonResult)
        {
            Model.visitor_message info_model = GetCommitInfo();
            string error_msg = CheckCommitInfo(info_model);

            if (!CheckData.IsStringNull(error_msg))
            {
                return(base.ErrorAjaxResult(jsonResult, error_msg));
            }

            info_model.ipaddress = DTRequest.GetIP();
            info_model.TimeAdd   = DateTime.Now;

            BLL.visitor_message bll_vismsg      = new BLL.visitor_message();
            const int           minute_interval = 15;
            int ip_repeat_count = bll_vismsg.GetIPRepeatCount(info_model.ipaddress, info_model.TimeAdd, 15);

            if (ip_repeat_count >= 2)
            {
                return(base.ErrorAjaxResult(jsonResult, @"您提交的太频繁了, 请" + minute_interval.ToString() + @"分钟后再提交!"));
            }
            int rid = bll_vismsg.Add(info_model);

            if (rid > 0)
            {
                jsonResult.Status = Model.AjaxResult.StatusValue.Success;
                jsonResult.Msg    = @"添加记录成功";
            }
            else
            {
                jsonResult.Status = Model.AjaxResult.StatusValue.Error;
                jsonResult.Msg    = @"添加记录失败";
            }
            return(jsonResult);
        }
コード例 #3
0
        /// <summary>
        /// 判断用户是否已经登录
        /// Update  2015/11/21  登录采用Cookies+Redis的方式进行
        /// </summary>
        public bool IsUserLogin()
        {
            //通过Cookies获得SessionID
            string sessionID = Utils.GetCookie(DTKeys.COOKIE_USER_INFO_REMEMBER);

            if (!string.IsNullOrEmpty(sessionID))
            {
                //获取Redis中对应的登录信息
                Model.users model = CacheHelperRedis.Get <Model.users>(sessionID);
                if (model != null)
                {
                    if (model.model_login != null)
                    {
                        if (model.model_login.login_ip.Trim() == DTRequest.GetIP().Trim())
                        {
                            return(true);
                        }
                    }
                }
                else
                {
                    //删除对应的COOKIES
                    Utils.WriteCookie(DTKeys.COOKIE_USER_INFO_REMEMBER, "", 1);
                }
            }
            else
            {
                //删除对应的COOKIES
                Utils.WriteCookie(DTKeys.COOKIE_USER_INFO_REMEMBER, "", 1);
            }
            return(false);
        }
コード例 #4
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;
        }
コード例 #5
0
ファイル: user_edit.aspx.cs プロジェクト: yilulu/Way-diguang
        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);
        }
コード例 #6
0
        private void comment_add(HttpContext context)
        {
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));
            StringBuilder    strTxt     = new StringBuilder();

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

            string _code       = DTRequest.GetFormString("txtCode");
            int    _channel_id = DTRequest.GetQueryInt("channel_id");
            int    _content_id = DTRequest.GetQueryInt("content_id");
            string _title      = DTRequest.GetFormString("txtTitle");
            string _content    = DTRequest.GetFormString("txtContent");

            //校检验证码
            if (string.IsNullOrEmpty(_code))
            {
                context.Response.Write("{msg:0, msgbox:\"对不起,请输入验证码!\"}");
                return;
            }
            if (context.Session[DTKeys.SESSION_CODE] == null)
            {
                context.Response.Write("{msg:0, msgbox:\"对不起,系统找不到生成的验证码!\"}");
                return;
            }
            if (_code.ToLower() != (context.Session[DTKeys.SESSION_CODE].ToString()).ToLower())
            {
                context.Response.Write("{msg:0, msgbox:\"您输入的验证码与系统的不一致!\"}");
                return;
            }
            if (_channel_id == 0 || _content_id == 0)
            {
                context.Response.Write("{msg: 0, msgbox: \"对不起,参数传输有误!\"}");
                return;
            }
            if (string.IsNullOrEmpty(_content))
            {
                context.Response.Write("{msg: 0, msgbox: \"对不起,请输入评论的内容!\"}");
                return;
            }

            model.channel_id = _channel_id;
            model.content_id = _content_id;
            model.title      = _title;
            model.content    = Utils.ToHtml(_content);
            model.user_name  = "游客";
            model.user_ip    = DTRequest.GetIP();
            model.is_lock    = siteConfig.commentstatus; //审核开关
            model.add_time   = DateTime.Now;
            model.is_reply   = 0;
            if (bll.Add(model) > 0)
            {
                context.Response.Write("{msg: 1, msgbox: \"恭喜您,留言提交成功啦!\"}");
                return;
            }
            context.Response.Write("{msg: 0, msgbox: \"对不起,保存过程中发生错误!\"}");
            return;
        }
コード例 #7
0
ファイル: webHelper.cs プロジェクト: tonyyzz/UQingHrMng
 /// <summary>
 /// 添加日志
 /// </summary>
 /// <param name="content">日志内容</param>
 public static void addLog(string content)
 {
     ZhongLi.Model.sys_Logs log = new ZhongLi.Model.sys_Logs();
     log.UserID    = Convert.ToInt32(Utils.GetCookie("UserID"));
     log.Remark    = content;
     log.AddTime   = DateTime.Now + "";
     log.IpAddress = DTRequest.GetIP();
     new ZhongLi.Bll.sys_Logs().Add(log);
 }
コード例 #8
0
 /// <summary>
 /// 增加管理日志
 /// </summary>
 /// <param name="用户id"></param>
 /// <param name="用户名"></param>
 /// <param name="操作类型"></param>
 /// <param name="备注"></param>
 /// <returns></returns>
 public int Add(int user_id, string user_name, string action_type, string remark)
 {
     Model.manager_log manager_log_model = new Model.manager_log();
     manager_log_model.user_id     = user_id;
     manager_log_model.user_name   = user_name;
     manager_log_model.action_type = action_type;
     manager_log_model.remark      = remark;
     manager_log_model.user_ip     = DTRequest.GetIP();
     return(dal.Add(manager_log_model));
 }
コード例 #9
0
ファイル: user_login_log.cs プロジェクト: ymh007/hyfp
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(int user_id, string user_name, string remark)
 {
     Model.user_login_log model = new Model.user_login_log();
     model.user_id    = user_id;
     model.user_name  = user_name;
     model.remark     = remark;
     model.login_ip   = DTRequest.GetIP();
     model.login_time = DateTime.Now;
     return(dal.Add(model));
 }
コード例 #10
0
ファイル: userinfo.aspx.cs プロジェクト: yilulu/Way-diguang
        //确认
        protected void btnlogin_Click(object sender, ImageClickEventArgs e)
        {
            Model.users model = daluser.GetModel(WEBUserCurrent.UserID);
            BLL.users   bll   = new BLL.users();
            model.user_name = lblUsername.Text.Trim();
            if (!string.IsNullOrEmpty(txtpassword.Text))
            {
                model.password = DESEncrypt.Encrypt(txtpassword.Text);
            }

            model.email     = txtemall.Value;
            model.nick_name = txtName.Value;
            if (fileUpImage.HasFile)
            {
                string extendName = fileUpImage.FileName.Substring(fileUpImage.FileName.LastIndexOf('.'));
                string filename   = DateTime.Now.ToString("yyyyMMddhhmmss") + extendName;
                if (!System.IO.Directory.Exists(Server.MapPath("upload/user/")))
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath("upload/user/"));
                }

                fileUpImage.SaveAs(Server.MapPath("upload/user/" + filename));
                model.avatar = filename;
            }
            else
            {
                model.avatar = ViewState["Image"].ToString();
            }
            model.sex = rblSex.SelectedValue;
            DateTime _birthday;

            //if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            //{
            //    model.birthday = _birthday;
            //}
            model.telphone = txtphone.Value.Trim();
            model.mobile   = txtMobile.Value.Trim();
            model.qq       = txtQQ.Value;
            model.address  = txtAddress.Value.Trim();
            model.amount   = 0;
            model.point    = 0;
            model.exp      = 0;
            //model.reg_time = DateTime.Now;
            model.reg_ip        = DTRequest.GetIP();
            model.safe_question = txtsafe_question.Value;
            model.safe_answer   = txtsafe_answer.Value;
            if (bll.Update(model) == false)
            {
                this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('網路異常,請重試!')</script>");
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('修改資料成功!')</script>");
            }
        }
コード例 #11
0
ファイル: manager_log.cs プロジェクト: Hcq/Rain
 public int Add(int user_id, string user_name, string action_type, string remark)
 {
     return(this.dal.Add(new Rain.Model.manager_log()
     {
         user_id = user_id,
         user_name = user_name,
         action_type = action_type,
         remark = remark,
         user_ip = DTRequest.GetIP()
     }));
 }
コード例 #12
0
 public int Add(int user_id, string user_name, string remark)
 {
     return(this.dal.Add(new Rain.Model.user_login_log()
     {
         user_id = user_id,
         user_name = user_name,
         remark = remark,
         login_ip = DTRequest.GetIP(),
         login_time = DateTime.Now
     }));
 }
コード例 #13
0
 /// <summary>
 /// 增加管理日志
 /// </summary>
 /// <param name="用户id"></param>
 /// <param name="用户名"></param>
 /// <param name="操作类型"></param>
 /// <param name="备注"></param>
 /// <returns></returns>
 public int Add(int user_id, string user_name, string action_type, string remark)
 {
     Model.manager_log managerLogModel = new Model.manager_log
     {
         user_id     = user_id,
         user_name   = user_name,
         action_type = action_type,
         remark      = remark,
         user_ip     = DTRequest.GetIP()
     };
     return(dal.Add(managerLogModel));
 }
コード例 #14
0
ファイル: Global.asax.cs プロジェクト: yilulu/Way-diguang
 protected void Application_Start(object sender, EventArgs e)
 {
     #region 记录网站访问
     BLL.ipAccess   bll_ipAccess = new BLL.ipAccess();
     Model.ipAccess entity       = new Model.ipAccess();
     entity.iP_Address  = DTRequest.GetIP();
     entity.iP_DateTime = DateTime.Now;
     if (!bll_ipAccess.Exists(entity.iP_Address))
     {
         bll_ipAccess.Add(entity);
     }
     #endregion
 }
コード例 #15
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);
            model.gongsi   = txtLinkUrl.Text.Trim();
            model.note     = txtNote.Text;
            model.jingli   = txtContent.Value;
            model.exp      = Utils.StringToNum(txtSortId.Text.Trim());
            //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("111");
            //model.email = txtEmail.Text;
            model.nick_name = txtLogSpec.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 (chkPoint.Checked == true)
            //{
            //    model.exp = 1;
            //}
            //else
            //{
            //    model.exp = 0;
            //}
            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return(result);
        }
コード例 #16
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()))
            {
                JscriptMsg("用户名已存在!", "", "Error");
                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.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();
            model.province  = Convert.ToInt32(ddl_province.SelectedValue);
            model.city      = Convert.ToInt32(ddl_city.SelectedValue);
            model.district  = Convert.ToInt32(ddl_district.SelectedValue);
            model.user_type = Convert.ToInt32(rb_user_type.SelectedValue);
            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                result = true;
            }
            return(result);
        }
コード例 #17
0
        public static void AppendAdminLog(this Agp2pDataContext context, string actionType, string remark, bool sysLog = true, int userId = 1, string userName = "******")
        {
            var dtManagerLog = new dt_manager_log
            {
                user_id     = userId,
                user_name   = userName,
                action_type = actionType,
                remark      = remark,
                user_ip     = sysLog ? "" : DTRequest.GetIP(),
                add_time    = DateTime.Now
            };

            context.dt_manager_log.InsertOnSubmit(dtManagerLog);
        }
コード例 #18
0
        public static int AddLogs(string Remark)
        {
            ZhongLi.Bll.sys_Logs manager = new ZhongLi.Bll.sys_Logs();
            int result = 0;

            ZhongLi.Model.sys_Logs syslogs = new ZhongLi.Model.sys_Logs();
            syslogs.UserID    = Convert.ToInt32(Utils.GetCookie("AdminID"));
            syslogs.Remark    = Remark;
            syslogs.IpAddress = DTRequest.GetIP();
            syslogs.AddTime   = DateTime.Now.ToString();
            if (manager.Add(syslogs) > 0)
            {
                result = 1;
            }
            return(result);
        }
コード例 #19
0
ファイル: AddUser.aspx.cs プロジェクト: zimo1988/dtcms
        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.Text.Trim()))
            //{
            //    return;
            //}
            model.user_name = tel.Text.Trim();
            model.salt      = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password = DESEncrypt.Encrypt("123456", model.salt);
            model.reg_time = DateTime.Now;
            model.reg_ip   = DTRequest.GetIP();
            model.mobile   = tel.Text.Trim();
            List <string> list       = new List <string>();
            string        aa         = Request.Form["IntegralCode"];
            var           codes_list = Request.Form["IntegralCode"].Split(',');

            BLL.BarCode bllBar = new BLL.BarCode();
            DataSet     ds     = null;

            ds = bllBar.QueryIntegralRatioSum(Request.Form["IntegralCode"]);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < codes_list.Length; i++)
                {
                    if (!list.Contains(codes_list[i]))
                    {
                        list.Add(codes_list[i]);
                    }
                }

                if (bll.Add(model, Convert.ToInt32(ds.Tables[0].Rows[0][0]), list))
                {
                    ClientScript.RegisterStartupScript(GetType(), "", "TipSuccess();", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(), "", "TipFail();", true);
                }
            }
        }
コード例 #20
0
        /**
         *
         * 测速上报接口实现
         * @param WxPayData inputObj 提交给测速上报接口的参数
         * @param int timeOut 测速上报接口超时时间
         * @throws WxPayException
         * @return 成功时返回测速上报接口返回的结果,其他抛异常
         */
        public static WxPayData Report(WxPayData inputObj, int timeOut = 1)
        {
            JsApiConfig jsApiConfig = new JsApiConfig();
            string      url         = "https://api.mch.weixin.qq.com/payitil/report";

            //检测必填参数
            if (!inputObj.IsSet("interface_url"))
            {
                throw new WxPayException("接口URL,缺少必填参数interface_url!");
            }
            if (!inputObj.IsSet("return_code"))
            {
                throw new WxPayException("返回状态码,缺少必填参数return_code!");
            }
            if (!inputObj.IsSet("result_code"))
            {
                throw new WxPayException("业务结果,缺少必填参数result_code!");
            }
            if (!inputObj.IsSet("user_ip"))
            {
                throw new WxPayException("访问接口IP,缺少必填参数user_ip!");
            }
            if (!inputObj.IsSet("execute_time_"))
            {
                throw new WxPayException("接口耗时,缺少必填参数execute_time_!");
            }

            inputObj.SetValue("appid", jsApiConfig.AppId);                      //公众账号ID
            inputObj.SetValue("mch_id", jsApiConfig.Partner);                   //商户号
            inputObj.SetValue("user_ip", DTRequest.GetIP());                    //终端ip
            inputObj.SetValue("time", DateTime.Now.ToString("yyyyMMddHHmmss")); //商户上报时间
            inputObj.SetValue("nonce_str", GenerateNonceStr());                 //随机字符串
            inputObj.SetValue("sign", inputObj.MakeSign(jsApiConfig.Key));      //签名
            string xml = inputObj.ToXml();

            string response = HttpService.Post(xml, url, false, timeOut);

            WxPayData result = new WxPayData();

            result.FromXml(response, jsApiConfig.Key);
            return(result);
        }
コード例 #21
0
        private bool DoAdd()
        {
            bool flag = false;

            Rain.Model.users model = new Rain.Model.users();
            Rain.BLL.users   users = new Rain.BLL.users();
            model.group_id = int.Parse(this.ddlGroupId.SelectedValue);
            model.status   = int.Parse(this.rblStatus.SelectedValue);
            if (users.Exists(this.txtUserName.Text.Trim()))
            {
                return(false);
            }
            model.user_name = Utils.DropHTML(this.txtUserName.Text.Trim());
            model.salt      = Utils.GetCheckCode(6);
            model.password  = DESEncrypt.Encrypt(this.txtPassword.Text.Trim(), model.salt);
            model.email     = Utils.DropHTML(this.txtEmail.Text);
            model.nick_name = Utils.DropHTML(this.txtNickName.Text);
            model.avatar    = Utils.DropHTML(this.txtAvatar.Text);
            model.sex       = this.rblSex.SelectedValue;
            DateTime result;

            if (DateTime.TryParse(this.txtBirthday.Text.Trim(), out result))
            {
                model.birthday = new DateTime?(result);
            }
            model.telphone = Utils.DropHTML(this.txtTelphone.Text.Trim());
            model.mobile   = Utils.DropHTML(this.txtMobile.Text.Trim());
            model.qq       = Utils.DropHTML(this.txtQQ.Text);
            model.msn      = Utils.DropHTML(this.txtMsn.Text);
            model.address  = Utils.DropHTML(this.txtAddress.Text.Trim());
            model.amount   = Decimal.Parse(this.txtAmount.Text.Trim());
            model.point    = int.Parse(this.txtPoint.Text.Trim());
            model.exp      = int.Parse(this.txtExp.Text.Trim());
            model.reg_time = DateTime.Now;
            model.reg_ip   = DTRequest.GetIP();
            if (users.Add(model) > 0)
            {
                this.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name);
                flag = true;
            }
            return(flag);
        }
コード例 #22
0
        /// <summary>
        /// 取得当前用户准确信息
        /// </summary>
        public Model.users GetUserInfo(bool needNew = true)
        {
            Model.users_login modellogin = new Model.users_login();
            //通过Cookies获得SessionID
            string sessionID = Utils.GetCookie(DTKeys.COOKIE_USER_INFO_REMEMBER);

            if (!string.IsNullOrEmpty(sessionID))
            {
                //获取Redis中对应的登录信息
                Model.users model = CacheHelperRedis.Get <Model.users>(sessionID);
                if (model != null)
                {
                    if (model.model_login != null)
                    {
                        if (model.model_login.login_ip.Trim() == DTRequest.GetIP().Trim())
                        {
                            return(needNew ? new BLL.users().GetModel(model.id) : model);
                        }
                    }
                }
            }
            return(null);
        }
コード例 #23
0
 /// <summary>
 /// 判断管理员是否已经登录(解决Session超时问题)
 /// </summary>
 public bool IsAdminLogin()
 {
     //如果Session为Null
     if (System.Web.HttpContext.Current.Session[DTKeys.SESSION_ADMIN_INFO] != null)
     {
         return(true);
     }
     else
     {
         //检查Cookies
         string adminname = Utils.GetCookie("AdminName", "DTcms");
         string adminpwd  = Utils.GetCookie("AdminPwd", "DTcms");
         //cookies密码解密
         try
         {
             //用户名加密
             adminname = DESEncrypt.Decrypt(adminname, DTKeys.COOKIE_KEY);
             //密码绑定IP
             adminpwd = DESEncrypt.Decrypt(adminpwd, DTRequest.GetIP());
         }
         catch
         {
             return(false);
         }
         if (adminname != "" && adminpwd != "")
         {
             BLL.manager   bll   = new BLL.manager();
             Model.manager model = bll.GetModel(adminname, adminpwd);
             if (model != null)
             {
                 System.Web.HttpContext.Current.Session[DTKeys.SESSION_ADMIN_INFO] = model;
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #24
0
ファイル: user_edit.aspx.cs プロジェクト: eazytec/TestGit
        private bool DoAdd()
        {
            bool result = true;

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

            model.group_id  = int.Parse(ddlGroupId.SelectedValue);
            model.is_lock   = int.Parse(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.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) < 1)
            {
                result = false;
            }
            return(result);
        }
コード例 #25
0
ファイル: paypage.aspx.cs プロジェクト: zklve/MallWechat
    /// <summary>
    /// 微信支付:生成请求数据
    /// </summary>
    /// <param name="openid">微信用户id</openid>
    /// <param name="ttFee">商品总价格</param>
    /// <param name="busiBody"></param>
    /// <returns></returns>
    protected void WxPayData(decimal ttFee, string busiBody, string out_trade_no)
    {
        WxPayHelper wxPayHelper = new WxPayHelper();
        //BLL.wx_payment_wxpay wxPayBll = new BLL.wx_payment_wxpay();
        //Model.wx_payment_wxpay paymentInfo = wxPayBll.GetModelByWid(wid);

        //先设置基本信息
        string partnerId  = "1220201501";                                                                                                                   // "1220201501";//
        string appId      = "wxe5d8d2c5589f5ffb";                                                                                                           // "wxe5d8d2c5589f5ffb";//
        string partnerKey = "19ace89a7acd6e14ac3c66b2852f14d6";                                                                                             // "19ace89a7acd6e14ac3c66b2852f14d6";//
        //paysignkey(非appkey)
        string appKey = "YOFbXGzn0i8ZH8UlfqH7D7LpHHCXd4CxNqZgLffI8v58GSpxntqnVOx5zJFrsM2efT6XH89Nr0WDpfZjcfYCHD05uteWUfHq6BG8zuyTAe4uQ39yKOKqwYwl6yhgKueb"; //"YOFbXGzn0i8ZH8UlfqH7D7LpHHCXd4CxNqZgLffI8v58GSpxntqnVOx5zJFrsM2efT6XH89Nr0WDpfZjcfYCHD05uteWUfHq6BG8zuyTAe4uQ39yKOKqwYwl6yhgKueb";//

        wxPayHelper.SetAppId(appId);
        wxPayHelper.SetAppKey(appKey);
        wxPayHelper.SetPartnerKey(partnerKey);
        wxPayHelper.SetSignType("SHA1");
        //设置请求package信息
        wxPayHelper.SetParameter("bank_type", "WX");
        wxPayHelper.SetParameter("body", busiBody);
        wxPayHelper.SetParameter("attach", wid + "|" + busiBody);
        wxPayHelper.SetParameter("partner", partnerId);
        wxPayHelper.SetParameter("out_trade_no", out_trade_no);
        wxPayHelper.SetParameter("total_fee", ((int)(ttFee * 100)).ToString());
        wxPayHelper.SetParameter("fee_type", "1");
        // wxPayHelper.SetParameter("notify_url", "http://" + HttpContext.Current.Request.Url.Authority + "/api/payment/wxpay/notify_url.aspx?wid="+wid);

        wxPayHelper.SetParameter("notify_url", "http://" + HttpContext.Current.Request.Url.Authority + "/api/payment/wxpay/notify_url.aspx");//不能带参数
        wxPayHelper.SetParameter("spbill_create_ip", DTRequest.GetIP());
        wxPayHelper.SetParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
        //---------有效期截至日期------

        wxPayHelper.SetParameter("time_expire", DateTime.Now.AddMinutes(expireMinute).ToString("yyyyMMddHHmmss"));

        wxPayHelper.SetParameter("input_charset", "UTF-8");
        packageValue = wxPayHelper.CreateBizPackage();
    }
コード例 #26
0
ファイル: register.aspx.cs プロジェクト: yilulu/Way-diguang
        protected void btnlogin_Click(object sender, ImageClickEventArgs e)
        {
            bool result = true;

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

            //model.is_lock = int.Parse(rblIsLock.SelectedValue);
            model.user_name = txtusername.Value.Trim();
            model.password  = DESEncrypt.Encrypt(txtpassword.Value);
            model.email     = txtemall.Value;
            model.nick_name = txtName.Value;
            if (fileUpImage.HasFile)
            {
                string extendName = fileUpImage.FileName.Substring(fileUpImage.FileName.LastIndexOf('.'));
                string filename   = DateTime.Now.ToString("yyyyMMddhhmmss") + extendName;
                if (!System.IO.Directory.Exists(Server.MapPath("upload/user/")))
                {
                    System.IO.Directory.CreateDirectory(Server.MapPath("upload/user/"));
                }

                fileUpImage.SaveAs(Server.MapPath("upload/user/" + filename));
                model.avatar = filename;
            }
            //model.sex = rblSex.SelectedValue;
            //DateTime _birthday;
            //if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            //{
            //    model.birthday = _birthday;
            //}
            model.mobile = txtphone.Value.Trim();
            //model.qq = "";
            model.address = txtAddress.Value.Trim();
            model.amount  = 0;
            model.point   = 0;
            switch (type)
            {
            case 1:
                model.amount = 0;
                break;

            case 2:
                model.amount = 100;
                break;

            case 3:
                model.amount = 200;
                break;

            case 4:
                model.amount = 300;
                break;
            }

            model.exp      = 0;
            model.reg_time = DateTime.Now;
            model.reg_ip   = DTRequest.GetIP();

            //if (ddlGroup.SelectedValue == "0")
            //{
            //    model.group_id = 1;
            //}
            //else
            //{
            model.group_id = Utils.StringToNum(ddlGroup.SelectedValue);
            model.dianming = txtIntroduce.Value;
            //model.dianmiaoshu = dianmiaoshu.Value;
            //model.congye = congye.Value;
            model.gongsi   = gongsi.Value;
            model.fuwuquyu = CompanyName.Value;
            //model.fuwuquyu = fuwuquyu.Value;
            //model.shuxishequ = shuxishequ.Value;
            //model.fuwutechang = fuwutechang.Value;
            //model.jingli = jingli.Value;
            //model.zhengshu = zhengshu.Value;
            model.note    = note.Value;
            model.is_lock = 1;
            //}
            if (bll.Add(model) < 1)
            {
                this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('網路異常,請重試')</script>");
            }
            else
            {
                login();
                //this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('註冊成功,請登入');window.location.href='login.aspx'</script>");
            }
        }
コード例 #27
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);
            }
        }
コード例 #28
0
ファイル: index.aspx.cs プロジェクト: yuebon/YuebonCms
        protected void Page_Load(object sender, EventArgs e)
        {
            //读取站点配置信息
            Model.sysconfig sysConfig       = new BLL.sysconfig().loadConfig();
            int             site_payment_id = 0; //订单支付方式

            //=============================获得订单信息================================
            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");

            //检查参数是否正确
            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;
                }
                site_payment_id = model.payment_id; //站点支付方式ID
            }
            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;
                }
                site_payment_id = model.payment_id; //站点支付方式ID
            }
            if (user_name != "")
            {
                user_name = "支付会员:" + user_name;
            }
            else
            {
                user_name = "匿名用户";
            }

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

            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("payment_type", "1");                          //收款类型1商品购买
            sParaTemp.Add("show_url", sysConfig.weburl);                 //商品展示地址
            sParaTemp.Add("out_trade_no", order_no);                     //网站订单号
            sParaTemp.Add("subject", sysConfig.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(site_payment_id);
            string  sHtmlText = ali.Create_direct_pay_by_user(sParaTemp);

            Response.Write(sHtmlText);
        }
コード例 #29
0
        }                                            //支付成功跳转的地址
        protected void Page_Load(object sender, EventArgs e)
        {
            string  openid       = DTRequest.GetQueryString("openid");
            string  order_no     = DTRequest.GetQueryString("order_no");
            decimal order_amount = 0;            //订单金额
            string  subject1     = string.Empty; //订单备注1
            string  subject2     = string.Empty; //订单备注2

            //检查参数是否正确
            if (string.IsNullOrEmpty(openid) || string.IsNullOrEmpty(order_no))
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,获取OPENID参数有误!")));
                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;
                }
                order_amount = model.amount; //订单金额
                subject1     = "充值订单";
                subject2     = "用户名:" + model.user_name;
            }
            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;
                }
                order_amount = model.order_amount; //订单金额
                subject1     = "商品订单";
                if (model.user_id > 0)
                {
                    subject2 = "用户名:" + model.user_name;
                }
                else
                {
                    subject2 = "匿名用户";
                }
            }

            //JSAPI支付预处理
            try
            {
                //统一下单
                string      sendUrl     = "https://api.mch.weixin.qq.com/pay/unifiedorder";
                JsApiConfig jsApiConfig = new JsApiConfig();
                WxPayData   data        = new WxPayData();
                data.SetValue("body", subject1);                                               //商品描述
                data.SetValue("detail", subject2);                                             //商品详情
                data.SetValue("out_trade_no", order_no);                                       //商户订单号
                data.SetValue("total_fee", (Convert.ToDouble(order_amount) * 100).ToString()); //订单总金额,以分为单位
                data.SetValue("trade_type", "JSAPI");                                          //交易类型
                data.SetValue("openid", openid);                                               //公众账号ID
                data.SetValue("appid", jsApiConfig.AppId);                                     //公众账号ID
                data.SetValue("mch_id", jsApiConfig.Partner);                                  //商户号
                data.SetValue("nonce_str", JsApiPay.GenerateNonceStr());                       //随机字符串
                data.SetValue("notify_url", jsApiConfig.Notify_url);                           //异步通知url
                data.SetValue("spbill_create_ip", DTRequest.GetIP());                          //终端IP
                data.SetValue("sign", data.MakeSign(jsApiConfig.Key));                         //签名
                string    xml       = data.ToXml();                                            //转换成XML
                var       startTime = DateTime.Now;                                            //开始时间
                string    response  = HttpService.Post(xml, sendUrl, false, 6);                //发送请求
                var       endTime   = DateTime.Now;                                            //结束时间
                int       timeCost  = (int)((endTime - startTime).TotalMilliseconds);          //计算所用时间
                WxPayData result    = new WxPayData();
                result.FromXml(response, jsApiConfig.Key);
                JsApiPay.ReportCostTime(sendUrl, timeCost, result);//测速上报

                //获取H5调起JS API参数
                WxPayData jsApiParam = new WxPayData();
                jsApiParam.SetValue("appId", result.GetValue("appid"));
                jsApiParam.SetValue("timeStamp", JsApiPay.GenerateTimeStamp());
                jsApiParam.SetValue("nonceStr", JsApiPay.GenerateNonceStr());
                jsApiParam.SetValue("package", "prepay_id=" + result.GetValue("prepay_id"));
                jsApiParam.SetValue("signType", "MD5");
                jsApiParam.SetValue("paySign", jsApiParam.MakeSign(jsApiConfig.Key));
                wxJsApiParam = jsApiParam.ToJson();

                //支付成功后跳转的URL
                returnUrl = new Web.UI.BasePage().linkurl("payment", "?action=succeed&order_no=" + order_no);
            }
            catch (Exception ex)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("调用JSAPI下单失败,请检查微信授权目录是否已注册!")));
                return;
            }
        }
コード例 #30
0
ファイル: login.aspx.cs プロジェクト: w1146869587/Hoto-cms
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string userName = txtUserName.Text.Trim();
            string userPwd  = txtUserPwd.Text.Trim();
            string code     = txtCode.Text.Trim();

            if (userName.Equals("") || userPwd.Equals(""))
            {
                lblTip.Visible = true;
                lblTip.Text    = "请输入用户名或密码";
                return;
            }
            if (code.Equals(""))
            {
                lblTip.Visible = true;
                lblTip.Text    = "请输入验证码";
                return;
            }
            if (Session[DTKeys.SESSION_CODE] == null)
            {
                lblTip.Visible = true;
                lblTip.Text    = "系统找不到验证码";
                return;
            }
            if (code.ToLower() != Session[DTKeys.SESSION_CODE].ToString().ToLower())
            {
                lblTip.Visible = true;
                lblTip.Text    = "验证码输入不正确";
                return;
            }
            BLL.manager   bll   = new BLL.manager();
            Model.manager model = bll.GetModel(userName, DESEncrypt.Encrypt(userPwd));
            if (model == null)
            {
                lblTip.Visible = true;
                lblTip.Text    = "用户名或密码有误";
                return;
            }
            Session[DTKeys.SESSION_ADMIN_INFO] = model;
            Session.Timeout = 45;
            //写入登录日志
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING));
            if (siteConfig.logstatus > 0)
            {
                Model.manager_log modelLog = new Model.manager_log();
                modelLog.user_id     = model.id;
                modelLog.user_name   = model.user_name;
                modelLog.action_type = "login";
                modelLog.note        = "用户登录";
                modelLog.login_ip    = DTRequest.GetIP();
                modelLog.login_time  = DateTime.Now;
                new BLL.manager_log().Add(modelLog);
            }
            //写入Cookies
            if (cbRememberId.Checked)
            {
                Utils.WriteCookie("DTRememberName", model.user_name, 14400);
            }
            else
            {
                Utils.WriteCookie("DTRememberName", model.user_name, -14400);
            }
            Utils.WriteCookie("AdminName", "DTcms", model.user_name);
            Utils.WriteCookie("AdminPwd", "DTcms", model.user_pwd);
            Response.Redirect("index.aspx");
            return;
        }