Beispiel #1
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     = MXRequest.GetIP();
     return(dal.Add(manager_log_model));
 }
Beispiel #2
0
 /// <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   = MXRequest.GetIP();
     model.login_time = DateTime.Now;
     return(dal.Add(model));
 }
Beispiel #3
0
        private bool DoAdd()
        {
            //地区
            string prov = ddlProvince.SelectedItem.Value;
            string city = ddlCity.SelectedItem.Value;
            string dist = txtArea.Text.Trim();


            Model.dt_manager model = new Model.dt_manager();
            BLL.dt_manager   bll   = new BLL.dt_manager();
            model.role_id   = int.Parse(ddlRoleId.SelectedValue);
            model.SectionId = Convert.ToInt32(ddlSection.SelectedValue);
            model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type;
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return(false);
            }
            model.user_name = txtUserName.Text.Trim();
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password  = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.real_name = txtRealName.Text.Trim();
            model.telephone = txtTelephone.Text.Trim();
            model.email     = txtEmail.Text.Trim();
            model.add_time  = DateTime.Now;
            model.wxNum     = int.Parse(txtMaxNum.Text);
            model.agentId   = GetAdminInfo().id;
            model.qq        = txtqq.Text;
            model.email     = txtEmail.Text;
            model.reg_ip    = MXRequest.GetIP();
            model.province  = prov;
            model.city      = city;
            model.county    = dist;
            model.sort_id   = MyCommFun.Obj2Int(txtSortid.Text);

            if (bll.Insert(model) > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                return(true);
            }
            return(false);
        }
        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.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   = MXRequest.GetIP();

            if (bll.Add(model) > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                result = true;
            }
            return(result);
        }
Beispiel #5
0
        private bool DoAdd()
        {
            //地区
            string prov = ddlProvince.SelectedItem.Value;
            string city = ddlCity.SelectedItem.Value;
            string dist = "";


            Model.manager model = new Model.manager();
            BLL.manager   bll   = new BLL.manager();
            model.role_id   = 2;
            model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type;
            model.is_lock   = 0;

            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return(false);
            }
            model.user_name = txtUserName.Text.Trim();
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password  = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.real_name = txtRealName.Text.Trim();
            model.telephone = txtTelephone.Text.Trim();
            model.email     = "";
            model.add_time  = DateTime.Now;
            model.wxNum     = 3;
            model.agentId   = 1;
            model.qq        = txtqq.Text;
            model.email     = "";
            model.reg_ip    = MXRequest.GetIP();
            model.province  = prov;
            model.city      = city;
            model.county    = dist;
            model.sort_id   = 99;

            if (bll.Add(model) > 0)
            {
                // mp.AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "注册用户:" + model.user_name); //记录日志
                return(true);
            }
            return(false);
        }
Beispiel #6
0
        /// <summary>
        /// 增加管理日志
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="sessionId"></param>
        /// <param name="userName"></param>
        /// <param name="actionType"></param>
        /// <param name="remark"></param>
        /// <returns></returns>
        public int Add(int userId, string sessionId, string userName, string actionType, string remark)
        {
            var managerLogInfo = new ManagerLogInfo
            {
                UserId     = userId,
                SessionId  = sessionId,
                UserName   = userName,
                ActionType = actionType,
                Remark     = remark,
                AddTime    = DateTime.Now,
#if DEBUG
                UserIp = "127.0.0.1"
#else
                UserIp = MXRequest.GetIP()
#endif
            };

            return(_repository.Add(managerLogInfo));
        }
Beispiel #7
0
        /// <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  = paymentInfo.partnerId;  // "1218574001";//
            string appId      = paymentInfo.appId;      // "wxa9b8e33e48ac5e0f";//
            string partnerKey = paymentInfo.partnerKey; // "huyuxianghuyuxianghuyuxiang12345";//
            //paysignkey(非appkey)
            string appKey = paymentInfo.paySignKey;     //"nwRmqgvSG08pe3vU5qzBLb7Bvih0WOABGzUPvqgFqE0iSkJlJ8wh7JlLYy2cXFgFA3v1bM8eTDm1y1UcyeW9IGq2py2qei7J5xDoVR9lfO3cS6fMjFbMQeeqBRit0bKp";//

            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", MXRequest.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();
        }
