Example #1
0
        //收款
        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);
        }
Example #2
0
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            long   id  = Convert.ToInt64(e.CommandArgument);
            string tag = e.CommandName;

            if (tag.Equals("cancel"))
            {
                lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(id);
                if (cashbuyInfo == null)
                {
                    MessageBox.ShowBox(this.Page, "订单不存在", Library.Enums.ModalTypes.warning);
                    return;
                }
                if (cashbuyInfo.IsBuy == -1)
                {
                    MessageBox.ShowBox(this.Page, "订单已撤销,请勿重复操作", Library.Enums.ModalTypes.warning);
                    return;
                }
                else if (cashbuyInfo.IsBuy == 1)
                {
                    MessageBox.ShowBox(this.Page, "订单已完成,无法撤销", Library.Enums.ModalTypes.warning);
                    return;
                }
                else
                {
                    int     SurplusNum  = cashbuyInfo.Number - cashbuyInfo.BuyNum;
                    decimal iAmount     = SurplusNum * cashbuyInfo.Price;
                    string  strRemark   = "后台已撤销买入订单[" + cashbuyInfo.OrderCode + "],返还剩余云盾[" + iAmount + "]";
                    string  strRemarkEn = "The manager has revoked the buyer's order [" + cashbuyInfo.OrderCode + "] and returned the remaining YD [" + iAmount + "]";
                    //修改买入订单记录
                    cashbuyInfo.IsBuy = -1;//买家已取消
                    cashbuyBLL.Update(cashbuyInfo);

                    int iJtype = (int)Library.AccountType.云盾;                                                    //币种
                    UpdateAccount("BonusAccount", cashbuyInfo.UserID, iAmount, iJtype);                          //终止交易,将剩余花费的云盾返还买家
                    SetAccount(cashbuyInfo.UserID, iAmount, strRemark, strRemarkEn, cashbuyInfo.UserID, iJtype); //插入流水

                    lgk.Model.SysLog log       = new lgk.Model.SysLog();                                         //日志
                    lgk.BLL.SysLog   syslogBLL = new lgk.BLL.SysLog();
                    log.LogMsg    = "后台撤销买入订单【" + cashbuyInfo.OrderCode + "】";
                    log.LogType   = 25;                               //
                    log.LogLeve   = 0;                                //
                    log.LogDate   = DateTime.Now;
                    log.LogCode   = "后台撤销买入订单";                       //
                    log.IsDeleted = 0;
                    log.Log1      = cashbuyInfo.CashbuyID.ToString(); //用户UserID
                    log.Log2      = "";                               // BrowserHelper.UserHostIP(this.Page);
                    log.Log3      = "";                               //BrowserHelper.UserHostName();
                    log.Log4      = "";
                    syslogBLL.Add(log);

                    BindData();
                }
            }
        }
Example #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(lgk.Model.Cashbuy model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Cashbuy set ");
            strSql.Append("UserID=@UserID,");
            strSql.Append("Amount=@Amount,");
            strSql.Append("Price=@Price,");
            strSql.Append("Number=@Number,");
            strSql.Append("BuyNum=@BuyNum,");
            strSql.Append("BuyDate=@BuyDate,");
            strSql.Append("IsBuy=@IsBuy,");
            strSql.Append("Phone=@Phone,");
            strSql.Append("OrderCode=@OrderCode");
            strSql.Append(" where CashbuyID=@CashbuyID");
            SqlParameter[] parameters =
            {
                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("@BuyNum",    SqlDbType.Int,        4),
                new SqlParameter("@BuyDate",   SqlDbType.DateTime),
                new SqlParameter("@IsBuy",     SqlDbType.Int,        4),
                new SqlParameter("@Phone",     SqlDbType.VarChar,   20),
                new SqlParameter("@OrderCode", SqlDbType.VarChar,   50),
                new SqlParameter("@CashbuyID", SqlDbType.BigInt, 8)
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.Amount;
            parameters[2].Value = model.Price;
            parameters[3].Value = model.Number;
            parameters[4].Value = model.BuyNum;
            parameters[5].Value = model.BuyDate;
            parameters[6].Value = model.IsBuy;
            parameters[7].Value = model.Phone;
            parameters[8].Value = model.OrderCode;
            parameters[9].Value = model.CashbuyID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        //撤销买入订单
        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);
        }
