public void Test_SetCFDFlag()
        {
            string        path          = @"c:\temp\shortablelist.csv";
            List <string> shortableList = new List <string>();
            ShareBLL      bll           = new ShareBLL(_unit);

            using (StreamReader sr = new StreamReader(path))
            {
                while (sr.Peek() >= 0)
                {
                    var s = sr.ReadLine();
                    shortableList.Add(s.Trim());
                }
            }

            var shareList = bll.GetList();

            foreach (var sh in shareList)
            {
                var Symbol = sh.Symbol;

                string v = shortableList.SingleOrDefault(c => c == Symbol);

                if (!string.IsNullOrEmpty(v))
                {
                    sh.IsCFD = true;
                    bll.Update(sh);
                    Debug.WriteLine("Updated cfd for {0}  {1}", Symbol, sh.Id);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 详细页面
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult Detail(int id)
        {
            ShareBLL    shareBLL    = new ShareBLL();
            ShareEntity shareEntity = shareBLL.GetById(id);

            return(View(shareEntity));
        }
        public void Test_SetShareType()
        {
            ShareBLL sBLL = new ShareBLL(_unit);

            Share s = sBLL.GetByID(1585);

            sBLL.SetShareType(s, "Stock");
        }
        public void Test_GetShareListByWatch()
        {
            ShareBLL sBLL = new ShareBLL(_unit);

            var slist = sBLL.GetShareListByWatch(15, false);

            slist = sBLL.GetShareListByWatch(15, true);
        }
        public IHttpActionResult Get()
        {
            ShareBLL sBLL = new ShareBLL(_unit);

            var shares = sBLL.GetList();

            return(Ok(shares));
        }
        public void Test_UpdateDailyShareTicker_FromAsxEod_DB()
        {
            TickerBLL tBll = new TickerBLL(_unit);

            ShareBLL sBll = new ShareBLL(_unit);

            Share s = sBll.GetShareBySymbol("ORG.AX");

            tBll.UpdateDailyShareTicker(s);
        }
Beispiel #7
0
        /// <summary>
        /// 列表页面
        /// </summary>
        /// <param name="searchString"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public IActionResult List(string searchString, int?page)
        {
            ViewBag.searchString = string.IsNullOrWhiteSpace(searchString) ? "" : searchString;
            int pageNumber = (page ?? 1);
            int pageSize   = 15;

            ShareBLL shareBLL = new ShareBLL();
            IPagedList <ShareEntity> shareEntities = shareBLL.AdminPageList(pageNumber, pageSize, searchString);

            return(View(shareEntities));
        }
        public IHttpActionResult Post(Share share)
        {
            Share output = null;

            if (share.Id > 0)
            {
                output = new ShareBLL(_unit).UpdateShare(share);
            }

            return(Ok(output));
        }
        public void Test_GetLastTicker()
        {
            TickerBLL tBll = new TickerBLL(_unit);
            ShareBLL  sBLL = new ShareBLL(_unit);

            Share s      = sBLL.GetShareBySymbol("ORG.AX");
            var   ticker = tBll.GetLastTicker(s.Id, null);


            s      = sBLL.GetShareBySymbol("1PG.AX");
            ticker = tBll.GetLastTicker(s.Id, null);
        }
Beispiel #10
0
    protected void lbtnShareHistory_Click(object sender, EventArgs e)
    {
        GridViewRow row      = ((GridViewRow)((LinkButton)sender).NamingContainer);
        LinkButton  linkLike = (LinkButton)row.FindControl("ShareLinkButton");
        HiddenField hfId     = (HiddenField)row.FindControl("HiddenFieldWallId");


        GridView gridviewShareHistory = (GridView)row.FindControl("GridViewShareHistory");

        gridviewShareHistory.DataSource = ShareBLL.getShareHistory(Global.WALL, hfId.Value);
        gridviewShareHistory.DataBind();
        // LoadWall(50);
    }
        public void Test_GetTickerListByShareDB_Full_AllShares()
        {
            ShareBLL  sBll = new ShareBLL(_unit);
            TickerBLL tBll = new TickerBLL(_unit);

            var shareList = sBll.GetList().ToList();

            foreach (var s in shareList)
            {
                var tickerList = tBll.GetTickerListByShareDB(s.Id, null, null);
                Debug.WriteLine("share {0}  {1}", s.Id, tickerList.Count);
            }
        }
Beispiel #12
0
    // To share a post
    protected void ShareLinkButton_Click(object sender, EventArgs e)
    {
        GridViewRow row        = ((GridViewRow)((LinkButton)sender).NamingContainer);
        LinkButton  linkShare  = (LinkButton)row.FindControl("ShareLinkButton");
        Label       labelShare = (Label)row.FindControl("ShareLabel");
        HiddenField hfId       = (HiddenField)row.FindControl("HiddenFieldId");

        if (linkShare.Text == "Share")
        {
            //

            UserBO objUser = new UserBO();
            objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());

            ShareBO objClass = new ShareBO();
            objClass.AtId      = hfId.Value;
            objClass.Type      = Global.WALL;
            objClass.UserId    = Session["UserId"].ToString();
            objClass.FirstName = objUser.FirstName;
            objClass.LastName  = objUser.LastName;
            ShareBLL.insertShare(objClass);

            ////////////////////////////////////////////////////////////////////////////
            // Put "follow" record for each user that has been tagged, traverse the list
            FollowPostBO objFollow = new FollowPostBO();
            objFollow.AtId      = hfId.Value;
            objFollow.Type      = Global.WALL;
            objFollow.UserId    = Session["hello"].ToString();
            objFollow.FirstName = objUser.FirstName;
            objFollow.LastName  = objUser.LastName;
            FollowPostBLL.insertFollowPost(objFollow);
            ////////////////////////////////////////////////////////////////////////////

            labelShare.Text = "You have shared this.";
            WallBO wall = WallBLL.getWallByWallId(objClass.AtId);
            string p    = ShareDescriptionTextBox.Text + " <br/>" + wall.Post;
            ShareStatus(p);
        }
        else
        {
            LikesBO objClass = new LikesBO();
            objClass.AtId   = hfId.Value;
            objClass.Type   = Global.WALL;
            objClass.UserId = Session["UserId"].ToString();
            LikesBLL.unLikes(objClass);
            labelShare.Text = "";
            linkShare.Text  = "Like";
        }
        LoadWall(50);
    }
        public IHttpActionResult GetStockListByZone(int zoneId)
        {
            List <Share> sList = new List <Share>();

            try
            {
                sList = new ShareBLL(_unit).GetShareListByZone(zoneId);
            }
            catch (Exception ex)
            {
                LogHelper.Error(_log, ex.ToString());
                return(InternalServerError(ex));
            }

            return(Ok(sList));
        }
Beispiel #14
0
    protected void CountShare()
    {
        foreach (GridViewRow gvr in GridViewWall.Rows)
        {
            if (gvr.RowType == DataControlRowType.DataRow)
            {
                LinkButton linkLike  = (LinkButton)gvr.FindControl("ShareLinkButton");
                Label      labelLike = (Label)gvr.FindControl("ShareLabel");
                //LinkButton linkLikeCount = (LinkButton)gvr.FindControl("lbtnUser");
                HiddenField hfId = (HiddenField)gvr.FindControl("HiddenFieldId");

                long likecount = ShareBLL.countPost(hfId.Value, Global.WALL);

                labelLike.Text = likecount.ToString();
            }
        }
    }
Beispiel #15
0
    protected void btnPost_Click(object sender, EventArgs e)
    {
        if (post != null)
        {
            UserBO objUser = new UserBO();
            objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());

            ShareBO objClass = new ShareBO();
            objClass.AtId      = post;
            objClass.Type      = Global.WALL;
            objClass.UserId    = Session["UserId"].ToString();
            objClass.FirstName = objUser.FirstName;
            objClass.LastName  = objUser.LastName;

            WallBO wall = WallBLL.getWallByWallId(objClass.AtId);
            string p    = txtUpdatePost.Text + " <br/>" + wall.Post;

            ShareStatus(p);
            foreach (string item in lstTag)
            {
                WallBO objWall2 = new WallBO();
                string tagpost  = p + "<br/><br/> Tag by <a  href=\"ViewProfile.aspx?UserId=" + Session["UserId"].ToString() + "\">" + objUser.FirstName + " " + objUser.LastName + "</a>.";
                UserBO objUser2 = new UserBO();
                objUser2 = UserBLL.getUserByUserId(item);
                objWall2.PostedByUserId  = item;
                objWall2.WallOwnerUserId = item;
                objWall2.FirstName       = objUser2.FirstName;
                objWall2.LastName        = objUser2.LastName;
                objWall2.Post            = tagpost;
                objWall2.AddedDate       = DateTime.Now;
                objWall2.Type            = Convert.ToInt32(Session["PostType"]);
                objWall2.EmbedPost       = Session["EmbedPost"].ToString();
                RWallPost(" tag post to <a  href=\"ViewProfile.aspx?UserId=" + item + "\">" + objUser2.FirstName + " " + objUser2.LastName + "</a>");

                WallBLL.insertWall(objWall2);
            }

            ShareBLL.insertShare(objClass);

            RWallPost(" Share a Post");
            Response.Redirect("UserData.aspx");
        }
    }
Beispiel #16
0
    protected void CountShare(GridViewRow gvr)
    {
        if (gvr.RowType == DataControlRowType.DataRow)
        {
            LinkButton  linkLike         = (LinkButton)gvr.FindControl("ShareLinkButton");
            LinkButton  linkShareHistory = (LinkButton)gvr.FindControl("lbtnShareHistory");
            Label       labelLike        = (Label)gvr.FindControl("ShareLabel");
            LinkButton  linkLikeCount    = (LinkButton)gvr.FindControl("lbtnUser");
            HiddenField hfId             = (HiddenField)gvr.FindControl("HiddenFieldWallId");

            long likecount = ShareBLL.countPost(hfId.Value, Global.WALL);
            if (likecount > 0)
            {
                //labelLike.Text = likecount.ToString();
                linkShareHistory.Text = likecount.ToString() + " Shares";
            }
            else
            {
                linkShareHistory.Visible = false;
            }
        }
    }
Beispiel #17
0
    // To share a post
    protected void ShareLinkButton_Click(object sender, EventArgs e)
    {
        GridViewRow row        = ((GridViewRow)((LinkButton)sender).NamingContainer);
        LinkButton  linkShare  = (LinkButton)row.FindControl("ShareLinkButton");
        Label       labelShare = (Label)row.FindControl("ShareLabel");
        HiddenField hfId       = (HiddenField)row.FindControl("HiddenFieldId");

        Session["PostID"] = hfId;

        if (linkShare.Text == "Share")
        {
            // Getting the user information
            UserBO objUser = new UserBO();
            objUser = UserBLL.getUserByUserId(Session["UserId"].ToString());

            // Creating Share object
            ShareBO objClass = new ShareBO();
            objClass.AtId      = hfId.Value;
            objClass.Type      = Global.WALL;
            objClass.UserId    = Session["UserId"].ToString();
            objClass.FirstName = objUser.FirstName;
            objClass.LastName  = objUser.LastName;

            // Getting the post which is going to be shared
            WallBO wall = WallBLL.getWallByWallId(objClass.AtId);
            string p    = txtUpdatePost.Text + " <br/>" + wall.Post;

            // Sharing the post on the wall
            ShareStatus(p);

            // Registering the Share after successful completion of the above process
            ShareBLL.insertShare(objClass);
        }

        LoadWall(50);
    }
Beispiel #18
0
        //
        // GET: /Base/
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            UserBLL       ubll  = new UserBLL();
            WorkUnitBLL   wbll  = new WorkUnitBLL();
            UserManageBLL umbll = new UserManageBLL();
            ShareBLL      sbll  = new ShareBLL();
            BuildTimeBLL  bbll  = new BuildTimeBLL();
            TotalBLL      tbll  = new TotalBLL();

            DT_UserLoginRecord u = filterContext.HttpContext.Session["user"] as DT_UserLoginRecord;

            //没有登录则不能访问
            if (u == null)
            {
                filterContext.Result = new RedirectResult("/Home/Login");
            }
            else
            {
                ViewBag.username = u.Telphone;
                //ViewBag.photo=u
                //是否科级干部
                ViewBag.iscadre = ubll.IsCadre(u.Id);

                //登录id
                ViewBag.id = u.Id;
                //用户角色
                ViewBag.role = Session["roleid"];

                //用户是否有共享
                ViewBag.sharestatus = Session["sharestatus"];

                //全部单位
                List <DT_WorkUnit> allunits = wbll.SelUnitByParent();
                ViewBag.allunits = allunits;

                //全部科室
                List <DT_WorkUnit> alldepts = wbll.SelDeptByParent();
                ViewBag.alldepts = alldepts;

                //照片
                string img = ubll.GetImg(Convert.ToInt32(Session["id"]));
                ViewBag.img = img;

                //全部内部用户
                List <DT_UserLoginRecord> allusers = umbll.SelectUsers();
                ViewBag.allusers = allusers;

                //根据本人登录id查询其单位id
                ViewBag.SelUnitidByUid = ubll.SelUnitidByUid(Convert.ToInt32(Session["id"]));
                //单位id
                ViewBag.unitid = Session["unitid"];

                //年份
                List <DT_Total> years = sbll.Total().GroupBy(a => a.YearTable).Select(b => new DT_Total {
                    YearTable = b.Key
                }).ToList();
                ViewBag.years = years;

                //根据添加时间获取最新的建档时间
                ViewBag.buildtime = bbll.GetLastTime();

                //查询全部基本信息表
                List <DT_UserInfo> userinfolist1 = ubll.SelectUserInfo();
                ViewBag.userinfolist1 = userinfolist1;

                //根据登录id和年份查询出年份
                ViewBag.yeartable = tbll.SelectYear(Convert.ToInt32(Session["id"]));


                //根据登录id查询总表status的状态  这里主要是根据status为“被退回”来判断
                //修改二次修改,点击“保存”时,同时修改status为“未提交”,可再次提交 (注意年份)
                ViewBag.status = ubll.SelStatus(Convert.ToInt32(Session["id"]));
            }
        }
Beispiel #19
0
        public void ExcLogin()
        {
            UserBLL ubll = new UserBLL();

            string tel = Request["telphone"];
            string pwd = Request["password"];

            Tools t = new Tools();

            pwd = t.GetMd5(pwd);

            DT_UserLoginRecord u = ubll.Login(tel, pwd);

            if (u != null)
            {
                Session["user"]        = u;
                Session["id"]          = u.Id;
                Session["realname"]    = u.RealName;
                Session["roleid"]      = u.RoleId;
                Session["unitid"]      = u.WorkUnitId;
                Session["tel"]         = u.Telphone;
                Session["sharestatus"] = u.ShareStatus;
                Session["count"]       = u.LoginNum;

                //登录IP
                string ip     = Request.UserHostAddress.ToString();
                string remark = "正常登录";

                DT_UserLoginRecord ulr = ubll.QueryOneUser(u.Id);
                ulr.LoginTime = DateTime.Now;                          //登录时间
                ulr.LoginIp   = ip;                                    //登录IP
                ulr.LoginNum  = (u.LoginNum == null?0:u.LoginNum) + 1; //登录次数
                ulr.Remark    = remark;
                ubll.UpdUserLoginRecord(ulr);

                // GetLoginRecord(u.Id,u.LoginNum);

                if (u.Status != null)
                {
                    if (u.Status == true)
                    {
                        if (u.RoleId != null)
                        {
                            if (u.IsCadre != null)
                            {
                                if (u.IsCadre == true)
                                {
                                    if (u.RoleId == 1 || u.RoleId == 2)
                                    {
                                        BuildTimeBLL bbll = new BuildTimeBLL();
                                        //填档开始时间
                                        DateTime?starttime = bbll.GetLastTime().BuildStartTime;
                                        //填档结束时间
                                        DateTime?endtime = bbll.GetLastTime().BuildEndTime;
                                        //这里目前设置的是本地时间
                                        DateTime time = DateTime.Now;
                                        //是科级干部的普通用户或审核用户在填档有效期内时间判断
                                        if (time < starttime)
                                        {
                                            Response.Write("<script type='text/javascript'>alert('很抱歉,填档时间未开始!');location.href='/Home/NoStart';</script>");
                                        }
                                        else if (time > endtime)
                                        {
                                            Response.Write("<script type='text/javascript'>alert('很抱歉,填档时间已结束!');location.href='/Home/HasStop';</script>");
                                        }
                                        else
                                        {
                                            if (u.RoleId == 1)
                                            {
                                                Response.Write("<script type='text/javascript'>alert('登录成功');location.href='/EnterFile/Index';</script>");
                                            }
                                            else if (u.RoleId == 2)
                                            {
                                                Response.Write("<script type='text/javascript'>alert('登录成功');location.href='/Main/Index';</script>");
                                            }
                                        }
                                    }
                                    else if (u.RoleId == 3 || u.RoleId == 4)
                                    {
                                        Response.Write("<script type='text/javascript'>alert('登录成功');location.href='/Main/Index';</script>");
                                    }
                                    else if ((u.RoleId == 1 || u.RoleId == 2 || u.RoleId == 3 || u.RoleId == 4) && u.ShareStatus == "是")
                                    {
                                        ShareBLL sbll = new ShareBLL();
                                        //共享开始时间
                                        DateTime?sharebegintime = sbll.GetLastRecord().ShareBeginTime;
                                        //共享结束时间
                                        DateTime?shareendtime = sbll.GetLastRecord().ShareEndTime;
                                        DateTime?time         = DateTime.Now;
                                        if (time < sharebegintime)
                                        {
                                            Response.Write("<script type='text/javascript'>alert('很抱歉,共享时间未开始!');location.href='/Home/NoStart';</script>");
                                        }
                                        else if (time > shareendtime)
                                        {
                                            Response.Write("<script type='text/javascript'>alert('很抱歉,共享时间已结束!');location.href='/Home/HasStop';</script>");
                                        }
                                        else if (time <= shareendtime && time >= sharebegintime)
                                        {
                                            Response.Write("<script type='text/javascript'>alert('登录成功');location.href='/ForeignShare/Index';</script>");
                                        }
                                    }
                                    else
                                    {
                                        Response.Write("<script type='text/javascript'>alert('你无权登录该系统!');location.href='/Home/Login';</script>");
                                    }
                                }
                            }
                            else
                            {
                                //科级干部为空或者不是科级干部的用户
                                if (u.RoleId == 1)
                                {
                                    Response.Write("<script type='text/javascript'>alert('你无权登录该系统!');location.href='/Home/Login';</script>");
                                }
                                else if (u.RoleId == 2 || u.RoleId == 3 || u.RoleId == 4)
                                {
                                    Response.Write("<script type='text/javascript'>alert('登录成功');location.href='/Main/Index';</script>");
                                }
                                else if (u.RoleId == 0 && u.IsInner == false && u.ShareStatus == "是")
                                {
                                    ShareBLL sbll = new ShareBLL();
                                    //共享开始时间
                                    DateTime?sharebegintime = sbll.GetLastRecord().ShareBeginTime;
                                    //共享结束时间
                                    DateTime?shareendtime = sbll.GetLastRecord().ShareEndTime;
                                    DateTime?time         = DateTime.Now;
                                    if (time < sharebegintime)
                                    {
                                        Response.Write("<script type='text/javascript'>alert('很抱歉,共享时间未开始!');location.href='/Home/NoStart';</script>");
                                    }
                                    else if (time > shareendtime)
                                    {
                                        Response.Write("<script type='text/javascript'>alert('很抱歉,共享时间已结束!');location.href='/Home/HasStop';</script>");
                                    }
                                    else if (time <= shareendtime && time >= sharebegintime)
                                    {
                                        Response.Write("<script type='text/javascript'>alert('登录成功');location.href='/ForeignShare/Index';</script>");
                                    }
                                }
                                else
                                {
                                    Response.Write("<script type='text/javascript'>alert('你无权登录该系统!');location.href='/Home/Login';</script>");
                                }
                            }
                        }
                        else
                        {
                            Response.Write("<script type='text/javascript'>alert('你无权登录该系统!');location.href='/Home/Login';</script>");
                        }
                    }
                    else
                    {
                        //ubll.UpdUserLoginRecord(u.Id, ip, remark2);
                        Response.Write("<script type='text/javascript'>alert('该用户账号已被禁用,请联系高级用户!');;location.href='/Home/Login';</script>");//账号被禁用
                    }
                }
                else
                {
                    Response.Write("<script type='text/javascript'>alert('你无权登录该系统!');location.href='/Home/Login';</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('登录失败!');location.href='/Home/Login';</script>");//登录失败
            }
            Response.End();
        }
Beispiel #20
0
        /// <summary>
        /// 打赏说说
        /// </summary>
        /// <param name="userEntity"></param>
        /// <param name="shareId"></param>
        /// <returns></returns>
        private DataResult SponsorShare(UserEntity userEntity, int shareId)
        {
            DataResult dr = new DataResult();

            ShareBLL shareBLL = new ShareBLL();

            ShareEntity shareEntity = shareBLL.GetById(shareId);

            if (shareEntity.isDel)
            {
                dr.code = "201";
                dr.msg  = "说说已被删除";
                return(dr);
            }
            if (shareEntity.userId < 10000)
            {
                dr.code = "201";
                dr.msg  = "无主说说";
                return(dr);
            }

            var result = shareBLL.ActionDal.ActionDBAccess.Ado.UseTran(() =>
            {
                //积分减1
                userEntity.integral = userEntity.integral - 1;
                var rows1           = shareBLL.ActionDal.ActionDBAccess.Updateable(userEntity).ExecuteCommand();
                IntegralDetailEntity integralDetailEntity = new IntegralDetailEntity()
                {
                    createDate = DateTime.Now,
                    integral   = -1,
                    isDel      = false,
                    modifyDate = DateTime.Now,
                    objId      = shareId,
                    type       = (int)Entity.TypeEnumEntity.TypeEnum.说说,
                    userId     = userEntity.userId
                };
                var rows2 = shareBLL.ActionDal.ActionDBAccess.Insertable(integralDetailEntity).ExecuteCommand();

                //积分加1
                UserEntity user = shareBLL.ActionDal.ActionDBAccess.Queryable <UserEntity>().Where(it => it.userId == shareEntity.userId).First();
                user.integral   = user.integral + 1;
                var rows3       = shareBLL.ActionDal.ActionDBAccess.Updateable(user).ExecuteCommand();
                IntegralDetailEntity integralDetail = new IntegralDetailEntity()
                {
                    createDate = DateTime.Now,
                    integral   = 1,
                    isDel      = false,
                    modifyDate = DateTime.Now,
                    objId      = shareId,
                    type       = (int)Entity.TypeEnumEntity.TypeEnum.说说,
                    userId     = user.userId
                };
                var rows4 = shareBLL.ActionDal.ActionDBAccess.Insertable(integralDetail).ExecuteCommand();

                shareEntity.integral = shareEntity.integral + 1;
                var rows5            = shareBLL.ActionDal.ActionDBAccess.Updateable(shareEntity).ExecuteCommand();
            });
            //增加阅读记录
            ReadBLL readBLL = new ReadBLL();

            readBLL.Create(userEntity.userId, (int)Entity.TypeEnumEntity.TypeEnum.说说, shareId);
            if (result.IsSuccess)
            {
                dr.code = "200";
                dr.msg  = "成功";
            }
            else
            {
                dr.code = "201";
                dr.msg  = "失败";
            }

            return(dr);
        }
        public void TestGetShareListByZone()
        {
            ShareBLL sBLL = new ShareBLL(_unit);

            var sList = sBLL.GetShareListByZone(2);
        }
        public void TestGetShareListByTradingDate()
        {
            ShareBLL sBLL = new ShareBLL(_unit);

            var sList = sBLL.GetShareListByTradingDate(20130101);
        }
Beispiel #23
0
 /// <summary>
 ///
 /// </summary>
 public ShareController()
 {
     this.shareBLL = new ShareBLL();
 }
Beispiel #24
0
        public JsonResult Attention([FromForm] string token, [FromForm] int pageNumber = 1, [FromForm] int pageSize = 10)
        {
            DataResult dr = new DataResult();

            try
            {
                UserEntity userEntity = this.GetUserByToken(token);

                FansBLL fansBLL = new FansBLL();

                List <FansUserResult> fansUserResults = fansBLL.AttentionList(userEntity.userId);

                if (fansUserResults.Count < 1)
                {
                    dr.code = "200";
                    dr.data = new PageData(null, pageNumber, pageSize, 0);
                    dr.msg  = "未关注任何人";
                    return(Json(dr));
                }

                CaseBLL         caseBLL         = new CaseBLL();
                ShareBLL        shareBLL        = new ShareBLL();
                CaseOfficialBLL caseOfficialBLL = new CaseOfficialBLL();

                int[] userIdInts = fansUserResults.Select(it => it.userId).ToArray();

                int caseCount         = caseBLL.CountByUserIdInts(userIdInts);
                int shareCount        = shareBLL.CountByUserIdInts(userIdInts);
                int caseOfficialCount = caseOfficialBLL.CountByUserIdInts(userIdInts);
                int totalItemCount    = caseCount + shareCount + caseOfficialCount;

                List <CircleResultHelper> circleResultHelpers = caseBLL.CaseAndShareList(pageNumber: pageNumber, pageSize: pageSize, totalCount: totalItemCount, userIdInte: userIdInts);

                List <CaseEntity> caseEntities = circleResultHelpers.Where(it => it.type == (int)Entity.TypeEnumEntity.TypeEnum.案例).Select(it => it.caseEntity).ToList();
                if (caseEntities.Count > 0)
                {
                    caseEntities = CaseListEndorseCountByList(caseEntities, userEntity.userId);
                    caseEntities = CaseListCommentCountByList(caseEntities);

                    caseEntities.ForEach(it =>
                    {
                        circleResultHelpers.Find(itt => itt.id == it.caseId).caseEntity = it;
                    });
                }

                List <ShareEntity> shareEntities = circleResultHelpers.Where(it => it.type == (int)Entity.TypeEnumEntity.TypeEnum.说说).Select(it => it.shareEntity).ToList();
                if (shareEntities.Count > 0)
                {
                    shareEntities = ShareListEndorseCountByList(shareEntities, userEntity.userId);
                    shareEntities = ShareListCommentCountByList(shareEntities);

                    shareEntities.ForEach(it =>
                    {
                        circleResultHelpers.Find(itt => itt.id == it.shareId).shareEntity = it;
                    });
                }


                List <CaseOfficialEntity> caseOfficialEntities = circleResultHelpers.Where(it => it.type == (int)Entity.TypeEnumEntity.TypeEnum.官方案例).Select(it => it.caseOfficialEntity).ToList();
                if (caseOfficialEntities.Count > 0)
                {
                    caseOfficialEntities = CaseOfficialEndorseCountByList(caseOfficialEntities, userEntity.userId);
                    caseOfficialEntities = CaseOfficialCommentCountByList(caseOfficialEntities);

                    caseOfficialEntities.ForEach(it =>
                    {
                        circleResultHelpers.Find(itt => itt.id == it.caseOfficialId).caseOfficialEntity = it;
                    });
                }


                circleResultHelpers = (from crh in circleResultHelpers
                                       orderby crh.createDate descending
                                       select crh
                                       ).ToList();

                PageData pageData = new PageData(circleResultHelpers, pageNumber, pageSize, totalItemCount);

                dr.code = "200";
                dr.data = pageData;
            }
            catch (Exception ex)
            {
                dr.code = "999";
                dr.msg  = ex.Message;
            }

            return(Json(dr));
        }
Beispiel #25
0
        public JsonResult Newest([FromForm] string token, [FromForm] int pageNumber = 1, [FromForm] int pageSize = 10)
        {
            DataResult dr = new DataResult();

            try
            {
                CaseBLL         caseBLL           = new CaseBLL();
                ShareBLL        shareBLL          = new ShareBLL();
                CaseOfficialBLL caseOfficialBLL   = new CaseOfficialBLL();
                int             caseCount         = caseBLL.Count();
                int             shareCount        = shareBLL.Count();
                int             caseOfficialCount = caseOfficialBLL.Count();
                int             totalItemCount    = caseCount + shareCount + caseOfficialCount;

                UserEntity userEntity = new UserEntity();
                if (!string.IsNullOrWhiteSpace(token))
                {
                    userEntity = this.GetUserByToken(token);
                }

                List <CircleResultHelper> circleResultHelpers = caseBLL.CaseAndShareList(pageNumber: pageNumber, pageSize: pageSize, totalCount: totalItemCount, thisUserId: userEntity.userId > 10000 ? userEntity.userId : -1);

                List <CaseEntity> caseEntities = circleResultHelpers.Where(it => it.type == (int)Entity.TypeEnumEntity.TypeEnum.案例).Select(it => it.caseEntity).ToList();
                if (caseEntities.Count > 0)
                {
                    caseEntities = CaseListEndorseCountByList(caseEntities, userEntity.userId > 10000 ? userEntity.userId : -1);
                    caseEntities = CaseListCommentCountByList(caseEntities);

                    caseEntities.ForEach(it =>
                    {
                        circleResultHelpers.Find(itt => itt.id == it.caseId).caseEntity = it;
                    });
                }

                List <ShareEntity> shareEntities = circleResultHelpers.Where(it => it.type == (int)Entity.TypeEnumEntity.TypeEnum.说说).Select(it => it.shareEntity).ToList();
                if (shareEntities.Count > 0)
                {
                    shareEntities = ShareListEndorseCountByList(shareEntities, userEntity.userId > 10000 ? userEntity.userId : -1);
                    shareEntities = ShareListCommentCountByList(shareEntities);

                    shareEntities.ForEach(it =>
                    {
                        circleResultHelpers.Find(itt => itt.id == it.shareId).shareEntity = it;
                    });
                }

                List <CaseOfficialEntity> caseOfficialEntities = circleResultHelpers.Where(it => it.type == (int)Entity.TypeEnumEntity.TypeEnum.官方案例).Select(it => it.caseOfficialEntity).ToList();
                if (caseOfficialEntities.Count > 0)
                {
                    caseOfficialEntities = CaseOfficialEndorseCountByList(caseOfficialEntities, userEntity.userId > 10000 ? userEntity.userId : -1);
                    caseOfficialEntities = CaseOfficialCommentCountByList(caseOfficialEntities);

                    caseOfficialEntities.ForEach(it =>
                    {
                        circleResultHelpers.Find(itt => itt.id == it.caseOfficialId).caseOfficialEntity = it;
                    });
                }

                circleResultHelpers = (from crh in circleResultHelpers
                                       orderby crh.createDate descending
                                       select crh
                                       ).ToList();

                PageData pageData = new PageData(circleResultHelpers, pageNumber, pageSize, totalItemCount);

                dr.code = "200";
                dr.data = pageData;
            }
            catch (Exception ex)
            {
                dr.code = "999";
                dr.msg  = ex.Message;
            }

            return(Json(dr));
        }