Exemplo n.º 1
0
        /// <summary>
        /// 更新扩展
        /// </summary>
        /// <param name="rtype"></param>
        /// <param name="userId"></param>
        /// <param name="DataValue"></param>
        /// <returns></returns>
        public bool DeleteUserExpand(UserExpandType rtype, string userId, string websiteOwner = "")
        {
            UserExpand data = GetUserExpand(rtype, userId, websiteOwner);

            if (data != null)
            {
                return(Delete(data) > 0);
            }
            return(false);
        }
Exemplo n.º 2
0
        public void UpdateUserExpand(UserExpand _UserExpand)
        {
            UserExpand CurrentUserExpand = context.UserExpands.Where(e => e.userId == _UserExpand.userId).FirstOrDefault();

            CurrentUserExpand.FirstBunch           = _UserExpand.FirstBunch;
            CurrentUserExpand.FirstComment         = _UserExpand.FirstComment;
            CurrentUserExpand.FirstKeen            = _UserExpand.FirstKeen;
            CurrentUserExpand.SecondBunch          = _UserExpand.SecondBunch;
            CurrentUserExpand.SecondKeen           = _UserExpand.SecondKeen;
            CurrentUserExpand.SecondComment        = _UserExpand.SecondComment;
            context.Entry(CurrentUserExpand).State = System.Data.Entity.EntityState.Modified;
            context.SaveChanges();
        }
Exemplo n.º 3
0
        public void PopulateInitialExpandValues(string UserId)
        {
            UserExpand CurrentUserExpand = context.UserExpands.Where(y => y.userId == UserId).FirstOrDefault();

            if (CurrentUserExpand == null)
            {
                UserExpand UserExpands = new UserExpand
                {
                    FirstBunch    = true,
                    FirstKeen     = true,
                    FirstComment  = true,
                    SecondBunch   = true,
                    SecondComment = true,
                    SecondKeen    = true,
                    userId        = UserId
                };
                context.UserExpands.Add(UserExpands);
                context.Entry(UserExpands).State = System.Data.Entity.EntityState.Added;
                context.SaveChanges();
            }
        }