Beispiel #8
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action = MyCommFun.QueryString("myact");
            string openid  = MyCommFun.RequestOpenid(); //得到微信用户的openid
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();
            int sid = MyCommFun.RequestInt("sid");
            int uid = 0;

            BLL.wx_ucard_store               storeBll = new BLL.wx_ucard_store();
            BLL.wx_ucard_users_consumeinfo   conBll   = new BLL.wx_ucard_users_consumeinfo();
            BLL.wx_ucard_score               scoreBll = new BLL.wx_ucard_score();
            BLL.wx_ucard_users               userBll  = new BLL.wx_ucard_users();
            Model.wx_ucard_users_consumeinfo consume  = new Model.wx_ucard_users_consumeinfo();
            Model.wx_ucard_score             score    = new Model.wx_ucard_score();
            Model.wx_ucard_store             store    = storeBll.GetModel(sid);
            if (store == null)
            {
                jsonDict.Add("ret", "err");
                jsonDict.Add("msg", "店铺不存在");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }

            if (_action == "userreg")
            {
                #region //用户第一次领取卡
                jsonDict = new Dictionary <string, string>();

                if (sid == 0)
                {
                    jsonDict.Add("ret", "error");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                string tel      = MyCommFun.QueryString("tel");
                string realName = MyCommFun.QueryString("truename");

                XCWeiXin.Model.wx_ucard_users user = userBll.GetStoreUserInfo(openid, sid);
                if (user == null)
                { //第一次添加
                    user              = new Model.wx_ucard_users();
                    user.mobile       = tel;
                    user.realName     = realName;
                    user.regTime      = DateTime.Now;
                    user.sid          = sid;
                    user.openid       = openid;
                    user.ttScore      = 0;
                    user.consumeScore = 0;
                    user.qdScore      = 0;
                    user.consumeMoney = 0;
                    user.regIp        = MXRequest.GetIP();
                    int ret = userBll.Add(user);
                    if (ret > 0)
                    {
                        jsonDict.Add("ret", "succ");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    }
                    else
                    {
                        jsonDict.Add("ret", "err");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    }
                }
                else
                {
                    user.mobile   = tel;
                    user.realName = realName;
                    user.regTime  = DateTime.Now;
                    user.sid      = sid;
                    user.openid   = openid;
                    user.regIp    = MXRequest.GetIP();
                    bool ret = userBll.Update(user);
                    if (ret)
                    {
                        jsonDict.Add("ret", "succ");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    }
                    else
                    {
                        jsonDict.Add("ret", "err");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    }
                }

                context.Response.End();
                #endregion
            }
            else if (_action == "qiandao")
            {
                #region 签到
                jsonDict = new Dictionary <string, string>();
                sid      = MyCommFun.RequestInt("sid");
                uid      = MyCommFun.RequestInt("uid");
                if (sid == 0 || uid == 0)
                {
                    jsonDict.Add("ret", "error");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                bool hasqd    = conBll.hasDayQD(sid, uid, DateTime.Now);
                int  retScore = 0;
                if (!hasqd)
                {
                    //新增
                    //取签到积分策略
                    score = scoreBll.GetStoreModel(sid);
                    if (score != null)
                    {
                        //判断是否6天连续签到,并且6天内没有给额外的奖励

                        DateTime day6before = DateTime.Now.AddDays(-6);

                        int record = conBll.GetRecordCount("sId=" + sid + " and uid=" + uid + " and moduleType='签到' and addTime>='" + day6before.ToShortDateString() + "' and addTime<'" + DateTime.Now.ToShortDateString() + "' and  moduleActionId=6 ");

                        if (record >= 5)
                        {
                            consume                  = new Model.wx_ucard_users_consumeinfo();
                            consume.sId              = sid;
                            consume.uid              = uid;
                            consume.moduleType       = "签到";
                            consume.moduleActionName = "连续6天签到奖励";
                            consume.moduleActionId   = 6;
                            consume.score            = MyCommFun.Obj2Int(score.qiandao6Score) + score.qiandaoScore.Value;
                            conBll.AddJiFen(consume, 0);
                            retScore = MyCommFun.Obj2Int(score.qiandao6Score) + score.qiandaoScore.Value;
                        }
                        else
                        {
                            consume            = new Model.wx_ucard_users_consumeinfo();
                            consume.sId        = sid;
                            consume.uid        = uid;
                            consume.moduleType = "签到";
                            consume.score      = score.qiandaoScore.Value;
                            conBll.AddJiFen(consume, 0);
                            retScore = score.qiandaoScore.Value;
                        }
                    }
                }

                jsonDict.Add("ret", "succ");
                jsonDict.Add("msg", "+" + retScore + "分,明天继续");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));

                #endregion
            }
            else if (_action == "tequan")
            {
                #region  //消费: 特权 ,注意,只有在新增这个的时候记录user表总积分,修改的时候 对user表的总积分和金额先减后加

                jsonDict = new Dictionary <string, string>();
                sid      = MyCommFun.RequestInt("sid"); //店铺id
                uid      = MyCommFun.RequestInt("uid"); //用户id
                string sn    = MyCommFun.QueryString("sncode");
                string pwd   = MyCommFun.QueryString("parssword");
                float  money = MyCommFun.RequestFloat("money", 0);
                int    pid   = MyCommFun.RequestInt("pid");   //特权主键id
                string type  = MyCommFun.QueryString("type"); //tequan:特权
                if (sid == 0 || uid == 0 || pid == 0)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "error");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (pwd != store.consumePwd)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "密码错误");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                int ssid = userBll.ExistsStoreAndUser(uid);
                if (ssid == 0 || sid != ssid)
                {  //验证,用户存在,店铺存在,并且用户属于这个店铺
                    return;
                }
                BLL.wx_ucard_privileges   privBll    = new BLL.wx_ucard_privileges();
                Model.wx_ucard_privileges privileges = privBll.GetModel(pid);
                if (privileges == null)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "特权不存在");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                //积分策略
                score = scoreBll.GetStoreModel(sid);
                int avgScore = score.consumeMoneyScore.Value / score.consumeMoney.Value;
                //1先添加消费明细,和修改用户的总积分和总消费金额
                //IList<Model.wx_ucard_users_consumeinfo> conlist = conBll.GetModelList("moduleType='特权' and moduleActionId=" + privileges.id + " and sid=" + sid + " and uid=" + uid);
                //if (conlist == null || conlist.Count <= 0 || conlist[0] == null)
                //{
                //新增
                consume = new Model.wx_ucard_users_consumeinfo();
                consume.moduleActionId   = 10;
                consume.moduleType       = "特权";
                consume.moduleActionId   = privileges.id;
                consume.moduleActionName = privileges.pName;
                consume.sId          = sid;
                consume.uid          = uid;
                consume.consumeMoney = (decimal)money;
                consume.addTime      = DateTime.Now;
                consume.sn           = sn;
                consume.pwd          = pwd;
                consume.cMoneyType   = 2;
                consume.score        = (int)(avgScore * money);
                consume.cScoreType   = 1;
                conBll.Add(consume, true);

                //}
                //else
                //{
                //    //修改
                //    consume = conlist[0];
                //    decimal oldMoney = MyCommFun.Obj2Decimal(consume.consumeMoney, 0);
                //    int oldScore = MyCommFun.Obj2Int(consume.score);


                //    consume.moduleActionName = privileges.pName;
                //    consume.consumeMoney = (decimal)money;
                //    consume.sn = sn;
                //    consume.pwd = pwd;
                //    consume.cMoneyType = 2;
                //    consume.score = (int)(avgScore * money);
                //    conBll.UpdateInfoAndUserTT(consume, oldMoney, oldScore);
                //}
                jsonDict.Add("ret", "succ");
                jsonDict.Add("msg", "获得" + consume.score.Value + "积分 ");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));

                #endregion
            }
            else if (_action == "lq_yhq")
            {
                #region 领取优惠券

                jsonDict = new Dictionary <string, string>();
                sid      = MyCommFun.RequestInt("sid"); //店铺id
                uid      = MyCommFun.RequestInt("uid"); //用户id
                string sn       = MyCommFun.QueryString("sncode");
                string pwd      = MyCommFun.QueryString("parssword");
                float  money    = MyCommFun.RequestFloat("money", 0);
                int    ticketId = MyCommFun.RequestInt("cid");//优惠券主键id

                if (sid == 0 || uid == 0 || ticketId == 0)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "error");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (pwd != store.consumePwd)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "密码错误");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                int ssid = userBll.ExistsStoreAndUser(uid);
                if (ssid == 0 || sid != ssid)
                {  //验证,用户存在,店铺存在,并且用户属于这个店铺
                    return;
                }
                BLL.wx_ucard_ticket   ticketBll = new BLL.wx_ucard_ticket();
                Model.wx_ucard_ticket ticket    = ticketBll.GetModel(ticketId);
                if (ticket == null)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "优惠券不存在");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                int syTimes = ticketBll.getsyTimesByTicket(uid, ticketId);
                if (syTimes <= 0)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "已没有使用次数");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                //积分策略
                score = scoreBll.GetStoreModel(sid);
                int avgScore = score.consumeMoneyScore.Value / score.consumeMoney.Value;
                //1先添加消费明细,和修改用户的总积分和总消费金额

                //新增
                consume = new Model.wx_ucard_users_consumeinfo();
                consume.moduleActionId   = 10;
                consume.moduleType       = "优惠券";
                consume.moduleActionId   = ticket.id;
                consume.moduleActionName = ticket.tName;
                consume.sId          = sid;
                consume.uid          = uid;
                consume.consumeMoney = (decimal)money;
                consume.addTime      = DateTime.Now;
                consume.sn           = sn;
                consume.pwd          = pwd;
                consume.cMoneyType   = 2;
                consume.score        = (int)(avgScore * money);
                consume.cScoreType   = 1;
                conBll.Add(consume, true);
                syTimes -= 1;

                jsonDict.Add("ret", "succ");
                jsonDict.Add("msg", "获得" + consume.score.Value + "积分 ");
                jsonDict.Add("sy", syTimes.ToString());
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));


                #endregion
            }
            else if (_action == "gift")
            {
                #region 兑换礼品券

                jsonDict = new Dictionary <string, string>();
                sid      = MyCommFun.RequestInt("sid"); //店铺id
                uid      = MyCommFun.RequestInt("uid"); //用户id
                string sn     = MyCommFun.QueryString("sncode");
                string pwd    = MyCommFun.QueryString("parssword");
                float  money  = MyCommFun.RequestFloat("money", 0);
                int    giftId = MyCommFun.RequestInt("gid");//礼品主键id

                if (sid == 0 || uid == 0 || giftId == 0)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "error");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (pwd != store.consumePwd)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "密码错误");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                int ssid = userBll.ExistsStoreAndUser(uid);
                if (ssid == 0 || sid != ssid)
                {  //验证,用户存在,店铺存在,并且用户属于这个店铺
                    return;
                }
                BLL.wx_ucard_gift   giftBll = new BLL.wx_ucard_gift();
                Model.wx_ucard_gift gift    = giftBll.GetModel(giftId);
                if (gift == null)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "优惠券不存在");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                int userTTScore = userBll.GetUserJiFen(uid);
                if (userTTScore < gift.score.Value)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "积分不够");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                //1先添加消费明细,和修改用户的总积分和总消费金额

                //新增
                consume = new Model.wx_ucard_users_consumeinfo();
                consume.moduleActionId   = 10;
                consume.moduleType       = "礼品券";
                consume.moduleActionId   = gift.id;
                consume.moduleActionName = gift.gName;
                consume.sId        = sid;
                consume.uid        = uid;
                consume.addTime    = DateTime.Now;
                consume.sn         = sn;
                consume.pwd        = pwd;
                consume.score      = -gift.score.Value;
                consume.cScoreType = 1;
                conBll.Add(consume, false);

                jsonDict.Add("ret", "succ");
                jsonDict.Add("msg", "成功兑换礼品扣除 " + gift.score.Value + " 积分 ");

                context.Response.Write(MyCommFun.getJsonStr(jsonDict));


                #endregion
            }
        }
Beispiel #9
0
        private bool DoAdd()
        {
            Model.manager adminEntity = GetAdminInfo(); //取得管理员信息

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

            //固定为餐饮管理员的角色

            model.role_id   = int.Parse(ddlRoleId.SelectedValue);
            model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type;

            model.is_lock = MyCommFun.Str2Int(rblIsLock.SelectedValue);
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return(false);
            }

            model.user_name = txtUserName.Text.Trim();
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password   = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.real_name  = txtRealName.Text.Trim();
            model.telephone  = txtTelephone.Text.Trim();
            model.email      = txtEmail.Text.Trim();
            model.add_time   = DateTime.Now;
            model.wxNum      = 0;
            model.agentId    = GetAdminInfo().id;
            model.qq         = string.Empty;
            model.email      = txtEmail.Text;
            model.reg_ip     = MXRequest.GetIP();
            model.agentLevel = -1;
            model.remark     = txtRemark.Text;
            model.agentId    = adminEntity.id;
            int addId = bll.Add(model);

            if (addId > 0)
            {
                //添加商铺与管理人员的关联
                BLL.wx_hotel_user   hotelUserBll = new BLL.wx_hotel_user();
                Model.wx_hotel_user hotelUser    = new Model.wx_hotel_user();
                hotelUser.ManagerId = addId;
                hotelUser.HotelId   = hotelid;
                hotelUser.AdminId   = GetAdminInfo().id;
                int addhotelAdminId = hotelUserBll.Add(hotelUser);

                if (addhotelAdminId <= 0)
                {
                    bll.Delete(addId);
                    addId = 0;
                }
            }

            if (addId > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加酒店管理员:" + model.user_name); //记录日志
                return(true);
            }
            return(false);
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //读取站点配置信息
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig();

            //=============================获得订单信息================================
            string  order_no     = MXRequest.GetFormString("pay_order_no").ToUpper();
            decimal order_amount = MXRequest.GetFormDecimal("pay_order_amount", 0);
            string  user_name    = MXRequest.GetFormString("pay_user_name");
            string  subject      = MXRequest.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 (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_amount_log model = new BLL.user_amount_log().GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!")));
                    return;
                }
                if (model.value != 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", MXRequest.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);
            }
        }
Beispiel #11
0
        private bool DoAdd()
        {
            Model.manager       adminEntity = GetAdminInfo(); //取得管理员信息
            Model.wx_agent_info agent       = new Model.wx_agent_info();
            bool isAgent = false;

            if (adminEntity.agentLevel < 0)
            {
                return(false);
            }
            if (adminEntity.agentLevel > 0)
            {
                agent   = aBll.GetAgentModel(adminEntity.id);
                isAgent = true;
                if (agent.remainMony < agent.agentPrice)
                {
                    JscriptMsg("余额不足,请联系管理员充值!", "", "Error");
                    return(false);
                }
            }
            else
            {
            }
            //int oldMaxNum = MyCommFun.Str2Int(hidOldMaxNum.Value);
            int newMaxNum = MyCommFun.Str2Int(ddlMaxNum.SelectedItem.Value);

            //地区
            string prov = ddlProvince.SelectedItem.Value;
            string city = ddlCity.SelectedItem.Value;
            string dist = txtArea.Text.Trim();

            Model.manager model = new Model.manager();
            BLL.manager   bll   = new BLL.manager();
            model.role_id   = int.Parse(ddlRoleId.SelectedValue);
            model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type;
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return(false);
            }
            model.user_name = txtUserName.Text.Trim();
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password   = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.real_name  = txtRealName.Text.Trim();
            model.telephone  = txtTelephone.Text.Trim();
            model.email      = txtEmail.Text.Trim();
            model.add_time   = DateTime.Now;
            model.wxNum      = newMaxNum;
            model.agentId    = GetAdminInfo().id;
            model.qq         = txtqq.Text;
            model.email      = txtEmail.Text;
            model.reg_ip     = MXRequest.GetIP();
            model.province   = prov;
            model.city       = city;
            model.county     = dist;
            model.sort_id    = MyCommFun.Obj2Int(txtSortid.Text);
            model.agentLevel = -1;
            model.remark     = txtRemark.Text;
            model.agentId    = adminEntity.id;
            int addId = bll.Add(model);

            if (addId > 0 && isAgent)
            {
                int xfjine = newMaxNum * agent.agentPrice.Value;//消费金额

                //是代理商 :缴费,扣除金额,增加消费记录
                agent.remainMony -= xfjine;
                agent.userNum    += 1;
                agent.wcodeNum   += newMaxNum;
                bool updateRet = aBll.Update(agent);

                if (updateRet)
                {
                    BLL.wx_manager_bill   bBll = new BLL.wx_manager_bill();
                    Model.wx_manager_bill bill = new Model.wx_manager_bill();
                    bill.billMoney    = xfjine;
                    bill.managerId    = agent.managerId;
                    bill.operPersonId = agent.managerId;
                    bill.operDate     = DateTime.Now;
                    bill.billUsed     = "开通1个用户" + model.user_name + "的" + newMaxNum + "个微帐号";
                    bill.moneyType    = "扣减";
                    int addBillId = bBll.Add(bill);
                }
                else
                {
                    bll.Delete(addId);
                    addId = 0;
                }
            }

            if (addId > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                return(true);
            }
            return(false);
        }
