//提现失败返回余额 public void ReduceUserPoint4(string username, decimal money, string type) { Beauty.Core.PaginationInfo paging = new Core.PaginationInfo(); IList <User> users = iuser.Get(null, username, null, null, null, null, null, null, null, null, 1, 0, null, out paging); if (users != null && users.Count > 0) { User user = users[0]; user.Balance += money; iuser.Update(user); MoneyRecord moneyrecord = new MoneyRecord { ID = Guid.NewGuid(), Money = 0, Statues = 1, Username = user.Username, Balance = user.Point - user.FreezePoint, Type = type }; imoney.Create(moneyrecord); } }
public void AddUserPoint(decimal point, string type) { Beauty.Core.PaginationInfo paging = new Core.PaginationInfo(); IList <User> users = iuser.Get(null, UserName, null, null, null, null, null, null, null, null, 1, 0, null, out paging); if (users != null && users.Count > 0) { User user = users[0]; user.FreezePoint -= point; if (user.FreezePoint < 0) { user.FreezePoint = 0; } iuser.Update(user); MoneyRecord money = new MoneyRecord { ID = Guid.NewGuid(), Money = 0, Statues = 1, Username = user.Username, Balance = user.Point - user.FreezePoint, Type = type }; imoney.Create(money); } }
/// <summary> /// Delete an existing MoneyRecord /// </summary> /// <param name="thisMoneyRecord">MoneyRecord</param> /// <returns>bool</returns> public bool Delete(MoneyRecord thisMoneyRecord) { string sql = string.Format("exec dbo.sp_Money_d {0} " , ToQuote(thisMoneyRecord.ID) ); try { int rowcount = SqlHelper.ExecuteNonQuery(ConnectStr, CommandType.Text, sql); if (rowcount >= 1) { return(true); } else { throw new Exception("SQL execution failed"); } } catch (Exception ex) { throw new Exception("SQL execution failed", ex); } }
/// <summary> /// Update an existing MoneyRecord /// </summary> /// <param name="thisMoneyRecord">MoneyRecord</param> /// <returns>bool</returns> public bool Update(MoneyRecord thisMoneyRecord) { string sql = string.Format("EXEC sp_Money_u {0},{1},{2},{3},{4},{5},{6},{7},{8}" , ToQuote(thisMoneyRecord.ID) , ToQuote(thisMoneyRecord.Username) , thisMoneyRecord.Userid.HasValue ? ToQuote(thisMoneyRecord.Userid.Value) : "NULL" , ToQuote(thisMoneyRecord.Money) , thisMoneyRecord.Balance.HasValue ? ToQuote(thisMoneyRecord.Balance.Value) : "NULL" , ToQuote(thisMoneyRecord.Type) , ToQuote(CurrentUserName) , ToQuote(DateTime.Now) , ToQuote(thisMoneyRecord.Statues) ); try { int rowcount = SqlHelper.ExecuteNonQuery(ConnectStr, CommandType.Text, sql); if (rowcount == 1) { return(true); } else { throw new Exception("SQL execution failed"); } } catch (Exception ex) { throw new Exception("SQL execution failed", ex); } }
public vMoneyRecord(MoneyRecord model) { this.ID = model.ID; this.UserID = model.UserID; this.Money = model.Money; this.Transaction = model.Transaction; this.Time = model.Time; this.Hint = model.Hint; }
private void adddr(MoneyRecord mr) { DataGridViewRow dr = new DataGridViewRow(); dr.CreateCells(dataGridView1); dr.Cells[0].Value = mr.usernumber; dr.Cells[1].Value = mr.username; dr.Cells[2].Value = mr.changedmoney; dr.Cells[3].Value = mr.changetime.ToString(); dataGridView1.Rows.Insert(0, dr); money += mr.changedmoney; }
private void freshdata(string uid) { if (textBox1.Text != "输入学号") { records = MoneyRecord.FindByUid(UserInfo.Getuid(uid)); data_add(records); } else { records = MoneyRecord.Getall(); data_add(records); } }
public JsonResult BugPoint(string point) { IList <SettingGroup> settings = isetting.GetSystemSetting(); string moneyratestr = GetSettingVal(settings, "2AADE1C6-59BE-4B0E-927C-7B28BFC8C397"); ResultMsg msg = new ResultMsg(); try { decimal money = decimal.Parse(point) / decimal.Parse(moneyratestr); money = decimal.Round(money, 2); PaginationInfo paging = new PaginationInfo(); User user = iuser.Get(null, UserName, null, null, null, null, null, null, null, null, 1, 1, null, out paging)[0]; if (money > user.Balance) { ModelState.AddModelError("", "余额不足"); msg.Msg = "余额不足"; msg.Result = false; return(Json(msg, JsonRequestBehavior.AllowGet)); } user.Point += decimal.Parse(point); user.Balance -= money; iuser.Update(user); MoneyRecord moneyrecord = new MoneyRecord { ID = Guid.NewGuid(), Money = 0, Statues = 1, Username = user.Username, Balance = user.Point - user.FreezePoint, Type = "购买积分:" + point.ToString() + ",扣除余额:" + money.ToString() }; imoney.Create(moneyrecord); AddCrossActionMsg("OK", "购买积分成功"); msg.Msg = "购买积分成功"; msg.Result = true; return(Json(msg, JsonRequestBehavior.AllowGet)); } catch { msg.Msg = "购买失败,系统忙"; msg.Result = false; return(Json(msg, JsonRequestBehavior.AllowGet)); } }
public void MoneyRecord(string type, string username, decimal balance) { var moneyds = DataServiceContainer.Self.GetService <IMoney>(); MoneyRecord money = new MoneyRecord { ID = Guid.NewGuid(), Money = 0, Statues = 1, Username = username, Balance = balance, Type = type }; moneyds.Create(money); }
/// <summary> /// Don't repeat yourself! This private function is for shared by all query public functions /// </summary> /// <param name="sql"></param> /// <param name="page"></param> /// <param name="pg"></param> /// <returns></returns> IList <MoneyRecord> GetMoneyRecords(string sql, int page, string sortKey, out PaginationInfo paging) { using (DataSet ds = SqlHelper.ExecuteDataset(ConnectStr, CommandType.Text, sql)) { if (ds == null || ds.Tables.Count != 2) { throw new Exception("SQL execution failed"); } else { List <MoneyRecord> Comments = new List <MoneyRecord>(); foreach (DataRow dr in ds.Tables[0].Rows) { MoneyRecord Comment = new MoneyRecord() { ID = new Guid(dr["id"].ToString()), Balance = ParseNDecimal(dr["Balance"]), Money = ParseDecimal(dr["Money"]), Type = ParseStr(dr["Type"]), Userid = ParseNGuid(dr["Userid"].ToString()), Username = ParseStr(dr["Username"]), Statues = ParseInt(dr["Statues"]), Createby = ParseStr(dr["Createby"]), Createtime = ParseStr(dr["Createtime"]), Updateby = ParseStr(dr["Updateby"]), Updatetime = ParseStr(dr["Updatetime"]) }; Comments.Add(Comment); } paging = new PaginationInfo() { Current = page, Size = ParseInt(ds.Tables[1].Rows[0]["pagesize"]), TotalRecords = ParseInt(ds.Tables[1].Rows[0]["totalrecords"]), TotalPages = (int)Math.Ceiling(ParseInt(ds.Tables[1].Rows[0]["totalrecords"]) / ParseFloat(ds.Tables[1].Rows[0]["pagesize"])) }; return(Comments); } } }
protected void onHeadNodShakeHandler(FaceEvent e) { Action d = () => { if (e.type == FaceEvent.EventType.HeadNodDetected) { MoneyRecord.Create(_lastFaceID, int.Parse(textBox1.Text), DateTime.Now); yue.Text = (int.Parse(yue.Text) + int.Parse(textBox1.Text)).ToString(); _faceCamera.SetSpeakAsync("充值成功,感谢使用"); } else if (e.type == FaceEvent.EventType.HeadShakeDetected) { _faceCamera.SetSpeakAsync("充值取消,欢迎下次光临!"); } _faceCamera.FaceCmd = FaceCamera.FaceCommand.ShotOneAndFind; }; this.BeginInvoke(d); }
protected void onHeadNodShakeHandler(FaceEvent e) { Action d = () => { if (e.type == FaceEvent.EventType.HeadNodDetected) { MoneyRecord.Create(_lastFaceID, -10, DateTime.Now); label_DetectResultHint.Text = "支付成功,祝您用餐愉快!"; _faceCamera.SetSpeakAsync("支付成功,祝您用餐愉快!"); textBox_balance.Text = (int.Parse(textBox_balance.Text) - 10).ToString(); } else if (e.type == FaceEvent.EventType.HeadShakeDetected) { label_DetectResultHint.Text = "付款取消,欢迎下次光临!"; _faceCamera.SetSpeakAsync("付款取消,欢迎下次光临!"); } _faceCamera.FaceCmd = FaceCamera.FaceCommand.ShotOneAndFind; }; this.BeginInvoke(d); }
public ActionResult ProcessTrx(FormCollection data) { //return JavaScript("window.location = 'http://www.google.co.uk'"); //return new RedirectResult("http://www.baidu.com",false); MoneyRecord money = new MoneyRecord { ID = Guid.NewGuid(), Money = decimal.Parse(Request["moneyhidden"]), Statues = 1, Username = Request["username"], Type = "充值类型:" + Request["type"] + ",充值金额:" + Request["moneyhidden"] }; string domain = System.Configuration.ConfigurationManager.AppSettings["domain"]; Guid id = imoney.Create(money); if (id == money.ID) { string payment_type = "1"; string notify_url = domain + "/home/notify"; //需http://格式的完整路径,不能加?id=123这类自定义参数 //页面跳转同步通知页面路径 string return_url = domain + "/home/processtrxreturn"; //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/ //卖家支付宝帐户 string seller_email = "*****@*****.**"; //必填 //商户订单号 string out_trade_no = id.ToString(); //商户网站订单系统中唯一订单号,必填 //订单名称 string subject = "美丽说分享宝"; //必填 //付款金额 string total_fee = money.Money.ToString(); //必填 //订单描述 string body = ""; //商品展示地址 string show_url = ""; //需以http://开头的完整路径,例如:http://www.xxx.com/myorder.html //防钓鱼时间戳 string anti_phishing_key = Submit.Query_timestamp(); //若要使用请调用类文件submit中的query_timestamp函数 //客户端的IP地址 string exter_invoke_ip = GetClientIP(); //非局域网的外网IP地址,如:221.0.0.1 //////////////////////////////////////////////////////////////////////////////////////////////// //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("partner", Config.Partner); sParaTemp.Add("_input_charset", Config.Input_charset.ToLower()); sParaTemp.Add("service", "create_direct_pay_by_user"); sParaTemp.Add("payment_type", payment_type); sParaTemp.Add("notify_url", notify_url); sParaTemp.Add("return_url", return_url); sParaTemp.Add("seller_email", seller_email); sParaTemp.Add("out_trade_no", out_trade_no); sParaTemp.Add("subject", subject); sParaTemp.Add("total_fee", total_fee); sParaTemp.Add("body", body); sParaTemp.Add("show_url", show_url); sParaTemp.Add("anti_phishing_key", anti_phishing_key); sParaTemp.Add("exter_invoke_ip", exter_invoke_ip); //建立请求 string sHtmlText = Submit.BuildRequest(sParaTemp, "get", "确认"); return(Content(sHtmlText)); } else { AddCrossActionMsg("fail", "下定单失败"); return(Content("下定单失败")); } }
public ActionResult ProcessTrxReturn() { SortedDictionary <string, string> sPara = GetRequestGet(); PaginationInfo paging = new PaginationInfo(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 //商户订单号 string out_trade_no = Request.QueryString["out_trade_no"]; //支付宝交易号 string trade_no = Request.QueryString["trade_no"]; //交易状态 string trade_status = Request.QueryString["trade_status"]; if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS") { //判断该笔订单是否在商户网站中已经做过处理 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 MoneyRecord moneyrecord = imoney.Get(Guid.Parse(out_trade_no)); if (moneyrecord != null && !moneyrecord.Balance.HasValue) { Setting setting = isetting.Get(Guid.Parse("2AADE1C6-59BE-4B0E-927C-7B28BFC8C397")); Setting backsetting = isetting.Get(Guid.Parse("3A1FC752-0700-492B-A6C6-A5460271DC91")); User user = iuser.Get(null, moneyrecord.Username, null, null, null, null, null, null, null, null, null, 0, null, out paging)[0]; user.Point = user.Point + decimal.Round(decimal.Parse(setting.Value) * moneyrecord.Money, 2); moneyrecord.Balance = user.Point - user.FreezePoint; iuser.Update(user); imoney.Update(moneyrecord); WriteLog(user.Username + " 充值" + moneyrecord.Money.ToString()); if (!string.IsNullOrEmpty(user.Refer)) { IList <User> referusers = iuser.Get(null, user.Refer, null, null, null, null, null, null, null, null, null, 0, null, out paging); if (referusers != null && referusers.Count > 0) { User referuser = referusers[0]; decimal addpoint = decimal.Parse(setting.Value) * moneyrecord.Money * decimal.Parse(backsetting.Value); addpoint = decimal.Round(addpoint, 2); referuser.Point = referuser.Point + addpoint; WriteLog(referuser.Username + " 获得返利积分" + (decimal.Parse(setting.Value) * moneyrecord.Money * decimal.Parse(backsetting.Value)).ToString()); iuser.Update(referuser); MoneyRecord money = new MoneyRecord { ID = Guid.NewGuid(), Money = 0, Statues = 1, Username = referuser.Username, Balance = referuser.Point - referuser.FreezePoint, Type = "获得返利积分:" + addpoint.ToString() }; imoney.Create(money); } } ViewBag.Money = moneyrecord.Money.ToString(); ViewBag.Msg = "成功"; ViewBag.Type = "OK"; } else { ViewBag.Msg = "非法操作"; ViewBag.Type = "Fail"; } } else { ViewBag.Msg = "非法操作"; ViewBag.Type = "Fail"; } //打印页面 //Response.Write("验证成功<br />"); //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { //Response.Write("验证失败"); ViewBag.Msg = "非法操作"; ViewBag.Type = "Fail"; } } else { //Response.Write("无返回参数"); ViewBag.Msg = "非法操作"; ViewBag.Type = "Fail"; } return(View()); }