Example #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public lgk.Model.Cashbuy DataRowToModel(DataRow row)
 {
     lgk.Model.Cashbuy model = new lgk.Model.Cashbuy();
     if (row != null)
     {
         if (row["CashbuyID"] != null && row["CashbuyID"].ToString() != "")
         {
             model.CashbuyID = long.Parse(row["CashbuyID"].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["BuyNum"] != null && row["BuyNum"].ToString() != "")
         {
             model.BuyNum = int.Parse(row["BuyNum"].ToString());
         }
         if (row["BuyDate"] != null && row["BuyDate"].ToString() != "")
         {
             model.BuyDate = DateTime.Parse(row["BuyDate"].ToString());
         }
         if (row["IsBuy"] != null && row["IsBuy"].ToString() != "")
         {
             model.IsBuy = int.Parse(row["IsBuy"].ToString());
         }
         if (row["Phone"] != null)
         {
             model.Phone = row["Phone"].ToString();
         }
         if (row["OrderCode"] != null)
         {
             model.OrderCode = row["OrderCode"].ToString();
         }
     }
     return(model);
 }
Example #6
0
        /// <summary>
        /// 显示数据
        /// </summary>
        private void ShowData()
        {
            lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID);

            if (cashorderInfo != null)
            {
                #region 订单信息
                lblOrderCode.Text = cashorderInfo.OrderCode;
                lbOrderDate.Text  = cashorderInfo.OrderDate.ToString();
                #endregion

                #region 商品信息
                ltTitle.Text = "";// cashsellBLL.GetModel(cashorderInfo.CashsellID).Title;
                lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID);
                ltAmount.Text = cashbuyInfo.Amount.ToString();
                // ltNumber.Text = (cashbuyInfo.Number + cashbuyInfo.Number * getParamAmount("Gold2") / 100).ToString();
                ltPayment.Text = cashbuyInfo.Number.ToString();
                //ltArrival.Text = (cashbuyInfo.Number + cashbuyInfo.Number * getParamAmount("Gold3") / 100).ToString();
                //ltPrice.Text = cashbuyInfo.Price.ToString();

                #endregion

                #region 卖家信息
                lgk.Model.tb_user userInfo = userBLL.GetModel(cashorderInfo.SUserID);
                ltBankAccount.Text     = userInfo.BankAccount;
                ltBankAccountUser.Text = userInfo.BankAccountUser;
                ltBankBranch.Text      = userInfo.BankBranch;
                #endregion

                //#region 信用等级
                //if (iUserID == cashorderInfo.SUserID)
                //{
                //    lgk.Model.Cashcredit cashcreditInfo = cashcreditBLL.GetModel("UserID=" + cashorderInfo.BUserID + "");

                //    ltCredit.Text = "买家信用度";
                //    if (cashcreditInfo != null)
                //        ltGrade.Text = cashcreditInfo.SValues.ToString();
                //}
                //else if (iUserID == cashorderInfo.BUserID)
                //{
                //    lgk.Model.Cashcredit cashcreditInfo = cashcreditBLL.GetModel("UserID=" + cashorderInfo.SUserID + "");
                //    ltCredit.Text = "卖家信用度";
                //    if (cashcreditInfo != null)
                //        ltGrade.Text = cashcreditInfo.BValues.ToString();
                //}
                //#endregion
            }
        }
