示例#1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public BrnMall.Core.Model.PayOrder DataRowToModel(DataRow row)
 {
     BrnMall.Core.Model.PayOrder model = new BrnMall.Core.Model.PayOrder();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["UID"] != null && row["UID"].ToString() != "")
         {
             model.UID = int.Parse(row["UID"].ToString());
         }
         if (row["Pice"] != null && row["Pice"].ToString() != "")
         {
             model.Pice = int.Parse(row["Pice"].ToString());
         }
         if (row["Type"] != null && row["Type"].ToString() != "")
         {
             model.Type = int.Parse(row["Type"].ToString());
         }
         if (row["Addtime"] != null && row["Addtime"].ToString() != "")
         {
             model.Addtime = DateTime.Parse(row["Addtime"].ToString());
         }
         if (row["Paytime"] != null && row["Paytime"].ToString() != "")
         {
             model.Paytime = DateTime.Parse(row["Paytime"].ToString());
         }
         if (row["PayStatus"] != null && row["PayStatus"].ToString() != "")
         {
             model.PayStatus = int.Parse(row["PayStatus"].ToString());
         }
         if (row["username"] != null && row["username"].ToString() != "")
         {
             model.UserName = row["UserName"].ToString();
         }
         if (row["OrderNo"] != null && row["OrderNo"].ToString() != "")
         {
             model.OrderNo = row["OrderNo"].ToString();
         }
     }
     return(model);
 }
示例#2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BrnMall.Core.Model.PayOrder model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update PayOrder set ");
            strSql.Append("UID=@UID,");
            strSql.Append("Pice=@Pice,");
            strSql.Append("Type=@Type,");
            strSql.Append("Addtime=@Addtime,");
            strSql.Append("Paytime=@Paytime,");
            strSql.Append("PayStatus=@PayStatus");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UID",       SqlDbType.Int,       4),
                new SqlParameter("@Pice",      SqlDbType.Int,       4),
                new SqlParameter("@Type",      SqlDbType.Int,       4),
                new SqlParameter("@Addtime",   SqlDbType.DateTime),
                new SqlParameter("@Paytime",   SqlDbType.DateTime),
                new SqlParameter("@PayStatus", SqlDbType.Int,       4),
                new SqlParameter("@ID",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.UID;
            parameters[1].Value = model.Pice;
            parameters[2].Value = model.Type;
            parameters[3].Value = model.Addtime;
            parameters[4].Value = model.Paytime;
            parameters[5].Value = model.PayStatus;
            parameters[6].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(BrnMall.Core.Model.PayOrder model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into PayOrder(");
            strSql.Append("ID,UID,Pice,Type,Addtime,Paytime,PayStatus)");
            strSql.Append(" values (");
            strSql.Append("@ID,@UID,@Pice,@Type,@Addtime,@Paytime,@PayStatus)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",        SqlDbType.Int,       4),
                new SqlParameter("@UID",       SqlDbType.Int,       4),
                new SqlParameter("@Pice",      SqlDbType.Int,       4),
                new SqlParameter("@Type",      SqlDbType.Int,       4),
                new SqlParameter("@Addtime",   SqlDbType.DateTime),
                new SqlParameter("@Paytime",   SqlDbType.DateTime),
                new SqlParameter("@PayStatus", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.UID;
            parameters[2].Value = model.Pice;
            parameters[3].Value = model.Type;
            parameters[4].Value = model.Addtime;
            parameters[5].Value = model.Paytime;
            parameters[6].Value = model.PayStatus;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BrnMall.Core.Model.PayOrder GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,orderno,(select username from bma_users where bma_users.uid=PayOrder.uid) as username,UID,Pice,Type,Addtime,Paytime,PayStatus from PayOrder ");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            BrnMall.Core.Model.PayOrder model = new BrnMall.Core.Model.PayOrder();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }