protected void btnSave_Click(object sender, EventArgs e) { try { int newPoint = Convert.ToInt32(frmpoint.Value); int oldPoint = newmember.point; newmember.point = newPoint; newmember.Update(); if (newPoint != oldPoint) { PointHistory pointhistory = new PointHistory(); pointhistory.UseTime = DateTime.Now; pointhistory.MemberId = id; pointhistory.Point = newmember.point - Point; pointhistory.CurrentPointCount = newmember.point; pointhistory.ItemName = "后台会员管理修改积分"; pointhistory.Save(); } Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", @"alert('成功!'); (function(){ var load=window.onload; window.onload=function(){ try{ if(load) load(); parent.Dialog.CloseAndRefresh(frameElement); }catch(e){}; }; })(); ", true); } catch (Exception ex) { } }
public override bool TickFunction() { string tags = "NCS_34_AI67,NCS_34_AI71,2NCS_AI190,2NCS_AI198,2NCS_AI230,2NCS_AI238,2NCS_AI266,2NCS_AI274"; try { DateTime nowTime = DateTime.Now; if (nowTime.Hour == 0) //当天的凌晨0点(60秒内) { List <SisData> sisList = WebApiHelper.GetEntity <List <SisData> >("http://10.146.33.9:20080/MIS/GetRtMonTagInfosByNames?tagNames=" + tags); List <PointHistory> pointList = new List <PointHistory>(); Bll db = Bll.NewBllNoRelation(); if (sisList != null && sisList.Count > 0) { foreach (SisData date in sisList) { PointHistory pointHis = new PointHistory(); pointHis.point = date.Name; pointHis.value = date.Value; pointHis.createTime = DateTime.Now; pointList.Add(pointHis); } bool result = db.PointHistories.AddRange(pointList); Log.Info("PointHistoryThread: 保存测点数据,时间:" + DateTime.Now + ",结果:" + result); } } } catch (Exception ex) { Log.Error("PointHistoryThread:" + ex.ToString()); } return(true); }
private void pbMaskImage_MouseUp(object sender, MouseEventArgs e) { if (this.rbBrush.Checked) { if (this._inProgessLayer != null) { this._transparentLayer = this.MergeBitmaps(this._transparentLayer, this._inProgessLayer); this.pbMaskImage.Image = this.MergeBitmaps(this._cameraLayer, this.AdjustImageOpacity(this._transparentLayer, DEFAULT_OPACITY)); this._inProgessLayer = null; } if (this._currentPoints.GetPoints().Count > 1) { this._allPointLists.Add(this._currentPoints); this._currentPoints = new PointHistory(); } } else if (this.rbRectangle.Checked && e.Button == MouseButtons.Left) { this._drawing = false; if (this._inProgessLayer != null) { this.pbMaskImage.Refresh(); // call paint to draw inprogress rectangle to image this._transparentLayer = this.MergeBitmaps(this._transparentLayer, this._inProgessLayer); this.pbMaskImage.Image = this.MergeBitmaps(this._cameraLayer, this.AdjustImageOpacity(this._transparentLayer, DEFAULT_OPACITY)); //reset rectangle positions and in progress layer this._startRectanglePoint = Point.Empty; this._currentRectanglePoint = Point.Empty; this._inProgessLayer = null; } } }
private void pbMaskImage_MouseUp(object sender, MouseEventArgs e) { if (rbBrush.Checked) { if (inProgessLayer != null) { transparentLayer = MergeBitmaps(transparentLayer, inProgessLayer); pbMaskImage.Image = MergeBitmaps(cameraLayer, AdjustImageOpacity(transparentLayer, DEFAULT_OPACITY)); inProgessLayer = null; } if (currentPoints.GetPoints().Count > 1) { allPointLists.Add(currentPoints); currentPoints = new PointHistory(); } } else if (rbRectangle.Checked && e.Button == MouseButtons.Left) { drawing = false; transparentLayer = MergeBitmaps(transparentLayer, inProgessLayer); pbMaskImage.Image = MergeBitmaps(cameraLayer, AdjustImageOpacity(transparentLayer, DEFAULT_OPACITY)); inProgessLayer = null; } }
public MatchSave(PlayerSave cpu) { this.cpuPlayer = cpu; this.matchOver = false; this.pointHistory = new GameEngine.PointHistory(); this.score = new Score(3); }
public ActionResult ShowPointHistory() { FansInfo Fans = Session["FansInfo"] as FansInfo; PointHistory dyn = _custMember.GetPointHistory(Fans.Openid); ViewBag.History = dyn; return(View()); }
private void pbMaskImage_MouseDown(object sender, MouseEventArgs e) { if (this.rbBrush.Checked) { this._currentPoints = new PointHistory(this.AdjustZoomMousePosition(e.Location), this.BrushSize); } else if (this.rbRectangle.Checked) { this._currentRectanglePoint = this._startRectanglePoint = e.Location; this._drawing = true; } }
private void pbMaskImage_MouseDown(object sender, MouseEventArgs e) { if (rbBrush.Checked) { currentPoints = new PointHistory(AdjustZoomMousePosition(e.Location), brushSize); } else if (rbRectangle.Checked) { currentRectanglePoint = startRectanglePoint = AdjustZoomMousePosition(e.Location); drawing = true; } }
public async Task <IActionResult> OnPostAsync() { var matchEntity = await GetMatchById(ResultModel.MatchId); matchEntity.Result = ResultModel.GetResult(); PointHistory pointHistory = new PointHistory { Id = Guid.NewGuid(), TimeStamp = DateTime.Now }; List <PointResult> results = new List <PointResult>(); foreach (var matchEntityBet in matchEntity.Bets) { List <PointPolicy> policies = new List <PointPolicy>(); foreach (var pointPolicy in PointPoliciese) { PointPolicy tmp = new PointPolicy { Applied = pointPolicy.CanApply(matchEntity.Result, matchEntityBet), Description = pointPolicy.Description, Name = pointPolicy.Name, Id = Guid.NewGuid(), Points = pointPolicy.Points, PolicyType = PolicyType.Match, TimeStamp = DateTime.Now }; policies.Add(tmp); } var user = await GetUserById(matchEntityBet.UserId); matchEntityBet.Result = new PointResult { User = user, Id = Guid.NewGuid(), AddedPoints = policies.Sum(c => c.Applied ? c.Points.Value : 0), PointPolicies = policies, SumPoints = user.Points + policies.Sum(c => c.Applied ? c.Points.Value : 0), TimeStamp = DateTime.Now }; user.Points = user.Points + policies.Sum(c => c.Applied ? c.Points.Value : 0); results.Add(matchEntityBet.Result); } pointHistory.PointResults = results; _context.PointHistories.Add(pointHistory); await _context.SaveChangesAsync(); return(RedirectToPage("../Dashboard/Index")); }
private void AddDeleteHistory(Point point) { var pointHistory = new PointHistory() { PointId = point.Id, OldDate = point.Date, OldLatitude = point.Latitude, OldLongitude = point.Longitude, OldNotes = point.Notes, ChangedOn = DateTime.Now, Action = PointHistoryType.Delete }; pointContext.PointsHistory.Add(pointHistory); }
private void AddCreateHistory(Point point) { var pointHistory = new PointHistory() { PointId = point.Id, NewDate = point.Date, NewLatitude = point.Latitude, NewLongitude = point.Longitude, NewNotes = point.Notes, ChangedOn = DateTime.Now, Action = PointHistoryType.Create }; pointContext.PointsHistory.Add(pointHistory); }
protected void Page_Load(object sender, EventArgs e) { Int32 ID = Convert.ToInt32(Request.QueryString["ID"]); Int32 addTime = Convert.ToInt32(Request.QueryString["timeAdd"]); //更新竞投时间 try { Auction auction = Auction.FindByID(ID); if (auction.AuctionSatus != 3 && auction.EndTime <= DateTime.Now && auction.MinPrice <= auction.BiddingPriceNow) { auction.AuctionSatus = 3; } auction.EndTime = auction.EndTime.AddSeconds(addTime); auction.BiddingPriceNow += auction.EveryAddPrice; auction.WinningBidder = member.Current.ID; auction.UpdateTime = DateTime.Now; auction.BidCount += 1; auction.Update(); //花费积分 竞投 member.Current.point = member.Current.point - auction.EveryNeedPoint; member.Current.Update(); AuctionHistory history = new AuctionHistory(); history.MemberID = member.Current.ID; history.AuctionID = auction.ID; history.BidDate = DateTime.Now; history.BidEyuan = auction.BiddingPriceNow; history.Insert(); PointHistory pointhistory = new PointHistory(); pointhistory.UseTime = DateTime.Now; pointhistory.MemberId = member.Current.ID; pointhistory.Point = -1 * auction.EveryNeedPoint; pointhistory.ItemName = "参与竞投"; pointhistory.CurrentPointCount = member.Current.point; pointhistory.Save(); msgStr = "success"; } catch (Exception ex) { msgStr = "fail"; HmTrace.WriteException(ex.Message); //Response.Write(ex.Message); } Response.Write(msgStr); }
/// <summary> /// 显示历史记录 /// </summary> /// <param name="openid"></param> /// <returns></returns> public PointHistory GetPointHistory(string openid) { //查询会员主数据信息 CUST_MEMBER member = _repo.GetMemberByOpenId(openid); dt_Dyn_GetPointDetail_req req = new dt_Dyn_GetPointDetail_req(); req.LOYALTY_BRAND = AppConfig.LOYALTY_BRAND; //忠诚度品牌 req.SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM; //来源系统 req.VGROUP = AppConfig.VGROUP; //销售组织 req.DATA_SOURCE = "0002"; //得到一年之内的历史记录 req.ZSTART_DATE = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd"); req.ZEND_DATE = DateTime.Now.ToString("yyyy-MM-dd"); req.ACCOUNT_ID = member.MEMBERNO; ZCRMT402_Dyn[] lists = WebApiHelp.GetPointDetail(req).ZCRMT402; PointHistory datas = new PointHistory(); List <PointHisList> arry = new List <PointHisList>(); foreach (ZCRMT402_Dyn dyn in lists) { PointHisList his = new PointHisList() { CATEGORY = dyn.CATEGORY, CREATED_TIME = dyn.CREATED_TIME, EXPIRE_DATE = dyn.EXPIRE_DATE, ORDER_TYPE = Utility.GetDetailDis(dyn.ORDER_TYPE), POINTS = dyn.POINTS.ToString(), CREATED_TIME_EX = DateTime.Parse(dyn.CREATED_TIME), }; arry.Add(his); } datas.Hise = arry.OrderByDescending(a => a.CREATED_TIME_EX).ToList(); datas.Point = member.AVA_POINTS.ToString(); return(datas); }
private void AddEditHistory(Point point) { var oldPoint = pointRepository.Get(point.Id); var pointHistory = new PointHistory() { PointId = point.Id, OldDate = oldPoint.Date, OldLatitude = oldPoint.Latitude, OldLongitude = oldPoint.Longitude, OldNotes = oldPoint.Notes, NewDate = DateTime.Now, NewLatitude = point.Latitude, NewLongitude = point.Longitude, NewNotes = point.Notes, ChangedOn = DateTime.Now, Action = PointHistoryType.Edit }; pointContext.PointsHistory.Add(pointHistory); }
protected void Page_Load(object sender, EventArgs e) { if (VerifyIPN()) { string ppTx = Request.Form["txn_id"].ToString(); string ppreceiver_email = Request.Form["receiver_email"].ToString(); string ppmc_gross = Request.Form["mc_gross"].ToString(); string ppmc_currency = Request.Form["mc_currency"].ToString(); string pppayment_status = Request.Form["payment_status"].ToString(); string pppitem_name = Request.Form["item_name"].ToString(); HmTrace.WriteInfo("No.:" + ppTx); HmTrace.WriteInfo("Email:" + ppreceiver_email); HmTrace.WriteInfo("gross:" + ppmc_gross); HmTrace.WriteInfo("currency:" + ppmc_currency); HmTrace.WriteInfo("status:" + pppayment_status); HmTrace.WriteInfo("item_name:" + pppitem_name); try { Order order = Order.FindByItemName(pppitem_name); if (order != null) { order.McCurrency = ppmc_currency; order.McGross = Convert.ToDecimal(ppmc_gross); order.OrderNo = ppTx; order.PaymentStatus = pppayment_status; order.ReceiverEmail = ppreceiver_email; order.Save(); if (pppayment_status == "Completed") { member ordermember = member.FindByID(order.MemberId); if (ordermember != null) { var newpoint = PointType.FindByGross(Convert.ToDecimal(ppmc_gross)).Point; HmTrace.WriteInfo("会员:" + order.memberName + "新增积分:" + newpoint); ordermember.point = ordermember.point + newpoint; ordermember.Save(); PointHistory pointhistory = new PointHistory(); pointhistory.UseTime = DateTime.Now; pointhistory.MemberId = ordermember.ID; pointhistory.Point = newpoint; pointhistory.ItemName = "购买积分"; pointhistory.CurrentPointCount = ordermember.point; pointhistory.Save(); HmTrace.WriteInfo("会员:" + order.memberName + "积分:" + ordermember.point); } else { HmTrace.WriteInfo("" + Convert.ToDecimal(ppmc_gross) + ""); } } } else { HmTrace.WriteInfo("找不到此itemName"); } } catch (Exception ex) { HmTrace.WriteDebug(ex.Message); } } }
public ActionResult ProcessReturn(ViewModels.ReturnBookModel rbm) { if (rbm.LoanId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Loan loan = db.Loans.Find(rbm.LoanId); if (loan == null) { TempData["Error"] = "1"; TempData["Message"] = "<strong>Failed to initiate return.</strong> Loan ID does not exist."; return(RedirectToAction("ActiveLoans", new { })); } if (loan.ReturnDate != null) { TempData["Error"] = "1"; TempData["Message"] = "<strong>Failed to initiate return.</strong> This reservation is already completed, the book has been returned last " + loan.ReturnDate.Value.ToString("MM-dd-yyyy hh:mm tt"); return(RedirectToAction("ViewLoans", new { email = loan.User.Email })); } loan.ReturnDate = DateTime.UtcNow.AddHours(8); loan.IsDamaged = rbm.IsDamaged; loan.IsSevere = rbm.IsSevere; loan.DamageDescription = rbm.DamageDescription; if (rbm.IsDamaged) { if (rbm.IsSevere) { loan.Book.BookStatus = BookStatusConstant.DAMAGED_AVAILABLE; TempData["Message"] = "<strong>Successfully returned book.</strong> The book, " + loan.Book.BookTemplate.Title + " with ID " + loan.BookId + ", has been set to Available - Damaged."; } else { loan.Book.BookStatus = BookStatusConstant.AVAILABLE; TempData["Message"] = "<strong>Successfully returned book.</strong> The book, " + loan.Book.BookTemplate.Title + " with ID " + loan.BookId + ", has been set to Available."; } } else { loan.Book.BookStatus = BookStatusConstant.AVAILABLE; TempData["Message"] = "<strong>Successfully returned book.</strong> The book, " + loan.Book.BookTemplate.Title + " with ID " + loan.BookId + ", has been set to Available."; } db.SaveChanges(); try { Task.Run(() => { new SMSController().SendSMS(loan.UserId, "Hello, this is to confirm that you've returned the book; " + loan.Book.BookTemplate.Title + " on " + loan.ReturnDate.Value.ToString("MM-dd-yyyy hh:mm tt") + " from Loan ID; " + loan.LoanId + ". "); }); } catch (Exception e) { Trace.TraceInformation("SMS Send Failed for " + loan.Book.BookTemplate.Title + ", Loan ID:" + loan.LoanId + ": " + e.Message); } if (loan.IsDamaged == false && loan.ReturnDate.Value.Date <= loan.EndDate) { try { PointHistory newPoints = new PointHistory { DateCreated = DateTime.UtcNow.AddHours(8), Description = "Points earned from returning the book; " + loan.Book.BookTemplate.Title + " with Loan ID " + loan.LoanId + " on time.", Type = PointTypeConstant.ADD, Points = 15, UserId = loan.UserId }; db.PointHistories.Add(newPoints); db.SaveChanges(); int totalAddPoints = db.PointHistories.Where(p => p.UserId == loan.UserId && p.Type == PointTypeConstant.ADD).Sum(p => p.Points); int totalMinusPoints = (db.PointHistories.Where(p => p.UserId == loan.UserId && p.Type == PointTypeConstant.MINUS).Count() == 0) ? 0 : db.PointHistories.Where(p => p.UserId == loan.UserId && p.Type == PointTypeConstant.MINUS).Sum(p => p.Points); int totalPoints = totalAddPoints - totalMinusPoints; Task.Run(() => { new SMSController().SendSMS(loan.UserId, "Thank you for returning " + loan.Book.BookTemplate.Title + " on time and in good condition! You've earned an additional " + newPoints.Points + ". Your total points is now " + totalPoints + "."); }); } catch (Exception e) { Trace.TraceInformation("SMS Send Failed for " + loan.Book.BookTemplate.Title + ", Loan ID:" + loan.LoanId + ": " + e.Message); } } return(RedirectToAction("ViewLoans", new { email = loan.User.Email })); }