Beispiel #1
0
        /// <summary>
        /// 地面摄像头添加函数,添加删除和管理的数据库连接还存在问题
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add(Model.SPYCAM_RANGE model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("INSERT INTO SPYCAM_RANGE(");
            strSql.Append("PLATFORM_ID,PLATFORM_Name,NumberOfSensor,");
            strSql.Append("HorizontalRotationAngle,VerticalRotationAngle)");
            strSql.Append(" Values(");
            strSql.Append("@in_PLATFORM_ID,@in_PLATFORM_Name,@in_NumberOfSensor,");
            strSql.Append("@in_HorizontalRotationAngle,@in_VerticalRotationAngle)");
            SqlParameter[] cmdParms = new SqlParameter[] {
                new SqlParameter("@in_PLATFORM_ID", SqlDbType.Decimal),
                new SqlParameter("@in_PLATFORM_Name", SqlDbType.NVarChar),
                new SqlParameter("@in_NumberOfSensor", SqlDbType.Decimal),
                new SqlParameter("@in_HorizontalRotationAngle", SqlDbType.Decimal),
                new SqlParameter("@in_VerticalRotationAngle", SqlDbType.Decimal)
            };

            cmdParms[0].Value = model.PLATFORM_ID;
            cmdParms[1].Value = model.PLATFORM_Name;
            cmdParms[2].Value = model.NumberOfSensor;
            cmdParms[3].Value = model.HorizontalRotationAngle;
            cmdParms[4].Value = model.VerticalRotationAngle;

            return(DbHelperSQL.ExecuteSql(strSql.ToString(), cmdParms));
        }
Beispiel #2
0
        /// <summary>
        /// 根据地面摄像头平台ID修改数据库中的一条记录
        /// </summary>
        /// <param name="model"></param>无人机平台实体类的实例
        /// <returns></returns>返回值为修改的记录数
        public int Update(Model.SPYCAM_RANGE model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Update SPYCAM_RANGE set ");

            strSql.Append("PLATFORM_Name=@in_PLATFORM_Name,");
            strSql.Append("NumberOfSensor=@in_NumberOfSensor,");
            strSql.Append("HorizontalRotationAngle=@in_HorizontalRotationAngle,");
            strSql.Append("VerticalRotationAngle=@in_VerticalRotationAngle");

            strSql.Append(" where PLATFORM_ID=@in_PLATFORM_ID");

            SqlParameter[] cmdParms = new SqlParameter[] {
                new SqlParameter("@in_PLATFORM_ID", SqlDbType.Decimal),
                new SqlParameter("@in_PLATFORM_Name", SqlDbType.NVarChar),
                new SqlParameter("@in_NumberOfSensor", SqlDbType.Decimal),
                new SqlParameter("@in_HorizontalRotationAngle", SqlDbType.Decimal),
                new SqlParameter("@in_VerticalRotationAngle", SqlDbType.Decimal)
            };

            cmdParms[0].Value = model.PLATFORM_ID;
            cmdParms[1].Value = model.PLATFORM_Name;
            cmdParms[2].Value = model.NumberOfSensor;
            cmdParms[3].Value = model.HorizontalRotationAngle;
            cmdParms[4].Value = model.VerticalRotationAngle;

            return(DbHelperSQL.ExecuteSql(strSql.ToString(), cmdParms));
        }
Beispiel #3
0
        //该类中需要实现 通过PLATFORM_ID来查找所需的飞艇速度和续航时间
        public Model.SPYCAM_RANGE GetModel(decimal platformid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Select * From SPYCAM_RANGE ");
            strSql.Append(" Where PLATFORM_ID=" + platformid);
            Model.SPYCAM_RANGE model = null;

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