Example #7
0
        protected void btnCheck_Click(object sender, EventArgs e)
        {
            string  strRemark = "";
            decimal dAccount  = Convert.ToDecimal(0.00);

            lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID);
            lgk.Model.Cashbuy   cashbuyInfo   = cashbuyBLL.GetModel(cashorderInfo.CashbuyID);

            if (txtRemark.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('终止原因不能为空!');", true);//登录密码不能为空
                return;
            }

            strRemark = txtRemark.Text;

            dAccount = cashbuyInfo.Number * cashbuyInfo.BuyNum;                      //每件数量*件数
            decimal dFactorage = cashbuyInfo.Number * getParamAmount("Gold2") / 100; //手续费
            decimal dTotal     = dAccount;                                           // + dFactorage;

            //加入流水账表
            if (iUserID == cashorderInfo.BUserID)
            {
                strRemark = "买家终止原因:" + strRemark;

                // cashorderBLL.Update(strRemark, iOrderID, iUserID, 1);
                UpdateAccount("BonusAccount", cashorderInfo.SUserID, dTotal, 1);//终止交易,将EP币返还卖家
                // UpdateAccount("ShopAccount", cashorderInfo.SUserID, dFactorage, 1);//终止交易,将交易码返还卖家
                SetAccount(cashorderInfo.SUserID, dTotal, strRemark, (int)Library.AccountType.交易钱包);
                // SetAccount(cashorderInfo.SUserID, dFactorage, strRemark, (int)Library.AccountType.交易码);
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('终止交易成功!');window.location.href='CashOrderList.aspx';", true);
            }
            else if (iUserID == cashorderInfo.SUserID)
            {
                strRemark = "卖家终止原因:" + strRemark;
                //dAccount = cashbuyInfo.Number * cashbuyInfo.BuyNum;

                //   cashorderBLL.Update(strRemark, iOrderID, iUserID, 2);
                UpdateAccount("BonusAccount", cashorderInfo.SUserID, dTotal, 1);//终止交易,将EP币返还卖家
                // UpdateAccount("ShopAccount", cashorderInfo.SUserID, dFactorage, 1);//终止交易,将交易码返还卖家

                SetAccount(iUserID, dTotal, strRemark, (int)Library.AccountType.交易钱包);
                // SetAccount(iUserID, dFactorage, strRemark, (int)Library.AccountType.交易码);

                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('终止交易成功!');window.location.href='CashOrderList.aspx';", true);
            }
        }
Example #8
0
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            long   id  = Convert.ToInt64(e.CommandArgument);
            string tag = e.CommandName;

            if (tag.Equals("cancel"))
            {
                lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(id);
                if (cashbuyInfo == null)
                {
                    MessageBox.ShowBox(this.Page, "订单不存在", Library.Enums.ModalTypes.warning);
                    return;
                }
                if (cashbuyInfo.IsBuy == -1)
                {
                    MessageBox.ShowBox(this.Page, "订单已撤销,请勿重复操作", Library.Enums.ModalTypes.warning);
                    return;
                }
                else if (cashbuyInfo.IsBuy == 1)
                {
                    MessageBox.ShowBox(this.Page, "订单已完成,无法撤销", Library.Enums.ModalTypes.warning);
                    return;
                }
                else
                {
                    string msg = cashbuyBLL.Proc_TradingBuyCancel(cashbuyInfo.CashbuyID);
                    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;
                    }

                    BindData();
                }
            }
        }
