Ejemplo n.º 1
0
        /// <summary>
        /// 根据传感器ID修改数据库中的一条记录
        /// </summary>
        /// <param name="model"></param>第一类传感器实体类的实例
        /// <returns></returns>返回值为修改的记录数
        public int Update(Model.SENSOR_2 model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Update SENSOR_2 set ");

            strSql.Append("SensorName=@in_SensorName,");
            strSql.Append("PLATFORM_ID=@in_PLATFORM_ID,");
            strSql.Append("SensorType=@in_SensorType,");
            strSql.Append("Application=@in_Application,");
            strSql.Append("Pixel=@in_Pixel,");
            strSql.Append("Resolution=@in_Resolution,");
            strSql.Append("HorizontalResolution=@in_HorizontalResolution,");
            strSql.Append("MinIllumination=@in_MinIllumination,");
            strSql.Append("LookAngle=@in_LookAngle,");
            strSql.Append("SquintAngle=@in_SquintAngle,");
            strSql.Append("MaxDistance=@in_MaxDistance,");
            strSql.Append("Aperture=@in_Aperture,");
            strSql.Append("FocalLength=@in_FocalLength,");
            strSql.Append("MAXGSD=@in_MAXGSD");

            strSql.Append(" where SensorID=@in_SensorID");

            SqlParameter[] cmdParms = new SqlParameter[] {
                new SqlParameter("@in_SensorID", SqlDbType.Decimal),
                new SqlParameter("@in_SensorName", SqlDbType.NVarChar),
                new SqlParameter("@in_PLATFORM_ID", SqlDbType.Decimal),
                new SqlParameter("@in_SensorType", SqlDbType.NVarChar),
                new SqlParameter("@in_Application", SqlDbType.NVarChar),
                new SqlParameter("@in_Pixel", SqlDbType.Decimal),
                new SqlParameter("@in_Resolution", SqlDbType.Decimal),
                new SqlParameter("@in_HorizontalResolution", SqlDbType.Decimal),
                new SqlParameter("@in_MinIllumination", SqlDbType.Decimal),
                new SqlParameter("@in_LookAngle", SqlDbType.Decimal),

                new SqlParameter("@in_SquintAngle", SqlDbType.Decimal),
                new SqlParameter("@in_MaxDistance", SqlDbType.Decimal),
                new SqlParameter("@in_Aperture", SqlDbType.Decimal),
                new SqlParameter("@in_FocalLength", SqlDbType.Decimal),
                new SqlParameter("@in_MAXGSD", SqlDbType.Decimal)
            };

            cmdParms[0].Value = model.SensorID;
            cmdParms[1].Value = model.SensorName;
            cmdParms[2].Value = model.PLATFORM_ID;
            cmdParms[3].Value = model.SensorType;

            cmdParms[4].Value  = model.Application;
            cmdParms[5].Value  = model.Pixel;
            cmdParms[6].Value  = model.Resolution;
            cmdParms[7].Value  = model.HorizontalResolution;
            cmdParms[8].Value  = model.MinIllumination;
            cmdParms[9].Value  = model.LookAngle;
            cmdParms[10].Value = model.SquintAngle;
            cmdParms[11].Value = model.MaxDistance;
            cmdParms[12].Value = model.Aperture;
            cmdParms[13].Value = model.FocalLength;
            cmdParms[14].Value = model.MAXGSD;
            return(DbHelperSQL.ExecuteSql(strSql.ToString(), cmdParms));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 第二类传感器添加函数
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add(Model.SENSOR_2 model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("INSERT INTO SENSOR_2(");
            strSql.Append("SensorID,SensorName,PLATFORM_ID,SensorType,Application,");
            strSql.Append("Pixel,Resolution,HorizontalResolution,MinIllumination,");
            strSql.Append("LookAngle,SquintAngle,MaxDistance,Aperture,FocalLength,MAXGSD)");
            strSql.Append(" Values(");
            strSql.Append("@in_SensorID,@in_SensorName,@in_PLATFORM_ID,@in_SensorType,");
            strSql.Append("@in_Application,@in_Pixel,@in_Resolution,@in_HorizontalResolution,@in_MinIllumination,@in_LookAngle,");
            strSql.Append("@in_SquintAngle,@in_MaxDistance,@in_Aperture,@in_FocalLength,@in_MAXGSD)");
            SqlParameter[] cmdParms = new SqlParameter[] {
                new SqlParameter("@in_SensorID", SqlDbType.Decimal),
                new SqlParameter("@in_SensorName", SqlDbType.NVarChar),
                new SqlParameter("@in_PLATFORM_ID", SqlDbType.Decimal),
                new SqlParameter("@in_SensorType", SqlDbType.NVarChar),
                new SqlParameter("@in_Application", SqlDbType.NVarChar),
                new SqlParameter("@in_Pixel", SqlDbType.Decimal),
                new SqlParameter("@in_Resolution", SqlDbType.Decimal),
                new SqlParameter("@in_HorizontalResolution", SqlDbType.Decimal),
                new SqlParameter("@in_MinIllumination", SqlDbType.Decimal),
                new SqlParameter("@in_LookAngle", SqlDbType.Decimal),

                new SqlParameter("@in_SquintAngle", SqlDbType.Decimal),
                new SqlParameter("@in_MaxDistance", SqlDbType.Decimal),
                new SqlParameter("@in_Aperture", SqlDbType.Decimal),
                new SqlParameter("@in_FocalLength", SqlDbType.Decimal),
                new SqlParameter("@in_MAXGSD", SqlDbType.Decimal)
            };

            cmdParms[0].Value = model.SensorID;
            cmdParms[1].Value = model.SensorName;
            cmdParms[2].Value = model.PLATFORM_ID;
            cmdParms[3].Value = model.SensorType;

            cmdParms[4].Value  = model.Application;
            cmdParms[5].Value  = model.Pixel;
            cmdParms[6].Value  = model.Resolution;
            cmdParms[7].Value  = model.HorizontalResolution;
            cmdParms[8].Value  = model.MinIllumination;
            cmdParms[9].Value  = model.LookAngle;
            cmdParms[10].Value = model.SquintAngle;
            cmdParms[11].Value = model.MaxDistance;
            cmdParms[12].Value = model.Aperture;
            cmdParms[13].Value = model.FocalLength;
            cmdParms[14].Value = model.MAXGSD;

            return(DbHelperSQL.ExecuteSql(strSql.ToString(), cmdParms));//执行SQL语句,还需修改数据库连接的问题
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        /// <param name="SensorID"></param>
        /// <returns></returns>
        public Model.SENSOR_2 GetModel(decimal SensorID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Select * from SENSOR_2 ");
            strSql.Append(" Where SensorID=" + SensorID);
            Model.SENSOR_2 model = null;

            using (DbDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString()))
            {
                while (dr.Read())
                {
                    model = GetModel(dr);//本类中的重载函数
                }
                return(model);
            }
        }