private void ajax() { string tid = Request.QueryString["tid"]; string[] tids = tid.Split(','); if (tids.Count() == 0) { return; } Response.Clear(); //清除所有之前生成的Response内容 foreach (var t in tids) { lgk.Model.tb_takeMoney cModel = takeBLL.GetModel(Convert.ToInt32(t)); lgk.Model.tb_user user = userBLL.GetModel(Convert.ToInt32(cModel.UserID)); if (cModel.Flag == 0) { cModel.Flag = 1; cModel.Take006 = DateTime.Now; if (takeBLL.Update(cModel) && UpdateSystemAccount("MoneyAccount", Convert.ToDecimal(cModel.RealityMoney), 0) > 0) { if (cModel.Take001 == 6) { user.Batch = 0; userBLL.Update(user); } } } } Response.Write("ok"); Response.End(); //停止Response后续写入动作,保证Response内只有我们写入内容 }
/// <summary> /// 增加一条数据 /// </summary> public int Add(lgk.Model.tb_takeMoney model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tb_takeMoney("); strSql.Append("TakeTime,TakeMoney,TakePoundage,RealityMoney,BonusBalance,Flag,UserID,BankName,BankAccount,BankAccountUser,BankDian,Take001,Take002,Take003,Take004,Take005,Take006)"); strSql.Append(" values ("); strSql.Append("@TakeTime,@TakeMoney,@TakePoundage,@RealityMoney,@BonusBalance,@Flag,@UserID,@BankName,@BankAccount,@BankAccountUser,@BankDian,@Take001,@Take002,@Take003,@Take004,@Take005,@Take006)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@TakeTime", SqlDbType.DateTime), new SqlParameter("@TakeMoney", SqlDbType.Decimal, 9), new SqlParameter("@TakePoundage", SqlDbType.Decimal, 9), new SqlParameter("@RealityMoney", SqlDbType.Decimal, 9), new SqlParameter("@BonusBalance", SqlDbType.Decimal, 9), new SqlParameter("@Flag", SqlDbType.Int, 4), new SqlParameter("@UserID", SqlDbType.Int, 4), new SqlParameter("@BankName", SqlDbType.VarChar, 100), new SqlParameter("@BankAccount", SqlDbType.VarChar, 100), new SqlParameter("@BankAccountUser", SqlDbType.VarChar, 100), new SqlParameter("@BankDian", SqlDbType.VarChar, 100), new SqlParameter("@Take001", SqlDbType.Int, 4), new SqlParameter("@Take002", SqlDbType.Int, 4), new SqlParameter("@Take003", SqlDbType.VarChar, 100), new SqlParameter("@Take004", SqlDbType.VarChar, 100), new SqlParameter("@Take005", SqlDbType.Decimal, 9), new SqlParameter("@Take006", SqlDbType.DateTime, 9) }; parameters[0].Value = model.TakeTime; parameters[1].Value = model.TakeMoney; parameters[2].Value = model.TakePoundage; parameters[3].Value = model.RealityMoney; parameters[4].Value = model.BonusBalance; parameters[5].Value = model.Flag; parameters[6].Value = model.UserID; parameters[7].Value = model.BankName; parameters[8].Value = model.BankAccount; parameters[9].Value = model.BankAccountUser; parameters[10].Value = model.BankDian; parameters[11].Value = model.Take001; parameters[12].Value = model.Take002; parameters[13].Value = model.Take003; parameters[14].Value = model.Take004; parameters[15].Value = model.Take005; parameters[16].Value = model.Take006; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
//取消会员提现 public bool ItemCommand(long userid, long txid, string paypassword, out string message) { lgk.Model.tb_takeMoney takeMoneyInfo = takeBLL.GetModel(txid); if (takeMoneyInfo == null) { message = GetLanguage("recordDeleted"); return(false); } if (takeMoneyInfo.Flag != 0) { message = GetLanguage("recordApproved"); return(false); } //提现账户 1:云盾,2:原始积分 int AccountType = takeMoneyInfo.Take001; lgk.Model.tb_user userInfo = userBLL.GetModel(takeMoneyInfo.UserID); if (paypassword != userInfo.SecondPassword) { message = "支付密码错误"; return(false); } if (userInfo.IsLock == 1) { message = "账户已冻结,取消提现失败"; return(false); } //加入流水账表 lgk.Model.tb_journal model = new lgk.Model.tb_journal(); model.UserID = takeMoneyInfo.UserID; model.Remark = "取消提现"; model.InAmount = takeMoneyInfo.TakeMoney; model.OutAmount = 0; model.BalanceAmount = (AccountType == 1? userInfo.Emoney : userInfo.StockAccount) + takeMoneyInfo.TakeMoney; model.JournalDate = DateTime.Now; model.JournalType = (AccountType == 1 ? (int)Library.AccountType.云盾 : (int)Library.AccountType.云图); model.Journal01 = takeMoneyInfo.UserID; if (journalBLL.Add(model) > 0 && takeBLL.UpdateFlag(Convert.ToInt64(userid), Convert.ToInt64(txid)) > 0) { if (AccountType == 1) { UpdateAccount("Emoney", takeMoneyInfo.UserID, takeMoneyInfo.TakeMoney, 1); } else if (AccountType == 2) { UpdateAccount("StockAccount", takeMoneyInfo.UserID, takeMoneyInfo.TakeMoney, 1); } message = GetLanguage("CancellationSuccess");//取消成功 return(true); } else { message = GetLanguage("FailedToCancel");//取消失败 return(false); } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { string filename = ""; if (e.CommandName == "change") { long iID = Convert.ToInt64(e.CommandArgument); lgk.Model.tb_takeMoney take = takeBLL.GetModel(iID); if (take == null) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("recordDeleted") + "');", true);//该记录已删除,无法再进行此操作 return; } if (take.Flag != 0) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("recordApproved") + "');", true);//该记录已审核,无法再进行此操作 return; } lgk.Model.tb_user userModel = userBLL.GetModel(Convert.ToInt32(take.UserID)); //加入流水账表 lgk.Model.tb_journal model = new lgk.Model.tb_journal(); if (take.Take001 == 1) { model.BalanceAmount = userModel.Emoney + take.TakeMoney; filename = "Emoney"; } else { model.BalanceAmount = userModel.BonusAccount + take.TakeMoney; filename = "BonusAccount"; } model.UserID = take.UserID; model.Remark = "取消提现"; model.RemarkEn = "Cancellation of cash"; model.InAmount = take.TakeMoney; model.OutAmount = 0; model.JournalDate = DateTime.Now; model.JournalType = take.Take001; model.Journal01 = take.UserID; if (journalBLL.Add(model) > 0 && UpdateAccount(filename, take.UserID, take.TakeMoney, 1) > 0 && takeBLL.Delete(iID)) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("CancellationSuccess") + "');window.location.href='TakeMoney.aspx';", true);//取消成功 } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("FailedToCancel") + "');", true);//取消失败 } } }
public lgk.Model.tb_takeMoney GetModel(string where) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,TakeTime,TakeMoney,TakePoundage,RealityMoney,BonusBalance,Flag,UserID,BankName,BankAccount,BankAccountUser,BankDian,Take001,Take002,Take003,Take004,Take005,Take006 from tb_takeMoney "); if (where != "") { strSql.Append(" where " + where); } lgk.Model.tb_takeMoney model = new lgk.Model.tb_takeMoney(); DataSet ds = DbHelperSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "") { model.ID = long.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); } if (ds.Tables[0].Rows[0]["TakeTime"] != null && ds.Tables[0].Rows[0]["TakeTime"].ToString() != "") { model.TakeTime = DateTime.Parse(ds.Tables[0].Rows[0]["TakeTime"].ToString()); } if (ds.Tables[0].Rows[0]["TakeMoney"] != null && ds.Tables[0].Rows[0]["TakeMoney"].ToString() != "") { model.TakeMoney = decimal.Parse(ds.Tables[0].Rows[0]["TakeMoney"].ToString()); } if (ds.Tables[0].Rows[0]["TakePoundage"] != null && ds.Tables[0].Rows[0]["TakePoundage"].ToString() != "") { model.TakePoundage = decimal.Parse(ds.Tables[0].Rows[0]["TakePoundage"].ToString()); } if (ds.Tables[0].Rows[0]["RealityMoney"] != null && ds.Tables[0].Rows[0]["RealityMoney"].ToString() != "") { model.RealityMoney = decimal.Parse(ds.Tables[0].Rows[0]["RealityMoney"].ToString()); } if (ds.Tables[0].Rows[0]["BonusBalance"] != null && ds.Tables[0].Rows[0]["BonusBalance"].ToString() != "") { model.BonusBalance = decimal.Parse(ds.Tables[0].Rows[0]["BonusBalance"].ToString()); } if (ds.Tables[0].Rows[0]["Flag"] != null && ds.Tables[0].Rows[0]["Flag"].ToString() != "") { model.Flag = int.Parse(ds.Tables[0].Rows[0]["Flag"].ToString()); } if (ds.Tables[0].Rows[0]["UserID"] != null && ds.Tables[0].Rows[0]["UserID"].ToString() != "") { model.UserID = long.Parse(ds.Tables[0].Rows[0]["UserID"].ToString()); } if (ds.Tables[0].Rows[0]["BankName"] != null && ds.Tables[0].Rows[0]["BankName"].ToString() != "") { model.BankName = ds.Tables[0].Rows[0]["BankName"].ToString(); } if (ds.Tables[0].Rows[0]["BankAccount"] != null && ds.Tables[0].Rows[0]["BankAccount"].ToString() != "") { model.BankAccount = ds.Tables[0].Rows[0]["BankAccount"].ToString(); } if (ds.Tables[0].Rows[0]["BankAccountUser"] != null && ds.Tables[0].Rows[0]["BankAccountUser"].ToString() != "") { model.BankAccountUser = ds.Tables[0].Rows[0]["BankAccountUser"].ToString(); } if (ds.Tables[0].Rows[0]["BankDian"] != null && ds.Tables[0].Rows[0]["BankDian"].ToString() != "") { model.BankDian = ds.Tables[0].Rows[0]["BankDian"].ToString(); } if (ds.Tables[0].Rows[0]["Take001"] != null && ds.Tables[0].Rows[0]["Take001"].ToString() != "") { model.Take001 = int.Parse(ds.Tables[0].Rows[0]["Take001"].ToString()); } if (ds.Tables[0].Rows[0]["Take002"] != null && ds.Tables[0].Rows[0]["Take002"].ToString() != "") { model.Take002 = int.Parse(ds.Tables[0].Rows[0]["Take002"].ToString()); } if (ds.Tables[0].Rows[0]["Take003"] != null && ds.Tables[0].Rows[0]["Take003"].ToString() != "") { model.Take003 = ds.Tables[0].Rows[0]["Take003"].ToString(); } if (ds.Tables[0].Rows[0]["Take004"] != null && ds.Tables[0].Rows[0]["Take004"].ToString() != "") { model.Take004 = ds.Tables[0].Rows[0]["Take004"].ToString(); } if (ds.Tables[0].Rows[0]["Take005"] != null && ds.Tables[0].Rows[0]["Take005"].ToString() != "") { model.Take005 = decimal.Parse(ds.Tables[0].Rows[0]["Take005"].ToString()); } if (ds.Tables[0].Rows[0]["Take006"] != null && ds.Tables[0].Rows[0]["Take006"].ToString() != "") { model.Take006 = DateTime.Parse(ds.Tables[0].Rows[0]["Take006"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(lgk.Model.tb_takeMoney model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_takeMoney set "); strSql.Append("TakeTime=@TakeTime,"); strSql.Append("TakeMoney=@TakeMoney,"); strSql.Append("TakePoundage=@TakePoundage,"); strSql.Append("RealityMoney=@RealityMoney,"); strSql.Append("BonusBalance=@BonusBalance,"); strSql.Append("Flag=@Flag,"); strSql.Append("UserID=@UserID,"); strSql.Append("BankName=@BankName,"); strSql.Append("BankAccount=@BankAccount,"); strSql.Append("BankAccountUser=@BankAccountUser,"); strSql.Append("BankDian=@BankDian,"); strSql.Append("Take001=@Take001,"); strSql.Append("Take002=@Take002,"); strSql.Append("Take003=@Take003,"); strSql.Append("Take004=@Take004,"); strSql.Append("Take005=@Take005,"); strSql.Append("Take006=@Take006"); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@TakeTime", SqlDbType.DateTime), new SqlParameter("@TakeMoney", SqlDbType.Decimal, 9), new SqlParameter("@TakePoundage", SqlDbType.Decimal, 9), new SqlParameter("@RealityMoney", SqlDbType.Decimal, 9), new SqlParameter("@BonusBalance", SqlDbType.Decimal, 9), new SqlParameter("@Flag", SqlDbType.Int, 4), new SqlParameter("@UserID", SqlDbType.Int, 4), new SqlParameter("@BankName", SqlDbType.VarChar, 100), new SqlParameter("@BankAccount", SqlDbType.VarChar, 100), new SqlParameter("@BankAccountUser", SqlDbType.VarChar, 100), new SqlParameter("@BankDian", SqlDbType.VarChar, 100), new SqlParameter("@Take001", SqlDbType.Int, 4), new SqlParameter("@Take002", SqlDbType.Int, 4), new SqlParameter("@Take003", SqlDbType.VarChar, 100), new SqlParameter("@Take004", SqlDbType.VarChar, 100), new SqlParameter("@Take005", SqlDbType.Decimal, 9), new SqlParameter("@Take006", SqlDbType.DateTime, 9), new SqlParameter("@ID", SqlDbType.BigInt, 8) }; parameters[0].Value = model.TakeTime; parameters[1].Value = model.TakeMoney; parameters[2].Value = model.TakePoundage; parameters[3].Value = model.RealityMoney; parameters[4].Value = model.BonusBalance; parameters[5].Value = model.Flag; parameters[6].Value = model.UserID; parameters[7].Value = model.BankName; parameters[8].Value = model.BankAccount; parameters[9].Value = model.BankAccountUser; parameters[10].Value = model.BankDian; parameters[11].Value = model.Take001; parameters[12].Value = model.Take002; parameters[13].Value = model.Take003; parameters[14].Value = model.Take004; parameters[15].Value = model.Take005; parameters[16].Value = model.Take006; parameters[17].Value = model.ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 审核分页申请记录 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { long ID = Convert.ToInt64(e.CommandArgument); //ID string filename = ""; lgk.Model.tb_takeMoney cModel = takeBLL.GetModel(ID); lgk.BLL.tb_systemMoney sy = new lgk.BLL.tb_systemMoney(); //lgk.BLL.tb_rechargeable dotx = new lgk.BLL.tb_rechargeable(); lgk.Model.tb_systemMoney system = sy.GetModel(1); if (cModel == null) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已删除,无法再进行此操作!');window.location.href='TakeMoney.aspx';", true); } else { if (cModel.Flag == 1) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已审核,无法再进行此操作!');window.location.href='TakeMoney.aspx';", true); } else { lgk.Model.tb_user user = userBLL.GetModel(Convert.ToInt32(cModel.UserID)); if (e.CommandName.Equals("Open"))//确认 { cModel.Flag = 1; cModel.Take006 = DateTime.Now; if (takeBLL.Update(cModel) && UpdateSystemAccount("MoneyAccount", Convert.ToDecimal(cModel.RealityMoney), 0) > 0) { if (cModel.Take001 == 6) { user.Batch = 0; userBLL.Update(user); } //发送短信通知 string content = GetLanguage("MessageTakeMoneyOK").Replace("{username}", user.UserCode).Replace("{time}", Convert.ToDateTime(cModel.TakeTime).ToString("yyyy年MM月dd日HH时mm分")).Replace("{timeEn}", Convert.ToDateTime(cModel.TakeTime).ToString("yyyy/MM/dd HH:mm")); SendMessage(Convert.ToInt32(cModel.UserID), user.PhoneNum, content); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('操作成功!');", true);//window.location.href='TakeMoney.aspx'; BindData(); } } if (e.CommandName.Equals("Remove"))//删除 { //加入流水账表 lgk.Model.tb_journal model = new lgk.Model.tb_journal(); lgk.Model.tb_user users = userBLL.GetModel(cModel.UserID); model.UserID = cModel.UserID; model.Remark = "取消提现"; model.InAmount = cModel.TakeMoney; model.OutAmount = 0; if (cModel.Take001 == 1) { model.BalanceAmount = user.Emoney + cModel.TakeMoney; filename = "emoney"; // model.Journal02 = 2;//奖励分 model.JournalType = 1; } if (cModel.Take001 == 2) { model.BalanceAmount = user.BonusAccount + cModel.TakeMoney; filename = "BonusAccount"; // users.Emoney = users.Emoney + cModel.RealityMoney + cModel.TakePoundage; // users.StockMoney = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage; // model.Journal02 = 4; //原始积分 model.JournalType = 2; } //if (cModel.Take001 == 3) //{ // model.BalanceAmount = user.StockMoney + cModel.TakeMoney + cModel.TakePoundage; // filename = "StockMoney"; // //users.BonusAccount = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage; // model.Journal02 = cModel.Take001; //} //if (cModel.Take001 == 4) //{ // model.BalanceAmount = user.ShopAccount + cModel.TakeMoney + cModel.TakePoundage; // filename = "ShopAccount"; // users.Emoney = users.Emoney + cModel.RealityMoney; // users.BonusAccount = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage; // model.Journal02 = cModel.Take001; //} //if (cModel.Take001 == 5) //{ // model.BalanceAmount = user.GLmoney + cModel.TakeMoney + cModel.TakePoundage; // filename = "GLmoney"; // users.BonusAccount = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage; // model.Journal02 = cModel.Take001; //} //if (cModel.Take001 == 6) //{ // model.BalanceAmount = user.RegMoney + cModel.TakeMoney + cModel.TakePoundage; // filename = "RegMoney"; // users.Batch = 0; // model.Journal02 = cModel.Take001; //} model.JournalDate = DateTime.Now; model.Journal01 = cModel.UserID; if (journalBLL.Add(model) > 0 && userBLL.Update(users) && UpdateAccount(filename, user.UserID, cModel.TakeMoney, 1) > 0 && takeBLL.Delete(ID)) { MessageBox.MyShow(this, "取消成功"); BindData(); } else { MessageBox.MyShow(this, "取消失败"); } } } } }
//取消会员提现 public bool ItemCommand(long userid, long txid, string paypassword, out string message) { lgk.Model.tb_takeMoney takeMoneyInfo = takeBLL.GetModel(txid); if (takeMoneyInfo == null) { message = GetLanguage("recordDeleted"); return(false); } if (takeMoneyInfo.Flag != 0) { message = GetLanguage("recordApproved"); return(false); } //提现账户 1:原始币,2:原始积分 int AccountType = takeMoneyInfo.Take001; lgk.Model.tb_user userInfo = userBLL.GetModel(takeMoneyInfo.UserID); if (!ValidPassword(userInfo.SecondPassword, paypassword)) { message = "支付密码错误"; return(false); } if (userInfo.IsLock == 1) { message = "账户已冻结,取消提现失败"; return(false); } //加入流水账表 lgk.Model.tb_journal model = new lgk.Model.tb_journal(); model.UserID = takeMoneyInfo.UserID; model.Remark = "取消提现"; model.InAmount = takeMoneyInfo.TakeMoney; model.OutAmount = 0; model.BalanceAmount = (AccountType == 1? userInfo.Emoney : userInfo.StockAccount) + takeMoneyInfo.TakeMoney; model.JournalDate = DateTime.Now; model.JournalType = (AccountType == 1 ? 1 : 2); model.Journal01 = takeMoneyInfo.UserID; //如果冻结释放币账户大于0,激活矿机时转入明细 if (userInfo.User016 > 0) { UpdateAccount("User016", userInfo.UserID, userInfo.User016, 0); // UpdateAccount("BonusAccount", userInfo.UserID, userInfo.User016, 1); // lgk.Model.tb_journal jourInfo = new lgk.Model.tb_journal(); jourInfo.UserID = userInfo.UserID; jourInfo.Remark = "释放币账户进账,冻结释放币转入释放币账户"; jourInfo.RemarkEn = "Cash withdrawal"; jourInfo.InAmount = userInfo.User016; jourInfo.OutAmount = 0; jourInfo.BalanceAmount = userBLL.GetMoney(userInfo.UserID, "BonusAccount"); jourInfo.JournalDate = DateTime.Now; jourInfo.JournalType = 2; jourInfo.Journal01 = userInfo.UserID; journalBLL.Add(jourInfo); } if (journalBLL.Add(model) > 0 && takeBLL.UpdateFlag(Convert.ToInt64(userid), Convert.ToInt64(txid)) > 0) { if (AccountType == 1) { UpdateAccount("Emoney", takeMoneyInfo.UserID, takeMoneyInfo.TakeMoney, 1); } else if (AccountType == 2) { UpdateAccount("StockAccount", takeMoneyInfo.UserID, takeMoneyInfo.TakeMoney, 1); } message = GetLanguage("CancellationSuccess");//取消成功 return(true); } else { message = GetLanguage("FailedToCancel");//取消失败 return(false); } }
/// <summary> /// 输入验证 /// </summary> /// <returns></returns> private bool TakeMoneyValidate(long UserID, string Currency, string ExtMoney, string BankID, out string message) { lgk.Model.tb_takeMoney takeMoneyInfo = new lgk.Model.tb_takeMoney(); lgk.Model.tb_user userInfo = userBLL.GetModel(UserID); if (BankID.Trim() == "") { message = "请输入收款账户编号"; return(false); } if (Currency.Trim() == "") { message = "请选择币种"; return(false); } if (ExtMoney.Trim() == "") { message = "请输入提现金额"; return(false); } decimal dMoney = 0; decimal tx_min = getParamAmount("ATM1"); //最小提现额 decimal tx_bs = getParamAmount("ATM2"); //倍数基数 if (decimal.TryParse(ExtMoney.Trim(), out dMoney)) { if (dMoney < tx_min) { message = GetLanguage("AmountThan") + tx_min + GetLanguage("TheInteger");//提现金额必须是大于等于XX的整数! return(false); } if (dMoney % tx_bs != 0) { message = GetLanguage("amountMust") + tx_bs + GetLanguage("Multiples");//提现金额必须是" + tx_bs + "的倍数! return(false); } } else { message = GetLanguage("AmountErrors");//金额格式输入错误 return(false); } if (dMoney < tx_min) { message = GetLanguage("AmountThan") + tx_min;//提现金额必须是大于等于XX return(false); } if (Currency.Trim() == "1") { if (dMoney > userInfo.Emoney) { message = "提现金额不能大于原始币余额!"; return(false); } if (dMoney + dMoney * getParamAmount("ATM3") / 100 > userInfo.Emoney) { message = "原始币余额不够扣除手续费"; return(false); } } else if (Currency.Trim() == "2") { if (dMoney > userInfo.BonusAccount) { message = "提现金额不能大于释放币余额!"; return(false); } if (dMoney + dMoney * getParamAmount("ATM3") / 100 > userInfo.BonusAccount) { message = "释放币余额不够扣除手续费"; return(false); } } message = ""; return(true); }
public bool TakeMoney(long UserID, string Currency, string ExtMoney, string BankID, string paypassword, out string message) { if (TakeMoneyValidate(UserID, Currency, ExtMoney, BankID, out message)) { #region 提现申请 var user = userBLL.GetModel(UserID); if (user == null) { message = "用户ID不存在"; return(false); } if (!ValidPassword(user.SecondPassword, paypassword)) { message = "支付密码错误"; return(false); } if (user.IsLock == 1) { message = "账户已冻结,提现失败"; return(false); } int JournalType = 0; int _id = 0; int.TryParse(BankID, out _id); var userbank = userBankBLL.GetModel(Convert.ToInt32(_id)); if (user == null) { message = "银行账户ID不存在"; return(false); } lgk.Model.tb_takeMoney takeMoneyInfo = new lgk.Model.tb_takeMoney(); decimal dMoney = decimal.Parse(ExtMoney); takeMoneyInfo.TakeTime = DateTime.Now; takeMoneyInfo.TakeMoney = dMoney; takeMoneyInfo.Flag = 0; takeMoneyInfo.UserID = UserID; if (Currency.Trim() == "1") { takeMoneyInfo.TakePoundage = dMoney * getParamAmount("ATM3") / 100; takeMoneyInfo.RealityMoney = dMoney;// - takeMoneyInfo.TakePoundage; takeMoneyInfo.BonusBalance = user.Emoney - takeMoneyInfo.TakeMoney; JournalType = 1; } if (Currency.Trim() == "2") { takeMoneyInfo.TakePoundage = dMoney * getParamAmount("ATM3") / 100; takeMoneyInfo.RealityMoney = dMoney;// - takeMoneyInfo.TakePoundage; takeMoneyInfo.BonusBalance = user.BonusAccount - takeMoneyInfo.TakeMoney; JournalType = 1; } takeMoneyInfo.Take001 = Currency == "2" ? 2 : 1; //提现类型 takeMoneyInfo.Take002 = _id; #endregion #region 加入流水账表 lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = takeMoneyInfo.UserID; journalInfo.Remark = Library.AccountTypeHelper.GetName(JournalType) + "提现"; journalInfo.RemarkEn = "Cash withdrawal"; journalInfo.InAmount = 0; journalInfo.OutAmount = takeMoneyInfo.TakeMoney; journalInfo.BalanceAmount = takeMoneyInfo.BonusBalance; journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = JournalType; journalInfo.Journal01 = takeMoneyInfo.UserID; journalBLL.Add(journalInfo); lgk.Model.tb_journal journalInfoFee = new lgk.Model.tb_journal(); journalInfoFee.UserID = takeMoneyInfo.UserID; journalInfoFee.Remark = Library.AccountTypeHelper.GetName(JournalType) + "提现手续费"; journalInfoFee.RemarkEn = "Cash withdrawal"; journalInfoFee.InAmount = 0; journalInfoFee.OutAmount = takeMoneyInfo.TakePoundage; journalInfoFee.BalanceAmount = takeMoneyInfo.BonusBalance - takeMoneyInfo.TakePoundage; journalInfoFee.JournalDate = DateTime.Now; journalInfoFee.JournalType = JournalType; journalInfoFee.Journal01 = takeMoneyInfo.UserID; journalBLL.Add(journalInfoFee); #endregion if (takeBLL.Add(takeMoneyInfo) > 0) { if (Currency.Trim() == "1") { UpdateAccount("Emoney", UserID, takeMoneyInfo.TakeMoney + takeMoneyInfo.TakePoundage, 0); } if (Currency.Trim() == "2") { UpdateAccount("BonusAccount", UserID, takeMoneyInfo.TakeMoney + takeMoneyInfo.TakePoundage, 0); } message = GetLanguage("successful");//申请提现成功 return(true); } else { message = GetLanguage("OperationFailed");//操作失败 return(false); } } else { return(false); } }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { #region 数据验证 //string[] Day = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" }; //week = Convert.ToInt32(DateTime.Now.DayOfWeek.ToString("d")); //var open2 = getParamAmount("extract4"); //if (week != open2) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请在提现日进行此功能操作,谢谢!');", true); // return; //} string filename = ""; lgk.Model.tb_user user = userBLL.GetModel(LoginUser.UserID); #region 提现金额验证 if (txtTake.Text.Trim() == "") { MessageBox.MyShow(this, GetLanguage("WithdrawalIsnull"));//提现金额不能为空 return; } decimal resultNum = 0; int Journal02 = 0; decimal tx_bs = getParamAmount("ATM2");//倍数基数 if (user.Emoney == 0) { MessageBox.MyShow(this, "消费金为0,无法提现");//提现金额不能为空 return; } if (decimal.TryParse(txtTake.Text.Trim(), out resultNum)) { if (resultNum < getParamAmount("ATM1")) { MessageBox.MyShow(this, "提现金额必须大于最低提现金额");//提现金额必须大于最低提现金额! return; } if (resultNum > user.Emoney) { MessageBox.MyShow(this, "云盾余额不足"); //提现金额必须小于消费金金额! return; } lgk.Model.tb_takeMoney takemodel = takeBLL.GetModel(" UserID=" + LoginUser.UserID + " and Flag=0"); if (takemodel != null) { MessageBox.MyShow(this, "您有待审核的申请记录,请等待后台审核后再申请!"); //提现金额必须大于最低提现金额! return; } user.Emoney = user.Emoney - resultNum; userBLL.Update(user); } else { MessageBox.MyShow(this, GetLanguage("AmountErrors"));//金额格式输入错误 return; } #endregion #endregion #region 提现申请 lgk.Model.tb_takeMoney takeMoneyInfo = new lgk.Model.tb_takeMoney(); lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); takeMoneyInfo.TakeTime = DateTime.Now; takeMoneyInfo.TakePoundage = getParamAmount("ATM3") / 100; takeMoneyInfo.TakeMoney = resultNum; takeMoneyInfo.RealityMoney = Convert.ToDecimal(txtExtMoney.Value); takeMoneyInfo.Flag = 0; takeMoneyInfo.UserID = getLoginID(); takeMoneyInfo.BonusBalance = user.Emoney - takeMoneyInfo.TakeMoney; takeMoneyInfo.BankName = user.BankName; takeMoneyInfo.Take003 = user.BankBranch; takeMoneyInfo.BankAccount = user.BankAccount; takeMoneyInfo.BankAccountUser = user.BankAccountUser; takeMoneyInfo.Take001 = Journal02; #endregion #region 加入流水账表 journalInfo.UserID = takeMoneyInfo.UserID; journalInfo.Remark = "会员提现"; journalInfo.RemarkEn = "Cash withdrawal"; journalInfo.InAmount = 0; journalInfo.OutAmount = takeMoneyInfo.TakeMoney; journalInfo.BalanceAmount = takeMoneyInfo.BonusBalance; journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = 1; journalInfo.Journal01 = takeMoneyInfo.UserID; journalInfo.Journal02 = Journal02; #endregion if (takeBLL.Add(takeMoneyInfo) > 0 && journalBLL.Add(journalInfo) > 0 && UpdateAccount(filename, getLoginID(), takeMoneyInfo.TakeMoney, 0) > 0) { //string ss = (GetLanguage("MessageTakeMoney").Replace("{username}", LoginUser.UserCode)).Replace("{time}", Convert.ToDateTime(journalInfo.JournalDate).ToString("yyyy年MM月dd日HH时mm分")).Replace("{timeEn}", Convert.ToDateTime(journalInfo.JournalDate).ToString("yyyy/MM/dd HH:mm"));//添加短信内容 //SendMessage((int)LoginUser.UserID, LoginUser.PhoneNum, ss); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("successful") + "');window.location.href='TakeMoney.aspx';", true);//申请提现成功 } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("OperationFailed") + "');", true);//操作失败 } }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { //string[] Day = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" }; //week = Convert.ToInt32(DateTime.Now.DayOfWeek.ToString("d")); //var open2 = getParamAmount("extract4"); //if (week != open2) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请在提现日进行此功能操作,谢谢!');", true); // return; //} string filename = ""; #region 提现金额验证 int iTypeID = Convert.ToInt32(dropType.SelectedValue); if (iTypeID == 0) { MessageBox.ShowBox(this.Page, "请选择提现类型", Library.Enums.ModalTypes.warning); return; } string strMoney = txtTake.Text.Trim(); if (string.IsNullOrEmpty(strMoney)) { MessageBox.ShowBox(this.Page, GetLanguage("WithdrawalIsnull"), Library.Enums.ModalTypes.warning);//提现金额不能为空 return; } decimal resultNum = 0; if (!decimal.TryParse(strMoney, out resultNum)) { MessageBox.ShowBox(this.Page, GetLanguage("AmountErrors"), Library.Enums.ModalTypes.warning);//金额格式输入错误 return; } decimal MinMoney = getParamAmount("ATM1"); //最小金额 decimal Multiple = getParamAmount("ATM2"); //倍数基数 if (resultNum < MinMoney) { MessageBox.ShowBox(this.Page, "提现金额必须大于最低提现金额", Library.Enums.ModalTypes.warning);//金额格式输入错误 return; } if (Multiple != 0 && resultNum % Multiple != 0) { MessageBox.ShowBox(this.Page, "提现金额必须是" + Multiple + "的整数倍", Library.Enums.ModalTypes.warning);//金额格式输入错误 return; } lgk.Model.tb_user userModel = userBLL.GetModel(getLoginID()); if (iTypeID == 1) { if (userModel.Emoney < resultNum) { MessageBox.ShowBox(this.Page, "注册分余额不足", Library.Enums.ModalTypes.warning); return; } filename = "Emoney"; } if (iTypeID == 2) { if (userModel.BonusAccount < resultNum) { MessageBox.ShowBox(this.Page, "奖励分余额不足", Library.Enums.ModalTypes.warning); return; } filename = "BonusAccount"; } lgk.Model.tb_takeMoney takemodel = takeBLL.GetModel(" UserID=" + LoginUser.UserID + " and Flag=0"); if (takemodel != null) { MessageBox.MyShow(this, "您有待审核的申请记录,请等待后台审核后再申请!");//提现金额必须大于最低提现金额! return; } #endregion #region 提现申请 decimal Fee = resultNum * getParamAmount("ATM3") / 100;//手续费 lgk.Model.tb_takeMoney takeMoneyInfo = new lgk.Model.tb_takeMoney(); lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); takeMoneyInfo.TakeTime = DateTime.Now; takeMoneyInfo.TakePoundage = Fee; takeMoneyInfo.TakeMoney = resultNum; takeMoneyInfo.RealityMoney = resultNum - Fee; takeMoneyInfo.Flag = 0; takeMoneyInfo.UserID = getLoginID(); if (iTypeID == 1)//YD { takeMoneyInfo.BonusBalance = userModel.Emoney - takeMoneyInfo.TakeMoney; } else//YT { takeMoneyInfo.BonusBalance = userModel.BonusAccount - takeMoneyInfo.TakeMoney; } takeMoneyInfo.BankName = userModel.BankName; takeMoneyInfo.Take003 = userModel.BankBranch; takeMoneyInfo.BankAccount = userModel.BankAccount; takeMoneyInfo.BankAccountUser = userModel.BankAccountUser; takeMoneyInfo.Take001 = iTypeID; //提现币种:1、注册分,2、奖励分 takeMoneyInfo.Take002 = 0; //dropOutAccount.SelectedValue.ToInt(); #endregion #region 加入流水账表 journalInfo.UserID = takeMoneyInfo.UserID; journalInfo.Remark = "会员提现"; journalInfo.RemarkEn = "Cash withdrawal"; journalInfo.InAmount = 0; journalInfo.OutAmount = takeMoneyInfo.TakeMoney; journalInfo.BalanceAmount = takeMoneyInfo.BonusBalance; journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = iTypeID; journalInfo.Journal01 = takeMoneyInfo.UserID; #endregion if (takeBLL.Add(takeMoneyInfo) > 0 && journalBLL.Add(journalInfo) > 0 && UpdateAccount(filename, getLoginID(), takeMoneyInfo.TakeMoney, 0) > 0) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("successful") + "');window.location.href='TakeMoney.aspx';", true);//申请提现成功 } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("OperationFailed") + "');", true);//操作失败 } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { int ID = Convert.ToInt32(e.CommandArgument); //ID lgk.Model.tb_takeMoney takeMoneyInfo = takeBLL.GetModel(ID); lgk.BLL.tb_systemMoney sy = new lgk.BLL.tb_systemMoney(); lgk.Model.tb_systemMoney system = sy.GetModel(1); if (takeMoneyInfo == null) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已删除,无法再进行此操作!');window.location.href='TakeMoney.aspx';", true); } else { if (takeMoneyInfo.Flag == 1) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已审核,无法再进行此操作!');window.location.href='TakeMoney.aspx';", true); } else { lgk.Model.tb_Stock stockInfo = stockBLL.GetModel("UserID=" + takeMoneyInfo.UserID); lgk.Model.tb_user userInfo = userBLL.GetModel(Convert.ToInt32(takeMoneyInfo.UserID)); decimal dProfit = stockInfo.Number * (getParamAmount("shares5") - stockInfo.Price); if (e.CommandName.Equals("Open"))//确认 { takeMoneyInfo.Flag = 1; takeMoneyInfo.Take006 = DateTime.Now; if (takeBLL.Update(takeMoneyInfo) && UpdateSystemAccount("MoneyAccount", Convert.ToDecimal(takeMoneyInfo.RealityMoney), 0) > 0) { //发送短信通知 string content = GetLanguage("MessageTakeMoneyOK").Replace("{username}", userInfo.UserCode).Replace("{time}", Convert.ToDateTime(takeMoneyInfo.TakeTime).ToString("yyyy年MM月dd日HH时mm分")).Replace("{timeEn}", Convert.ToDateTime(takeMoneyInfo.TakeTime).ToString("yyyy/MM/dd HH:mm")); SendMessage(Convert.ToInt32(takeMoneyInfo.UserID), userInfo.PhoneNum, content); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('操作成功!');window.location.href='TakeMoney.aspx';", true); } } if (e.CommandName.Equals("Remove"))//删除 { //加入流水账表 lgk.Model.tb_journal model = new lgk.Model.tb_journal(); model.UserID = takeMoneyInfo.UserID; model.Remark = "取消提现"; model.InAmount = takeMoneyInfo.TakeMoney; model.OutAmount = 0; model.BalanceAmount = dProfit + takeMoneyInfo.TakeMoney; model.JournalDate = DateTime.Now; model.JournalType = 1; model.Journal01 = takeMoneyInfo.UserID; bool bFalg = stockBLL.UpdateStockNumber(stockInfo.StockID, Convert.ToDecimal(takeMoneyInfo.TakeMoney), getParamAmount("shares5"), 1); if (journalBLL.Add(model) > 0 && bFalg && takeBLL.Delete(ID)) { MessageBox.MyShow(this, "取消成功"); BindData(); } else { MessageBox.MyShow(this, "取消失败"); } } } } }