Example #9
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(lgk.Model.Cashbuy model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Cashbuy(");
            strSql.Append("UserID,Amount,Price,Number,BuyNum,BuyDate,IsBuy,Phone,OrderCode)");
            strSql.Append(" values (");
            strSql.Append("@UserID,@Amount,@Price,@Number,@BuyNum,@BuyDate,@IsBuy,@Phone,@OrderCode)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                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("@BuyNum",    SqlDbType.Int,        4),
                new SqlParameter("@BuyDate",   SqlDbType.DateTime),
                new SqlParameter("@IsBuy",     SqlDbType.Int,        4),
                new SqlParameter("@Phone",     SqlDbType.VarChar,   20),
                new SqlParameter("@OrderCode", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.Amount;
            parameters[2].Value = model.Price;
            parameters[3].Value = model.Number;
            parameters[4].Value = model.BuyNum;
            parameters[5].Value = model.BuyDate;
            parameters[6].Value = model.IsBuy;
            parameters[7].Value = model.Phone;
            parameters[8].Value = model.OrderCode;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
Example #10
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public lgk.Model.Cashbuy GetModel(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select CashbuyID, CashsellID, UserID, Amount, Price, Number, BuyNum, BuyDate, IsBuy,Phone");
            strSql.Append(" from Cashbuy ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }

            lgk.Model.Cashbuy model = new lgk.Model.Cashbuy();
            DataSet           ds    = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #11
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public lgk.Model.Cashbuy GetModel(long CashbuyID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 CashbuyID,UserID,Amount,Price,Number,BuyNum,BuyDate,IsBuy,Phone,OrderCode from Cashbuy ");
            strSql.Append(" where CashbuyID=@CashbuyID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CashbuyID", SqlDbType.BigInt)
            };
            parameters[0].Value = CashbuyID;

            lgk.Model.Cashbuy model = new lgk.Model.Cashbuy();
            DataSet           ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #12
0
        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);
            }
        }
Example #13
0
        //买入
        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);
        }
Example #14
0
        /// <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
            }
        }
Example #15
0
        /// <summary>
        /// 显示数据
        /// </summary>
        private void ShowData()
        {
            lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID);

            if (cashorderInfo != null)
            {
                #region 订单信息
                lblOrderCode.Text = cashorderInfo.OrderCode;
                lbOrderDate.Text  = cashorderInfo.OrderDate.ToString();
                #endregion

                #region 商品信息
                lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID);
                ltAmount.Text = cashbuyInfo.Amount.ToString("0.00");
                ltNumber.Text = cashbuyInfo.Number.ToString("0.00");
                #endregion

                #region 卖家信息
                lgk.Model.tb_user suserInfo = userBLL.GetModel(cashorderInfo.SUserID);

                ltSUserCode.Text = suserInfo.UserCode;               //会员编号

                ltSBankName.Text = suserInfo.BankName;               //开户银行

                ltSTrueName.Text = suserInfo.TrueName;               //银行姓名

                ltSBankAccount.Text = suserInfo.BankAccount;         //银行帐号

                ltSBankAccountUser.Text = suserInfo.BankAccountUser; //银行姓名

                ltSBankBranch.Text = suserInfo.BankBranch;           //开户网点

                ltSPhoneNum.Text = suserInfo.PhoneNum;               //卖家手机号码
                #endregion

                #region 买家信息
                lgk.Model.tb_user buserInfo = userBLL.GetModel(cashorderInfo.BUserID);

                ltBUserCode.Text = buserInfo.UserCode;               //会员编号

                ltBBankName.Text = buserInfo.BankName;               //开户银行

                ltBTrueName.Text = buserInfo.TrueName;               //银行姓名

                ltBBankAccount.Text = buserInfo.BankAccount;         //银行帐号

                ltBBankAccountUser.Text = buserInfo.BankAccountUser; //银行姓名

                ltBBankBranch.Text = buserInfo.BankBranch;           //开户网点

                ltBPhoneNum.Text = buserInfo.PhoneNum;               //卖家手机号码
                #endregion

                #region 信用等级
                //"卖家信誉等级";
                //int iBValues = cashcreditBLL.GetValues(cashorderInfo.SUserID, "BValues");
                //if (iBValues > 0)
                //{
                //    for (int i = 0; i < iBValues; i++)
                //    {
                //        ltSGrade.Text += "<img alt='' src='../../images/start.png' />";
                //    }
                //}

                //int iSValues = cashcreditBLL.GetValues(cashorderInfo.BUserID, "SValues");
                //if (iSValues > 0)
                //{
                //    for (int i = 0; i < iSValues; i++)
                //    {
                //        ltBGrade.Text += "<img alt='' src='../../images/start.png' />";
                //    }
                //}
                #endregion
            }
        }
