Esempio n. 1
0
        public bool Delete( int Codigo )
        {
            Query query = new Query( "api/personal/" + Codigo );

            try
            {
                query.SendRequestDELETE();

                if ( query.ResponseStatusCode == HttpStatusCode.InternalServerError )
                    throw new ArgumentNullException( "Existe un error en el servidor:\n" + this._msgExceptionPersonal, "Error en el Servidor" );
                else if ( query.ResponseStatusCode == HttpStatusCode.NotFound )
                    throw new ArgumentNullException( "No se encontro recurso al cual acceder", "Recurso no encontrado" );

                msgResponse resp = JsonConvert.DeserializeObject<msgResponse>( query.ResponseContent );

                if ( query.ResponseStatusCode == HttpStatusCode.BadRequest )
                    throw new InvalidOperationException( resp.message );

                return Convert.ToBoolean( resp.data );
            }
            catch ( Exception e )
            {
                this._msgExceptionPersonal = e.Message;
                return false;
            }
        }
Esempio n. 2
0
        public bool Delete( int CodigoBranch )
        {
            Query oQuery = new Query( "api/institution/branches/" + CodigoBranch );

            try
            {
                oQuery.SendRequestDELETE();

                if ( oQuery.ResponseStatusCode == HttpStatusCode.InternalServerError )
                    throw new ArgumentNullException( "Existe un error en el servidor:\n" + this._exceptionHistory, "Error en el Servidor" );
                else if ( oQuery.ResponseStatusCode == HttpStatusCode.NotFound )
                    throw new ArgumentNullException( "No se encontro recurso al cual acceder", "Recurso no encontrado" );

                msgResponse resp = JsonConvert.DeserializeObject<msgResponse>( oQuery.ResponseContent );

                if ( oQuery.ResponseStatusCode == HttpStatusCode.BadRequest )
                    throw new InvalidOperationException( resp.message );

                return true;
            }
            catch ( Exception e )
            {
                this.ExceptionHistory = e.Message;
                return false;
            }
        }
Esempio n. 3
0
        public bool Delete(string CodigoMaterialSalon)
        {
            Query query = new Query("api/students/destroy/" + CodigoMaterialSalon);
            try
            {
                query.SendRequestDELETE();

                if (query.ResponseStatusCode != HttpStatusCode.OK)
                    throw new ArgumentException(query.MsgExceptionQuery, "ERROR AL ELIMINAR EL MATERIAL");

                return Convert.ToBoolean(query.ResponseContent);
            }
            catch (Exception e)
            {
                this._msgException = e.Message;
                return false;
            }
        }
Esempio n. 4
0
        public bool Delete( int CodigoStudent, int CodigoParent )
        {
            Query query = new Query( "api/students/" + CodigoStudent + "/parents/" + CodigoParent );
            try
            {
                query.SendRequestDELETE();

                if ( query.ResponseStatusCode != HttpStatusCode.OK )
                    throw new ArgumentException( query.MsgExceptionQuery, "ERROR AL ELIMINAR EL PARIENTE DEL ALUMNO" );

                return Convert.ToBoolean( query.ResponseContent );
            }
            catch ( Exception e )
            {
                this.MsgExceptionParents = e.Message;
                return false;
            }
        }
Esempio n. 5
0
        public bool Delete(int CodigoIngreso, int CodigoMaterial)
        {
            Query query = new Query("api/material/"+CodigoMaterial+ "/entry/"+ CodigoMaterial);

            try
            {
                query.SendRequestDELETE();

                if (query.ResponseStatusCode != HttpStatusCode.OK)
                    throw new ArgumentException(query.MsgExceptionQuery, "ERROR AL ELIMINAR ESTE INGRESO");

                return Convert.ToBoolean(query.ResponseContent);
            }
            catch (Exception e)
            {
                this._msgException = e.Message;
                return false;
            }
        }
Esempio n. 6
0
        public bool DeleteMaterialsToAula( int CodigoSalon, string Keys )
        {
            Query oQuery = new Query( string.Format("api/control/aula/{0}/asign/material/{1}", CodigoSalon, Keys ) );

            try
            {
                oQuery.SendRequestDELETE();

                if ( oQuery.ResponseStatusCode == HttpStatusCode.InternalServerError )
                    throw new ArgumentNullException( "Existe un error en el servidor:\n", "Error en el Servidor" );
                else if ( oQuery.ResponseStatusCode == HttpStatusCode.NotFound )
                    throw new ArgumentNullException( "No se encontro recurso al cual acceder", "Recurso no encontrado" );

                msgResponse resp = JsonConvert.DeserializeObject<msgResponse>( oQuery.ResponseContent );

                if ( oQuery.ResponseStatusCode == HttpStatusCode.BadRequest )
                    throw new InvalidOperationException( resp.message );

                return Convert.ToBoolean( resp.data );
            }
            catch ( Exception e )
            {
                this._ExceptionCM = e.Message;
                return false;
            }
        }
Esempio n. 7
0
        public bool DeleteStudent( int codalumno )
        {
            Query query = new Query( this._AlumnoCtrl + "/" + codalumno );

            try
            {
                query.SendRequestDELETE();

                if ( query.ResponseStatusCode != HttpStatusCode.Accepted )
                    throw new ArgumentException( query.MsgExceptionQuery, "ERROR AL ELIMINARR EL ALUMNO" );

                return true;
            }
            catch ( Exception e )
            {
                this._msgExceptionRegAlumno = e.Message;
                return false;
            }
        }