Exemplo n.º 4
0
Arquivo: Get.ashx.cs Projeto: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            string type = context.Request["type"];

            UserExpandType nType = new UserExpandType();

            if (!Enum.TryParse(type, out nType))
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "类型格式不能识别";
                bllUserEx.ContextResponse(context, apiResp);
                return;
            }
            UserExpand ex = bllUserEx.GetUserExpand(nType, CurrentUserInfo.UserID);

            if (ex == null)
            {
                ex = new UserExpand();
            }
            apiResp.result = new
            {
                value = ex.DataValue,
                ex1   = ex.Ex1,
                ex2   = ex.Ex2,
                ex3   = ex.Ex3,
                ex4   = ex.Ex4,
                ex5   = ex.Ex5,
                ex6   = ex.Ex6,
                ex7   = ex.Ex7,
                ex8   = ex.Ex8,
                ex9   = ex.Ex9,
                ex10  = ex.Ex10
            };
            apiResp.msg    = "获取完成";
            apiResp.status = true;
            apiResp.code   = (int)APIErrCode.IsSuccess;
            bllUserEx.ContextResponse(context, apiResp);
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(Request.InputStream);
                try
                {
                    xmlDoc.Save(string.Format("C:\\WXPay\\Notify{0}.xml", DateTime.Now.ToString("yyyyMMddHHmmssfff")));
                }
                catch (Exception)
                {
                }
                //全部参数
                Dictionary <string, string> parametersAll = new Dictionary <string, string>();
                foreach (XmlElement item in xmlDoc.DocumentElement.ChildNodes)
                {
                    string key   = item.Name;
                    string value = item.InnerText;
                    if ((!string.IsNullOrEmpty(key)) && (!string.IsNullOrEmpty(value)))
                    {
                        parametersAll.Add(key, value);
                    }
                }

                parametersAll = (from entry in parametersAll
                                 orderby entry.Key ascending
                                 select entry).ToDictionary(pair => pair.Key, pair => pair.Value);//全部参数排序

                BllOrder bllOrder = new BllOrder();
                BLLJIMP.Model.OrderPay orderPay = bllOrder.GetOrderPay(parametersAll["out_trade_no"], "", bllOrder.WebsiteOwner);

                BllPay    bllPay    = new BllPay();
                PayConfig payConfig = bllPay.GetPayConfig();
                if (bllPay.VerifySignatureWx(parametersAll, payConfig.WXPartnerKey))//验证签名
                {
                    if (orderPay == null)
                    {
                        Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
                        return;
                    }

                    if (orderPay.Status == 1)
                    {
                        Response.Write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
                        return;
                    }
                    orderPay.Status = 1;
                    if (bllOrder.Update(orderPay))
                    {
                        BLLUser bllUser = new BLLUser();
                        if (orderPay.Type == "1")
                        {
                            int score = 0;
                            int.TryParse(orderPay.Ex1, out score);
                            BLLKeyValueData bllKeyValueData  = new BLLKeyValueData();
                            string          ScoreDispalyName = bllKeyValueData.GetDataVaule("ScoreDispalyName", "1", bllKeyValueData.WebsiteOwner);

                            string msg = "消费" + orderPay.Total_Fee + "元,充值" + score + ScoreDispalyName;
                            if (bllUser.AddUserScoreDetail(orderPay.UserId, EnumStringHelper.ToString(ScoreDefineType.Recharge), bllUser.WebsiteOwner, score, msg))
                            {
                                Response.Write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
                            }
                            else
                            {
                                Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
                            }
                            //BLLSystemNotice bllSystemNotice = new BLLSystemNotice();
                            //bllSystemNotice.SendNotice(BLLSystemNotice.NoticeType.SystemMessage, null, null, orderPay.UserId, msg);
                        }
                        else if (orderPay.Type == "2")
                        {
                            string invoiceMsg;
                            if (orderPay.Ex1 == "1")
                            {
                                invoiceMsg = "带发票,";
                            }
                            else
                            {
                                invoiceMsg = "无发票,";
                            }

                            string msg = "充值VIP," + invoiceMsg + "消费" + orderPay.Total_Fee.ToString() + "元";


                            BLLKeyValueData bllKeyValueData = new BLLKeyValueData();
                            string          VIPDatelong     = bllKeyValueData.GetDataVaule("VIPDatelong", "1", bllKeyValueData.WebsiteOwner);
                            if (string.IsNullOrWhiteSpace(VIPDatelong))
                            {
                                VIPDatelong = "12";
                            }
                            int datelong = Convert.ToInt32(VIPDatelong);

                            BLLUserExpand bllUserExpand = new BLLUserExpand();
                            UserExpand    userVip       = bllUserExpand.GetUserExpand(BLLJIMP.Enums.UserExpandType.UserIsVip, orderPay.UserId);
                            string        userVipEndDate;
                            if (userVip == null || DateTime.Parse(userVip.DataValue) < DateTime.Now)
                            {
                                userVipEndDate = DateTime.Now.AddMonths(datelong).ToString("yyyy-MM-dd");
                            }
                            else
                            {
                                userVipEndDate = DateTime.Parse(userVip.DataValue).AddMonths(datelong).ToString("yyyy-MM-dd");
                            }
                            bllUserExpand.UpdateUserExpand(BLLJIMP.Enums.UserExpandType.UserIsVip, orderPay.UserId, userVipEndDate);

                            //更新用户字段
                            UserScoreDetailsInfo scoreModel = new UserScoreDetailsInfo();
                            scoreModel.AddNote   = msg;
                            scoreModel.AddTime   = DateTime.Now;
                            scoreModel.Score     = 0;
                            scoreModel.UserID    = orderPay.UserId;
                            scoreModel.ScoreType = "RechargeVIP";
                            UserInfo currUser = bllUser.GetUserInfo(orderPay.UserId);
                            scoreModel.TotalScore   = currUser.TotalScore;
                            scoreModel.WebSiteOwner = currUser.WebsiteOwner;
                            if (bllUser.Add(scoreModel))
                            {
                                BLLSystemNotice bllSystemNotice = new BLLSystemNotice();
                                bllSystemNotice.SendNotice(BLLSystemNotice.NoticeType.SystemMessage, null, null, orderPay.UserId, msg);

                                Response.Write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
                            }
                            else
                            {
                                Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
                            }
                        }

                        return;
                    }
                    else
                    {
                        Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
                        return;
                    }
                }
                Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
            }
            catch (Exception)
            {
                Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>");
            }
        }
