/// <summary>
        /// 增加一条数据
        /// </summary>
        public static int Add(Model.UserAccount model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into UserAccount(");
            strSql.Append("typeId,typeName,userId,orderId,orderNo,orderTotal,payType,moneyValue,status,remark,addTime,addUser,infoType)");
            strSql.Append(" values (");
            strSql.Append("@typeId,@typeName,@userId,@orderId,@orderNo,@orderTotal,@payType,@moneyValue,@status,@remark,@addTime,@addUser,@infoType)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@typeId",     SqlDbType.Int,         4),
                new SqlParameter("@typeName",   SqlDbType.VarChar,   150),
                new SqlParameter("@userId",     SqlDbType.Int,         4),
                new SqlParameter("@orderId",    SqlDbType.Int,         4),
                new SqlParameter("@orderNo",    SqlDbType.VarChar,   150),
                new SqlParameter("@orderTotal", SqlDbType.Money,       8),
                new SqlParameter("@payType",    SqlDbType.Int,         4),
                new SqlParameter("@moneyValue", SqlDbType.Money,       8),
                new SqlParameter("@status",     SqlDbType.Int,         4),
                new SqlParameter("@remark",     SqlDbType.VarChar,   150),
                new SqlParameter("@addTime",    SqlDbType.DateTime),
                new SqlParameter("@addUser",    SqlDbType.Int,         4),
                new SqlParameter("@infoType",   SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.typeId;
            parameters[1].Value  = model.typeName;
            parameters[2].Value  = model.userId;
            parameters[3].Value  = model.orderId;
            parameters[4].Value  = model.orderNo;
            parameters[5].Value  = model.orderTotal;
            parameters[6].Value  = model.payType;
            parameters[7].Value  = model.moneyValue;
            parameters[8].Value  = model.status;
            parameters[9].Value  = model.remark;
            parameters[10].Value = model.addTime;
            parameters[11].Value = model.addUser;
            parameters[12].Value = model.infoType;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Model.UserAccount GetModelByUserId(int userId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from UserAccount ");
            strSql.Append(" where userId=@userId order by id desc");
            SqlParameter[] parameters =
            {
                new SqlParameter("@userId", SqlDbType.Int, 4)
            };
            parameters[0].Value = userId;

            Model.UserAccount model = new Model.UserAccount();
            DataSet           ds    = DBHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Model.UserAccount GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,typeId,typeName,userId,orderId,orderNo,orderTotal,payType,moneyValue,status,remark,addTime,addUser,infoType from UserAccount ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Model.UserAccount model = new Model.UserAccount();
            DataSet           ds    = DBHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public static Model.UserAccount DataRowToModel(DataRow row)
 {
     Model.UserAccount model = new Model.UserAccount();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["typeId"] != null && row["typeId"].ToString() != "")
         {
             model.typeId = int.Parse(row["typeId"].ToString());
         }
         if (row["typeName"] != null)
         {
             model.typeName = row["typeName"].ToString();
         }
         if (row["userId"] != null && row["userId"].ToString() != "")
         {
             model.userId = int.Parse(row["userId"].ToString());
         }
         if (row["orderId"] != null && row["orderId"].ToString() != "")
         {
             model.orderId = int.Parse(row["orderId"].ToString());
         }
         if (row["orderNo"] != null)
         {
             model.orderNo = row["orderNo"].ToString();
         }
         if (row["orderTotal"] != null && row["orderTotal"].ToString() != "")
         {
             model.orderTotal = double.Parse(row["orderTotal"].ToString());
         }
         if (row["payType"] != null && row["payType"].ToString() != "")
         {
             model.payType = int.Parse(row["payType"].ToString());
         }
         if (row["moneyValue"] != null && row["moneyValue"].ToString() != "")
         {
             model.moneyValue = double.Parse(row["moneyValue"].ToString());
         }
         if (row["status"] != null && row["status"].ToString() != "")
         {
             model.status = int.Parse(row["status"].ToString());
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["addTime"] != null && row["addTime"].ToString() != "")
         {
             model.addTime = DateTime.Parse(row["addTime"].ToString());
         }
         if (row["addUser"] != null && row["addUser"].ToString() != "")
         {
             model.addUser = int.Parse(row["addUser"].ToString());
         }
         if (row["infoType"] != null && row["infoType"].ToString() != "")
         {
             model.infoType = int.Parse(row["infoType"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static bool Update(Model.UserAccount model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update UserAccount set ");
            strSql.Append("typeId=@typeId,");
            strSql.Append("typeName=@typeName,");
            strSql.Append("userId=@userId,");
            strSql.Append("orderId=@orderId,");
            strSql.Append("orderNo=@orderNo,");
            strSql.Append("orderTotal=@orderTotal,");
            strSql.Append("payType=@payType,");
            strSql.Append("moneyValue=@moneyValue,");
            strSql.Append("status=@status,");
            strSql.Append("remark=@remark,");
            strSql.Append("addTime=@addTime,");
            strSql.Append("addUser=@addUser,");
            strSql.Append("infoType=@infoType");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@typeId",     SqlDbType.Int,         4),
                new SqlParameter("@typeName",   SqlDbType.VarChar,   150),
                new SqlParameter("@userId",     SqlDbType.Int,         4),
                new SqlParameter("@orderId",    SqlDbType.Int,         4),
                new SqlParameter("@orderNo",    SqlDbType.VarChar,   150),
                new SqlParameter("@orderTotal", SqlDbType.Money,       8),
                new SqlParameter("@payType",    SqlDbType.Int,         4),
                new SqlParameter("@moneyValue", SqlDbType.Money,       8),
                new SqlParameter("@status",     SqlDbType.Int,         4),
                new SqlParameter("@remark",     SqlDbType.VarChar,   150),
                new SqlParameter("@addTime",    SqlDbType.DateTime),
                new SqlParameter("@addUser",    SqlDbType.Int,         4),
                new SqlParameter("@infoType",   SqlDbType.Int,         4),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.typeId;
            parameters[1].Value  = model.typeName;
            parameters[2].Value  = model.userId;
            parameters[3].Value  = model.orderId;
            parameters[4].Value  = model.orderNo;
            parameters[5].Value  = model.orderTotal;
            parameters[6].Value  = model.payType;
            parameters[7].Value  = model.moneyValue;
            parameters[8].Value  = model.status;
            parameters[9].Value  = model.remark;
            parameters[10].Value = model.addTime;
            parameters[11].Value = model.addUser;
            parameters[12].Value = model.infoType;
            parameters[13].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }