protected void btnSubmit_Click(object sender, EventArgs e) { int toUserID = 0; lgk.Model.tb_user userInfo = userBLL.GetModel(getLoginID()); lgk.Model.tb_change changeInfo = new lgk.Model.tb_change(); int type = 0; if (Convert.ToDecimal(txtMoney.Value.Trim()) > userInfo.BonusAccount) { MessageBox.Show(this, GetLanguage("balanceDollars"));//奖金余额不足 return; } changeInfo.UserID = getLoginID(); changeInfo.ToUserID = toUserID; changeInfo.ToUserType = 0; changeInfo.MoneyType = 0; changeInfo.Amount = Convert.ToDecimal(txtMoney.Value.Trim()); changeInfo.ChangeType = 5; changeInfo.ChangeDate = DateTime.Now; if (changeBLL.Add(changeInfo) > 0) { var user = userBLL.GetModel(LoginUser.UserID); decimal EMoney = Convert.ToDecimal(getColumn(0, "BonusAccount", "tb_user", "UserID=" + getLoginID(), "")); if (EMoney >= Convert.ToDecimal(txtMoney.Value.Trim())) { UpdateAccount("BonusAccount", getLoginID(), Convert.ToDecimal(changeInfo.Amount), 0);// UpdateSystemAccount("Money001", Convert.ToDecimal(changeInfo.Amount), 1); UpdateSystemAccount("Money002", Convert.ToDecimal(changeInfo.Amount), 1); // UpdateAccount("Emoney", toUserID, Convert.ToDecimal(changeInfo.Amount), 1);// //加入流水账表(奖金币减少) lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); jmodel.UserID = getLoginID(); jmodel.Remark = "慈善捐款"; jmodel.RemarkEn = "慈善捐款"; jmodel.InAmount = 0; jmodel.OutAmount = changeInfo.Amount; var data = userBLL.GetModel(getLoginID()); jmodel.BalanceAmount = data.BonusAccount; jmodel.JournalDate = DateTime.Now; jmodel.JournalType = 3; jmodel.Journal01 = toUserID; journalBLL.Add(jmodel); MessageBox.ShowAndRedirect(this, "捐款金额成功!", "addcishan.aspx");//转账成功 // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('捐款金额成功!');", true);//奖金币转拍币功能未开放 } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('捐款金额不能大于奖金币余额!');", true);//奖金币转拍币功能未开放 } //发送短信通知 //content = GetLanguage("TransferMoenyFrom").Replace("{username}", user.UserCode).Replace("{Amount}", changeInfo.Amount.ToString()).Replace("{time}", DateTime.Now.ToString("yyyy年MM月dd日HH时mm分")).Replace("{timeEn}", DateTime.Now.ToString("yyyy/MM/dd HH:mm")); //SendMessage(getLoginID(), user.PhoneNum, content); } }
/// <summary> /// 获得数据列表 /// </summary> public List <lgk.Model.tb_journal> DataTableToList(DataTable dt) { List <lgk.Model.tb_journal> modelList = new List <lgk.Model.tb_journal>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { lgk.Model.tb_journal model; for (int n = 0; n < rowsCount; n++) { model = new lgk.Model.tb_journal(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = long.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "") { model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString()); } if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "") { model.Remark = dt.Rows[n]["Remark"].ToString(); } if (dt.Rows[n]["InAmount"] != null && dt.Rows[n]["InAmount"].ToString() != "") { model.InAmount = decimal.Parse(dt.Rows[n]["InAmount"].ToString()); } if (dt.Rows[n]["OutAmount"] != null && dt.Rows[n]["OutAmount"].ToString() != "") { model.OutAmount = decimal.Parse(dt.Rows[n]["OutAmount"].ToString()); } if (dt.Rows[n]["BalanceAmount"] != null && dt.Rows[n]["BalanceAmount"].ToString() != "") { model.BalanceAmount = decimal.Parse(dt.Rows[n]["BalanceAmount"].ToString()); } if (dt.Rows[n]["JournalDate"] != null && dt.Rows[n]["JournalDate"].ToString() != "") { model.JournalDate = DateTime.Parse(dt.Rows[n]["JournalDate"].ToString()); } if (dt.Rows[n]["JournalType"] != null && dt.Rows[n]["JournalType"].ToString() != "") { model.JournalType = int.Parse(dt.Rows[n]["JournalType"].ToString()); } if (dt.Rows[n]["Journal01"] != null && dt.Rows[n]["Journal01"].ToString() != "") { model.Journal01 = int.Parse(dt.Rows[n]["Journal01"].ToString()); } if (dt.Rows[n]["Journal02"] != null && dt.Rows[n]["Journal02"].ToString() != "") { model.Journal02 = int.Parse(dt.Rows[n]["Journal02"].ToString()); } if (dt.Rows[n]["Journal03"] != null && dt.Rows[n]["Journal03"].ToString() != "") { model.Journal03 = dt.Rows[n]["Journal03"].ToString(); } if (dt.Rows[n]["Journal04"] != null && dt.Rows[n]["Journal04"].ToString() != "") { model.Journal04 = dt.Rows[n]["Journal04"].ToString(); } if (dt.Rows[n]["Journal05"] != null && dt.Rows[n]["Journal05"].ToString() != "") { model.Journal05 = decimal.Parse(dt.Rows[n]["Journal05"].ToString()); } if (dt.Rows[n]["Journal06"] != null && dt.Rows[n]["Journal06"].ToString() != "") { model.Journal06 = decimal.Parse(dt.Rows[n]["Journal06"].ToString()); } if (dt.Rows[n]["Journal07"] != null && dt.Rows[n]["Journal07"].ToString() != "") { model.Journal07 = DateTime.Parse(dt.Rows[n]["Journal07"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(lgk.Model.tb_journal model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public long Add(lgk.Model.tb_journal model) { return(dal.Add(model)); }
protected void btnSubmit_Click(object sender, EventArgs e) { long toUserID = 0; lgk.Model.tb_user userInfo = userBLL.GetModel(getLoginID()); lgk.Model.tb_change changeInfo = new lgk.Model.tb_change(); int iTypeID = int.Parse(dropCurrency.SelectedValue); if (iTypeID == 0) { MessageBox.ShowBox(this.Page, GetLanguage("ChooseTransfer"), Library.Enums.ModalTypes.warning);//请选择转账类型 return; } if (!CheckOpen(iTypeID)) { MessageBox.ShowBox(this.Page, GetLanguage("Feature"), Library.Enums.ModalTypes.warning);//该功能未开放 return; } string strMoney = txtMoney.Text.Trim(); if (string.IsNullOrEmpty(strMoney)) { MessageBox.ShowBox(this.Page, GetLanguage("transferMoneyIsnull"), Library.Enums.ModalTypes.warning);//转账金额不能为空 return; } string strPayPwd = txtSecondPassword.Text.Trim(); if (string.IsNullOrEmpty(strPayPwd)) { MessageBox.ShowBox(this.Page, GetLanguage("SecondaryISNUll"), Library.Enums.ModalTypes.warning);//二级密码不能为空 return; } if (!ValidPassword(userInfo.SecondPassword, PageValidate.GetMd5(strPayPwd))) { MessageBox.ShowBox(this.Page, "支付密码错误", Library.Enums.ModalTypes.warning);// return; } decimal dResult = 0; if (decimal.TryParse(strMoney, out dResult)) { decimal dTrans = getParamAmount("Transfer1"); //转账最低金额 decimal d = getParamAmount("Transfer2"); //转账倍数基数 if (dResult < dTrans) { MessageBox.ShowBox(this.Page, GetLanguage("equalTo") + dTrans, Library.Enums.ModalTypes.warning);//转账金额必须是大于等于XX的整数 return; } if (d != 0 && dResult % d != 0) { MessageBox.ShowBox(this.Page, GetLanguage("amountMustbe") + d + GetLanguage("Multiples"), Library.Enums.ModalTypes.warning);//转账金额必须是XX的倍数 return; } } else { MessageBox.ShowBox(this.Page, "输入的金额格式错误", Library.Enums.ModalTypes.warning); return; } if ((iTypeID == 1) && dResult > userInfo.BonusAccount) { MessageBox.ShowBox(this.Page, "奖励分余额不足", Library.Enums.ModalTypes.warning);// return; } else if (iTypeID == 2 && dResult > userInfo.StockAccount) { MessageBox.ShowBox(this.Page, "激活分余额不足", Library.Enums.ModalTypes.warning);// return; } else if (iTypeID == 3 && dResult > userInfo.Emoney) { MessageBox.ShowBox(this.Page, "注册分余额不足", Library.Enums.ModalTypes.warning);// return; } string strUserCode = txtUserCode.Text.Trim(); var toUser = userBLL.GetModelByUserCode(strUserCode); if (toUser == null) { MessageBox.ShowBox(this.Page, GetLanguage("numberIsExist"), Library.Enums.ModalTypes.warning);//会员编号不存在 return; } else { toUserID = int.Parse(toUser.UserID.ToString()); } if (toUserID <= 0) { MessageBox.ShowBox(this.Page, GetLanguage("objectExist"), Library.Enums.ModalTypes.warning);//转帐对象不存在 return; } if (!userInfo.SecondPassword.Equals(PageValidate.GetMd5(txtSecondPassword.Text.Trim()))) { MessageBox.ShowBox(this.Page, GetLanguage("PasswordError"), Library.Enums.ModalTypes.error);//二级密码错误 return; } decimal fee = dResult * getParamAmount("Transfer3"); changeInfo.UserID = getLoginID(); changeInfo.ToUserID = toUserID; changeInfo.ToUserType = 0; changeInfo.MoneyType = 0; changeInfo.Amount = dResult; changeInfo.ChangeType = iTypeID; changeInfo.ChangeDate = DateTime.Now; changeInfo.Change005 = dResult - fee; changeInfo.Change006 = fee;// 转账手续费 if (changeBLL.Add(changeInfo) > 0) { try { if (changeInfo.ChangeType == 1)//奖励分转激活分 { #region 奖励分转激活分 decimal dBonusAccount = userBLL.GetMoney(userInfo.UserID, "BonusAccount"); if (dBonusAccount >= changeInfo.Amount) { UpdateAccount("BonusAccount", userInfo.UserID, changeInfo.Amount, 0); // UpdateAccount("StockAccount", toUserID, changeInfo.Change005, 1); // //加入流水账表(佣金币减少) lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); jmodel.UserID = userInfo.UserID; jmodel.Remark = "奖励分转激活分"; jmodel.RemarkEn = "Currency to shopping currency"; jmodel.InAmount = 0; jmodel.OutAmount = changeInfo.Amount; jmodel.BalanceAmount = userBLL.GetMoney(userInfo.UserID, "BonusAccount"); jmodel.JournalDate = DateTime.Now; jmodel.JournalType = (int)Library.AccountType.奖励分; jmodel.Journal01 = toUserID; journalBLL.Add(jmodel); //加入流水账表(现金币增加) lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = toUserID; journalInfo.Remark = "奖励分转激活分"; journalInfo.RemarkEn = "Currency to shopping currency"; journalInfo.InAmount = changeInfo.Change005; journalInfo.OutAmount = 0; journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "StockAccount"); journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = (int)Library.AccountType.激活分; journalInfo.Journal01 = userInfo.UserID; journalBLL.Add(journalInfo); } else { MessageBox.ShowBox(this.Page, GetLanguage("objectExist"), Library.Enums.ModalTypes.warning);//转帐对象不存在 } #endregion } else if (changeInfo.ChangeType == 2)//激活分转其他会员 { #region 激活分转其他会员 decimal dStockAccount = userBLL.GetMoney(userInfo.UserID, "StockAccount"); if (dStockAccount >= changeInfo.Amount) { UpdateAccount("StockAccount", userInfo.UserID, changeInfo.Amount, 0); // UpdateAccount("StockAccount", toUserID, changeInfo.Change005, 1); // //加入流水账表(佣金币减少) lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); jmodel.UserID = userInfo.UserID; jmodel.Remark = "激活分转给" + toUser.UserCode; jmodel.RemarkEn = "Investment BonusAccount transferred to other member"; jmodel.InAmount = 0; jmodel.OutAmount = changeInfo.Amount; jmodel.BalanceAmount = userBLL.GetMoney(userInfo.UserID, "StockAccount"); jmodel.JournalDate = DateTime.Now; jmodel.JournalType = (int)Library.AccountType.激活分; jmodel.Journal01 = toUserID; journalBLL.Add(jmodel); //加入流水账表(现金币增加) lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = toUserID; journalInfo.Remark = "收到" + userInfo.UserCode + "转来激活分"; journalInfo.RemarkEn = "Investment BonusAccount transferred to other member"; journalInfo.InAmount = changeInfo.Change005; journalInfo.OutAmount = 0; journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "StockAccount "); journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = (int)Library.AccountType.激活分; journalInfo.Journal01 = userInfo.UserID; journalBLL.Add(journalInfo); } else { MessageBox.ShowBox(this.Page, GetLanguage("objectExist"), Library.Enums.ModalTypes.warning);//转帐对象不存在 return; } #endregion } else if (changeInfo.ChangeType == 3)//注册分转其他会员 { #region 注册分转其他会员 decimal dBonusAccount = userBLL.GetMoney(userInfo.UserID, "Emoney"); if (dBonusAccount >= changeInfo.Amount) { UpdateAccount("Emoney", userInfo.UserID, changeInfo.Amount, 0); // UpdateAccount("Emoney", toUserID, changeInfo.Change005, 1); // fee = changeInfo.Amount - changeInfo.Change005; //加入流水账表(减少) lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); jmodel.UserID = userInfo.UserID; jmodel.Remark = "注册分转给" + toUser.UserCode; jmodel.RemarkEn = "Currency to shopping currency"; jmodel.InAmount = 0; jmodel.OutAmount = changeInfo.Change005; jmodel.BalanceAmount = userBLL.GetMoney(toUserID, "Emoney"); jmodel.JournalDate = DateTime.Now; jmodel.JournalType = (int)Library.AccountType.注册分; jmodel.Journal01 = toUserID; journalBLL.Add(jmodel); //加入流水账表(现金币增加) lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = toUserID; journalInfo.Remark = "收到" + userInfo.UserCode + "转来注册分"; journalInfo.RemarkEn = "Currency to shopping currency"; journalInfo.InAmount = changeInfo.Change005; journalInfo.OutAmount = 0; journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "Emoney "); journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = (int)Library.AccountType.注册分; journalInfo.Journal01 = userInfo.UserID; journalBLL.Add(journalInfo); } #endregion } } catch { MessageBox.ShowBox(this.Page, GetLanguage("addError"), Library.Enums.ModalTypes.error); //添加流水账错误 } MessageBox.ShowBox(this.Page, GetLanguage("TransferSuccess"), Library.Enums.ModalTypes.success, "TransferToEmoney.aspx"); //转账成功 } else { MessageBox.ShowBox(this.Page, GetLanguage("addError"), Library.Enums.ModalTypes.error);//操作失败 } }
protected void btnSubmit_Click(object sender, EventArgs e) { long toUserID = 0; string strUserCode = txtUserCode.Text.Trim(); lgk.Model.tb_user userInfo = userBLL.GetModel(getLoginID()); lgk.Model.tb_change changeInfo = new lgk.Model.tb_change(); if (dropCurrency.SelectedValue == "0") { MessageBox.Show(this, "" + GetLanguage("ChooseTransfer") + "");//请选择转账类型 return; } if (strUserCode == "") { MessageBox.Show(this, "转入的会员编号不能为空!");//转入的会员编号不能为空 return; } else if (strUserCode == LoginUser.UserCode) { MessageBox.Show(this, "登录会员账号不能进行自转账操作!");//不能自己给自己转账 return; } var toUser = userBLL.GetModel(" UserCode='" + strUserCode + "'"); if (toUser == null) { MessageBox.Show(this, GetLanguage("numberIsExist"));//会员编号不存在 return; } else { toUserID = int.Parse(toUser.UserID.ToString()); } if (toUserID <= 0) { MessageBox.Show(this, GetLanguage("objectExist"));//转帐对象不存在 return; } //if (!CheckOpen(dropCurrency.SelectedValue)) //{ // MessageBox.Show(this, "" + GetLanguage("Feature") + "");//该功能未开放 // return; //} int iTypeID = int.Parse(dropCurrency.SelectedValue); if (txtScore.Text.Trim() == "") { MessageBox.Show(this, "" + GetLanguage("transferScoreIsnull") + "");//转账金额不能为空 return; } decimal dResult = 0; if (decimal.TryParse(txtScore.Text.Trim(), out dResult)) { decimal dTrans = getParamAmount("Transfer1"); //转账最低金额 decimal d = getParamAmount("Transfer2"); //转账倍数基数 if (dResult < dTrans) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("equalTo") + dTrans + "');", true);//转账金额/积分必须是大于等于XX的整数 return; } if (d != 0 && dResult % d != 0) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("amountMustbe") + "" + d + "" + GetLanguage("Multiples") + "');", true);//转账金额/积分必须是XX的倍数 return; } } if (iTypeID != 0) { if (iTypeID <= 1 && dResult > userInfo.BonusAccount) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('奖金积分不足');", true); return; } //if (iTypeID <= 3 && dResult > userInfo.BonusAccount) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("NotCurrent") + "');", true); // return; //} //else if (iTypeID >= 4 && dResult > userInfo.StockAccount) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("NotRegistered") + "');", true); // return; //} } //if (dropCurrency.SelectedValue == "5") //{ // if (toUserID == userInfo.UserID) // { // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("TransferToOuner") + "');", true); // return; // } // if (!userBLL.OnRecommendSameLine(userInfo.UserID, toUserID)) // { // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("objectExist") + "');", true); // return; // } //} changeInfo.UserID = getLoginID(); changeInfo.ToUserID = toUserID; changeInfo.ToUserType = 0; changeInfo.MoneyType = 0; changeInfo.Amount = dResult; //转出积分 changeInfo.ChangeType = Convert.ToInt32(dropCurrency.SelectedValue); changeInfo.ChangeDate = DateTime.Now; changeInfo.Change005 = dResult - dResult * getParamAmount("Transfer3") / 100; //实际到账奖金积分 if (changeBLL.Add(changeInfo) > 0) { try { if (changeInfo.ChangeType == 1)//奖金积分转其他会员 { #region 奖金积分转其他会员 decimal dBonusAccount = userBLL.GetMoney(getLoginID(), "BonusAccount"); if (dBonusAccount >= changeInfo.Amount) { UpdateAccount("BonusAccount", userInfo.UserID, changeInfo.Amount, 0); // UpdateAccount("BonusAccount", toUserID, changeInfo.Change005, 1); // //转出账号加入流水账表(奖金积分减少) lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); jmodel.UserID = userInfo.UserID; jmodel.Remark = "奖金积分转给" + txtUserCode.Text; jmodel.RemarkEn = "BonusScore to " + txtUserCode.Text; jmodel.InAmount = 0; jmodel.OutAmount = changeInfo.Amount; //转出积分 jmodel.BalanceAmount = dBonusAccount - changeInfo.Amount; //转出后的积分余额 jmodel.JournalDate = DateTime.Now; jmodel.JournalType = 2; //流水记录类型: 1-提现 2-转账 3-充值 5-会员升级 jmodel.Journal01 = toUserID; //转入积分的账号 jmodel.Journal02 = 1; //转账类型流水记录: 1-积分 2-月分红静态钱包 3-月分红动态钱包 4-年分红静态钱包 5-年分红动态钱包 journalBLL.Add(jmodel); //转入账号加入流水账表(奖金积分增加) lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = toUserID; journalInfo.Remark = "获得" + LoginUser.UserCode + "转来奖金积分"; journalInfo.RemarkEn = "Get " + LoginUser.UserCode + " Transfer BonusSocre"; journalInfo.InAmount = changeInfo.Change005; //实际到账积分 journalInfo.OutAmount = 0; journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "BonusAccount") + changeInfo.Change005; //转入后的积分余额 journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = 2; //操作记录的流水类型: 1-提现 2-转账 3-充值 5-会员升级 journalInfo.Journal01 = userInfo.UserID; //转出积分的账号 journalInfo.Journal02 = 1; //转账类型流水记录: 1-积分 2-月分红静态钱包 3-月分红动态钱包 4-年分红静态钱包 5-年分红动态钱包 journalBLL.Add(journalInfo); } //else //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("objectExist") + "');", true);//奖金币转拍币功能未开放 //} #endregion // #region 流通币转MDD钻币 // decimal dBonusAccount = userBLL.GetMoney(getLoginID(), "BonusAccount"); // if (dBonusAccount >= changeInfo.Amount) // { // UpdateAccount("BonusAccount", userInfo.UserID, changeInfo.Amount, 0);// // UpdateAccount("Emoney", toUserID, changeInfo.Change005, 1);// // //加入流水账表(流通币减少) // lgk.Model.tb_journal model = new lgk.Model.tb_journal(); // model.UserID = userInfo.UserID; // model.Remark = "流通币转MDD钻币"; // model.RemarkEn = "Currency to MDD drill"; // model.InAmount = 0; // model.OutAmount = changeInfo.Amount; // model.BalanceAmount = userBLL.GetMoney(getLoginID(), "BonusAccount"); // model.JournalDate = DateTime.Now; // model.JournalType = 1; // model.Journal01 = toUserID; // journalBLL.Add(model); // //加入流水账表(购物币增加) // lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); // journalInfo.UserID = toUserID; // journalInfo.Remark = "流通币转MDD钻币"; // journalInfo.RemarkEn = "Currency to MDD drill"; // journalInfo.InAmount = changeInfo.Change005; // journalInfo.OutAmount = 0; // journalInfo.BalanceAmount = userBLL.GetMoney(getLoginID(), "Emoney"); // journalInfo.JournalDate = DateTime.Now; // journalInfo.JournalType = 2; // journalInfo.Journal01 = userInfo.UserID; // journalBLL.Add(journalInfo); // } // else // { // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("objectExist") + "');", true);//奖金币转拍币功能未开放 // } // #endregion //} //else if (changeInfo.ChangeType == 2)//流通币转注册币 //{ // #region 流通币转注册币 // decimal dBonusAccount = userBLL.GetMoney(getLoginID(), "BonusAccount"); // if (dBonusAccount >= changeInfo.Amount) // { // UpdateAccount("BonusAccount", userInfo.UserID, changeInfo.Amount, 0);// // UpdateAccount("StockAccount", toUserID, changeInfo.Change005, 1);// // //加入流水账表(佣金币减少) // lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); // jmodel.UserID = userInfo.UserID; // jmodel.Remark = "流通币转注册币"; // jmodel.RemarkEn = "Currency to Registered currency"; // jmodel.InAmount = 0; // jmodel.OutAmount = changeInfo.Amount; // jmodel.BalanceAmount = userBLL.GetMoney(getLoginID(), "BonusAccount"); // jmodel.JournalDate = DateTime.Now; // jmodel.JournalType = 1; // jmodel.Journal01 = toUserID; // journalBLL.Add(jmodel); // //加入流水账表(现金币增加) // lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); // journalInfo.UserID = toUserID; // journalInfo.Remark = "流通币转注册币"; // journalInfo.RemarkEn = "Currency to Registered currency"; // journalInfo.InAmount = changeInfo.Change005; // journalInfo.OutAmount = 0; // journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "StockAccount"); // journalInfo.JournalDate = DateTime.Now; // journalInfo.JournalType = 5; // journalInfo.Journal01 = userInfo.UserID; // journalBLL.Add(journalInfo); // } // else // { // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("objectExist") + "');", true);//奖金币转拍币功能未开放 // } // #endregion //} //else if (changeInfo.ChangeType == 3)//流通币转购物币 //{ // #region 流通币转购物币 // decimal dBonusAccount = userBLL.GetMoney(getLoginID(), "BonusAccount"); // if (dBonusAccount >= changeInfo.Amount) // { // UpdateAccount("BonusAccount", userInfo.UserID, changeInfo.Amount, 0);// // UpdateAccount("ShopAccount", toUserID, changeInfo.Change005, 1);// // //加入流水账表(佣金币减少) // lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); // jmodel.UserID = userInfo.UserID; // jmodel.Remark = "流通币转购物币"; // jmodel.RemarkEn = "Currency to shopping currency"; // jmodel.InAmount = 0; // jmodel.OutAmount = changeInfo.Amount; // jmodel.BalanceAmount = userBLL.GetMoney(getLoginID(), "BonusAccount"); // jmodel.JournalDate = DateTime.Now; // jmodel.JournalType = 1; // jmodel.Journal01 = toUserID; // journalBLL.Add(jmodel); // //加入流水账表(现金币增加) // lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); // journalInfo.UserID = toUserID; // journalInfo.Remark = "流通币转购物币"; // journalInfo.RemarkEn = "Currency to shopping currency"; // journalInfo.InAmount = changeInfo.Change005; // journalInfo.OutAmount = 0; // journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "ShopAccount"); // journalInfo.JournalDate = DateTime.Now; // journalInfo.JournalType = 3; // journalInfo.Journal01 = userInfo.UserID; // journalBLL.Add(journalInfo); // } // else // { // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("objectExist") + "');", true);//奖金币转拍币功能未开放 // } // #endregion //} //else if (changeInfo.ChangeType == 4)//注册币转购物币 //{ // #region 注册币转购物币 // decimal dStockAccount = userBLL.GetMoney(getLoginID(), "StockAccount"); // if (dStockAccount >= changeInfo.Amount) // { // UpdateAccount("StockAccount", userInfo.UserID, changeInfo.Amount, 0);// // UpdateAccount("ShopAccount", toUserID, changeInfo.Change005, 1);// // //加入流水账表(佣金币减少) // lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); // jmodel.UserID = userInfo.UserID; // jmodel.Remark = "注册币转购物币"; // jmodel.RemarkEn = "Registered currency to shopping currency"; // jmodel.InAmount = 0; // jmodel.OutAmount = changeInfo.Amount; // jmodel.BalanceAmount = userBLL.GetMoney(getLoginID(), "StockAccount"); // jmodel.JournalDate = DateTime.Now; // jmodel.JournalType = 5; // jmodel.Journal01 = toUserID; // journalBLL.Add(jmodel); // //加入流水账表(现金币增加) // lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); // journalInfo.UserID = toUserID; // journalInfo.Remark = "注册币转购物币"; // journalInfo.RemarkEn = "Registered currency to shopping currency"; // journalInfo.InAmount = changeInfo.Change005; // journalInfo.OutAmount = 0; // journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "ShopAccount"); // journalInfo.JournalDate = DateTime.Now; // journalInfo.JournalType = 3; // journalInfo.Journal01 = userInfo.UserID; // journalBLL.Add(journalInfo); // } // else // { // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("objectExist") + "');", true);//奖金币转拍币功能未开放 // } // #endregion //} //else if (changeInfo.ChangeType == 5)//注册币转其他会员 //{ // #region 注册币转其他会员 // decimal dStockAccount = userBLL.GetMoney(getLoginID(), "StockAccount"); // if (dStockAccount >= changeInfo.Amount) // { // UpdateAccount("StockAccount", userInfo.UserID, changeInfo.Amount, 0);// // UpdateAccount("StockAccount", toUserID, changeInfo.Change005, 1);// // //加入流水账表(佣金币减少) // lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); // jmodel.UserID = userInfo.UserID; // jmodel.Remark = "注册币转给" + txtUserCode.Text; // jmodel.RemarkEn = "Registered currency to " + txtUserCode.Text; // jmodel.InAmount = 0; // jmodel.OutAmount = changeInfo.Amount; // jmodel.BalanceAmount = userBLL.GetMoney(getLoginID(), "StockAccount"); // jmodel.JournalDate = DateTime.Now; // jmodel.JournalType = 5; // jmodel.Journal01 = toUserID; // journalBLL.Add(jmodel); // //加入流水账表(现金币增加) // lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); // journalInfo.UserID = toUserID; // journalInfo.Remark = "获得" + LoginUser.UserCode + "转来注册币"; // journalInfo.RemarkEn = "Get " + LoginUser.UserCode + " Transfer Registered currency"; // journalInfo.InAmount = changeInfo.Change005; // journalInfo.OutAmount = 0; // journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "StockAccount"); // journalInfo.JournalDate = DateTime.Now; // journalInfo.JournalType = 5; // journalInfo.Journal01 = userInfo.UserID; // journalBLL.Add(journalInfo); // } // else // { // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("objectExist") + "');", true);//奖金币转拍币功能未开放 // } // #endregion } } catch { MessageBox.Show(this, GetLanguage("addError")); //添加流水账错误 } MessageBox.ShowAndRedirect(this, GetLanguage("TransferSuccess"), "TransferToEmoney.aspx"); //转账成功 } else { MessageBox.Show(this, GetLanguage("OperationFailed"));//操作失败 } }
protected void btnSubmit_Click(object sender, EventArgs e) { long toUserID = 0; lgk.Model.tb_user userInfo = userBLL.GetModel(getLoginID()); lgk.Model.tb_change changeInfo = new lgk.Model.tb_change(); if (dropCurrency.SelectedValue == "0") { MessageBox.ShowBox(this.Page, GetLanguage("ChooseTransfer"), Library.Enums.ModalTypes.warning);//请选择转账类型 return; } if (!CheckOpen(dropCurrency.SelectedValue)) { MessageBox.ShowBox(this.Page, GetLanguage("Feature"), Library.Enums.ModalTypes.warning);//该功能未开放 return; } int iTypeID = int.Parse(dropCurrency.SelectedValue); if (txtMoney.Text.Trim() == "") { MessageBox.ShowBox(this.Page, GetLanguage("transferMoneyIsnull"), Library.Enums.ModalTypes.warning);//转账金额不能为空 return; } if (string.IsNullOrEmpty(txtSecondPassword.Text.Trim())) { MessageBox.ShowBox(this.Page, GetLanguage("SecondaryISNUll"), Library.Enums.ModalTypes.warning);//二级密码不能为空 return; } decimal dResult = 0; if (decimal.TryParse(txtMoney.Text.Trim(), out dResult)) { decimal dTrans = getParamAmount("Transfer1"); //转账最低金额 decimal d = getParamAmount("Transfer2"); //转账倍数基数 if (dResult < dTrans) { MessageBox.ShowBox(this.Page, GetLanguage("equalTo") + dTrans, Library.Enums.ModalTypes.warning); //转账金额必须是大于等于XX的整数 return; } if (d != 0 && dResult % d != 0) { MessageBox.ShowBox(this.Page, GetLanguage("amountMustbe") + d + GetLanguage("Multiples"), Library.Enums.ModalTypes.warning); //转账金额必须是XX的倍数 return; } } if (iTypeID != 0) { if ((iTypeID == 1 || iTypeID == 2) && dResult > userInfo.BonusAccount) { MessageBox.ShowBox(this.Page, GetLanguage("NotCurrent"), Library.Enums.ModalTypes.warning);//云图余额不足 return; } else if (iTypeID == 3 && dResult > userInfo.Emoney) { MessageBox.ShowBox(this.Page, GetLanguage("moneyDollars"), Library.Enums.ModalTypes.warning);//云盾余额不足 return; } else if (iTypeID == 4 && dResult > userInfo.StockMoney) { MessageBox.ShowBox(this.Page, GetLanguage("balanceDollars"), Library.Enums.ModalTypes.warning);//云图余额不足 return; } else if (iTypeID == 5 && dResult > userInfo.ShopAccount) { MessageBox.ShowBox(this.Page, GetLanguage("NotCurrency"), Library.Enums.ModalTypes.warning);//云图余额不足 return; } } string strUserCode = txtUserCode.Text.Trim(); var toUser = userBLL.GetModel(" UserCode='" + strUserCode + "'"); if (toUser == null) { MessageBox.ShowBox(this.Page, GetLanguage("numberIsExist"), Library.Enums.ModalTypes.warning);//会员编号不存在 return; } else { toUserID = int.Parse(toUser.UserID.ToString()); } if (toUserID <= 0) { MessageBox.ShowBox(this.Page, GetLanguage("objectExist"), Library.Enums.ModalTypes.warning);//转帐对象不存在 return; } if (dropCurrency.SelectedValue == "5") { if (toUserID == userInfo.UserID) { MessageBox.ShowBox(this.Page, GetLanguage("TransferToOuner"), Library.Enums.ModalTypes.warning);//不能给自己转账 return; } if (!userBLL.OnRecommendSameLine(userInfo.UserID, toUserID)) { MessageBox.ShowBox(this.Page, GetLanguage("objectExist"), Library.Enums.ModalTypes.warning);//转帐对象不存在 return; } } if (!userInfo.SecondPassword.Equals(PageValidate.GetMd5(txtSecondPassword.Text.Trim()))) { MessageBox.ShowBox(this.Page, GetLanguage("PasswordError"), Library.Enums.ModalTypes.error);//二级密码错误 return; } changeInfo.UserID = getLoginID(); changeInfo.ToUserID = toUserID; changeInfo.ToUserType = 0; changeInfo.MoneyType = 0; changeInfo.Amount = dResult; changeInfo.ChangeType = Convert.ToInt32(dropCurrency.SelectedValue); changeInfo.ChangeDate = DateTime.Now; changeInfo.Change005 = dResult - dResult * getParamAmount("Transfer3") / 100; if (changeBLL.Add(changeInfo) > 0) { try { if (changeInfo.ChangeType == 1)//云图转换云盾 { #region 云图转换云盾 decimal dBonusAccount = userBLL.GetMoney(getLoginID(), "BonusAccount"); if (dBonusAccount >= changeInfo.Amount) { UpdateAccount("BonusAccount", userInfo.UserID, changeInfo.Amount, 0); // UpdateAccount("Emoney", toUserID, changeInfo.Change005, 1); // //加入流水账表(流通币减少) lgk.Model.tb_journal model = new lgk.Model.tb_journal(); model.UserID = userInfo.UserID; model.Remark = "云图转换云盾"; model.RemarkEn = "Cash register integral transform integral"; model.InAmount = 0; model.OutAmount = changeInfo.Amount; model.BalanceAmount = userBLL.GetMoney(getLoginID(), "BonusAccount"); model.JournalDate = DateTime.Now; model.JournalType = (int)Library.AccountType.云图; model.Journal01 = toUserID; journalBLL.Add(model); //加入流水账表(购物币增加) lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = toUserID; journalInfo.Remark = "云图转换云盾"; journalInfo.RemarkEn = "Cash register integral transform integral"; journalInfo.InAmount = changeInfo.Change005; journalInfo.OutAmount = 0; journalInfo.BalanceAmount = userBLL.GetMoney(getLoginID(), "Emoney"); journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = (int)Library.AccountType.云盾; journalInfo.Journal01 = userInfo.UserID; journalBLL.Add(journalInfo); } else { MessageBox.ShowBox(this.Page, GetLanguage("objectExist"), Library.Enums.ModalTypes.warning);//转帐对象不存在 } #endregion } else if (changeInfo.ChangeType == 2)//云图转云图 { #region 云图转云图 decimal dBonusAccount = userBLL.GetMoney(getLoginID(), "BonusAccount"); if (dBonusAccount >= changeInfo.Amount) { UpdateAccount("BonusAccount", userInfo.UserID, changeInfo.Amount, 0); // UpdateAccount("StockMoney", toUserID, changeInfo.Change005, 1); // //加入流水账表(佣金币减少) lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); jmodel.UserID = userInfo.UserID; jmodel.Remark = "云图转云图"; jmodel.RemarkEn = "Cash conversion points"; jmodel.InAmount = 0; jmodel.OutAmount = changeInfo.Amount; jmodel.BalanceAmount = userBLL.GetMoney(getLoginID(), "BonusAccount"); jmodel.JournalDate = DateTime.Now; jmodel.JournalType = (int)Library.AccountType.云图; jmodel.Journal01 = toUserID; journalBLL.Add(jmodel); //加入流水账表(现金币增加) lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = toUserID; journalInfo.Remark = "云图转云图"; journalInfo.RemarkEn = "Cash conversion points"; journalInfo.InAmount = changeInfo.Change005; journalInfo.OutAmount = 0; journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "StockMoney"); journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = (int)Library.AccountType.云图; journalInfo.Journal01 = userInfo.UserID; journalBLL.Add(journalInfo); } else { MessageBox.ShowBox(this.Page, GetLanguage("objectExist"), Library.Enums.ModalTypes.warning);//转帐对象不存在 } #endregion } else if (changeInfo.ChangeType == 3)//云盾转给其他会员 { #region 云盾转给其他会员 decimal dBonusAccount = userBLL.GetMoney(getLoginID(), "Emoney"); if (dBonusAccount >= changeInfo.Amount) { UpdateAccount("Emoney", userInfo.UserID, changeInfo.Amount, 0); // UpdateAccount("Emoney", toUserID, changeInfo.Change005, 1); // //加入流水账表(佣金币减少) lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); jmodel.UserID = userInfo.UserID; jmodel.Remark = "云盾转给" + txtUserCode.Text;; jmodel.RemarkEn = "Currency to shopping currency"; jmodel.InAmount = 0; jmodel.OutAmount = changeInfo.Amount; jmodel.BalanceAmount = userBLL.GetMoney(getLoginID(), "Emoney"); jmodel.JournalDate = DateTime.Now; jmodel.JournalType = (int)Library.AccountType.云盾; jmodel.Journal01 = toUserID; journalBLL.Add(jmodel); //加入流水账表(现金币增加) lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = toUserID; journalInfo.Remark = "获得" + LoginUser.UserCode + "转来云盾"; journalInfo.RemarkEn = "Currency to shopping currency"; journalInfo.InAmount = changeInfo.Change005; journalInfo.OutAmount = 0; journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "Emoney"); journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = (int)Library.AccountType.云盾; journalInfo.Journal01 = userInfo.UserID; journalBLL.Add(journalInfo); } else { MessageBox.ShowBox(this.Page, GetLanguage("objectExist"), Library.Enums.ModalTypes.warning);//转帐对象不存在 } #endregion } else if (changeInfo.ChangeType == 4)//云图转给其他会员 { #region 云图转给其他会员 decimal dStockAccount = userBLL.GetMoney(getLoginID(), "StockMoney"); if (dStockAccount >= changeInfo.Amount) { UpdateAccount("StockMoney", userInfo.UserID, changeInfo.Amount, 0); // UpdateAccount("StockMoney", toUserID, changeInfo.Change005, 1); // //加入流水账表(佣金币减少) lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); jmodel.UserID = userInfo.UserID; jmodel.Remark = "云图转给" + txtUserCode.Text; jmodel.RemarkEn = "Investment points transferred to shopping currency"; jmodel.InAmount = 0; jmodel.OutAmount = changeInfo.Amount; jmodel.BalanceAmount = userBLL.GetMoney(getLoginID(), "StockMoney"); jmodel.JournalDate = DateTime.Now; jmodel.JournalType = (int)Library.AccountType.云图; jmodel.Journal01 = toUserID; journalBLL.Add(jmodel); //加入流水账表(现金币增加) lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = toUserID; journalInfo.Remark = "获得" + LoginUser.UserCode + "转来云图"; journalInfo.RemarkEn = "Investment points transferred to shopping currency"; journalInfo.InAmount = changeInfo.Change005; journalInfo.OutAmount = 0; journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "StockMoney"); journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = (int)Library.AccountType.云图; journalInfo.Journal01 = userInfo.UserID; journalBLL.Add(journalInfo); } else { MessageBox.ShowBox(this.Page, GetLanguage("objectExist"), Library.Enums.ModalTypes.warning);//转帐对象不存在 return; } #endregion } else if (changeInfo.ChangeType == 5)//云图转其他会员 { #region 云图转其他会员 decimal dStockAccount = userBLL.GetMoney(getLoginID(), "ShopAccount"); if (dStockAccount >= changeInfo.Amount) { UpdateAccount("ShopAccount", userInfo.UserID, changeInfo.Amount, 0); // UpdateAccount("ShopAccount", toUserID, changeInfo.Change005, 1); // //加入流水账表(佣金币减少) lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal(); jmodel.UserID = userInfo.UserID; jmodel.Remark = "云图转给" + txtUserCode.Text; jmodel.RemarkEn = "Transaction code transfer to " + txtUserCode.Text; jmodel.InAmount = 0; jmodel.OutAmount = changeInfo.Amount; jmodel.BalanceAmount = userBLL.GetMoney(getLoginID(), "ShopAccount"); jmodel.JournalDate = DateTime.Now; jmodel.JournalType = (int)Library.AccountType.云图; jmodel.Journal01 = toUserID; journalBLL.Add(jmodel); //加入流水账表(现金币增加) lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = toUserID; journalInfo.Remark = "获得" + LoginUser.UserCode + "转来云图"; journalInfo.RemarkEn = "Get " + LoginUser.UserCode + " Transaction code transfer"; journalInfo.InAmount = changeInfo.Change005; journalInfo.OutAmount = 0; journalInfo.BalanceAmount = userBLL.GetMoney(toUserID, "ShopAccount"); journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = (int)Library.AccountType.云图; journalInfo.Journal01 = userInfo.UserID; journalBLL.Add(journalInfo); } else { MessageBox.ShowBox(this.Page, GetLanguage("objectExist"), Library.Enums.ModalTypes.warning);//转帐对象不存在 } #endregion } } catch { MessageBox.ShowBox(this.Page, GetLanguage("addError"), Library.Enums.ModalTypes.error);//添加流水账错误 } MessageBox.ShowBox(this.Page, GetLanguage("TransferSuccess"), Library.Enums.ModalTypes.success, "TransferToEmoney.aspx");//转账成功 } else { MessageBox.ShowBox(this.Page, GetLanguage("addError"), Library.Enums.ModalTypes.error);//操作失败 } }