Beispiel #12
0
        private bool DoAdd()
        {
            //地区
            string prov      = ddlProvince.SelectedItem.Value;
            string city      = ddlCity.SelectedItem.Value;
            string dist      = txtArea.Text.Trim();
            string agentArea = txtagentArea.Text.Trim();


            Model.manager model = new Model.manager();

            model.role_id   = 3; //代理商的角色id
            model.role_type = 2; //系统用户,有区别与admin
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            //检测用户名是否重复
            if (mBll.Exists(txtUserName.Text.Trim()))
            {
                return(false);
            }
            model.user_name = txtUserName.Text.Trim();
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password  = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.real_name = txtRealName.Text.Trim();
            model.telephone = txtTelephone.Text.Trim();
            model.email     = txtEmail.Text.Trim();
            model.add_time  = DateTime.Now;

            model.agentId    = GetAdminInfo().id;
            model.agentLevel = 1;//说明为代理商
            model.qq         = txtqq.Text;
            model.email      = txtEmail.Text;
            model.reg_ip     = MXRequest.GetIP();
            model.province   = prov;
            model.city       = city;
            model.county     = dist;
            model.sort_id    = MyCommFun.Obj2Int(txtSortid.Text);
            model.remark     = txtRemark.Text;


            //代理商的基本信息
            Model.wx_agent_info agentinfo = new Model.wx_agent_info();
            int managerId = mBll.Add(model);

            if (managerId > 0)
            {
                agentinfo.managerId   = managerId;
                agentinfo.agentPrice  = MyCommFun.Str2Int(txtagentPrice.Text.Trim());
                agentinfo.sqJine      = MyCommFun.Str2Int(txtsqJine.Text.Trim());
                agentinfo.czTotMoney  = 0;
                agentinfo.remainMony  = 0;
                agentinfo.companyInfo = txtcompanyName.Text;
                agentinfo.agentType   = MyCommFun.Str2Int(ddlagentType.SelectedItem.Value);
                agentinfo.agentLevel  = ddlagentLevel.SelectedItem.Value;
                agentinfo.agentArea   = agentArea;
                agentinfo.industry    = txtindustry.Text.Trim();
                agentinfo.userNum     = 0;
                agentinfo.wcodeNum    = 0;
                agentinfo.createDate  = DateTime.Now;
                agentinfo.expiryDate  = DateTime.Parse("2100-12-1");
                int agentid = aBll.Add(agentinfo);
                if (agentid > 0)
                {
                    AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加代理商基本信息:" + model.user_name); //记录日志
                    return(true);
                }
                else
                {
                    mBll.Delete(managerId);
                }
            }
            return(false);
        }
        private bool DoAdd()
        {
            var  adminEntity = GetAdminInfo(); //取得管理员信息
            var  agent       = new AgentInfo();
            bool isAgent     = false;

            if (adminEntity.AgentLevel < 0)
            {
                return(false);
            }
            if (adminEntity.AgentLevel > 0)
            {
                agent   = aBll.GetAgentModel(adminEntity.Id);
                isAgent = true;
                if (agent.RemainMony < agent.AgentPrice)
                {
                    JscriptMsg("余额不足,请联系管理员充值!", "", "Error");
                    return(false);
                }
            }
            else
            {
            }
            //int oldMaxNum = MyCommFun.Str2Int(hidOldMaxNum.Value);
            int newMaxNum = MyCommFun.Str2Int(ddlMaxNum.SelectedItem.Value);

            //地区
            string prov = ddlProvince.SelectedItem.Value;
            string city = ddlCity.SelectedItem.Value;
            string dist = txtArea.Text.Trim();

            var model = new ManagerInfo();
            var bll   = new ManagerInfoService();

            model.RoleId   = int.Parse(ddlRoleId.SelectedValue);
            model.RoleType = new ManagerRoleService().GetModel(model.RoleId).RoleType;
            if (cbIsLock.Checked == true)
            {
                model.IsLock = 0;
            }
            else
            {
                model.IsLock = 1;
            }
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return(false);
            }
            model.UserName = txtUserName.Text.Trim();
            //获得6位的salt加密字符串
            model.Salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.Password   = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.Salt);
            model.RealName   = txtRealName.Text.Trim();
            model.Telephone  = txtTelephone.Text.Trim();
            model.Email      = txtEmail.Text.Trim();
            model.AddTime    = DateTime.Now;
            model.WxNum      = newMaxNum;
            model.AgentId    = GetAdminInfo().Id;
            model.QQ         = txtqq.Text;
            model.Email      = txtEmail.Text;
            model.RegIp      = MXRequest.GetIP();
            model.Province   = prov;
            model.City       = city;
            model.County     = dist;
            model.SortId     = MyCommFun.Obj2Int(txtSortid.Text);
            model.AgentLevel = -1;
            model.Remark     = txtRemark.Text;
            model.AgentId    = adminEntity.Id;
            int addId = bll.Add(model);

            if (addId > 0 && isAgent)
            {
                int xfjine = newMaxNum * agent.AgentPrice.Value;//消费金额

                //是代理商 :缴费,扣除金额,增加消费记录
                agent.RemainMony -= xfjine;
                agent.UserNum    += 1;
                agent.WcodeNum   += newMaxNum;
                bool updateRet = aBll.Update(agent);

                if (updateRet)
                {
                    var bBll = new WXManagerBillService(new ManagerBillRepository());
                    var bill = new ManagerBillInfo
                    {
                        BillMoney    = xfjine,
                        ManagerId    = agent.ManagerId,
                        OperPersonId = agent.ManagerId,
                        OperDate     = DateTime.Now,
                        BillUsed     = "开通1个用户" + model.UserName + "的" + newMaxNum + "个微帐号",
                        MoneyType    = "扣减"
                    };
                    int addBillId = bBll.Add(bill);
                }
                else
                {
                    bll.Delete(addId);
                    addId = 0;
                }
            }

            if (addId > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.UserName); //记录日志
                return(true);
            }
            return(false);
        }