Exemplo n.º 6
0
        public RideModelIndex PopulateRideModel(int RideId, int GroupId, string UserId, bool NeedPreviousRide)
        {
            string ChevronClassDown = "glyphicon glyphicon glyphicon-minus";
            string ChevronClassUp   = "glyphicon glyphicon glyphicon-plus";

            string PanelClassDown = "panel-collapse collapse in";
            string PanelClassUp   = "panel-collapse collapse";

            Ride  _Ride  = new Ride();
            Group _Group = new Group();

            _Group = repository.GetGroupByID(GroupId);

            if (_Group == null)
            {
                _Group = repository.GetGroupByRideID(RideId);
            }

            CultureHelper _CultureHelper = new CultureHelper(repository);
            TimeZoneInfo  TZone          = _CultureHelper.GetTimeZoneInfo(_Group.Location.id);
            DateTime      LocalNow       = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TZone);
            UserExpand    _UserExpands   = repository.GetUserExpandByUserID(UserId);

            if (RideId == -1) // this is the case when first enter view ride screen as rideid is unkown at that point.
            {
                _Ride = _Group.Rides.Where(u => u.RideDate.AddHours(2) >= LocalNow).OrderBy(i => i.RideDate).FirstOrDefault();
            }
            else
            {
                _Ride = repository.GetClosestNextRide(_Group, TZone);
            }

            RideModelIndex RideModel = new RideModelIndex();

            RideModel.Ride         = _Ride;
            RideModel.RideDate     = RideModel.Ride.RideDate;
            RideModel.Group        = _Group;
            RideModel.Comments     = repository.GetTop2CommentsForRide(RideModel.Ride.id);
            RideModel.CommentCount = repository.GetCommentCountForRide(RideModel.Ride.id);
            RideModel.KeenCount    = repository.GetKeenCountForRide(RideModel.Ride.id);
            RideModel.IsOwner      = repository.IsGroupCreator(_Group.id, UserId);
            RideModel.InFirst      = repository.IsIn(RideModel.Ride.id, UserId);
            RideModel.OutFirst     = repository.IsOut(RideModel.Ride.id, UserId);
            RideModel.OnWayFirst   = repository.IsOnWay(RideModel.Ride.id, UserId);
            RideModel.Routes       = new List <RouteWithVoteCount>();
            RideModel.NextRoutes   = new List <RouteWithVoteCount>();
            List <RouteWithVoteCount> _RouteWithVoteCount = new List <RouteWithVoteCount>();

            foreach (Route item in _Group.Routes)
            {
                RouteWithVoteCount _RVC = new RouteWithVoteCount
                {
                    Desc      = item.Desc,
                    Group     = item.Group,
                    MapURL    = item.MapURL,
                    RouteId   = item.id,
                    VoteCount = repository.RouteVoteCountByRideid(item.id, RideModel.Ride.id)
                };

                RideModel.Routes.Add(_RVC);
            }

            //RideModel.Routes = _RouteWithVoteCount;

            if (RideModel.Group.OneOff == false)
            {
                RideModel.NextRide = _Group.Rides.Where(u => u.RideDate > RideModel.Ride.RideDate).OrderBy(i => i.RideDate).FirstOrDefault();
                if (RideModel.NextRide == null)
                {
                    //If no next ride need to poulate from the latest date, will catch some issues.
                    repository.PopulateRideDatesFromDate(_Group, RideModel.RideDate, TZone);
                    RideModel.NextRide = _Group.Rides.Where(u => u.RideDate > RideModel.Ride.RideDate).OrderBy(i => i.RideDate).FirstOrDefault();
                }
                RideModel.NextRideDate     = RideModel.NextRide.RideDate;
                RideModel.NextComments     = repository.GetTop2CommentsForRide(RideModel.NextRide.id);
                RideModel.NextCommentCount = repository.GetCommentCountForRide(RideModel.NextRide.id);
                RideModel.NextKeenCount    = repository.GetKeenCountForRide(RideModel.NextRide.id);
                RideModel.NextRiders       = repository.GetRidersForRide(RideModel.NextRide.id, TZone);
                RideModel.InSecond         = repository.IsIn(RideModel.NextRide.id, UserId);
                RideModel.OutSecond        = repository.IsOut(RideModel.NextRide.id, UserId);
                RideModel.OnWaySecond      = repository.IsOnWay(RideModel.NextRide.id, UserId);

                foreach (Route item in _Group.Routes)
                {
                    RouteWithVoteCount _RVCNext = new RouteWithVoteCount
                    {
                        Desc      = item.Desc,
                        Group     = item.Group,
                        MapURL    = item.MapURL,
                        RouteId   = item.id,
                        VoteCount = repository.RouteVoteCountByRideid(item.id, RideModel.NextRide.id)
                    };

                    RideModel.NextRoutes.Add(_RVCNext);
                }
            }

            if (_UserExpands != null)
            {
                RideModel.FirstBunch = _UserExpands.FirstBunch;
                if (RideModel.FirstBunch)
                {
                    RideModel.FirstBunchChevronClass = ChevronClassDown;
                    RideModel.FirstBunchPanelClass   = PanelClassDown;
                }
                else
                {
                    RideModel.FirstBunchChevronClass = ChevronClassUp;
                    RideModel.FirstBunchPanelClass   = PanelClassUp;
                }

                RideModel.FirstKeen = _UserExpands.FirstKeen;
                if (RideModel.FirstKeen)
                {
                    RideModel.FirstKeenChevronClass = ChevronClassDown;
                    RideModel.FirstKeenPanelClass   = PanelClassDown;
                }
                else
                {
                    RideModel.FirstKeenChevronClass = ChevronClassUp;
                    RideModel.FirstKeenPanelClass   = PanelClassUp;
                }

                RideModel.FirstComment = _UserExpands.FirstComment;
                if (RideModel.FirstComment)
                {
                    RideModel.FirstCommentChevronClass = ChevronClassDown;
                    RideModel.FirstCommentPanelClass   = PanelClassDown;
                }
                else
                {
                    RideModel.FirstCommentChevronClass = ChevronClassUp;
                    RideModel.FirstCommentPanelClass   = PanelClassUp;
                }

                RideModel.SecondBunch = _UserExpands.SecondBunch;
                if (RideModel.SecondBunch)
                {
                    RideModel.SecondBunchChevronClass = ChevronClassDown;
                    RideModel.SecondBunchPanelClass   = PanelClassDown;
                }
                else
                {
                    RideModel.SecondBunchChevronClass = ChevronClassUp;
                    RideModel.SecondBunchPanelClass   = PanelClassUp;
                }
                RideModel.SecondKeen = _UserExpands.SecondKeen;
                if (RideModel.SecondKeen)
                {
                    RideModel.SecondKeenChevronClass = ChevronClassDown;
                    RideModel.SecondKeenPanelClass   = PanelClassDown;
                }
                else
                {
                    RideModel.SecondKeenChevronClass = ChevronClassUp;
                    RideModel.SecondKeenPanelClass   = PanelClassUp;
                }

                RideModel.SecondComment = _UserExpands.SecondComment;
                if (RideModel.SecondComment)
                {
                    RideModel.SecondCommentChevronClass = ChevronClassDown;
                    RideModel.SecondCommentPanelClass   = PanelClassDown;
                }
                else
                {
                    RideModel.SecondCommentChevronClass = ChevronClassUp;
                    RideModel.SecondCommentPanelClass   = PanelClassUp;
                }
            }

            if (RideModel.Group.MapUrl != null)
            {
                RideModel.MapUrl = RideModel.MapUrl = string.Concat("<iframe id=mapmyfitness_route src=https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=http://veloroutes.org/k/%3Fr%3D", RideModel.Group.MapUrl, "&output=embed height=300px width=300px frameborder=0></iframe>");
            }

            RideModel.Riders = repository.GetRidersForRide(RideModel.Ride.id, TZone);
            return(RideModel);
        }
