Exemple #1
0
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private Model.SATELLITE_TEMP GetModel(DbDataReader dr)
 {
     Model.SATELLITE_TEMP model = new Model.SATELLITE_TEMP();
     model.SATELLITE_ID         = Convert.ToDecimal(dr["SATELLITE_ID"]);
     model.SATELLITE_NAME       = Convert.ToString(dr["SATELLITE_NAME"]);
     model.SATELLITE_UPDATETIME = Convert.ToDateTime(dr["SATELLITE_UPDATETIME"]);
     model.SATELLITE_CHOOSE     = Convert.ToInt32(dr["SATELLITE_CHOOSE"]);
     return(model);
 }
Exemple #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.SATELLITE_TEMP GetModel(decimal SATELLITE_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("SELECT * FROM SATELLITE_TEMP ");
            strSql.Append(" WHERE SATELLITE_ID=" + SATELLITE_ID);
            Model.SATELLITE_TEMP model = null;
            using (DbDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (dr.Read())
                {
                    model = GetModel(dr);
                }
                return(model);
            }
        }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.SATELLITE_TEMP model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("INSERT INTO SATELLITE_TEMP(");
            strSql.Append("SATELLITE_ID,SATELLITE_NAME,SATELLITE_UPDATETIME,SATELLITE_CHOOSE)");
            strSql.Append(" VALUES (");
            strSql.Append("@in_SATELLITE_ID,@in_SATELLITE_NAME,@in_SATELLITE_UPDATETIME,@in_SATELLITE_CHOOSE)");
            SqlParameter[] cmdParms = new SqlParameter[] {
                new SqlParameter("@in_SATELLITE_ID", SqlDbType.Decimal),
                new SqlParameter("@in_SATELLITE_NAME", SqlDbType.NVarChar),
                new SqlParameter("@in_SATELLITE_UPDATETIME", SqlDbType.NVarChar),
                new SqlParameter("@in_SATELLITE_CHOOSE", SqlDbType.Int)
            };
            cmdParms[0].Value = model.SATELLITE_ID;
            cmdParms[1].Value = model.SATELLITE_NAME;
            cmdParms[2].Value = model.SATELLITE_UPDATETIME;
            cmdParms[3].Value = model.SATELLITE_CHOOSE;
            return(DbHelperSQL.ExecuteSql(strSql.ToString(), cmdParms));
        }
Exemple #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(Model.SATELLITE_TEMP model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("UPDATE SATELLITE_TEMP SET ");
            strSql.Append("SATELLITE_NAME=@in_SATELLITE_NAME,");
            strSql.Append("SATELLITE_UPDATETIME=@in_SATELLITE_UPDATETIME,");
            strSql.Append("SATELLITE_CHOOSE=@in_SATELLITE_CHOOSE");
            strSql.Append(" WHERE SATELLITE_ID=@in_SATELLITE_ID");
            SqlParameter[] cmdParms = new SqlParameter[] {
                new SqlParameter("@in_SATELLITE_ID", SqlDbType.Decimal),
                new SqlParameter("@in_SATELLITE_NAME", SqlDbType.NVarChar),
                new SqlParameter("@in_SATELLITE_UPDATETIME", SqlDbType.NVarChar),
                new SqlParameter("@in_SATELLITE_CHOOSE", SqlDbType.Int)
            };
            cmdParms[0].Value = model.SATELLITE_ID;
            cmdParms[1].Value = model.SATELLITE_NAME;
            cmdParms[2].Value = model.SATELLITE_UPDATETIME;
            cmdParms[3].Value = model.SATELLITE_CHOOSE;
            return(DbHelperSQL.ExecuteSql(strSql.ToString(), cmdParms));
        }