Esempio n. 1
0
        private IEnumerable <PartnerTranWithLevel> GetPartnerTransWithLevel(int level)
        {
            var partners            = PayDAO.GetAllPartners();
            var partnerTrans        = PayDAO.GetAllAgencyTransactions();
            var partnerTransByLevel = from a in partnerTrans
                                      from b in partners.Where(p => (p.GameAccountId == a.SenderID) || p.GameAccountId == a.RecvID)
                                      .DefaultIfEmpty()
                                      select new PartnerTranWithLevel()
            {
                ID            = a.ID,
                CreatedTime   = a.CreatedTime,
                Amount        = a.Amount,
                Fee           = a.Fee,
                Sender        = a.Sender,
                SenderID      = a.SenderID,
                Recv          = a.Recv,
                RecvID        = a.RecvID,
                Description   = a.Description,
                Note          = a.Note,
                CreateTimeInt = a.CreateTimeInt,
                State         = a.State,
                Level         = b.Level
            };

            return(partnerTransByLevel.Where(x => x.Level == level));
        }
Esempio n. 2
0
        public ActionResult GoldTransferStatisticsData(int month = 0)
        {
            var aTrans = PayDAO.GetAllAgencyTransactions();

            month = month == 0 ? DateTime.Now.Month : month;

            var soldByOwner   = aTrans.Where(x => (x.SenderID == 860000 || x.SenderID == 860001) && (x.RecvID != 860000 && x.RecvID != 860001) && x.CreatedTime.Month == month).OrderByDescending(x => x.CreatedTime);
            var soldByPartner = aTrans.Where(x => (x.RecvID == 860000 || x.RecvID == 860001) && (x.SenderID != 860000 && x.SenderID != 860001) && x.CreatedTime.Month == month).OrderByDescending(x => x.CreatedTime);

            var ownerGroupByDate  = soldByOwner.GroupBy(x => x.CreatedTime.Date);
            var parnerGroupByDate = soldByPartner.GroupBy(x => x.CreatedTime.Date);

            var ownerList   = new List <AgencyTranByDate>();
            var partnerList = new List <AgencyTranByDate>();

            foreach (var date in ownerGroupByDate)
            {
                ownerList.Add(new AgencyTranByDate()
                {
                    DateString = date.Key.ToString("dd/MM/yyyy"),
                    TotalGold  = date.Sum(x => x.Amount),
                    TotalMoney = (long)(date.Sum(x => x.Amount) * 0.82),
                    TotalTrans = date.Count()
                });
            }

            foreach (var date in parnerGroupByDate)
            {
                partnerList.Add(new AgencyTranByDate()
                {
                    DateString = date.Key.ToString("dd/MM/yyyy"),
                    TotalGold  = date.Sum(x => x.Amount),
                    TotalMoney = (long)(date.Sum(x => x.Amount) * 0.82),
                    TotalTrans = date.Count()
                });
            }


            var totalOwnerGold = ViewBag.TotalOwnerGold = soldByOwner.Sum(x => x.Amount);

            ViewBag.TotalOwnerMoney = totalOwnerGold * 0.82;
            ViewBag.TotalOwnerTrans = soldByOwner.Count();

            // by partner
            var totalPartnerGold = ViewBag.TotalPartnerGold = soldByPartner.Sum(x => x.Amount);

            ViewBag.TotalPartnerMoney = totalPartnerGold * 0.82;
            ViewBag.TotalPartnerTrans = soldByPartner.Count();
            var allDate = ownerList.Select(x => x.DateString).Union((partnerList.Select(x => x.DateString)));

            //NLogManager.LogMessage($"ownerList:{JsonConvert.SerializeObject(ownerList)}\npartnerList:{JsonConvert.SerializeObject(partnerList)}\nAlLDate:{JsonConvert.SerializeObject(allDate)}");
            ViewData["OwnerList"]   = ownerList;
            ViewData["PartnerList"] = partnerList;
            ViewData["AllDate"]     = allDate;
            return(PartialView());
        }
Esempio n. 3
0
        public ActionResult GoldTransferDetails(string date, bool isSelling, int month = 0) //xem chi tiết giao dịch đại lý và nph
        {
            var aTrans      = PayDAO.GetAllAgencyTransactions();
            var currentDate = DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            month  = month == 0 ? DateTime.Now.Month : month;
            aTrans = aTrans.Where(x => x.CreatedTime.Month == month);
            aTrans = aTrans.Where(x => x.CreatedTime.Date == currentDate); // xem trong ngày chỉ định
            var transferDetails = new List <AgencyTransaction>();

            if (isSelling)
            {
                transferDetails = aTrans.Where(x => (x.RecvID == 860000 || x.RecvID == 860001) && (x.SenderID != 860000 && x.SenderID != 860001)).OrderByDescending(x => x.CreatedTime).ToList();
            }
            else
            {
                transferDetails = aTrans.Where(x => (x.SenderID == 860000 || x.SenderID == 860001) && (x.RecvID != 860000 && x.RecvID != 860001)).OrderByDescending(x => x.CreatedTime).ToList();
            }

            ViewBag.IsSelling = isSelling; // đại lý bán


            return(View(transferDetails));
        }