Beispiel #1
0
        /// <summary>
        /// Updates a Layer record and returns the number of records affected
        /// </summary>
        public static int Update(LayerDO DO)
        {
            SqlParameter _LayerID = new SqlParameter("LayerID", SqlDbType.VarChar);
            SqlParameter _Required = new SqlParameter("Required", SqlDbType.Bit);
            
            _LayerID.Value = DO.LayerID;
            _Required.Value = DO.Required;
            
            SqlParameter[] _params = new SqlParameter[] {
                _LayerID,
                _Required
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            return DataCommon.ExecuteScalar("[dbo].[Layer_Update]", _params, pid);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new Layer record using async
        /// </summary>
        public static async Task CreateAsync(LayerDO DO)
        {
            SqlParameter _LayerID = new SqlParameter("LayerID", SqlDbType.VarChar);
            SqlParameter _Required = new SqlParameter("Required", SqlDbType.Bit);
            
            _LayerID.Value = DO.LayerID;
            _Required.Value = DO.Required;
            
            SqlParameter[] _params = new SqlParameter[] {
                _LayerID,
                _Required
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            await DataCommon.ExecuteNonQueryAsync("[dbo].[Layer_Insert]", _params, pid);
            
        }
Beispiel #3
0
        /// <summary>
        /// Gets all Layer records
        /// </summary>
        public static async Task<LayerDO[]> GetAllAsync()
        {

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[Layer_GetAll]", new SqlParameter[] { }, pid);
            
            List<LayerDO> objs = new List<LayerDO>();
            
            while(sr.Read()){

                LayerDO obj = new LayerDO();
                
                obj.LayerID = sr.GetString(sr.GetOrdinal("LayerID"));
                if (sr.IsDBNull(sr.GetOrdinal("Required"))) { obj.Required = null; } else { obj.Required = sr.GetBoolean(sr.GetOrdinal("Required")); }


                objs.Add(obj);
            }

            return objs.ToArray();
        }
Beispiel #4
0
        /// <summary>
        /// Selects Layer records by PK
        /// </summary>
        public static async Task<LayerDO[]> GetByPKAsync(String LayerID)
        {

            SqlParameter _LayerID = new SqlParameter("LayerID", SqlDbType.VarChar);
			
            _LayerID.Value = LayerID;
			
            SqlParameter[] _params = new SqlParameter[] {
                _LayerID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[Layer_GetByPK]", _params, pid);


            List<LayerDO> objs = new List<LayerDO>();
			
            while(sr.Read())
            {
                LayerDO obj = new LayerDO();
				
                obj.LayerID = sr.GetString(sr.GetOrdinal("LayerID"));
                if (sr.IsDBNull(sr.GetOrdinal("Required"))) { obj.Required = null; } else { obj.Required = sr.GetBoolean(sr.GetOrdinal("Required")); }

                objs.Add(obj);
            }

            return objs.ToArray();
        }
Beispiel #5
0
        /// <summary>
        /// Deletes a Layer record
        /// </summary>
        public static async Task<int> DeleteAsync(LayerDO DO)
        {
            SqlParameter _LayerID = new SqlParameter("LayerID", SqlDbType.VarChar);
            
            _LayerID.Value = DO.LayerID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _LayerID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            return await DataCommon.ExecuteScalarAsync("[dbo].[Layer_Delete]", _params, pid);
        }