Beispiel #1
0
        /// <summary>
        /// 保存充值信息
        /// </summary>
        void baocun()
        {
            MChongZhi model = new MChongZhi();
            model.OrderID = Guid.NewGuid().ToString();
            model.OperatorID = HuiYuanInfo.UserID;
            model.OptMoney = Utils.GetDecimal(Utils.GetFormValue(txtMoney.UniqueID));
            model.PayState = PaymentState.未支付;
            model.OrderCode = "CZ" + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1000, 9999);
            int result = new Eyousoft_yhq.BLL.BChongZhi().Add(model);

            Utils.RCWE(UtilsCommons.AjaxReturnJson(result == 1 ? "1" : "0", result == 1 ? "正在跳转..." : "系统繁忙,稍后再试!", model.OrderID));
        }
Beispiel #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(MChongZhi model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("INSERT INTO tmp_tbl_ChongZhi(OrderID, OperatorID, OptMoney,OrderCode,PayState) VALUES (@OrderID, @OperatorID, @OptMoney,@OrderCode,@PayState)");
     DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());
     this._db.AddInParameter(cmd, "OrderID", DbType.AnsiStringFixedLength, model.OrderID);
     this._db.AddInParameter(cmd, "OperatorID", DbType.AnsiStringFixedLength, model.OperatorID);
     this._db.AddInParameter(cmd, "OptMoney", DbType.String, model.OptMoney);
     this._db.AddInParameter(cmd, "OrderCode", DbType.AnsiStringFixedLength, model.OrderCode);
     this._db.AddInParameter(cmd, "PayState", DbType.Byte, model.PayState);
     return DbHelper.ExecuteSql(cmd, this._db);
 }
Beispiel #3
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="RecordCount"></param>
        /// <param name="serModel"></param>
        /// <returns></returns>
        public IList<MChongZhi> GetList(int PageSize, int PageIndex, ref int RecordCount, MChongZhiSer serModel)
        {
            IList<MChongZhi> list = new List<MChongZhi>();

            string tableName = "view_ChongZhi";
            string fileds = "* ";
            string orderByString = "ISSUETIME DESC ";

            StringBuilder query = new StringBuilder();
            query.AppendFormat("  PayState=2   ");

            if (serModel != null)
            {
                if (!string.IsNullOrEmpty(serModel.OrderCode))
                {
                    query.AppendFormat(" and OrderCode  like '%{0}%' ", serModel.OrderCode);
                }
                if (!string.IsNullOrEmpty(serModel.TradeNo))
                {
                    query.AppendFormat(" and TradeNo like '%{0}%' ", serModel.TradeNo);
                }
                if (!string.IsNullOrEmpty(serModel.Account))
                {
                    query.AppendFormat(" and UserName like '%{0}%'  ", serModel.Account);
                }
                if (!string.IsNullOrEmpty(serModel.OperatorID))
                {
                    query.AppendFormat(" and OperatorID = '{0}' ", serModel.OperatorID);
                }
            }

            using (IDataReader dr = DbHelper.ExecuteReader1(this._db, PageSize, PageIndex, ref RecordCount, tableName, fileds, query.ToString(), orderByString, null))
            {
                while (dr.Read())
                {
                    MChongZhi model = new MChongZhi();
                    model.UserName = dr.IsDBNull(dr.GetOrdinal("UserName")) ? "" : dr.GetString(dr.GetOrdinal("UserName"));
                    model.ContactName = dr.IsDBNull(dr.GetOrdinal("ContactName")) ? "" : dr.GetString(dr.GetOrdinal("ContactName"));

                    model.OrderID = dr.GetString(dr.GetOrdinal("OrderID"));
                    model.OperatorID = dr.GetString(dr.GetOrdinal("OperatorID"));
                    model.OptMoney = dr.GetDecimal(dr.GetOrdinal("OptMoney"));
                    model.Issuetime = dr.GetDateTime(dr.GetOrdinal("Issuetime"));
                    model.OrderCode = dr.GetString(dr.GetOrdinal("OrderCode"));
                    model.PayState = (PaymentState)dr.GetByte(dr.GetOrdinal("PayState"));
                    model.TradeNo = dr.IsDBNull(dr.GetOrdinal("TradeNo")) ? "" : dr.GetString(dr.GetOrdinal("TradeNo"));

                    list.Add(model);
                }
            }
            return list;
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MChongZhi GetModelByOrderCode(string TradeNO)
        {
            MChongZhi model = null;

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT  [OrderID], [OrderCode]      ,[OperatorID]      ,[OptMoney]      ,[Issuetime]      ,[PayState] ,[TradeNO]  FROM tmp_tbl_ChongZhi WHERE OrderCode=@OrderCode ");
            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());
            this._db.AddInParameter(cmd, "OrderCode", DbType.AnsiStringFixedLength, TradeNO);

            using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db))
            {

                while (dr.Read())
                {
                    model = new MChongZhi();
                    model.OrderID = dr.GetString(dr.GetOrdinal("OrderID"));
                    model.OperatorID = dr.GetString(dr.GetOrdinal("OperatorID"));
                    model.OptMoney = dr.GetDecimal(dr.GetOrdinal("OptMoney"));
                    model.Issuetime = dr.GetDateTime(dr.GetOrdinal("Issuetime"));
                    model.OrderCode = dr.GetString(dr.GetOrdinal("OrderCode"));
                    model.PayState = (PaymentState)dr.GetByte(dr.GetOrdinal("PayState"));
                    model.TradeNo = dr.IsDBNull(dr.GetOrdinal("TradeNo")) ? "" : dr.GetString(dr.GetOrdinal("TradeNo"));
                }
            }
            Eyousoft_yhq.SQLServerDAL.Utils.WLog("1", "/log_2.txt");

            return model;
        }
Beispiel #5
0
        /// 得到一个对象实体
        /// </summary>
        public MChongZhi GetModel(string ID)
        {
            MChongZhi model = null;

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT   [OrderCode]      ,[OperatorID]      ,[OptMoney]      ,[Issuetime]      ,[PayState] ,[TradeNo]  FROM tmp_tbl_ChongZhi WHERE orderid=@orderid and PayState=1");
            DbCommand cmd = this._db.GetSqlStringCommand(strSql.ToString());
            this._db.AddInParameter(cmd, "orderid", DbType.AnsiStringFixedLength, ID);

            using (IDataReader dr = DbHelper.ExecuteReader(cmd, this._db))
            {

                while (dr.Read())
                {
                    model = new MChongZhi();
                    model.OrderID = ID;
                    model.OperatorID = dr.GetString(dr.GetOrdinal("OperatorID"));
                    model.OptMoney = dr.GetDecimal(dr.GetOrdinal("OptMoney"));
                    model.Issuetime = dr.GetDateTime(dr.GetOrdinal("Issuetime"));
                    model.OrderCode = dr.GetString(dr.GetOrdinal("OrderCode"));
                    model.PayState = (PaymentState)dr.GetByte(dr.GetOrdinal("PayState"));
                    model.TradeNo = dr.IsDBNull(dr.GetOrdinal("TradeNo")) ? "" : dr.GetString(dr.GetOrdinal("TradeNo"));
                }
            }

            return model;
        }
Beispiel #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(MChongZhi model)
 {
     return dal.Add(model);
 }