Пример #1
0
 public void Info(InfoDetail detail)
 {
     if (_service != null)
     {
         _service.Info(detail);
     }
 }
Пример #2
0
 public stringCombine(List<string> list, InfoDetail.Info[] info)
 {
     for (int i = 0; i < info.Length; i++)
     {
         NewForm = NewForm + list[i] + ">" + info[i].Str + "@";
     }
 }
Пример #3
0
        public async Task <MessageModel <List <AllData> > > Post(string openId, string name, DateTime date)
        {
            try
            {
                _userServices.GetAdo().BeginTran();

                var data = new MessageModel <List <AllData> >();

                User user = (await _userServices.Query(q => q.OpenId == openId)).FirstOrDefault();

                if (user != null)
                {
                    user.Version += 1;

                    Info info = new Info()
                    {
                        OpenId = openId,
                        Name   = name
                    };

                    var infoId = (await _infoServices.Add(info));

                    if (infoId > 0)
                    {
                        InfoDetail infoDetail = new InfoDetail()
                        {
                            InfoId = infoId,
                            Date   = date,
                            Count  = 0,
                            Type   = "日"
                        };

                        var infoDetailId = (await _infoDetailServices.Add(infoDetail));

                        if (await _userServices.Update(user) && infoDetailId > 0)
                        {
                            data.success = true;
                        }
                    }

                    if (data.success)
                    {
                        data.response = (await userController.Get(openId)).response;
                        data.msg      = "添加成功";
                        _userServices.GetAdo().CommitTran();
                    }
                    else
                    {
                        _userServices.GetAdo().RollbackTran();
                    }
                }
                return(data);
            }
            catch (Exception ex)
            {
                _userServices.GetAdo().RollbackTran();
                throw ex;
            }
        }
Пример #4
0
        public async Task <MessageModel <List <AllData> > > Post(string openId, int infoId, int addCount, string type)
        {
            try
            {
                _userServices.GetAdo().BeginTran();

                var data = new MessageModel <List <AllData> >();

                if (addCount != 0)
                {
                    User user = (await _userServices.Query(q => q.OpenId == openId)).FirstOrDefault();

                    if (user != null)
                    {
                        user.Version += 1;

                        InfoDetail infoDetailInitail = (await _infoDetailServices.Query(q => q.InfoId == infoId && q.Count == 0 && q.Type == "日")).FirstOrDefault();

                        if (infoDetailInitail != null)
                        {
                            InfoDetail infoDetail = new InfoDetail()
                            {
                                InfoId = infoId,
                                Type   = type,
                                Count  = addCount,
                                Date   = GetDate(infoDetailInitail.Date.Value, addCount, type)
                            };

                            if (await _userServices.Update(user) && await _infoDetailServices.Add(infoDetail) > 0)
                            {
                                data.success = true;
                            }

                            if (data.success)
                            {
                                data.response = (await userController.Get(openId)).response;
                                data.msg      = "添加成功";
                                _userServices.GetAdo().CommitTran();
                            }
                            else
                            {
                                _userServices.GetAdo().RollbackTran();
                            }
                        }
                    }
                }
                return(data);
            }
            catch (Exception ex)
            {
                _userServices.GetAdo().RollbackTran();
                throw ex;
            }
        }
Пример #5
0
        /// <summary>
        /// 页面主入口
        /// </summary>
        public ActionResult Index(int bookid = 0)
        {
            ViewBag.BID = bookid;

            if (bookid == 0)
                return RedirectToAction("NotFound", "Error", new { err = "该作品不存在或者已暂时被下架" });

            if (bookid != 0)
            {
                ViewBag.IsKeep = _bookcaseService.Exists(ViewBag.User.ID, bookid);
            }

            Detail = GetInfoDetail(bookid);

            if (Detail.Book.Id != bookid || Detail.Book.Check != 0)
                return RedirectToAction("NotFound", "Error", new { err = "该作品不存在或者已暂时被下架" });

            if (Detail.Book.SpecialOffer > 0)
            {

                ViewBag.Tejia_Class = "group g2";
                ViewBag.Tejia_InnerHtml = string.Format(
                        "<li><a href=\"javascript:XiaoXiangJS.download({1},'{3}')\" class=\"button color1 r3\">下载到本地离线阅读</a></li><li><a href=\"javascript:;\" onclick=\"Site.showQuanbenrSubscribebox({0},{1})\" class=\"button color3 r3\">{2}元特价</a></li>"
                        , ViewBag.UserID, Detail.Book.Id, Detail.Book.SpecialOffer / 100, Detail.Book.Title);

                //判断是否包月
                if (ViewBag.User.ID > 0)
                {
                    DateTime baoyueTime = _memberService.GetMonthlyEndTime(ViewBag.User.ID);
                    if (baoyueTime > DateTime.Now)
                    {
                        if (Detail.Book.IsMonthly == 1)
                        {
                            ViewBag.Tejia_Class = "group g1";
                            ViewBag.Tejia_InnerHtml = string.Format(
                                "<li><a href=\"javascript:XiaoXiangJS.download({0},'{1}')\" class=\"button color1 r3\">下载到本地离线阅读</a></li>"
                                , Detail.Book.Id, Detail.Book.Title);
                        }
                    }
                }

            }
            else
            {
                ViewBag.Tejia_Class = "group g1";
                ViewBag.Tejia_InnerHtml = string.Format(
                        "<li><a href=\"javascript:XiaoXiangJS.download({0},'{1}')\" class=\"button color1 r3\">下载到本地离线阅读</a></li>"
                        , Detail.Book.Id, Detail.Book.Title);
            }

            return View(Detail);
        }
Пример #6
0
 private void DataGridMain_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (sender is DataGrid)
     {
         DataGrid mainGrid = (DataGrid)sender;
         rowDetail = (DataRowView)mainGrid.SelectedItem;
         if (rowDetail != null)                         //защита от дабл клик на пустой строке датагрида. Если пустой строки нету, то дабл клик по полосе прокрутки ведет к тому же.
         {
             readAllOneRow(rowDetail["id"].ToString()); //внутри будет переинициализирован rowDetail
             InfoDetail detail = new InfoDetail();
             detail.ShowDialog();
             readAllTableService();
             rowDetail = null;
         }
     }
 }
Пример #7
0
    private GameObject BuildBuilding(BuildingMetaData metaData, Vector2Int coordinate)
    {
        GameObject tile = HexMapManager.GetInstance().TileAtCoordinate(coordinate);

        bool isUpgrade = false;

        Building oldBuilding = BuildingAtCoordinate(coordinate);

        if (oldBuilding != null)
        {
            //check upgrade
            if (oldBuilding.metaData.id == metaData.id)
            {
                //is upgrade
                isUpgrade = true;
            }
            else
            {
                Debug.LogError("Cannot build: already have building here");
                return(null);
            }
        }

        GameObject buildingObject    = GameObject.Instantiate(metaData.prefab, tile.transform.position, tile.transform.rotation);
        Building   buildingComponent = buildingObject.GetComponent <Building>();

        buildingComponent.Initialize(metaData, coordinate);

        if (isUpgrade)
        {
            buildingComponent.UpgradeHandoverFrom(oldBuilding);
            buildings.Remove(coordinate);
            GameObject.Destroy(oldBuilding.gameObject);
        }

        buildings.Add(coordinate, buildingComponent);
        RecalculateResources();

        InfoDetail.GetInstance().LoadData(buildingComponent);
        return(buildingObject);
    }
Пример #8
0
 public static void Info(this ILogger logger, InfoDetail detail)
 {
     Log.Logger.Information("[Info]{@detail}", detail);
 }