Exemplo n.º 7
0
        public void UpdateOrInsertUserExpand(UserExpandModel _UserExpandModel)
        {
            //IDs for collapse user remember
            // 1 = FirstBunchCollapse
            // 2 = FirstKeen
            // 3 = FirstComment
            // 4 = SecondBunchCollapse
            // 5 = SecondKeen
            // 6 = SecondComment

            UserExpand CurrentUserExpand = repository.GetUserExpandByUserID(_UserExpandModel.userid);

            if (CurrentUserExpand == null)
            {
                if (_UserExpandModel.Id == 1)
                {
                    UserExpand _UserExpand = new UserExpand {
                        userId = _UserExpandModel.userid, FirstBunch = _UserExpandModel.collapsed
                    };
                    repository.AddUserExpand(_UserExpand);
                    repository.Save();
                }

                if (_UserExpandModel.Id == 2)
                {
                    UserExpand _UserExpand = new UserExpand {
                        userId = _UserExpandModel.userid, FirstKeen = _UserExpandModel.collapsed
                    };
                    repository.AddUserExpand(_UserExpand);
                    repository.Save();
                }

                if (_UserExpandModel.Id == 3)
                {
                    UserExpand _UserExpand = new UserExpand {
                        userId = _UserExpandModel.userid, FirstComment = _UserExpandModel.collapsed
                    };
                    repository.AddUserExpand(_UserExpand);
                    repository.Save();
                }

                //Second Ride

                if (_UserExpandModel.Id == 4)
                {
                    UserExpand _UserExpand = new UserExpand {
                        userId = _UserExpandModel.userid, SecondBunch = _UserExpandModel.collapsed
                    };
                    repository.AddUserExpand(_UserExpand);
                    repository.Save();
                }

                if (_UserExpandModel.Id == 5)
                {
                    UserExpand _UserExpand = new UserExpand {
                        userId = _UserExpandModel.userid, SecondKeen = _UserExpandModel.collapsed
                    };
                    repository.AddUserExpand(_UserExpand);
                    repository.Save();
                }

                if (_UserExpandModel.Id == 6)
                {
                    UserExpand _UserExpand = new UserExpand {
                        userId = _UserExpandModel.userid, SecondComment = _UserExpandModel.collapsed
                    };
                    repository.AddUserExpand(_UserExpand);
                    repository.Save();
                }
            }
            else
            {
                if (_UserExpandModel.Id == 1)
                {
                    UserExpand _UserExpand = new UserExpand
                    {
                        userId        = _UserExpandModel.userid,
                        FirstKeen     = CurrentUserExpand.FirstKeen,
                        FirstComment  = CurrentUserExpand.FirstComment,
                        FirstBunch    = _UserExpandModel.collapsed,
                        SecondBunch   = CurrentUserExpand.SecondBunch,
                        SecondKeen    = CurrentUserExpand.SecondKeen,
                        SecondComment = CurrentUserExpand.SecondComment
                    };

                    repository.UpdateUserExpand(_UserExpand);
                    repository.Save();
                }

                if (_UserExpandModel.Id == 2)
                {
                    UserExpand _UserExpand = new UserExpand
                    {
                        userId        = _UserExpandModel.userid,
                        FirstKeen     = _UserExpandModel.collapsed,
                        FirstComment  = CurrentUserExpand.FirstComment,
                        FirstBunch    = CurrentUserExpand.FirstBunch,
                        SecondBunch   = CurrentUserExpand.SecondBunch,
                        SecondKeen    = CurrentUserExpand.SecondKeen,
                        SecondComment = CurrentUserExpand.SecondComment
                    };

                    repository.UpdateUserExpand(_UserExpand);
                    repository.Save();
                }

                if (_UserExpandModel.Id == 3)
                {
                    UserExpand _UserExpand = new UserExpand
                    {
                        userId        = _UserExpandModel.userid,
                        FirstKeen     = CurrentUserExpand.FirstKeen,
                        FirstComment  = _UserExpandModel.collapsed,
                        FirstBunch    = CurrentUserExpand.FirstBunch,
                        SecondBunch   = CurrentUserExpand.SecondBunch,
                        SecondKeen    = CurrentUserExpand.SecondKeen,
                        SecondComment = CurrentUserExpand.SecondComment
                    };

                    repository.UpdateUserExpand(_UserExpand);
                    repository.Save();
                }

                //Second Ride

                if (_UserExpandModel.Id == 4)
                {
                    UserExpand _UserExpand = new UserExpand
                    {
                        userId        = _UserExpandModel.userid,
                        FirstKeen     = CurrentUserExpand.FirstKeen,
                        FirstComment  = CurrentUserExpand.FirstComment,
                        FirstBunch    = CurrentUserExpand.FirstBunch,
                        SecondBunch   = _UserExpandModel.collapsed,
                        SecondKeen    = CurrentUserExpand.SecondKeen,
                        SecondComment = CurrentUserExpand.SecondComment
                    };

                    repository.UpdateUserExpand(_UserExpand);
                    repository.Save();
                }

                if (_UserExpandModel.Id == 5)
                {
                    UserExpand _UserExpand = new UserExpand
                    {
                        userId        = _UserExpandModel.userid,
                        FirstKeen     = CurrentUserExpand.FirstKeen,
                        FirstComment  = CurrentUserExpand.FirstComment,
                        FirstBunch    = CurrentUserExpand.FirstBunch,
                        SecondBunch   = CurrentUserExpand.SecondBunch,
                        SecondKeen    = _UserExpandModel.collapsed,
                        SecondComment = CurrentUserExpand.SecondComment
                    };

                    repository.UpdateUserExpand(_UserExpand);
                    repository.Save();
                }

                if (_UserExpandModel.Id == 6)
                {
                    UserExpand _UserExpand = new UserExpand
                    {
                        userId        = _UserExpandModel.userid,
                        FirstKeen     = CurrentUserExpand.FirstKeen,
                        FirstComment  = CurrentUserExpand.FirstComment,
                        FirstBunch    = CurrentUserExpand.FirstBunch,
                        SecondBunch   = CurrentUserExpand.SecondBunch,
                        SecondKeen    = CurrentUserExpand.SecondKeen,
                        SecondComment = _UserExpandModel.collapsed
                    };

                    repository.UpdateUserExpand(_UserExpand);
                    repository.Save();
                }
            }
        }