Example #16
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public lgk.Model.Cashbuy GetModel(long CashbuyID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select CashbuyID, CashsellID, UserID, Amount, Price, Number, BuyNum, BuyDate, IsBuy,Phone");
            strSql.Append(" from Cashbuy");
            strSql.Append(" where CashbuyID=@CashbuyID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CashbuyID", SqlDbType.BigInt, 8)
            };
            parameters[0].Value = CashbuyID;

            lgk.Model.Cashbuy model = new lgk.Model.Cashbuy();
            DataSet           ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["CashbuyID"].ToString() != "")
                {
                    model.CashbuyID = long.Parse(ds.Tables[0].Rows[0]["CashbuyID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CashsellID"].ToString() != "")
                {
                    model.CashsellID = long.Parse(ds.Tables[0].Rows[0]["CashsellID"].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]["BuyNum"].ToString() != "")
                {
                    model.BuyNum = decimal.Parse(ds.Tables[0].Rows[0]["BuyNum"].ToString());
                }
                if (ds.Tables[0].Rows[0]["BuyDate"].ToString() != "")
                {
                    model.BuyDate = DateTime.Parse(ds.Tables[0].Rows[0]["BuyDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsBuy"].ToString() != "")
                {
                    model.IsBuy = int.Parse(ds.Tables[0].Rows[0]["IsBuy"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Phone"].ToString() != "")
                {
                    model.Phone = ds.Tables[0].Rows[0]["Phone"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #17
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public lgk.Model.Cashbuy GetModel(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select CashbuyID, CashsellID, UserID, Amount, Price, Number, BuyNum, BuyDate, IsBuy,Phone");
            strSql.Append(" from Cashbuy ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }

            lgk.Model.Cashbuy model = new lgk.Model.Cashbuy();
            DataSet           ds    = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["CashbuyID"].ToString() != "")
                {
                    model.CashbuyID = long.Parse(ds.Tables[0].Rows[0]["CashbuyID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CashsellID"].ToString() != "")
                {
                    model.CashsellID = long.Parse(ds.Tables[0].Rows[0]["CashsellID"].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]["BuyNum"].ToString() != "")
                {
                    model.BuyNum = decimal.Parse(ds.Tables[0].Rows[0]["BuyNum"].ToString());
                }
                if (ds.Tables[0].Rows[0]["BuyDate"].ToString() != "")
                {
                    model.BuyDate = DateTime.Parse(ds.Tables[0].Rows[0]["BuyDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsBuy"].ToString() != "")
                {
                    model.IsBuy = int.Parse(ds.Tables[0].Rows[0]["IsBuy"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Phone"].ToString() != "")
                {
                    model.Phone = ds.Tables[0].Rows[0]["Phone"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #18
0
        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);
            }
        }
Example #19
0
        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);
                }
            }
        }
        /// <summary>
        /// 显示数据
        /// </summary>
        private void ShowData()
        {
            lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID);

            if (cashorderInfo != null)
            {
                #region 订单信息
                lblOrderCode.Text = cashorderInfo.OrderCode;
                lbOrderDate.Text  = cashorderInfo.OrderDate.ToString();
                ltPayDate.Text    = cashorderInfo.PayDate.ToString();

                if (cashorderInfo.IsFeedback == 1)
                {
                    trFeedback.Visible = true;
                    litFeedback.Text   = cashorderInfo.Feedback;
                }
                else
                {
                    trFeedback.Visible = false;
                }
                #endregion

                #region 商品信息
                lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID);
                ltAmount.Text = cashbuyInfo.Amount.ToString("0.00");
                ltNumber.Text = cashbuyInfo.Number.ToString("0.00");
                #endregion

                #region 卖家信息
                var cashsellInfo = cashsellBLL.GetModel(cashorderInfo.CashsellID);
                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;
                    trBankAccount.Visible     = false;
                    trBankAccountUser.Visible = false;
                    trBagAddress.Visible      = false;
                    trOutQrCode.Visible       = false;
                    trQRNiceName.Visible      = false;

                    if (bankType == 1) //银行卡
                    {
                        trBankAccount.Visible     = true;
                        trBankAccountUser.Visible = true;
                    }
                    else if (bankType == 2)//微信
                    {
                        trQRNiceName.Visible = true;
                        trOutQrCode.Visible  = true;
                        ltQRNiceName.Text    = bank.BankAccount;
                    }
                    else if (bankType == 3) //支付宝
                    {
                        trQRNiceName.Visible = true;
                        trOutQrCode.Visible  = true;
                        ltQRNiceName.Text    = bank.BankAccount;
                    }
                    else if (bankType == 4)  //数字货币钱包
                    {
                        trBagAddress.Visible = true;
                        BagAddress.Text      = bank.BankAccount;
                    }
                }

                lgk.Model.tb_user suserInfo = userBLL.GetModel(cashorderInfo.SUserID);
                if (suserInfo != null)
                {
                    ltSUserCode.Text = suserInfo.UserCode; //会员编号
                    ltNiceName.Text  = suserInfo.NiceName; //会员昵称
                    ltPhoneNum.Text  = suserInfo.PhoneNum;
                }
                #endregion

                #region 买家信息
                lgk.Model.tb_user buserInfo = userBLL.GetModel(cashorderInfo.BUserID);
                ltBNiceName.Text = buserInfo.NiceName;
                ltBUserCode.Text = buserInfo.UserCode;//会员编号

                //ltBBankName.Text = buserInfo.BankName;//开户银行

                //ltBTrueName.Text = buserInfo.TrueName;//银行姓名

                //ltBBankAccount.Text = buserInfo.BankAccount;//银行帐号

                //ltBBankAccountUser.Text = buserInfo.BankAccountUser;//银行姓名

                //ltBBankBranch.Text = buserInfo.BankBranch;//开户网点

                ltBPhoneNum.Text = buserInfo.PhoneNum;//卖家手机号码
                #endregion

                #region 信用等级
                //"卖家信誉等级";
                //int iBValues = cashcreditBLL.GetValues(cashorderInfo.SUserID, "BValues");
                //if (iBValues > 0)
                //{
                //    for (int i = 0; i < iBValues; i++)
                //    {
                //        ltSGrade.Text += "<img alt='' src='../../images/start.png' />";
                //    }
                //}

                //int iSValues = cashcreditBLL.GetValues(cashorderInfo.BUserID, "SValues");
                //if (iSValues > 0)
                //{
                //    for (int i = 0; i < iSValues; i++)
                //    {
                //        ltBGrade.Text += "<img alt='' src='../../images/start.png' />";
                //    }
                //}
                #endregion
            }
        }
        /// <summary>
        /// 显示数据
        /// </summary>
        private void ShowData()
        {
            lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID);

            if (cashorderInfo != null)
            {
                var cashsellInfo = cashsellBLL.GetModel(cashorderInfo.CashsellID);

                #region 订单信息
                lblOrderCode.Text = cashorderInfo.OrderCode;
                lbOrderDate.Text  = cashorderInfo.OrderDate.ToString();
                ltBRemark.Text    = cashorderInfo.BRemark;
                ltSRemark.Text    = cashorderInfo.SRemark;
                #endregion

                #region 商品信息

                lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID);
                ltAmount.Text     = cashbuyInfo.Amount.ToString("0.0000"); //支付金额
                ltBuyNumber.Text  = (cashbuyInfo.BuyNum).ToString("0");    //购买数量
                ltSellNumber.Text = (cashsellInfo.Number).ToString("0");   //售卖数量
                //ltPayment.Text = cashbuyInfo.Number.ToString();
                //ltArrival.Text = (cashbuyInfo.Number + cashbuyInfo.Number * getParamAmount("Gold3") / 100).ToString();
                //ltPrice.Text = cashbuyInfo.Price.ToString("0.00");
                //ltBuyNum.Text = cashbuyInfo.BuyNum.ToString();
                #endregion

                #region 卖家信息
                //   var cashsellInfo = cashsellBLL.GetModel(cashorderInfo.CashsellID);
                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;
                        BagAddress            = bank.BankAccount;
                    }
                }

                lgk.Model.tb_user userInfo = userBLL.GetModel(cashorderInfo.SUserID);
                ltUserCode.Text = userInfo.UserCode; //会员编号
                ltNiceName.Text = userInfo.NiceName; //昵称
                ltPhoneNum.Text = userInfo.PhoneNum; //卖家手机号码
                #endregion

                #region 买家信息
                lgk.Model.tb_user buserInfo = userBLL.GetModel(cashorderInfo.BUserID);

                ltBUserCode.Text = buserInfo.NiceName; //会员编号

                ltBPhoneNum.Text = buserInfo.PhoneNum; //卖家手机号码
                #endregion

                if (cashorderInfo.IsFeedback == 1)
                {
                    divFeedback.Visible = true;
                    ltReason.Text       = cashorderInfo.Feedback;
                    ltFeedbackDate.Text = cashorderInfo.FeedbackDate.ToString();
                }
                else
                {
                    divFeedback.Visible = false;
                }

                //#region 信用等级
                //int iBValues = cashcreditBLL.GetValues(cashorderInfo.SUserID, "BValues");
                //if (iBValues > 0)
                //{
                //    for (int i = 0; i < iBValues; i++)
                //    {
                //        ltSGrade.Text += "<img alt='' src='../../images/start.png' />";
                //    }
                //}

                //int iSValues = cashcreditBLL.GetValues(cashorderInfo.BUserID, "SValues");
                //if (iSValues > 0)
                //{
                //    for (int i = 0; i < iSValues; i++)
                //    {
                //        ltBGrade.Text += "<img alt='' src='../../images/start.png' />";
                //    }
                //}
                //#endregion
            }
        }
Example #22
0
        //撤销买入订单
        public bool BuyCancel(long userid, long orderid, out string message)
        {
            var user = userBLL.GetModel(userid);

            if (user == null)
            {
                message = "账户不存在";
                return(false);
            }
            if (user.IsLock == 1)
            {
                message = "账户已冻结,撤销买入订单失败";
                return(false);
            }

            lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(orderid);
            if (cashbuyInfo == null)
            {
                message = "订单不存在";
                return(false);
            }
            if (cashbuyInfo.IsBuy == -1)
            {
                message = "订单已撤销,请勿重复操作";
                return(false);
            }
            else if (cashbuyInfo.IsBuy == 1)
            {
                message = "订单已完成,无法撤销";
                return(false);
            }
            else
            {
                int     SurplusNum = cashbuyInfo.Number - cashbuyInfo.BuyNum;
                decimal iAmount    = SurplusNum * cashbuyInfo.Price;
                string  strRemark  = "买家已撤销订单[" + cashbuyInfo.OrderCode + "]的买入,返还剩余云盾[" + iAmount + "]";

                //修改买入订单记录
                cashbuyInfo.IsBuy = -1;//买家已取消
                cashbuyBLL.Update(cashbuyInfo);

                int iJtype = (int)Library.AccountType.云盾;               //币种
                UpdateAccount("BonusAccount", userid, iAmount, iJtype); //终止交易,将剩余花费的云盾返还买家
                SetAccount(userid, iAmount, strRemark, userid, iJtype); //插入流水

                lgk.Model.SysLog log       = new lgk.Model.SysLog();    //日志
                lgk.BLL.SysLog   syslogBLL = new lgk.BLL.SysLog();
                log.LogMsg    = "买家撤销订单【" + cashbuyInfo.OrderCode + "】";
                log.LogType   = 23;                               //
                log.LogLeve   = 0;                                //
                log.LogDate   = DateTime.Now;
                log.LogCode   = "买家撤销订单";                         //
                log.IsDeleted = 0;
                log.Log1      = cashbuyInfo.CashbuyID.ToString(); //用户UserID
                log.Log2      = "";                               // BrowserHelper.UserHostIP(this.Page);
                log.Log3      = "";                               //BrowserHelper.UserHostName();
                log.Log4      = "";
                syslogBLL.Add(log);

                message = "买家撤销成功";
                return(true);
            }
        }
Example #23
0
        /// <summary>
        /// 显示数据
        /// </summary>
        private void ShowData()
        {
            lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID);

            if (cashorderInfo != null)
            {
                var cashsellInfo = cashsellBLL.GetModel(cashorderInfo.CashsellID);
                #region 订单信息
                ltOrderCode.Text = cashorderInfo.OrderCode;
                ltOrderDate.Text = cashorderInfo.OrderDate.ToString();
                #endregion

                #region 商品信息
                lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID);
                ltAmount.Text     = cashbuyInfo.Amount.ToString("0.0000"); //支付金额
                ltBuyNumber.Text  = (cashbuyInfo.BuyNum).ToString("0");    //购买数量
                ltSellNumber.Text = (cashsellInfo.Number).ToString("0");   //售卖数量

                #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(cashorderInfo.SUserID);
                ltUserCode.Text = userInfo.UserCode; //会员编号

                ltPhoneNum.Text = userInfo.PhoneNum; //卖家手机号码
                #endregion

                #region 买家信息
                lgk.Model.tb_user buserInfo = userBLL.GetModel(cashorderInfo.BUserID);

                ltBUserCode.Text = buserInfo.NiceName; //会员编号

                ltBPhoneNum.Text = buserInfo.PhoneNum; //卖家手机号码
                #endregion
                //#region 信用等级
                //if (iUserID == cashorderInfo.SUserID)
                //{
                //    ltCredit.Text = GetLanguage("BuyersRating");
                //    int iSValues = cashcreditBLL.GetValues(cashorderInfo.SUserID, "SValues");
                //    if (iSValues > 0)
                //    {
                //        for (int i = 0; i < iSValues; i++)
                //        {
                //            ltGrade.Text += "<img alt='' src='../../images/start.png' />";
                //        }
                //    }
                //}
                //else if (iUserID == cashorderInfo.BUserID)
                //{
                //    ltCredit.Text = GetLanguage("SellersRating");
                //    int iBValues = cashcreditBLL.GetValues(cashorderInfo.SUserID, "SValues");
                //    if (iBValues > 0)
                //    {
                //        for (int i = 0; i < iBValues; i++)
                //        {
                //            ltGrade.Text += "<img alt='' src='../../images/start.png' />";
                //        }
                //    }
                //}
                //#endregion
                divBuyerInfo.Visible   = true;
                divUploadImage.Visible = false;
                if (cashorderInfo.BUserID == iUserID && cashorderInfo.SStatus == 0 && cashorderInfo.BStatus == 0 && iActionID == 1)
                {
                    btnCheck.Text          = GetLanguage("Payment");//"付 款";
                    divBuyerInfo.Visible   = true;
                    divUploadImage.Visible = true;
                }
                else if (cashorderInfo.SUserID == iUserID && cashorderInfo.BStatus == 1 && cashorderInfo.SStatus == 0 && iActionID == 2)
                {
                    btnCheck.Text    = GetLanguage("ConfirmPayment");//"确认已付款"
                    previewImage.Src = cashorderInfo.Pic;
                }
                else
                {
                    btnCheck.Visible = false;
                    previewImage.Src = cashorderInfo.Pic;
                }
            }
        }
Example #24
0
        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);
                }
            }
        }