Пример #9
0
        //[Route("Update")]
        public async Task <MessageModel <List <AllData> > > Put(string openId, string infoId, string name, DateTime?date)
        {
            try
            {
                _userServices.GetAdo().BeginTran();

                var data = new MessageModel <List <AllData> >();

                if (!string.IsNullOrEmpty(name) || date != null)
                {
                    User user = (await _userServices.Query(q => q.OpenId == openId)).FirstOrDefault();

                    if (user != null)
                    {
                        user.Version += 1;

                        Info info = (await _infoServices.QueryById(infoId));

                        if (info != null)
                        {
                            if (!string.IsNullOrEmpty(name))
                            {
                                info.Name = name;
                            }
                            if (await _userServices.Update(user) && await _infoServices.Update(info))
                            {
                                if (date != null)
                                {
                                    InfoDetail infoDetail = (await _infoDetailServices.Query(q => q.InfoId.ToString() == infoId && q.Count == 0 && q.Type == "日")).FirstOrDefault();

                                    if (infoDetail != null)
                                    {
                                        infoDetail.Date = date;

                                        if (await _infoDetailServices.Update(infoDetail))
                                        {
                                            List <InfoDetail> infoDetails = (await _infoDetailServices.Query(q => q.InfoId.ToString() == infoId && q.Count != 0 && q.Type != "日")).ToList();

                                            if (infoDetails.Count > 0)
                                            {
                                                foreach (InfoDetail infoDetail1 in infoDetails)
                                                {
                                                    infoDetail1.Date = date.Value.AddDays(infoDetail1.Count);
                                                }

                                                if (await _infoDetailServices.Update(infoDetails))
                                                {
                                                    data.success = true;
                                                }
                                            }
                                            else
                                            {
                                                data.success = true;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    data.success = true;
                                }
                            }
                        }

                        if (data.success)
                        {
                            data.response = (await userController.Get(openId)).response;
                            data.msg      = "更新成功";
                            _userServices.GetAdo().CommitTran();
                        }
                        else
                        {
                            _userServices.GetAdo().RollbackTran();
                        }
                    }
                }
                return(data);
            }
            catch (Exception ex)
            {
                _userServices.GetAdo().RollbackTran();
                throw ex;
            }
        }
Пример #10
0
        private async Task <List <AllData> > UserInitialAsync(string openId)
        {
            try
            {
                _userServices.GetAdo().BeginTran();

                List <AllData> allDatas = new List <AllData>();

                User newUser = new User
                {
                    OpenId  = openId,
                    Version = 0
                };

                var userId = await _userServices.Add(newUser, false);

                if (userId > 0)
                {
                    Info newInfo = new Info()
                    {
                        OpenId = openId,
                        Name   = "初体验"
                    };

                    var infoId = (await _infoServices.Add(newInfo));

                    if (infoId > 0)
                    {
                        InfoDetail infoDetail0day = new InfoDetail()
                        {
                            InfoId = infoId,
                            Date   = DateTime.Now,
                            Count  = 0,
                            Type   = "日"
                        };

                        List <InfoDetail> newInfoDetails = new List <InfoDetail> {
                            new InfoDetail()
                            {
                                InfoId = infoId,
                                Date   = DateTime.Now.Date,
                                Count  = 0,
                                Type   = "日"
                            },
                            new InfoDetail()
                            {
                                InfoId = infoId,
                                Date   = DateTime.Now.Date.AddDays(100),
                                Count  = 100,
                                Type   = "日"
                            },
                            new InfoDetail()
                            {
                                InfoId = infoId,
                                Date   = DateTime.Now.Date.AddMonths(100),
                                Count  = 100,
                                Type   = "月"
                            },
                            new InfoDetail()
                            {
                                InfoId = infoId,
                                Date   = DateTime.Now.Date.AddYears(100),
                                Count  = 100,
                                Type   = "年"
                            }
                        };

                        bool addSuccess = true;

                        foreach (var infoDetail in newInfoDetails)
                        {
                            var infoDetailId = await _infoDetailServices.Add(infoDetail);

                            if (infoDetailId <= 0)
                            {
                                addSuccess = false;
                                break;
                            }
                        }

                        if (addSuccess)
                        {
                            allDatas.Add(new AllData()
                            {
                                user       = newUser,
                                info       = newInfo,
                                infoDetail = newInfoDetails
                            });
                        }
                    }
                }

                if (allDatas.Count > 0)
                {
                    _userServices.GetAdo().CommitTran();
                }
                else
                {
                    _userServices.GetAdo().RollbackTran();
                }

                return(allDatas);
            }
            catch (Exception ex)
            {
                _userServices.GetAdo().RollbackTran();
                throw ex;
            }
        }
Пример #11
0
        /// <summary>
        /// 获取详情数据
        /// </summary>
        InfoDetail GetInfoDetail(int bookid)
        {
            var detail = new InfoDetail();

            var book = _bookService.Get(bookid);

            var lastChapterTags = _bookChapterService.GetLast(bookid);

            if (book != null)
            {
                detail.Book = book;
                //获取最新的5条评论
                //detail.Revies.AddRange(_bookReviewService.GetReviews(bookid, 0, 5, 0, out iTotal));
                //获取同类推荐
                //detail.SimilarBooks.AddRange(_cacheManager.Get<List<Nxp.Framework.Model.Books.Booksearch>>(string.Format("TongleiTuijian_{0}", book.ClassId), 180, () => { return _bookSearchService.SameRecommendtion(bookid, 5, 50); }));
                //获取作者其他
                //detail.AuthorOtherBooks.AddRange(_bookSearchService.GetAuthorOtherBooks(bookid));
                //获取最新章节
                detail.LastChapterTags = lastChapterTags;
            }
            return detail;
        }
Пример #12
0
 public void Info(InfoDetail detail)
 {
     _log.Information("[Info]{@detail}", detail);
 }
Пример #13
0
 InfoDetail()
 {
     _singleton = this;
 }
 private static void Information(InfoDetail detail)
 {
     Serilog.Log.Logger.Information(StandardizeMessage(detail));
 }