Exemplo n.º 8
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                int    pageIndex      = !string.IsNullOrEmpty(context.Request["page"]) ? int.Parse(context.Request["page"]) : 1;
                int    pageSize       = !string.IsNullOrEmpty(context.Request["rows"]) ? int.Parse(context.Request["rows"]) : 10;
                string keyWord        = context.Request["keyWord"];
                string supplierUserId = "";
                if (currentUserInfo.UserType == 7)
                {
                    supplierUserId = currentUserInfo.UserID;
                }
                int totalCount;
                var sourceData = bllUser.GetSupplierList(bllUser.WebsiteOwner, pageIndex, pageSize, keyWord, supplierUserId, out totalCount);

                List <RespUserInfo> returnList = new List <RespUserInfo>();
                foreach (var p in sourceData)
                {
                    RespUserInfo model      = new RespUserInfo();
                    UserExpand   userExpand = bllUserExpand.GetUserExpand(BLLJIMP.Enums.UserExpandType.BankInfo, p.UserID, p.WebsiteOwner);
                    model.id                    = p.AutoID;
                    model.user_id               = p.UserID;
                    model.company_name          = p.Company;
                    model.true_name             = p.TrueName;
                    model.phone                 = p.Phone;
                    model.email                 = p.Email;
                    model.desc                  = p.Description;
                    model.permission_group_id   = p.PermissionGroupID;
                    model.permission_group_name = p.PermissionGroupID.HasValue ? bllUser.Get <ZentCloud.BLLPermission.Model.PermissionGroupInfo>(string.Format("GroupID={0}", p.PermissionGroupID)).GroupName : "";
                    model.head_img_url          = p.WXHeadimgurl;
                    model.image                 = p.Images;
                    model.ex1                   = p.Ex1;
                    model.ex2                   = p.Ex2; //供应商代码
                    model.ex3                   = p.Ex3;
                    model.ex4                   = p.Ex4; //提醒
                    model.address               = p.Address;
                    model.province              = p.Province;
                    model.city                  = p.City;
                    model.district              = p.District;
                    model.province_code         = p.ProvinceCode;
                    model.city_code             = p.CityCode;
                    model.district_code         = p.DistrictCode;
                    model.back_deposit          = userExpand != null?userExpand.Ex1:"";
                    model.back_account          = userExpand != null?userExpand.Ex2:"";
                    returnList.Add(model);
                }

                var resp = new
                {
                    total = totalCount,

                    rows = returnList
                };
                bllUser.ContextResponse(context, resp);
            }
            catch (Exception ex)
            {
                resp.returnObj = ex.ToString();
                bllUser.ContextResponse(context, resp);
            }
        }
