//收款 public bool OrderGet(long userid, long orderid, out string message) { var user = userBLL.GetModel(userid); if (user.IsLock == 1) { message = "账户已冻结,收款失败"; return(false); } lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(orderid); if (cashorderInfo == null) { message = "订单不存在"; return(false); } if (cashorderInfo.SUserID != userid) { message = "订单无效"; return(false); } if (cashorderInfo.SUserID == userid && cashorderInfo.BStatus == 1 && cashorderInfo.SStatus == 0) { cashorderBLL.Update(userid, cashorderInfo.OrderID, DateTime.Now, "", "", 2); //确认已付款 cashorderBLL.Update(cashorderInfo.SUserID, orderid, DateTime.Now, "", "", 3); //发货 lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); lgk.Model.Cashsell CashsellInfo = cashsellBLL.GetModel(cashbuyInfo.CashsellID); decimal dNumber = cashbuyInfo.Number; //decimal dCharge = CashsellInfo.Charge;//总手续费 //decimal dMTaxRate = dNumber * getParamAmount("Gold3") / 100;//买家获得手续费 //decimal dCTaxRate = dNumber * getParamAmount("Gold4") / 100;//公司获得手续费 //decimal dTNumber = dNumber - dCharge + dMTaxRate; //聚元宝:注册币( 1:TransferRateBTE) //注册币 = 聚元宝 * 比例b decimal dTNumber = dNumber * getParamAmount("TransferRateBTE"); //聚元宝转换注册币比例 ;// + dMTaxRate; //买家得到的是聚元宝 StockMoney UpdateAccount("Emoney", cashorderInfo.BUserID, dTNumber, 1); //发货给购买者 //UpdateSystemAccount("MoneyAccount", dCTaxRate, 1); ////SetAccount(iUserID, dAccount, "EP币发货!", 1); SetAccount(cashorderInfo.BUserID, dTNumber, "金币发货!", cashorderInfo.SUserID, (int)Library.AccountType.购物分); message = GetLanguage("Successful"); return(true); } message = "收款失败"; return(false); }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "cancel") { long iCashsellID = Convert.ToInt64(e.CommandArgument); lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(iCashsellID); lgk.Model.tb_user userInfo = userBLL.GetModel(cashsellInfo.UserID); if (cashsellInfo == null) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("recordDeleted") + "');", true);//该记录已删除,无法再进行此操作 return; } if (cashsellInfo.IsSell > 1) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("GoldUnable") + "');", true); //金币已卖出,无法再进行此操作 return; //GoldUnable } #region 加入流水账表 //现金积分 //decimal dNumber = (cashsellInfo.Number + cashsellInfo.Charge) * cashsellInfo.UnitNum; decimal dNumber = (cashsellInfo.Number); lgk.Model.tb_journal model = new lgk.Model.tb_journal(); model.UserID = cashsellInfo.UserID; model.Remark = "取消订单,返回交易币"; model.InAmount = dNumber; model.OutAmount = 0; model.BalanceAmount = userInfo.ShopAccount + dNumber; model.JournalDate = DateTime.Now; model.JournalType = (int)Library.AccountType.交易钱包; model.Journal01 = cashsellInfo.UserID; //交易码 lgk.Model.tb_journal modelTrans = new lgk.Model.tb_journal(); modelTrans.UserID = cashsellInfo.UserID; modelTrans.Remark = "取消订单,返回保证金"; modelTrans.InAmount = cashsellInfo.Charge; modelTrans.OutAmount = 0; modelTrans.BalanceAmount = userInfo.ShopAccount + dNumber + cashsellInfo.Charge; modelTrans.JournalDate = DateTime.Now; modelTrans.JournalType = (int)Library.AccountType.交易钱包; modelTrans.Journal01 = cashsellInfo.UserID; #endregion if (journalBLL.Add(model) > 0 && journalBLL.Add(modelTrans) > 0 && cashsellBLL.UpdateUndo(iCashsellID, 1) && UpdateAccount("ShopAccount", getLoginID(), dNumber + cashsellInfo.Charge, 1) > 0) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("CancellationSuccess") + "');window.location.href='CashsellList.aspx';", true);//取消成功 } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("FailedToCancel") + "');", true);//取消失败 } } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { long id = Convert.ToInt64(e.CommandArgument); string tag = e.CommandName; if (tag.Equals("cancel")) { lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(id); if (cashsellInfo == null) { MessageBox.ShowBox(this.Page, "订单不存在", Library.Enums.ModalTypes.warning); return; } if (cashsellInfo.IsSell == -1) { MessageBox.ShowBox(this.Page, "订单已撤销,请勿重复操作", Library.Enums.ModalTypes.warning); return; } else if (cashsellInfo.IsSell == 1) { MessageBox.ShowBox(this.Page, "订单已完成,无法撤销", Library.Enums.ModalTypes.warning); return; } else if (cashsellInfo.IsSell == 0) { int SurplusNum = cashsellInfo.Number - cashsellInfo.SaleNum; string strRemark = "后台已撤销卖出订单[" + cashsellInfo.OrderCode + "],返还剩余云图[" + SurplusNum + "]"; string strRemarkEn = "The manager has revoked the seller's order [" + cashsellInfo.OrderCode + "] and returned the remaining YT [" + SurplusNum + "]"; //修改订单状态 cashsellInfo.IsUndo = 1; cashsellInfo.IsSell = -1; cashsellBLL.Update(cashsellInfo); int iJtype = (int)Library.AccountType.云图; //币种 UpdateAccount("BonusAccount", cashsellInfo.UserID, SurplusNum, iJtype); //终止交易,将云图返还卖家 SetAccount(cashsellInfo.UserID, Convert.ToDecimal(SurplusNum * 1.00), strRemark, strRemarkEn, cashsellInfo.UserID, iJtype); //插入流水 lgk.Model.SysLog log = new lgk.Model.SysLog(); //日志 lgk.BLL.SysLog syslogBLL = new lgk.BLL.SysLog(); log.LogMsg = strRemark; log.LogType = 24; // log.LogLeve = 0; // log.LogDate = DateTime.Now; log.LogCode = "卖家已撤销订单"; // log.IsDeleted = 0; log.Log1 = cashsellInfo.CashsellID.ToString(); //用户UserID log.Log2 = ""; // BrowserHelper.UserHostIP(this.Page); log.Log3 = ""; //BrowserHelper.UserHostName(); log.Log4 = ""; syslogBLL.Add(log); BindData(); } } }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { long iUserID = Convert.ToInt64(DataBinder.Eval(e.Item.DataItem, "UserID")); long iCashsellID = Convert.ToInt64(DataBinder.Eval(e.Item.DataItem, "CashsellID")); int iIsSell = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "IsSell")); //Literal ltSValues = (Literal)e.Item.FindControl("ltSValues");//卖家评分 Literal ltStatus = (Literal)e.Item.FindControl("ltStatus");//可提现余额 LinkButton lbtnCancel = (LinkButton)e.Item.FindControl("lbtnCancel");//撤销按钮 LinkButton lbtnCancelEn = (LinkButton)e.Item.FindControl("lbtnCancelEn");//撤销按钮 int iValue = cashcreditBLL.GetValues(iUserID, "SValues"); //if (iValue > 0) //{ // for (int i = 0; i < iValue; i++) // { // ltSValues.Text += "<img alt='' src='../../../images/start.png' />"; // } //} lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(iCashsellID); if (cashsellInfo != null) { if (cashsellInfo.IsUndo == 1) { ltStatus.Text = GetLanguage("Undone");//已撤销 } else { if (cashsellInfo.IsSell == 0) ltStatus.Text = "挂卖中"; else if (cashsellInfo.IsSell == 1) ltStatus.Text = "交易中,未付款"; else if (cashsellInfo.IsSell == 2) ltStatus.Text = "已付款,未发货"; else if (cashsellInfo.IsSell == 3) ltStatus.Text = "完成"; } if (cashsellInfo.SaleNum == 0 && cashsellInfo.IsUndo == 0) { lbtnCancel.Visible = true; lbtnCancelEn.Visible = true; } else { lbtnCancel.Visible = false; lbtnCancelEn.Visible = false; } } } }
/// <summary> /// 增加一条数据 /// </summary> public long Add(lgk.Model.Cashsell model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Cashsell("); strSql.Append("Title,UserID,Amount,Price,Number,UnitNum,SaleNum,Charge,SellDate,Remark,IsSell,IsUndo,PurchaseID,Phone)"); strSql.Append(" values ("); strSql.Append("@Title,@UserID,@Amount,@Price,@Number,@UnitNum,@SaleNum,@Charge,@SellDate,@Remark,@IsSell,@IsUndo,@PurchaseID,@Phone)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Title", SqlDbType.VarChar, 60), new SqlParameter("@UserID", SqlDbType.BigInt, 8), new SqlParameter("@Amount", SqlDbType.Decimal, 9), new SqlParameter("@Price", SqlDbType.Decimal, 9), new SqlParameter("@Number", SqlDbType.Int, 4), new SqlParameter("@UnitNum", SqlDbType.Decimal, 4), new SqlParameter("@SaleNum", SqlDbType.Decimal, 4), new SqlParameter("@Charge", SqlDbType.Decimal, 9), new SqlParameter("@SellDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.VarChar, 500), new SqlParameter("@IsSell", SqlDbType.Int, 4), new SqlParameter("@IsUndo", SqlDbType.Int, 4), new SqlParameter("@PurchaseID", SqlDbType.BigInt, 8), new SqlParameter("@Phone", SqlDbType.VarChar, 20) }; parameters[0].Value = model.Title; parameters[1].Value = model.UserID; parameters[2].Value = model.Amount; parameters[3].Value = model.Price; parameters[4].Value = model.Number; parameters[5].Value = model.UnitNum; parameters[6].Value = model.SaleNum; parameters[7].Value = model.Charge; parameters[8].Value = model.SellDate; parameters[9].Value = model.Remark; parameters[10].Value = model.IsSell; parameters[11].Value = model.IsUndo; parameters[12].Value = model.PurchaseID; parameters[13].Value = model.Phone; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt64(obj)); } }
//撤销买入订单 public bool BuyOrderCancel(long userid, long orderid, out string message) { string strRemark = ""; decimal dAccount = Convert.ToDecimal(0.00); lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(orderid); lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); var user = userBLL.GetModel(userid); if (user.IsLock == 1) { message = "账户已冻结,撤销买入订单失败"; return(false); } strRemark = "买家已取消"; //加入流水账表 if (userid == cashorderInfo.BUserID && cashorderInfo.BStatus == 0) { cashorderBLL.UndoOrder(orderid, strRemark); //买家撤销订单 lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(cashorderInfo.CashsellID); cashsellInfo.SaleNum = cashsellInfo.SaleNum - cashbuyInfo.BuyNum; //减掉购买的金额,卖方继续挂卖 cashsellBLL.Update(cashsellInfo); cashbuyInfo.IsBuy = -1;//买家已取消 cashbuyBLL.Update(cashbuyInfo); lgk.Model.SysLog log = new lgk.Model.SysLog();//日志 lgk.BLL.SysLog syslogBLL = new lgk.BLL.SysLog(); log.LogMsg = "买家已取消订单【" + cashorderInfo.OrderCode + "】"; log.LogType = 23; // log.LogLeve = 0; // log.LogDate = DateTime.Now; log.LogCode = "买家已取消订单"; // log.IsDeleted = 0; log.Log1 = cashorderInfo.BUserID.ToString(); //用户UserID log.Log2 = ""; // BrowserHelper.UserHostIP(this.Page); log.Log3 = ""; //BrowserHelper.UserHostName(); log.Log4 = ""; syslogBLL.Add(log); message = "买家取消成功"; return(true); } message = "该订单不能撤销"; return(false); }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { long id = Convert.ToInt64(e.CommandArgument); string tag = e.CommandName; if (tag.Equals("cancel")) { lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(id); if (cashsellInfo == null) { MessageBox.ShowBox(this.Page, "订单不存在", Library.Enums.ModalTypes.warning); return; } if (cashsellInfo.IsSell == -1) { MessageBox.ShowBox(this.Page, "订单已撤销,请勿重复操作", Library.Enums.ModalTypes.warning); return; } else if (cashsellInfo.IsSell == 1) { MessageBox.ShowBox(this.Page, "订单已完成,无法撤销", Library.Enums.ModalTypes.warning); return; } else if (cashsellInfo.IsSell == 0) { string msg = cashsellBLL.Proc_TradingSellCancel(cashsellInfo.CashsellID); if (msg == "ok") { MessageBox.ShowBox(this.Page, "撤销成功", Library.Enums.ModalTypes.success); BindData(); } else if (!string.IsNullOrEmpty(msg)) { MessageBox.ShowBox(this.Page, msg, Library.Enums.ModalTypes.warning); return; } else { MessageBox.ShowBox(this.Page, "撤销失败", Library.Enums.ModalTypes.warning); return; } } } }
/// <summary> /// 显示数据 /// </summary> private void ShowData() { lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(iCashsellID); if (cashsellInfo != null) { #region 商品信息 ltTitle.Text = cashsellInfo.Title; ltAmount.Text = cashsellInfo.Amount.ToString("0.00"); ltNumber.Text = cashsellInfo.Number.ToString(); ltPrice.Text = cashsellInfo.Price.ToString("0.00"); ltUnitNum.Text = cashsellInfo.UnitNum.ToString(); #endregion #region 卖家信息 lgk.Model.tb_user userInfo = userBLL.GetModel(cashsellInfo.UserID); ltUserCode.Text = userInfo.UserCode; //会员编号 ltBankName.Text = userInfo.BankName; //开户银行 ltTrueName.Text = userInfo.TrueName; //银行姓名 ltBankAccount.Text = userInfo.BankAccount; //银行帐号 ltBankAccountUser.Text = userInfo.BankAccountUser; //银行姓名 ltBankBranch.Text = userInfo.BankBranch; //开户网点 ltQQnumer.Text = userInfo.QQnumer; //卖家QQ号码 ltPhoneNum.Text = userInfo.PhoneNum; //卖家手机号码 #endregion #region 信用等级 lgk.Model.Cashcredit cashcreditInfo = cashcreditBLL.GetModel("UserID=" + cashsellInfo.UserID + ""); if (cashcreditInfo != null) { ltGrade.Text = cashcreditInfo.BValues.ToString(); } #endregion } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Trial") { int iCashsellID = Convert.ToInt32(e.CommandArgument); lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(iCashsellID); cashsellInfo.IsSell = 1; if (cashsellBLL.Update(cashsellInfo)) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('审批成功');", true);//审批成功 } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('审批失败');", true);//审批失败 } } BindData(); }
/// <summary> /// 得到一个对象实体 /// </summary> public lgk.Model.Cashsell GetModel(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 CashsellID, UserID, Amount, Price, Number, UnitNum, SaleNum, Charge, SellDate, Remark, IsSell, IsUndo, PurchaseID,Phone"); strSql.Append(" from Cashsell"); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } lgk.Model.Cashsell model = new lgk.Model.Cashsell(); DataSet ds = DbHelperSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public lgk.Model.Cashsell GetModel(long CashsellID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 CashsellID,UserID,Amount,Price,Number,UnitNum,SaleNum,Charge,SellDate,Remark,IsSell,IsUndo,PurchaseID,Phone,OrderCode from Cashsell "); strSql.Append(" where CashsellID=@CashsellID"); SqlParameter[] parameters = { new SqlParameter("@CashsellID", SqlDbType.BigInt) }; parameters[0].Value = CashsellID; lgk.Model.Cashsell model = new lgk.Model.Cashsell(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
//买入 public bool Buy(long UserID, string OrderSellID, string Number, string phone, string paypassword, out long orderid, out string message) { orderid = 0; var user = userBLL.GetModel(UserID); if (user == null) { message = "该账号不存在"; return(false); } if (user.SecondPassword != paypassword) { message = "支付密码错误"; return(false); } if (user.IsLock == 1) { message = "账户已冻结,买入失败"; return(false); } lgk.Model.Cashbuy cashbuyInfo = new lgk.Model.Cashbuy(); lgk.Model.Cashsell cashsellInfo = new lgk.Model.Cashsell(); lgk.Model.Cashorder cashorderInfo = new lgk.Model.Cashorder(); if (getParamInt("Gold") == 0) { message = GetLanguage("Feature");//该功能未开放 return(false); } if (user.IsOpend == 0) { message = GetLanguage("AccountNoActiveInfo");//您的帐号未激活 return(false); } if (user.IsLock == 1) { message = GetLanguage("AccountLock") + GetLanguage("AccountLockInfo");//您的帐号已冻结,不能进行操作 return(false); } decimal iBuyNum = Number.ToDecimal();//购买件数 if (iBuyNum <= 0) { message = GetLanguage("NumberThanZero");//数量必须大于零 return(false); } int _orderSellID = OrderSellID.ToInt(); cashsellInfo = cashsellBLL.GetModel(_orderSellID); if (cashsellInfo == null) { message = "挂卖订单不存在"; return(false); } decimal iUnitNum = cashsellInfo.Number; //发布件数 decimal iSaleNum = cashsellInfo.SaleNum; //已卖件数 decimal iSurplus = iUnitNum - iSaleNum; //剩余件数 if (iBuyNum > iSurplus) { message = GetLanguage("BuyAmountMust");//购买金额不能大于售出金额 return(false); } cashsellInfo.SaleNum = iSaleNum + iBuyNum; #region EP币购买表 cashbuyInfo.CashsellID = cashsellInfo.CashsellID; cashbuyInfo.UserID = UserID; cashbuyInfo.Amount = iBuyNum; cashbuyInfo.Price = cashsellInfo.Price; cashbuyInfo.Number = (int)iBuyNum; cashbuyInfo.BuyNum = iBuyNum; cashbuyInfo.BuyDate = DateTime.Now; cashbuyInfo.IsBuy = 0; cashbuyInfo.Phone = phone; #endregion #region EP币订单表 cashorderInfo.CashsellID = cashsellInfo.CashsellID; cashorderInfo.BUserID = cashbuyInfo.UserID; cashorderInfo.SUserID = cashsellInfo.UserID; // string strOrderCode = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString(); //strOrderCode = strOrderCode + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString(); cashorderInfo.OrderCode = Library.Util.CreateNo();// strOrderCode + GetRandom(); cashorderInfo.OrderDate = DateTime.Now; cashorderInfo.BStatus = 0; cashorderInfo.BRemark = ""; cashorderInfo.SStatus = 0; cashorderInfo.SRemark = ""; cashorderInfo.Status = 0; // cashorderInfo.Pic = picpath; #endregion long iCashbuyID = cashbuyBLL.Add(cashbuyInfo); if (iCashbuyID > 0) { cashsellBLL.Update(cashsellInfo); cashorderInfo.CashbuyID = iCashbuyID; cashorderBLL.Add(cashorderInfo); orderid = iCashbuyID; message = GetLanguage("Successful") + "," + GetLanguage("OrderNumber") + ":" + cashorderInfo.OrderCode; return(true); } message = "买入失败"; return(false); }
//卖出 public bool Sell(long UserID, string Number, string phone, long bankid, string paypassword, out string message) { var user = userBLL.GetModel(UserID); if (user == null) { message = "该账号不存在"; return(false); } if (user.SecondPassword != paypassword) { message = "支付密码错误"; return(false); } if (user.IsLock == 1) { message = "账户已冻结,挂卖失败"; return(false); } if (getParamInt("Gold") == 0) { message = GetLanguage("Feature");//该功能未开放 return(false); } var bank = userBankBLL.GetModel(bankid); if (bank == null) { message = "请选择收款账户"; return(false); } if (bank.UserID != UserID) { message = "收款账户不存在"; return(false); } #region 金额验证 if (Number.Trim() == "") { message = GetLanguage("AmountNoEmpty");//卖出金额不能为空 return(false); } int dNumber = 0; if (int.TryParse(Number.Trim(), out dNumber)) { decimal dGold1 = getParamAmount("Gold1"); if (dNumber < dGold1) { message = GetLanguage("Minimum");//最小交易额 return(false); } } else { message = GetLanguage("NumberThanZero");//金额格式输入错误 return(false); } int mul = getParamInt("Gold7"); if (dNumber % mul != 0) { message = string.Format(GetLanguage("CashSellMul"), mul);//出售金额必须为 7 的整数倍 return(false); } decimal dMaxNumber = 0; //每日最大挂卖数量 decimal dBaseNumber = 0; //每日挂卖基数 dBNumber = 0, decimal dANumber = 0; //今日已挂卖数量 dBaseNumber = getParamAmount("Gold6"); // dBNumber = getParamAmount("Gold7"); dMaxNumber = dBaseNumber;// dBaseNumber + dBNumber * userBLL.GetCount("RecommendID = " + LoginUser.UserID + " AND IsOpend = 2");//每日挂卖基数 dANumber = cashsellBLL.GetAlready(UserID) + dNumber; if (dANumber > dMaxNumber) { message = GetLanguage("ConsignmentOver");// 寄售数量已超额 return(false); } //decimal dPrice = getParamAmount("GoldPrice"); decimal dPrice = getParamAmount("Exchange"); #endregion //if (txtThreePassword.Value.Trim() == "") //{ // MessageBox.ShowBox(this.Page, GetLanguage("Pleasepassword"), Library.Enums.ModalTypes.warning);// 请输入二级密码 // return; //} //string strPassword = PageValidate.GetMd5(txtThreePassword.Value.Trim()); //int re = spd.findSecondpws(strPassword, 1, getLoginID()); //if (re == 0) //{ // MessageBox.ShowBox(this.Page, GetLanguage("PasswordError"), Library.Enums.ModalTypes.error);// >密码输入错误! // return; //} // int iUnitNum = Convert.ToInt32(txtUnitNum.Value.Trim());//发布件数1 decimal dFactorage = dNumber * getParamAmount("Gold2") / 100;//手续费 lgk.Model.tb_user userInfo = new lgk.Model.tb_user(); lgk.Model.Cashsell cashsellInfo = new lgk.Model.Cashsell(); decimal dAmount = dNumber * dPrice; userInfo = userBLL.GetModel(UserID); #region 赋值给金币销售表实体 cashsellInfo.Title = Util.CreateNo(); cashsellInfo.UserID = UserID; cashsellInfo.Amount = dAmount; //总金额 cashsellInfo.Number = dNumber; //单件数量 cashsellInfo.Price = dPrice; //商品单价 cashsellInfo.UnitNum = getParamAmount("Gold2"); //手续费率 cashsellInfo.SaleNum = 0; //已卖件数 cashsellInfo.Charge = dFactorage; //所需手续费 cashsellInfo.SellDate = DateTime.Now; //提交时间 cashsellInfo.Remark = ""; // cashsellInfo.PurchaseID = 0; cashsellInfo.IsSell = 1; cashsellInfo.Phone = phone; cashsellInfo.PurchaseID = bankid; //收款账户ID #endregion #region 加入流水账表 lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = cashsellInfo.UserID; journalInfo.Remark = "卖出交易币"; journalInfo.RemarkEn = "Sell Circulating gold"; journalInfo.InAmount = 0; journalInfo.OutAmount = cashsellInfo.Number; // cashsellInfo.Number * iUnitNum + dFactorage; journalInfo.BalanceAmount = userInfo.ShopAccount - dNumber; // userInfo.BonusAccount - dNumber - dFactorage; journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = (int)Library.AccountType.购物分; journalInfo.Journal01 = cashsellInfo.UserID; #endregion #region 保证金 加入流水账表 lgk.Model.tb_journal journalInfoTrans = new lgk.Model.tb_journal() { UserID = cashsellInfo.UserID, Remark = "卖出交易币,扣除保证金", RemarkEn = "Sell gold points, consumption code", InAmount = 0, OutAmount = dFactorage, // cashsellInfo.Number * iUnitNum + dFactorage; BalanceAmount = userInfo.ShopAccount - dFactorage, // userInfo.BonusAccount - dNumber - dFactorage; JournalDate = DateTime.Now, JournalType = (int)Library.AccountType.购物分, Journal01 = cashsellInfo.UserID }; #endregion decimal dBonusAccount = dNumber;// + dFactorage; if (userInfo.ShopAccount < (dBonusAccount + dFactorage)) { message = GetLanguage("GoldInsufficient");// 金币不足,请重新填写数据之后再试!! return(false); } //if (userInfo.ShopAccount < dFactorage) //{ // message = GetLanguage("GoldTransInsufficient");//交易码不足! // return false; //} journalBLL.Add(journalInfoTrans); // UpdateAccount("ShopAccount", UserID, dBonusAccount+ dFactorage, 0); //扣除保证金 if (cashsellBLL.Add(cashsellInfo) > 0 && journalBLL.Add(journalInfo) > 0 && UpdateAccount("ShopAccount", UserID, dBonusAccount + dFactorage, 0) > 0) { message = GetLanguage("Successful");//卖出成功! return(true); } else { message = GetLanguage("OperationFailed");//操作失败! } return(false); }
/// <summary> /// 显示数据 /// </summary> private void ShowData() { lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(iCashsellID); lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(iCashbuyID); if (cashbuyInfo != null) { ltAmount.Text = cashbuyInfo.Amount.ToString("0.00"); } if (cashsellInfo != null) { #region 商品信息 // ltTitle.Text = "";// cashsellInfo.Title; ltNumber.Text = (cashsellInfo.Number).ToString("0"); // ltPayment.Text = cashsellInfo.Number.ToString(); //ltArrival.Text = (cashsellInfo.Number).ToString();// + cashsellInfo.Number * getParamAmount("Gold3") / 100).ToString(); ltPrice.Text = cashsellInfo.Price.ToString(); ltBalanceNumber.Text = (cashsellInfo.Number - cashsellInfo.SaleNum).ToString("0"); ltAmount.Text = cashsellInfo.Amount.ToString(); #endregion #region 卖家信息 var bank = userBankBLL.GetModel(cashsellInfo.PurchaseID); if (bank != null) { int bankType = (int)bank.Bank003; ltReceiveAccount.Text = bank.BankName; ltBankAccount.Text = bank.BankAccount; imgOutQRCode.ImageUrl = bank.Bank001; ltBankAccountUser.Text = bank.BankAccountUser; divBankAccount.Visible = false; divBankAccountUser.Visible = false; divBagAddress.Visible = false; divOutQrCode.Visible = false; divBagAddress.Visible = false; divQRNiceName.Visible = false; if (bankType == 1) //银行卡 { divBankAccount.Visible = true; divBankAccountUser.Visible = true; } else if (bankType == 2)//微信 { divQRNiceName.Visible = true; divOutQrCode.Visible = true; ltQRNiceName.Text = bank.BankAccount; } else if (bankType == 3) //支付宝 { divQRNiceName.Visible = true; divOutQrCode.Visible = true; ltQRNiceName.Text = bank.BankAccount; } else if (bankType == 4) //数字货币钱包 { divBagAddress.Visible = true; // ltBagAddress.Text = bank.BankAccount; BagAddress = bank.BankAccount; } } lgk.Model.tb_user userInfo = userBLL.GetModel(cashsellInfo.UserID); ltUserCode.Text = userInfo.UserCode; //会员编号 ltNiceName.Text = userInfo.NiceName; //会员昵称 ltPhoneNum.Text = userInfo.PhoneNum; //卖家手机号码 #endregion //#region 信用等级 //lgk.Model.Cashcredit cashcreditInfo = cashcreditBLL.GetModel("UserID=" + cashsellInfo.UserID + ""); //if (cashcreditInfo != null) // ltGrade.Text = cashcreditInfo.BValues.ToString(); //#endregion } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(lgk.Model.Cashsell model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Cashsell set "); strSql.Append(" Title = @Title,"); strSql.Append(" UserID = @UserID,"); strSql.Append(" Amount = @Amount,"); strSql.Append(" Price = @Price,"); strSql.Append(" Number = @Number,"); strSql.Append(" UnitNum = @UnitNum,"); strSql.Append(" SaleNum = @SaleNum,"); strSql.Append(" Charge = @Charge,"); strSql.Append(" SellDate = @SellDate,"); strSql.Append(" Remark = @Remark,"); strSql.Append(" IsSell = @IsSell,"); strSql.Append(" IsUndo = @IsUndo,"); strSql.Append(" PurchaseID = @PurchaseID"); strSql.Append(" where CashsellID=@CashsellID "); SqlParameter[] parameters = { new SqlParameter("@CashsellID", SqlDbType.BigInt, 8), new SqlParameter("@Title", SqlDbType.VarChar, 60), new SqlParameter("@UserID", SqlDbType.BigInt, 8), new SqlParameter("@Amount", SqlDbType.Decimal, 9), new SqlParameter("@Price", SqlDbType.Decimal, 9), new SqlParameter("@Number", SqlDbType.Int, 4), new SqlParameter("@UnitNum", SqlDbType.Decimal, 4), new SqlParameter("@SaleNum", SqlDbType.Decimal, 4), new SqlParameter("@Charge", SqlDbType.Decimal, 9), new SqlParameter("@SellDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.VarChar, 500), new SqlParameter("@IsSell", SqlDbType.Int, 4), new SqlParameter("@IsUndo", SqlDbType.Int, 4), new SqlParameter("@PurchaseID", SqlDbType.BigInt, 8) }; parameters[0].Value = model.CashsellID; parameters[1].Value = model.Title; parameters[2].Value = model.UserID; parameters[3].Value = model.Amount; parameters[4].Value = model.Price; parameters[5].Value = model.Number; parameters[6].Value = model.UnitNum; parameters[7].Value = model.SaleNum; parameters[8].Value = model.Charge; parameters[9].Value = model.SellDate; parameters[10].Value = model.Remark; parameters[11].Value = model.IsSell; parameters[12].Value = model.IsUndo; parameters[13].Value = model.PurchaseID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public lgk.Model.Cashsell GetModel(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 CashsellID, Title, UserID, Amount, Price, Number, UnitNum, SaleNum, Charge, SellDate, Remark, IsSell, IsUndo, PurchaseID,Phone"); strSql.Append(" from Cashsell"); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } lgk.Model.Cashsell model = new lgk.Model.Cashsell(); DataSet ds = DbHelperSQL.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["CashsellID"].ToString() != "") { model.CashsellID = long.Parse(ds.Tables[0].Rows[0]["CashsellID"].ToString()); } model.Title = ds.Tables[0].Rows[0]["Title"].ToString(); if (ds.Tables[0].Rows[0]["UserID"].ToString() != "") { model.UserID = long.Parse(ds.Tables[0].Rows[0]["UserID"].ToString()); } if (ds.Tables[0].Rows[0]["Amount"].ToString() != "") { model.Amount = decimal.Parse(ds.Tables[0].Rows[0]["Amount"].ToString()); } if (ds.Tables[0].Rows[0]["Price"].ToString() != "") { model.Price = decimal.Parse(ds.Tables[0].Rows[0]["Price"].ToString()); } if (ds.Tables[0].Rows[0]["Number"].ToString() != "") { model.Number = int.Parse(ds.Tables[0].Rows[0]["Number"].ToString()); } if (ds.Tables[0].Rows[0]["UnitNum"].ToString() != "") { model.UnitNum = decimal.Parse(ds.Tables[0].Rows[0]["UnitNum"].ToString()); } if (ds.Tables[0].Rows[0]["SaleNum"].ToString() != "") { model.SaleNum = decimal.Parse(ds.Tables[0].Rows[0]["SaleNum"].ToString()); } if (ds.Tables[0].Rows[0]["Charge"].ToString() != "") { model.Charge = decimal.Parse(ds.Tables[0].Rows[0]["Charge"].ToString()); } if (ds.Tables[0].Rows[0]["SellDate"].ToString() != "") { model.SellDate = DateTime.Parse(ds.Tables[0].Rows[0]["SellDate"].ToString()); } model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString(); if (ds.Tables[0].Rows[0]["IsSell"].ToString() != "") { model.IsSell = int.Parse(ds.Tables[0].Rows[0]["IsSell"].ToString()); } if (ds.Tables[0].Rows[0]["IsUndo"].ToString() != "") { model.IsUndo = int.Parse(ds.Tables[0].Rows[0]["IsUndo"].ToString()); } if (ds.Tables[0].Rows[0]["PurchaseID"].ToString() != "") { model.PurchaseID = long.Parse(ds.Tables[0].Rows[0]["PurchaseID"].ToString()); } if (ds.Tables[0].Rows[0]["Phone"].ToString() != "") { model.Phone = ds.Tables[0].Rows[0]["Phone"].ToString(); } return(model); } else { return(null); } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { int iOrderID = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Undo") { lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo != null) { cashorderBLL.UndoOrder(iOrderID, "后台撤销订单");//后台撤销订单 lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(cashorderInfo.CashsellID); lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); cashbuyInfo.IsBuy = -1;//撤销 cashbuyBLL.Update(cashbuyInfo); decimal dAccount = Convert.ToDecimal(cashsellInfo.Number); // + cashsellInfo.Charge;//数量+手续费 UpdateAccount("ShopAccount", cashsellInfo.UserID, dAccount + cashsellInfo.Charge, 1); //返还金币 + 保证金 // UpdateAccount("ShopAccount", cashsellInfo.UserID, cashsellInfo.Charge, 1);//返还 //SetAccount(iUserID, dAccount, "EP币发货!", 1); SetAccount(cashsellInfo.UserID, dAccount, "后台撤销订单,返回交易币!", cashsellInfo.UserID, (int)Library.AccountType.购物分, "ShopAccount"); //if (cashorderInfo.SStatus == 0 && cashorderInfo.BStatus == 0) //{ // userBLL.UserLock(cashorderInfo.BUserID, 1); //} //else //{ // userBLL.UserLock(cashorderInfo.SUserID, 1); // userBLL.UserLock(cashorderInfo.BUserID, 1); //} ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('撤销成功!');window.location.href='CashOrderList.aspx';", true); } } if (e.CommandName == "Payfor") { lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo != null) { cashorderBLL.Update(cashorderInfo.SUserID, cashorderInfo.OrderID, DateTime.Now, "", "", 2); //确认已付款 cashorderBLL.Update(cashorderInfo.SUserID, iOrderID, DateTime.Now, "", "", 3); //发货 lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); cashbuyInfo.IsBuy = 2;//完成 cashbuyBLL.Update(cashbuyInfo); lgk.Model.Cashsell CashsellInfo = cashsellBLL.GetModel(cashbuyInfo.CashsellID); int buyNum = cashorderBLL.GetOrderBuyNumber(cashbuyInfo.CashsellID); if (buyNum == CashsellInfo.Number) { CashsellInfo.IsSell = 2;//完成 cashsellBLL.Update(CashsellInfo); } decimal dNumber = CashsellInfo.Number; //decimal dCharge = CashsellInfo.Charge;//总手续费 //decimal dMTaxRate = dNumber * getParamAmount("Gold3") / 100;//买家获得手续费 // decimal dCTaxRate = dNumber * getParamAmount("Gold4") / 100;//公司获得手续费 //decimal dTNumber = dNumber - dCharge + dMTaxRate; decimal dTNumber = dNumber; // + dMTaxRate; // decimal give = dTNumber * getParamAmount("Gold10") / 100; //买入获得系统赠送 // dTNumber += give; //买入获得系统赠送2018-3-15 //买家得到的是投资积分 StockMoney UpdateAccount("ShopAccount", cashorderInfo.BUserID, dTNumber, 1);//发货给购买者 //UpdateSystemAccount("MoneyAccount", dCTaxRate, 1); ////SetAccount(iUserID, dAccount, "EP币发货!", 1); SetAccount(cashorderInfo.BUserID, dTNumber, "金币收货!", cashorderInfo.SUserID, (int)Library.AccountType.购物分, "ShopAccount"); UpdateGLmoney(cashorderInfo.BUserID, dTNumber, 1); //更新能量值 买方 UpdateGLmoney(cashorderInfo.SUserID, dTNumber, 0); //更新能量值 卖方 //扣除交易币到购物币 var userBuy = userBLL.GetModel(cashorderInfo.BUserID); if (userBuy.GLmoney <= 0) { decimal lessthenRate = getParamAmount("Gold11"); //能量值小于等于0时,每次购买交易币扣除 decimal shoppingAmount = dTNumber * lessthenRate / 100; UpdateAccount("ShopAccount", cashorderInfo.BUserID, shoppingAmount, 0); //交易币 UpdateAccount("AllBonusAccount", cashorderInfo.BUserID, shoppingAmount, 1); //购物币 SetOutAccount(cashorderInfo.BUserID, shoppingAmount, "能量值小于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "ShopAccount"); SetAccount(cashorderInfo.BUserID, shoppingAmount, "能量值小于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "AllBonusAccount"); } else { decimal greaterthenRate = getParamAmount("Gold10"); //能量值大于0时,每次购买交易币扣除 decimal shoppingAmount = dTNumber * greaterthenRate / 100; UpdateAccount("ShopAccount", cashorderInfo.BUserID, shoppingAmount, 0); //交易币 UpdateAccount("AllBonusAccount", cashorderInfo.BUserID, shoppingAmount, 1); //购物币 SetOutAccount(cashorderInfo.BUserID, shoppingAmount, "能量值大于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "ShopAccount"); SetAccount(cashorderInfo.BUserID, shoppingAmount, "能量值大于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "AllBonusAccount"); } ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Successful") + "');window.location.href='CashOrderList.aspx';", true); } } if (e.CommandName == "Send") { lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo != null) { cashorderBLL.Update(cashorderInfo.SUserID, iOrderID, DateTime.Now, "", "", 3);//发货 lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); cashbuyInfo.IsBuy = 2;//完成 cashbuyBLL.Update(cashbuyInfo); lgk.Model.Cashsell CashsellInfo = cashsellBLL.GetModel(cashbuyInfo.CashsellID); int buyNum = cashorderBLL.GetOrderBuyNumber(cashbuyInfo.CashsellID); if (buyNum == CashsellInfo.Number) { CashsellInfo.IsSell = 2;//完成 cashsellBLL.Update(CashsellInfo); } decimal dNumber = cashbuyInfo.Number; //decimal dCharge = CashsellInfo.Charge;//总手续费 //decimal dMTaxRate = dNumber * getParamAmount("Gold3") / 100;//买家获得手续费 //decimal dCTaxRate = dNumber * getParamAmount("Gold4") / 100;//公司获得手续费 decimal dTNumber = dNumber;// + dMTaxRate; // decimal give = dTNumber * getParamAmount("Gold10") / 100; //买入获得系统赠送 // dTNumber += give; //买入获得系统赠送2018-3-15 //买家得到的是投资积分 StockMoney UpdateAccount("ShopAccount", cashorderInfo.BUserID, dTNumber, 1);//发货给购买者 // UpdateSystemAccount("MoneyAccount", dCTaxRate, 1); ////SetAccount(iUserID, dAccount, "EP币发货!", 1); SetAccount(cashorderInfo.BUserID, dTNumber, "金币发货!", cashorderInfo.SUserID, (int)Library.AccountType.购物分, "ShopAccount"); //更新能量值 UpdateGLmoney(cashorderInfo.BUserID, dTNumber, 1); //更新能量值 买方 UpdateGLmoney(cashorderInfo.SUserID, dTNumber, 0); //更新能量值 卖方 //扣除交易币到购物币 var userBuy = userBLL.GetModel(cashorderInfo.BUserID); if (userBuy.GLmoney <= 0) { decimal lessthenRate = getParamAmount("Gold11"); //能量值小于等于0时,每次购买交易币扣除 decimal shoppingAmount = dTNumber * lessthenRate / 100; UpdateAccount("ShopAccount", cashorderInfo.BUserID, shoppingAmount, 0); //交易币 UpdateAccount("AllBonusAccount", cashorderInfo.BUserID, shoppingAmount, 1); //购物币 SetOutAccount(cashorderInfo.BUserID, shoppingAmount, "能量值小于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "ShopAccount"); SetAccount(cashorderInfo.BUserID, shoppingAmount, "能量值小于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "AllBonusAccount"); } else { decimal greaterthenRate = getParamAmount("Gold10"); //能量值大于0时,每次购买交易币扣除 decimal shoppingAmount = dTNumber * greaterthenRate / 100; UpdateAccount("ShopAccount", cashorderInfo.BUserID, shoppingAmount, 0); //交易币 UpdateAccount("AllBonusAccount", cashorderInfo.BUserID, shoppingAmount, 1); //购物币 SetOutAccount(cashorderInfo.BUserID, shoppingAmount, "能量值大于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "ShopAccount"); SetAccount(cashorderInfo.BUserID, shoppingAmount, "能量值大于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "AllBonusAccount"); } ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('发货成功!');window.location.href='CashOrderList.aspx';", true); } } if (e.CommandName == "AdjustNoPay") { lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo != null) { cashorderBLL.UndoOrder(iOrderID, "后台撤销订单");//后台撤销订单 lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); cashbuyInfo.IsBuy = -1;//撤销 cashbuyBLL.Update(cashbuyInfo); lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(cashorderInfo.CashsellID); //decimal dAccount = Convert.ToDecimal(cashbuyInfo.Amount);// + cashsellInfo.Charge;//数量+手续费 cashsellInfo.SaleNum = cashsellInfo.SaleNum - cashbuyInfo.BuyNum; //减掉购买的金额,卖方继续挂卖 cashsellBLL.Update(cashsellInfo); //UpdateAccount("BonusAccount", cashsellInfo.UserID, dAccount, 1);//返还金币 //UpdateAccount("ShopAccount", cashsellInfo.UserID, cashsellInfo.Charge, 1);//返还金币 //SetAccount(iUserID, dAccount, "EP币发货!", 1); // SetAccount(cashsellInfo.UserID, dAccount, "后台撤销订单,返回现金积分!", cashsellInfo.UserID, (int)Library.AccountType.现金积分); // SetAccount(cashsellInfo.UserID, dAccount, "后台撤销订单,返回交易码!", cashsellInfo.UserID, (int)Library.AccountType.交易码); //冻结买家 var user = userBLL.GetModel(cashorderInfo.BUserID); user.IsLock = 1; userBLL.Update(user); lgk.Model.SysLog log = new lgk.Model.SysLog();//日志 lgk.BLL.SysLog syslogBLL = new lgk.BLL.SysLog(); log.LogMsg = "后台裁决买家【" + cashorderInfo.OrderCode + "】未付款,冻结帐号"; log.LogType = 23; // log.LogLeve = 0; // log.LogDate = DateTime.Now; log.LogCode = "后台裁决买家未付款冻结帐号"; // log.IsDeleted = 0; log.Log1 = cashorderInfo.BUserID.ToString(); //用户UserID log.Log2 = BrowserHelper.UserHostIP(this.Page); log.Log3 = BrowserHelper.UserHostName(); log.Log4 = ""; syslogBLL.Add(log); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('操作成功!');window.location.href='CashOrderList.aspx';", true); } } if (e.CommandName == "AdjustReceived") { lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo != null) { cashorderBLL.Update(cashorderInfo.SUserID, cashorderInfo.OrderID, DateTime.Now, "", "", 2); //确认已付款 cashorderBLL.Update(cashorderInfo.SUserID, iOrderID, DateTime.Now, "", "", 3); //发货 lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); cashbuyInfo.IsBuy = 2;//完成 cashbuyBLL.Update(cashbuyInfo); lgk.Model.Cashsell CashsellInfo = cashsellBLL.GetModel(cashbuyInfo.CashsellID); int buyNum = cashorderBLL.GetOrderBuyNumber(cashbuyInfo.CashsellID); if (buyNum == CashsellInfo.Number) { CashsellInfo.IsSell = 2;//完成 cashsellBLL.Update(CashsellInfo); } decimal dNumber = cashbuyInfo.Amount; decimal dTNumber = dNumber; // + dMTaxRate; // decimal give = dTNumber * getParamAmount("Gold10") / 100; //买入获得系统赠送 // dTNumber += give; //买入获得系统赠送 //买家得到的是投资积分 StockMoney UpdateAccount("ShopAccount", cashorderInfo.BUserID, dTNumber, 1);//发货给购买者 SetAccount(cashorderInfo.BUserID, dTNumber, "金币收货!", cashorderInfo.SUserID, (int)Library.AccountType.购物分, "ShopAccount"); //更新能量值 UpdateGLmoney(cashorderInfo.BUserID, dTNumber, 1); //更新能量值 买方 UpdateGLmoney(cashorderInfo.SUserID, dTNumber, 0); //更新能量值 卖方 //扣除交易币到购物币 var userBuy = userBLL.GetModel(cashorderInfo.BUserID); if (userBuy.GLmoney <= 0) { decimal lessthenRate = getParamAmount("Gold11"); //能量值小于等于0时,每次购买交易币扣除 decimal shoppingAmount = dTNumber * lessthenRate / 100; UpdateAccount("ShopAccount", cashorderInfo.BUserID, shoppingAmount, 0); //交易币 UpdateAccount("AllBonusAccount", cashorderInfo.BUserID, shoppingAmount, 1); //购物币 SetOutAccount(cashorderInfo.BUserID, shoppingAmount, "能量值小于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "ShopAccount"); SetAccount(cashorderInfo.BUserID, shoppingAmount, "能量值小于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "AllBonusAccount"); } else { decimal greaterthenRate = getParamAmount("Gold10"); //能量值大于0时,每次购买交易币扣除 decimal shoppingAmount = dTNumber * greaterthenRate / 100; UpdateAccount("ShopAccount", cashorderInfo.BUserID, shoppingAmount, 0); //交易币 UpdateAccount("AllBonusAccount", cashorderInfo.BUserID, shoppingAmount, 1); //购物币 SetOutAccount(cashorderInfo.BUserID, shoppingAmount, "能量值大于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "ShopAccount"); SetAccount(cashorderInfo.BUserID, shoppingAmount, "能量值大于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "AllBonusAccount"); } //冻结卖家 var user = userBLL.GetModel(cashorderInfo.SUserID); user.IsLock = 1; userBLL.Update(user); lgk.Model.SysLog log = new lgk.Model.SysLog();//日志 lgk.BLL.SysLog syslogBLL = new lgk.BLL.SysLog(); log.LogMsg = "后台裁决卖家订单【" + cashorderInfo.OrderCode + "】未付款,冻结帐号"; log.LogType = 24; // log.LogLeve = 0; // log.LogDate = DateTime.Now; log.LogCode = "后台裁决卖家未付款冻结帐号"; // log.IsDeleted = 0; log.Log1 = cashorderInfo.SUserID.ToString(); //用户UserID log.Log2 = BrowserHelper.UserHostIP(this.Page); log.Log3 = BrowserHelper.UserHostName(); log.Log4 = ""; syslogBLL.Add(log); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Successful") + "');window.location.href='CashOrderList.aspx';", true); } } }
protected void btnCheck_Click(object sender, EventArgs e) { //if (!SysTradeIsOpen()) //{ // MessageBox.ShowBox(this.Page,string.Format(GetLanguage("TradingReminder"),getParamVarchar("GoldTradingTime")), Library.Enums.ModalTypes.warning);//请选择投资积分 // return; //} lgk.BLL.SMS smsBLL = new lgk.BLL.SMS(); lgk.Model.SMS smsModel = new lgk.Model.SMS(); lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo.BUserID == iUserID && cashorderInfo.SStatus == 0 && cashorderInfo.BStatus == 0 && iActionID == 1) { string pic = Request.Form["hiddenupimage"] == null || Request.Form["hiddenupimage"].ToString() == "" ? "" : Request.Form["hiddenupimage"].ToString(); if (string.IsNullOrEmpty(pic)) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请上传图片凭证。');window.location.href='CashOrderList.aspx';", true); return; } cashorderBLL.Update(iUserID, cashorderInfo.OrderID, DateTime.Now, pic, "", 1);//付款 lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); cashbuyInfo.IsBuy = 1;//已付款,未发货 cashbuyBLL.Update(cashbuyInfo); #region 短信通知 //给卖家发短信通知已付款 // SCode --1:出局短信 2:买家点击已付款 3:卖家点击已收款 4:卖家点击未收款 var user = userBLL.GetModel(cashorderInfo.SUserID); smsModel.ToUserID = cashorderInfo.SUserID; smsModel.ToUserCode = user.UserCode; smsModel.ToPhone = user.PhoneNum; smsModel.PublishTime = DateTime.Now; smsModel.ValidTime = DateTime.Now.AddMinutes(5); smsModel.SendNum = 0; smsModel.SMSContent = cashorderInfo.OrderCode; smsModel.IsValid = 1; smsModel.IsDeleted = 0; smsModel.SCode = "2"; smsModel.TypeID = 0; smsBLL.Add(smsModel); #endregion ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Successful") + "');window.location.href='CashOrderList.aspx';", true); } else if (cashorderInfo.SUserID == iUserID && cashorderInfo.BStatus == 1 && cashorderInfo.SStatus == 0 && iActionID == 2) { cashorderBLL.Update(iUserID, cashorderInfo.OrderID, DateTime.Now, "", "", 2); //确认已付款 cashorderBLL.Update(cashorderInfo.SUserID, iOrderID, DateTime.Now, "", "", 3); //发货 lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); cashbuyInfo.IsBuy = 2;//完成 cashbuyBLL.Update(cashbuyInfo); lgk.Model.Cashsell CashsellInfo = cashsellBLL.GetModel(cashbuyInfo.CashsellID); int buyNum = cashorderBLL.GetOrderBuyNumber(cashbuyInfo.CashsellID); if (buyNum == CashsellInfo.Number) { CashsellInfo.IsSell = 2;//完成 cashsellBLL.Update(CashsellInfo); } decimal dNumber = cashbuyInfo.Amount; //decimal dCharge = CashsellInfo.Charge;//总手续费 //decimal dMTaxRate = dNumber * getParamAmount("Gold3") / 100;//买家获得手续费 //decimal dCTaxRate = dNumber * getParamAmount("Gold4") / 100;//公司获得手续费 //decimal dTNumber = dNumber - dCharge + dMTaxRate; decimal dTNumber = dNumber;// + dMTaxRate; // decimal give = dTNumber * getParamAmount("Gold10") / 100; //买入获得系统赠送 // dTNumber += give; //买入获得系统赠送2018-3-15 //买家得到的是投资积分 StockMoney UpdateAccount("ShopAccount", cashorderInfo.BUserID, dTNumber, 1);//发货给购买者 //UpdateSystemAccount("MoneyAccount", dCTaxRate, 1); ////SetAccount(iUserID, dAccount, "EP币发货!", 1); SetAccount(cashorderInfo.BUserID, dTNumber, "金币发货!", cashorderInfo.SUserID, (int)Library.AccountType.购物分, "ShopAccount"); var user = userBLL.GetModel(cashorderInfo.BUserID); if (user.GLmoney <= 0) { decimal lessthenRate = getParamAmount("Gold11"); //能量值小于等于0时,每次购买交易币扣除 decimal shoppingAmount = dTNumber * lessthenRate / 100; UpdateAccount("ShopAccount", cashorderInfo.BUserID, shoppingAmount, 0); //交易币 UpdateAccount("AllBonusAccount", cashorderInfo.BUserID, shoppingAmount, 1); //购物币 SetOutAccount(cashorderInfo.BUserID, shoppingAmount, "能量值小于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "ShopAccount"); SetAccount(cashorderInfo.BUserID, shoppingAmount, "能量值小于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "AllBonusAccount"); } else { decimal greaterthenRate = getParamAmount("Gold10"); //能量值大于0时,每次购买交易币扣除 decimal shoppingAmount = dTNumber * greaterthenRate / 100; UpdateAccount("ShopAccount", cashorderInfo.BUserID, shoppingAmount, 0); //交易币 UpdateAccount("AllBonusAccount", cashorderInfo.BUserID, shoppingAmount, 1); //购物币 SetOutAccount(cashorderInfo.BUserID, shoppingAmount, "能量值大于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "ShopAccount"); SetAccount(cashorderInfo.BUserID, shoppingAmount, "能量值大于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "AllBonusAccount"); } UpdateGLmoney(cashorderInfo.BUserID, dTNumber, 1); //更新能量值 买方 UpdateGLmoney(cashorderInfo.SUserID, dTNumber, 0); //更新能量值 卖方 #region 短信通知 //给卖家发短信通知已付款 // SCode --1:出局短信 2:买家点击已付款 3:卖家点击已收款 4:卖家点击未收款 // var user = userBLL.GetModel(cashorderInfo.BUserID); smsModel.ToUserID = cashorderInfo.BUserID; smsModel.ToUserCode = user.UserCode; smsModel.ToPhone = user.PhoneNum; smsModel.PublishTime = DateTime.Now; smsModel.ValidTime = DateTime.Now.AddMinutes(5); smsModel.SendNum = 0; smsModel.SMSContent = cashorderInfo.OrderCode; smsModel.IsValid = 1; smsModel.IsDeleted = 0; smsModel.SCode = "3"; smsModel.TypeID = 0; smsBLL.Add(smsModel); #endregion ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Successful") + "');window.location.href='CashOrderList.aspx';", true); } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("OperationFailed") + "');window.location.href='CashOrderList.aspx';", true); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (getParamInt("Gold1") == 0) { MessageBox.Show(this, GetLanguage("Feature"));//该功能未开放 return; } if (LoginUser.IsOpend == 0) { MessageBox.ShowBox(this.Page, GetLanguage("AccountNoActiveInfo"), Library.Enums.ModalTypes.error);//您的帐号未激活 return; } if (LoginUser.IsLock == 1) { MessageBox.ShowBox(this.Page, GetLanguage("AccountLock"), GetLanguage("AccountLockInfo"), Library.Enums.ModalTypes.error);//您的帐号已冻结,不能进行操作 return; } int receivaAccount = dorpReceiveAccount.SelectedValue.ToInt(); if (receivaAccount == 0) { MessageBox.ShowBox(this.Page, GetLanguage("SelectReceiveAccount"), Library.Enums.ModalTypes.error);//请选择收款账户 return; } #region 金额验证 if (txtNumber.Text.Trim() == "") { MessageBox.ShowBox(this.Page, GetLanguage("AmountNoEmpty"), Library.Enums.ModalTypes.warning);//卖出金额不能为空 return; } decimal dNumber = 0; if (decimal.TryParse(txtNumber.Text.Trim(), out dNumber)) { decimal dGold1 = getParamAmount("Gold1"); if (dNumber < dGold1) { MessageBox.ShowBox(this.Page, GetLanguage("Minimum"), Library.Enums.ModalTypes.warning);//最小交易额 return; } } else { MessageBox.ShowBox(this.Page, GetLanguage("NumberThanZero"), Library.Enums.ModalTypes.error);//金额格式输入错误 return; } int mul = getParamInt("Gold7"); if (dNumber % mul != 0) { MessageBox.ShowBox(this.Page, string.Format(GetLanguage("CashSellMul"), mul), Library.Enums.ModalTypes.warning);//出售金额必须为 7 的整数倍 return; } decimal dMaxNumber = 0; //每日最大挂卖数量 decimal dBNumber = 0, dBaseNumber = 0; //每日挂卖基数 decimal dANumber = 0; //今日已挂卖数量 dBaseNumber = getParamAmount("Gold6"); // dBNumber = getParamAmount("Gold7"); dMaxNumber = dBaseNumber;// dBaseNumber + dBNumber * userBLL.GetCount("RecommendID = " + LoginUser.UserID + " AND IsOpend = 2");//每日挂卖基数 dANumber = cashsellBLL.GetAlready(LoginUser.UserID) + dNumber; if (dANumber > dMaxNumber) { MessageBox.ShowBox(this.Page, GetLanguage("ConsignmentOver"), Library.Enums.ModalTypes.warning);// 寄售数量已超额 return; } //if (txtPrice.Text.Trim() == "") //{ // MessageBox.MyShow(this, GetLanguage("PriceEmpty"));//价格不能为空 // return; //} decimal dPrice = 1; //if (decimal.TryParse(txtPrice.Text.Trim(), out dPrice)) //{ // decimal dGoldMin = getParamAmount("GoldMin");//最低价格 // decimal dGoldMax = getParamAmount("GoldMax");//最高价格 // if (dPrice < dGoldMin) // { // MessageBox.MyShow(this, GetLanguage("PriceBetween")); // return; // } // else if (dPrice > dGoldMax) // { // MessageBox.MyShow(this, GetLanguage("PriceBetween")); // return; // } //} //else //{ // MessageBox.MyShow(this, GetLanguage("PriceFormat"));//价格格式错误 // return; //} #endregion if (txtThreePassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, GetLanguage("Pleasepassword"), Library.Enums.ModalTypes.warning);// 请输入二级密码 return; } string strPassword = PageValidate.GetMd5(txtThreePassword.Value.Trim()); int re = spd.findSecondpws(strPassword, 1, getLoginID()); if (re == 0) { MessageBox.ShowBox(this.Page, GetLanguage("PasswordError"), Library.Enums.ModalTypes.error);// >密码输入错误! return; } // int iUnitNum = Convert.ToInt32(txtUnitNum.Value.Trim());//发布件数1 decimal dFactorage = dNumber * getParamAmount("Gold2") / 100;//保证金 lgk.Model.tb_user userInfo = new lgk.Model.tb_user(); lgk.Model.Cashsell cashsellInfo = new lgk.Model.Cashsell(); decimal dAmount = dNumber * dPrice; userInfo = userBLL.GetModel(getLoginID()); #region 赋值给金币销售表实体 cashsellInfo.Title = Util.CreateNo(); cashsellInfo.UserID = getLoginID(); cashsellInfo.Amount = dAmount; //商品价格 cashsellInfo.Number = Convert.ToInt32(dNumber); //单件数量 cashsellInfo.Price = dPrice; //商品单价 cashsellInfo.UnitNum = getParamAmount("Gold2"); //手续费率 cashsellInfo.SaleNum = 0; //已卖件数 cashsellInfo.Charge = dFactorage; //每件所需手续费 cashsellInfo.SellDate = DateTime.Now; //提交时间 cashsellInfo.Remark = ""; cashsellInfo.PurchaseID = receivaAccount; //收款账户ID cashsellInfo.IsSell = 1; #endregion #region 加入流水账表 lgk.Model.tb_journal journalInfo = new lgk.Model.tb_journal(); journalInfo.UserID = cashsellInfo.UserID; journalInfo.Remark = "卖出交易币"; journalInfo.RemarkEn = "Sell Circulating gold"; journalInfo.InAmount = 0; journalInfo.OutAmount = cashsellInfo.Number; // cashsellInfo.Number * iUnitNum + dFactorage; journalInfo.BalanceAmount = userInfo.ShopAccount - dNumber; // userInfo.BonusAccount - dNumber - dFactorage; journalInfo.JournalDate = DateTime.Now; journalInfo.JournalType = (int)Library.AccountType.交易钱包; journalInfo.Journal01 = cashsellInfo.UserID; #endregion #region 保证金 加入流水账表 lgk.Model.tb_journal journalInfoTrans = new lgk.Model.tb_journal() { UserID = cashsellInfo.UserID, Remark = "卖出交易币,扣除保证金", RemarkEn = "Sell gold points, consumption code", InAmount = 0, OutAmount = dFactorage, // cashsellInfo.Number * iUnitNum + dFactorage; BalanceAmount = userInfo.ShopAccount - dNumber - dFactorage, // userInfo.BonusAccount - dNumber - dFactorage; JournalDate = DateTime.Now, JournalType = (int)Library.AccountType.交易钱包, Journal01 = cashsellInfo.UserID }; #endregion decimal dBonusAccount = dNumber;// + dFactorage; if (userInfo.ShopAccount < dBonusAccount + dFactorage) { MessageBox.ShowBox(this.Page, GetLanguage("GoldInsufficient"), Library.Enums.ModalTypes.warning);// 金币不足,请重新填写数据之后再试!! return; } //if (userInfo.ShopAccount < dFactorage) //{ // MessageBox.ShowBox(this.Page, GetLanguage("GoldTransInsufficient"), Library.Enums.ModalTypes.warning);//交易码不足! // return; //} // UpdateAccount("ShopAccount", getLoginID(), dFactorage, 0); if (cashsellBLL.Add(cashsellInfo) > 0 && journalBLL.Add(journalInfoTrans) > 0 && journalBLL.Add(journalInfo) > 0 && UpdateAccount("ShopAccount", getLoginID(), dBonusAccount + dFactorage, 0) > 0) { SetCashcredit(); MessageBox.ShowBox(this.Page, GetLanguage("Successful"), Library.Enums.ModalTypes.success, "CashsellList.aspx");//注册成功! } else { MessageBox.ShowBox(this.Page, GetLanguage("OperationFailed"), Library.Enums.ModalTypes.error);//操作失败! } }
protected void btnSubmit_Click(object sender, EventArgs e) { lgk.Model.Cashbuy cashbuyInfo = new lgk.Model.Cashbuy(); lgk.Model.Cashsell cashsellInfo = new lgk.Model.Cashsell(); lgk.Model.Cashorder cashorderInfo = new lgk.Model.Cashorder(); if (getParamInt("Gold1") == 0) { MessageBox.Show(this, GetLanguage("Feature"));//该功能未开放 return; } //if (!SysTradeIsOpen()) //{ // MessageBox.ShowBox(this.Page, GetLanguage("TradingReminderTitle"), string.Format(GetLanguage("TradingReminder"), getParamVarchar("GoldTradingTime")), Library.Enums.ModalTypes.warning);//请选择投资积分 // return; //} if (LoginUser.IsOpend == 0) { MessageBox.ShowBox(this.Page, GetLanguage("AccountNoActiveInfo"), Library.Enums.ModalTypes.error);//您的帐号未激活 return; } if (LoginUser.IsLock == 1) { MessageBox.ShowBox(this.Page, GetLanguage("AccountLock"), GetLanguage("AccountLockInfo"), Library.Enums.ModalTypes.error);//您的帐号已冻结,不能进行操作 return; } decimal iBuyNum = 0; decimal.TryParse(txtUnitNum.Value.Trim(), out iBuyNum);//购买件数 if (iBuyNum <= 0) { MessageBox.ShowBox(this.Page, GetLanguage("NumberThanZero"), Library.Enums.ModalTypes.error);//数量必须大于零 return; } cashsellInfo = cashsellBLL.GetModel(iCashsellID); decimal iUnitNum = cashsellInfo.Number; //发布件数 decimal iSaleNum = cashsellInfo.SaleNum; //已卖件数 decimal iSurplus = iUnitNum - iSaleNum; //剩余件数 if (iBuyNum > iSurplus) { MessageBox.ShowBox(this.Page, GetLanguage("BuyAmountMust"), Library.Enums.ModalTypes.error);//数量必须大于零 return; } cashsellInfo.SaleNum = iSaleNum + iBuyNum; #region EP币购买表 cashbuyInfo.CashsellID = cashsellInfo.CashsellID; cashbuyInfo.UserID = getLoginID(); cashbuyInfo.Amount = iBuyNum; cashbuyInfo.Price = cashsellInfo.Price; cashbuyInfo.Number = cashsellInfo.Number; cashbuyInfo.BuyNum = iBuyNum; cashbuyInfo.BuyDate = DateTime.Now; cashbuyInfo.IsBuy = 0; #endregion #region EP币订单表 cashorderInfo.CashsellID = cashsellInfo.CashsellID; cashorderInfo.BUserID = cashbuyInfo.UserID; cashorderInfo.SUserID = cashsellInfo.UserID; // string strOrderCode = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString(); //strOrderCode = strOrderCode + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString(); cashorderInfo.OrderCode = Library.Util.CreateNo();// strOrderCode + GetRandom(); cashorderInfo.OrderDate = DateTime.Now; cashorderInfo.BStatus = 0; cashorderInfo.BRemark = ""; cashorderInfo.SStatus = 0; cashorderInfo.SRemark = ""; cashorderInfo.Status = 0; #endregion long iCashbuyID = cashbuyBLL.Add(cashbuyInfo); if (iCashbuyID > 0) { cashsellBLL.Update(cashsellInfo); cashorderInfo.CashbuyID = iCashbuyID; cashorderBLL.Add(cashorderInfo); SetCashcredit(); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Successful") + "," + GetLanguage("OrderNumber") + ":" + cashorderInfo.OrderCode + "');window.location.href='CashOrderList.aspx';", true); } }
/// <summary> /// 得到一个对象实体 /// </summary> public lgk.Model.Cashsell DataRowToModel(DataRow row) { lgk.Model.Cashsell model = new lgk.Model.Cashsell(); if (row != null) { if (row["CashsellID"] != null && row["CashsellID"].ToString() != "") { model.CashsellID = long.Parse(row["CashsellID"].ToString()); } if (row["UserID"] != null && row["UserID"].ToString() != "") { model.UserID = long.Parse(row["UserID"].ToString()); } if (row["Amount"] != null && row["Amount"].ToString() != "") { model.Amount = decimal.Parse(row["Amount"].ToString()); } if (row["Price"] != null && row["Price"].ToString() != "") { model.Price = decimal.Parse(row["Price"].ToString()); } if (row["Number"] != null && row["Number"].ToString() != "") { model.Number = int.Parse(row["Number"].ToString()); } if (row["UnitNum"] != null && row["UnitNum"].ToString() != "") { model.UnitNum = int.Parse(row["UnitNum"].ToString()); } if (row["SaleNum"] != null && row["SaleNum"].ToString() != "") { model.SaleNum = int.Parse(row["SaleNum"].ToString()); } if (row["Charge"] != null && row["Charge"].ToString() != "") { model.Charge = decimal.Parse(row["Charge"].ToString()); } if (row["SellDate"] != null && row["SellDate"].ToString() != "") { model.SellDate = DateTime.Parse(row["SellDate"].ToString()); } if (row["Remark"] != null) { model.Remark = row["Remark"].ToString(); } if (row["IsSell"] != null && row["IsSell"].ToString() != "") { model.IsSell = int.Parse(row["IsSell"].ToString()); } if (row["IsUndo"] != null && row["IsUndo"].ToString() != "") { model.IsUndo = int.Parse(row["IsUndo"].ToString()); } if (row["PurchaseID"] != null && row["PurchaseID"].ToString() != "") { model.PurchaseID = long.Parse(row["PurchaseID"].ToString()); } if (row["Phone"] != null) { model.Phone = row["Phone"].ToString(); } if (row["OrderCode"] != null) { model.OrderCode = row["OrderCode"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public lgk.Model.Cashsell GetModel(long CashsellID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from Cashsell"); strSql.Append(" where CashsellID=@CashsellID"); SqlParameter[] parameters = { new SqlParameter("@CashsellID", SqlDbType.BigInt, 8) }; parameters[0].Value = CashsellID; lgk.Model.Cashsell model = new lgk.Model.Cashsell(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["CashsellID"].ToString() != "") { model.CashsellID = long.Parse(ds.Tables[0].Rows[0]["CashsellID"].ToString()); } model.Title = ds.Tables[0].Rows[0]["Title"].ToString(); if (ds.Tables[0].Rows[0]["UserID"].ToString() != "") { model.UserID = long.Parse(ds.Tables[0].Rows[0]["UserID"].ToString()); } if (ds.Tables[0].Rows[0]["Amount"].ToString() != "") { model.Amount = decimal.Parse(ds.Tables[0].Rows[0]["Amount"].ToString()); } if (ds.Tables[0].Rows[0]["Price"].ToString() != "") { model.Price = decimal.Parse(ds.Tables[0].Rows[0]["Price"].ToString()); } if (ds.Tables[0].Rows[0]["Number"].ToString() != "") { model.Number = int.Parse(ds.Tables[0].Rows[0]["Number"].ToString()); } if (ds.Tables[0].Rows[0]["UnitNum"].ToString() != "") { model.UnitNum = decimal.Parse(ds.Tables[0].Rows[0]["UnitNum"].ToString()); } if (ds.Tables[0].Rows[0]["SaleNum"].ToString() != "") { model.SaleNum = decimal.Parse(ds.Tables[0].Rows[0]["SaleNum"].ToString()); } if (ds.Tables[0].Rows[0]["Charge"].ToString() != "") { model.Charge = decimal.Parse(ds.Tables[0].Rows[0]["Charge"].ToString()); } if (ds.Tables[0].Rows[0]["SellDate"].ToString() != "") { model.SellDate = DateTime.Parse(ds.Tables[0].Rows[0]["SellDate"].ToString()); } model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString(); if (ds.Tables[0].Rows[0]["IsSell"].ToString() != "") { model.IsSell = int.Parse(ds.Tables[0].Rows[0]["IsSell"].ToString()); } if (ds.Tables[0].Rows[0]["IsUndo"].ToString() != "") { model.IsUndo = int.Parse(ds.Tables[0].Rows[0]["IsUndo"].ToString()); } if (ds.Tables[0].Rows[0]["PurchaseID"].ToString() != "") { model.PurchaseID = long.Parse(ds.Tables[0].Rows[0]["PurchaseID"].ToString()); } if (ds.Tables[0].Rows[0]["Phone"].ToString() != "") { model.Phone = ds.Tables[0].Rows[0]["Phone"].ToString(); } return(model); } else { return(null); } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { int iOrderID = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Undo") { lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo != null) { lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(cashorderInfo.CashsellID); decimal dAccount = Convert.ToDecimal(cashsellInfo.Number); // + cashsellInfo.Charge;//数量+手续费 UpdateAccount("BonusAccount", cashsellInfo.UserID, dAccount + cashsellInfo.Charge, 1); //返还金币 // UpdateAccount("ShopAccount", cashsellInfo.UserID, cashsellInfo.Charge, 1);//返还金币 //SetAccount(iUserID, dAccount, "EP币发货!", 1); //SetAccount(cashsellInfo.UserID, dAccount + cashsellInfo.Charge, "后台撤销订单,返回现金积分!", cashsellInfo.UserID, (int)Library.AccountType.云图); //SetAccount(cashsellInfo.UserID, dAccount, "后台撤销订单,返回云图!", cashsellInfo.UserID, (int)Library.AccountType.云图); //if (cashorderInfo.SStatus == 0 && cashorderInfo.BStatus == 0) //{ // userBLL.UserLock(cashorderInfo.BUserID, 1); //} //else //{ // userBLL.UserLock(cashorderInfo.SUserID, 1); // userBLL.UserLock(cashorderInfo.BUserID, 1); //} ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('撤销成功!');window.location.href='CashOrderList.aspx';", true); } } if (e.CommandName == "Payfor") { lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo != null) { lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); //lgk.Model.Cashsell CashsellInfo = cashsellBLL.GetModel(cashbuyInfo.CashsellID); //decimal dNumber = CashsellInfo.Number; //decimal dCharge = CashsellInfo.Charge;//总手续费 //decimal dMTaxRate = dNumber * getParamAmount("Gold3") / 100;//买家获得手续费 // decimal dCTaxRate = dNumber * getParamAmount("Gold4") / 100;//公司获得手续费 //decimal dTNumber = dNumber - dCharge + dMTaxRate; //decimal dTNumber = dNumber; // + dMTaxRate; //买家得到的是投资积分 StockMoney //UpdateAccount("BonusAccount", cashorderInfo.BUserID, dTNumber, 1);//发货给购买者 //UpdateSystemAccount("MoneyAccount", dCTaxRate, 1); ////SetAccount(iUserID, dAccount, "EP币发货!", 1); //SetAccount(cashorderInfo.BUserID, dTNumber, "金币收货!", cashorderInfo.SUserID, (int)Library.AccountType.云图); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Successful") + "');window.location.href='CashOrderList.aspx';", true); } } if (e.CommandName == "Send") { lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo != null) { lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); //decimal dAccount = Convert.ToDecimal(cashbuyInfo.Number * cashbuyInfo.BuyNum);//每件数量*件数 //decimal dNumber = CashsellInfo.Number; //decimal dCharge = CashsellInfo.Charge;//总手续费 //decimal dMTaxRate = dNumber * getParamAmount("Gold3") / 100;//买家获得手续费 //decimal dCTaxRate = dNumber * getParamAmount("Gold4") / 100;//公司获得手续费 //decimal dTNumber = dNumber;// + dMTaxRate; //买家得到的是投资积分 StockMoney //UpdateAccount("BonusAccount", cashorderInfo.BUserID, dTNumber, 1);//发货给购买者 // UpdateSystemAccount("MoneyAccount", dCTaxRate, 1); ////SetAccount(iUserID, dAccount, "EP币发货!", 1); //SetAccount(cashorderInfo.BUserID, dTNumber, "金币发货!", cashorderInfo.SUserID, (int)Library.AccountType.云图); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('发货成功!');window.location.href='CashOrderList.aspx';", true); } } if (e.CommandName == "AdjustNoPay") { lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo != null) { lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(cashorderInfo.CashsellID); //decimal dAccount = Convert.ToDecimal(cashbuyInfo.Amount);// + cashsellInfo.Charge;//数量+手续费 cashsellInfo.SaleNum = cashsellInfo.SaleNum - cashbuyInfo.BuyNum; //减掉购买的金额,卖方继续挂卖 cashsellBLL.Update(cashsellInfo); //UpdateAccount("BonusAccount", cashsellInfo.UserID, dAccount, 1);//返还金币 //UpdateAccount("ShopAccount", cashsellInfo.UserID, cashsellInfo.Charge, 1);//返还金币 //SetAccount(iUserID, dAccount, "EP币发货!", 1); // SetAccount(cashsellInfo.UserID, dAccount, "后台撤销订单,返回现金积分!", cashsellInfo.UserID, (int)Library.AccountType.现金积分); // SetAccount(cashsellInfo.UserID, dAccount, "后台撤销订单,返回云图!", cashsellInfo.UserID, (int)Library.AccountType.云图); //冻结买家 var user = userBLL.GetModel(cashorderInfo.BUserID); user.IsLock = 1; userBLL.Update(user); lgk.Model.SysLog log = new lgk.Model.SysLog();//日志 lgk.BLL.SysLog syslogBLL = new lgk.BLL.SysLog(); log.LogMsg = "后台裁决买家【" + cashorderInfo.OrderCode + "】未付款,冻结帐号"; log.LogType = 23; // log.LogLeve = 0; // log.LogDate = DateTime.Now; log.LogCode = "后台裁决买家未付款冻结帐号"; // log.IsDeleted = 0; log.Log1 = cashorderInfo.BUserID.ToString(); //用户UserID log.Log2 = BrowserHelper.UserHostIP(this.Page); log.Log3 = BrowserHelper.UserHostName(); log.Log4 = ""; syslogBLL.Add(log); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('操作成功!');window.location.href='CashOrderList.aspx';", true); } } if (e.CommandName == "AdjustReceived") { lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID); if (cashorderInfo != null) { lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID); //lgk.Model.Cashsell CashsellInfo = cashsellBLL.GetModel(cashbuyInfo.CashsellID); decimal dNumber = cashbuyInfo.Amount; decimal dTNumber = dNumber; // + dMTaxRate; //买家得到的是投资积分 StockMoney //UpdateAccount("BonusAccount", cashorderInfo.BUserID, dTNumber, 1);//发货给购买者 //SetAccount(cashorderInfo.BUserID, dTNumber, "金币收货!", cashorderInfo.SUserID, (int)Library.AccountType.云图); //冻结卖家 var user = userBLL.GetModel(cashorderInfo.SUserID); user.IsLock = 1; userBLL.Update(user); lgk.Model.SysLog log = new lgk.Model.SysLog();//日志 lgk.BLL.SysLog syslogBLL = new lgk.BLL.SysLog(); log.LogMsg = "后台裁决卖家订单【" + cashorderInfo.OrderCode + "】未付款,冻结帐号"; log.LogType = 24; // log.LogLeve = 0; // log.LogDate = DateTime.Now; log.LogCode = "后台裁决卖家未付款冻结帐号"; // log.IsDeleted = 0; log.Log1 = cashorderInfo.SUserID.ToString(); //用户UserID log.Log2 = BrowserHelper.UserHostIP(this.Page); log.Log3 = BrowserHelper.UserHostName(); log.Log4 = ""; syslogBLL.Add(log); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Successful") + "');window.location.href='CashOrderList.aspx';", true); } } }
/// <summary> /// 绑定数据 /// </summary> private void ShowData() { lgk.Model.Cashsell cashsellInfo = cashsellBLL.GetModel(iCashsellID); #region 商品信息 ltAmount.Text = cashsellInfo.Amount.ToString("0.00"); ltResidualAmount.Text = (cashsellInfo.Number - cashsellInfo.SaleNum).ToString("0"); txtUnitNum.Value = ltResidualAmount.Text; // ltNumber.Text = (cashsellInfo.Number + cashsellInfo.Charge).ToString(); // ltPayment.Text = cashsellInfo.Number.ToString(); // ltArrival.Text = (cashsellInfo.Number + cashsellInfo.Number * getParamAmount("Gold3") / 100).ToString(); //ltPrice.Text = cashsellInfo.Price.ToString("0.00"); #endregion #region 用户信息 var bank = userBankBLL.GetModel(cashsellInfo.PurchaseID); if (bank != null) { int bankType = (int)bank.Bank003; ltReceiveAccount.Text = bank.BankName; ltBankAccount.Text = bank.BankAccount; imgOutQRCode.ImageUrl = bank.Bank001; ltBankAccountUser.Text = bank.BankAccountUser; divBankAccount.Visible = false; divBankAccountUser.Visible = false; divBagAddress.Visible = false; divOutQrCode.Visible = false; divBagAddress.Visible = false; divQRNiceName.Visible = false; if (bankType == 1) //银行卡 { divBankAccount.Visible = true; divBankAccountUser.Visible = true; } else if (bankType == 2)//微信 { divQRNiceName.Visible = true; divOutQrCode.Visible = true; ltQRNiceName.Text = bank.BankAccount; } else if (bankType == 3) //支付宝 { divQRNiceName.Visible = true; divOutQrCode.Visible = true; ltQRNiceName.Text = bank.BankAccount; } else if (bankType == 4) //数字货币钱包 { divBagAddress.Visible = true; ltBagAddress.Text = bank.BankAccount; } } lgk.Model.tb_user userInfo = userBLL.GetModel(cashsellInfo.UserID); ltUserCode.Text = userInfo.UserCode; //会员编号 ltPhoneNum.Text = userInfo.PhoneNum; //卖家手机号码 //ltGrade.Text = cashcreditBLL.GetValues(cashsellInfo.UserID, "SValues").ToString();//卖家信誉等级 #endregion }