Exemplo n.º 9
0
 public void AddUserExpand(UserExpand _UserExpand)
 {
     context.UserExpands.Add(_UserExpand);
     context.Entry(_UserExpand).State = System.Data.Entity.EntityState.Added;
     context.SaveChanges();
 }
Exemplo n.º 10
0
        public void ProcessRequest(HttpContext context)
        {
            string name   = context.Request["name"];
            string idCard = context.Request["id_card"];

            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(idCard))
            {
                apiResp.msg  = "姓名和身份证为必填信息";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            UserExpand userExpand = bllUserExpand.GetUserExpand(BLLJIMP.Enums.UserExpandType.StudentStatus, idCard);

            if (userExpand != null)
            {
                RespBody body = new RespBody();
                body.STUDYSTYLE      = userExpand.Ex1;
                body.EDUCATIONDEGREE = userExpand.Ex2;
                body.GRADUATETIME    = userExpand.Ex3;
                body.STUDYRESULT     = userExpand.Ex4;
                body.GRADUATE        = userExpand.Ex5;
                body.SPECIALITYNAME  = userExpand.Ex6;
                body.ENROLDATE       = userExpand.Ex7;
                bllUserExpand.ContextResponse(context, body);
                return;
            }
            Request model = new Request();

            model.header            = new Header();
            model.body              = new Body();
            model.header.version    = "1.0";
            model.header.product    = "B1001093";
            model.header.merchant   = "201512179102";
            model.header.outOrderId = Math.Ceiling(bllUser.GetTimeStamp(DateTime.Now)).ToString();
            model.body.realName     = name;
            model.body.cardId       = idCard;
            var sign1 = new
            {
                body   = model.body,
                header = model.header
            };

            string singStr = ZentCloud.Common.JSONHelper.ObjectToJson(sign1);

            string key = "sFpCmChE9VLpVcSrefDh";

            string sign     = Payment.Alipay.AlipayMD5.Sign(singStr, key, "utf-8").ToLower();
            var    postData = new
            {
                request = model,
                sign    = sign
            };

            string strPostdata = ZentCloud.Common.JSONHelper.ObjectToJson(postData);

            string sResult = string.Empty;

            string sError = string.Empty;

            string sResponseStatusCode = string.Empty;

            string sResponseStatusDescription = string.Empty;

            HttpWebResponse oHttpWebResponse = null;
            HttpWebRequest  oHttpWebRequest  = null;
            Stream          oStream          = null;
            StreamReader    oStreamReader    = null;

            byte[] bytes = Encoding.UTF8.GetBytes(strPostdata);
            try
            {
                oHttpWebRequest               = (HttpWebRequest)WebRequest.Create("https://api.udcredit.com/api/credit/v1/education_checkinfo");
                oHttpWebRequest.Method        = "POST";
                oHttpWebRequest.ContentType   = "application/json";
                oHttpWebRequest.ContentLength = bytes.Length;

                oHttpWebRequest.Timeout = 1000 * 50;

                oStream = oHttpWebRequest.GetRequestStream();
                oStream.Write(bytes, 0, bytes.Length);
                oStream.Close();

                oHttpWebResponse           = (HttpWebResponse)oHttpWebRequest.GetResponse();
                oStreamReader              = new StreamReader(oHttpWebResponse.GetResponseStream());
                sResponseStatusCode        = oHttpWebResponse.StatusCode.ToString();
                sResponseStatusDescription = oHttpWebResponse.StatusDescription;

                sResult = oStreamReader.ReadToEnd();
                ResponseModel resultModel = ZentCloud.Common.JSONHelper.JsonToModel <ResponseModel>(sResult);
                if (resultModel.response.header.retCode == "0000")
                {
                    bllUserExpand.AddUserExpand(BLLJIMP.Enums.UserExpandType.StudentStatus, idCard, name, resultModel.response.body.STUDYSTYLE, resultModel.response.body.EDUCATIONDEGREE,
                                                resultModel.response.body.GRADUATETIME, resultModel.response.body.STUDYRESULT, resultModel.response.body.GRADUATE, resultModel.response.body.SPECIALITYNAME,
                                                resultModel.response.body.ENROLDATE
                                                );
                    bllUser.ContextResponse(context, resultModel.response.body);
                }
                else
                {
                    apiResp.status = false;
                    apiResp.msg    = resultModel.response.header.retMsg;
                    bllUser.ContextResponse(context, apiResp);
                }
            }
            catch (Exception ex)
            {
                apiResp.msg  = ex.ToString();
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllUser.ContextResponse(context, apiResp);
            }
            finally
            {
                oStream = null;
            }
        }