Esempio n. 1
0
        public List<tMaterialSalon> AsignMaterialsToAula( int CodigoSalon, int CodigoMaterial, int Cantidad )
        {
            Query oQuery = new Query( string.Format( "api/control/aula/{0}/material/{1}/quantity/{2}", CodigoSalon, CodigoMaterial, Cantidad ) );

            try
            {
                oQuery.SendRequestPOST();

                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 JsonConvert.DeserializeObject<List<tMaterialSalon>>( resp.data );
            }
            catch ( Exception ex )
            {
                this._ExceptionCM = ex.Message;
                return null;
            }
        }
Esempio n. 2
0
        public bool Insert()
        {
            Query oQuery = new Query( "api/institution/history" );

            oQuery.RequestParameters = this._data;

            try
            {
                oQuery.SendRequestPOST();

                if ( oQuery.ResponseStatusCode == HttpStatusCode.NotModified )
                {
                    throw new ArgumentNullException( oQuery.ResponseContent, "NO SE REALIZÓ EL REGISTRO" );
                }
                else if ( oQuery.ResponseStatusCode != HttpStatusCode.Accepted )
                {
                    throw new ArgumentNullException( "Error en el Servidor la consulta a sido detenida" );
                }

                return Convert.ToBoolean( oQuery.ResponseContent.Trim() );
            }
            catch ( Exception e )
            {
                this.ExceptionHistory = e.Message;
                return false;
            }
        }
Esempio n. 3
0
        public tInstitucion Find()
        {
            Query oQuery = new Query( "api/institution/information" );

            try
            {
                oQuery.SendRequestGET();

                if ( oQuery.ResponseStatusCode == HttpStatusCode.NotFound )
                {
                    throw new ArgumentNullException( "No se Encontro un El registro de la Institución", "No se Encontró Institución" );
                }
                else if ( oQuery.ResponseStatusCode != HttpStatusCode.Found )
                {
                    throw new ArgumentNullException( "Error en el Servidor la consulta a sido detenida" );
                }

                return JsonConvert.DeserializeObject<tInstitucion>( oQuery.ResponseContent );
            }
            catch( Exception e )
            {
                this.ExceptionInfo = e.Message;
                return null;
            }
        }
Esempio n. 4
0
        public string Insert()
        {
            Query oQuery = new Query( "api/institution/information" );

            oQuery.RequestParameters = this._data;

            try
            {
                oQuery.SendRequestPOST();

                if ( oQuery.ResponseStatusCode == HttpStatusCode.NotModified )
                {
                    throw new ArgumentNullException( "La Acción ha podido concluir, verifique sus datos y vuelva a intentarlo", "Regristro ó Modificación" );
                }
                else if ( oQuery.ResponseStatusCode != HttpStatusCode.Created )
                {
                    throw new ArgumentNullException( "Error en el Servidor la consulta a sido detenida" );
                }

                return (oQuery.ResponseContent.Replace('"', ' ') ).Trim();
            }
            catch ( Exception e )
            {
                this.ExceptionInfo = e.Message;
                return null;
            }
        }
Esempio n. 5
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. 6
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. 7
0
        public TVisionMision Find()
        {
            Query oQuery = new Query( "api/institution/vision_mision" );

            try
            {
                oQuery.SendRequestGET();

                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 JsonConvert.DeserializeObject<TVisionMision>( resp.data );
            }
            catch ( Exception e )
            {
                this.ExceptionHistory = e.Message;
                return null;
            }
        }
Esempio n. 8
0
        public bool Insert()
        {
            Query oQuery = new Query( "api/control/material/" + this._data.CodigoMaterial + "/income" );

            oQuery.RequestParameters = this._data;

            try
            {
                oQuery.SendRequestPOST();

                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.EXception = e.Message;
                return false;
            }
        }
Esempio n. 9
0
        public tPersonal Find( int ID )
        {
            Query oQuery = new Query( "api/personal/" + ID );

            try
            {
                oQuery.SendRequestGET();

                if ( oQuery.ResponseStatusCode == HttpStatusCode.InternalServerError )
                    throw new ArgumentNullException( "Existe un error en el servidor:\n" + this._msgExceptionPersonal, "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 JsonConvert.DeserializeObject<tPersonal>( resp.data );
            }
            catch ( Exception ex )
            {
                this._msgExceptionPersonal = ex.Message.ToString();
                return null;
            }
        }
Esempio n. 10
0
        public bool AsignBranch( int CodigoSucursal )
        {
            Query oQuery = new Query( "api/initial/institution/" + CodigoSucursal );

            try
            {
                oQuery.SendRequestGET();

                if ( oQuery.ResponseStatusCode == HttpStatusCode.InternalServerError )
                    throw new ArgumentNullException( "Existe un error en el servidor:\n" + this._exceptionUbigeo, "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 );

                AsignBranches asign = JsonConvert.DeserializeObject<AsignBranches>( resp.data );

                this.setAppSettings( "InstitutionCode", asign.Codigo );
                this.setAppSettings( "InstitutionName", asign.Name );
                this.setAppSettings( "InstitutionLogo", asign.Logo );
                this.setAppSettings( "BranchCode", asign.CodigoSucursal.ToString() );
                this.setAppSettings( "BranchAddress", asign.BranchAddress );

                return true;
            }
            catch ( Exception e )
            {
                this._exceptionUbigeo = e.Message;
                return false;
            }
        }
Esempio n. 11
0
        public tBranch Find( string Codigo )
        {
            if ( string.IsNullOrEmpty( Codigo ) )
                throw new InvalidOperationException( "No hay un Codigo Asignado a este recurso" );

            Query oQuery = new Query( "api/institution/branches/" + Codigo );

            try
            {
                oQuery.SendRequestGET();

                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 JsonConvert.DeserializeObject<tBranch>( resp.data );
            }
            catch ( Exception e )
            {
                this.ExceptionHistory = e.Message;
                return null;
            }
        }
Esempio n. 12
0
        public int CreateStudent( bool Individual = false )
        {
            Query query = new Query(  ( ! Individual ) ? this._pAlumnoCtrl : this._AlumnoCtrl );

            this._dataMain.Alumno = this._dataAlumno;

            if ( ! Individual ) //si no solo se registraran datos unicos del alumno
            {
                this._dataMain.Documentos = this._dataDocumento;
                this._dataMain.Apoderado = this._dataApoderado;
                this._dataMain.CursosExonerados = this._dataCursoExonerado;
            }

            //limpiando los datos de imagen de perfil y agregandolo al contenedor de imagenes
            if ( !string.IsNullOrEmpty( DataAlumno.ImageKey ) && !string.IsNullOrEmpty( DataAlumno.ImageSrc ) )
            {
                this._File.Add( this.DataAlumno.ImageKey, this.DataAlumno.ImageSrc );
                this._dataMain.Alumno.ImageSrc = string.Empty;
            }

            if ( !Individual )
            {
                int con = 0;

                //limpiando los datos de imagen de documento y agregandolos al contenedor de imagens
                foreach ( tDocumentoAlumno items in this._dataMain.Documentos )
                {
                    if ( !string.IsNullOrEmpty( items.ImageSrc ) && !string.IsNullOrEmpty( items.ImageKey ) )
                    {
                        this._File.Add( items.ImageKey, items.ImageSrc );
                        this._dataMain.Documentos[con].ImageSrc = string.Empty;
                        con++;
                    }
                }
            }

            query.RequestParameters = this._dataMain;

            if ( this._File.Any() )
                query.AddRequestFiles( this._File );

            try
            {
                query.SendRequestPOST();

                if ( query.ResponseStatusCode != HttpStatusCode.OK )
                    throw new ArgumentNullException( query.MsgExceptionQuery, "ERROR AL REGISTRO" );

                return Convert.ToInt32( query.ResponseContent );
            }
            catch ( Exception e )
            {
                this._msgExceptionRegAlumno = e.Message;
                return 0;
            }
        }
Esempio n. 13
0
        public DataSet ListaGradoSeccion( DataSet dts )
        {
            Query query = new Query( "api/initial/gradoseccion" );

            try
            {
                query.SendRequestGET();

                dts.Tables["Grados"].Clear();
                dts.Tables["Secciones"].Clear();
                dts.Tables["Niveles"].Clear();

                if ( query.ResponseStatusCode != HttpStatusCode.OK )
                {
                    throw new ArgumentNullException( "No se ha podido acceder a los datos", "Datos de Grados y Secciones" );
                }

                GradoSeccion grs = JsonConvert.DeserializeObject<GradoSeccion>( query.ResponseContent );

                foreach ( tGrado Item in grs.Grados )
                {
                    object[] td = new object[7] {
                        Item.Codigo, Item.CodigoNivel, Item.Name, Item.Preview, Item.Next, Item.Description, Item.ModifiedDate
                    };

                    dts.Tables["Grados"].Rows.Add( td );
                }

                foreach ( tSeccion Item in grs.Secciones )
                {
                    object[] td = new object[4] {
                        Item.Codigo, Item.Name, Item.Character, Item.ModifiedDate
                    };

                    dts.Tables["Secciones"].Rows.Add( td );
                }

                foreach ( tNivel Item in grs.Niveles )
                {
                    object[] td = new object[4] {
                        Item.Codigo, Item.Name, Item.Description, Item.ModifiedDate
                    };

                    dts.Tables["Niveles"].Rows.Add( td );
                }

                return dts;

            }
            catch ( Exception e )
            {
                this._exceptionUbigeo = e.Message;
                return null;
            }
        }
Esempio n. 14
0
        public bool ConfirmLogged()
        {
            Query oQuery = new Query( "api/prslog/confirm" );

            try
            {
                object arq = new object[2] { this.getAppSettings( "User" ), 1 };

                oQuery.RequestParameters = arq;

                oQuery.SendRequestPOST();

                if ( oQuery.ResponseStatusCode == HttpStatusCode.InternalServerError )
                    throw new ArgumentNullException( "Existe un error en el servidor:\n" + this._msgExceptionLogin, "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 );

                LoginData obj = JsonConvert.DeserializeObject<LoginData>( resp.data );

                if ( obj.UserLevel != "0" && obj.UserLevel != "1" && obj.UserLevel != "2" )
                    throw new InvalidOperationException( "TU NIVEL DE ACCESO NO ESTA PERMITIDO PARA ESTE SISTEMA" );

                this.setAppSettings( "UserName", obj.FullName );
                this.setAppSettings( "UserType", obj.UserType );
                this.setAppSettings( "UserLevel", obj.UserLevel );
                this.setAppSettings( "UserPictureUrl", ( ! string.IsNullOrEmpty(obj.ImagePath) ) ? this.ConfigBaseUrl + obj.ImagePath : "" );

                this.setAppSettings( "InstitutionName", obj.Institution.NameInstitution );
                this.setAppSettings( "InstitutionLogo", obj.Institution.LogoInstitution );
                this.setAppSettings( "BranchCode", obj.Institution.BranchCode.ToString() );
                this.setAppSettings( "BranchAddress", obj.Institution.BranchAddress );
                this.setAppSettings( "Remember_me", "true" );

                this.AuthToken = obj.Token;
                this.AccessLevel = Convert.ToInt32( obj.UserLevel );

                return true;

            }
            catch ( Exception e )
            {
                this._msgExceptionLogin = e.Message;
                return false;
            }
        }
Esempio n. 15
0
        public bool SendDataPersonal()
        {
            Query query = new Query(this._Controller);
            query.RequestParameters = this._DataPersonal;

            try
            {
                query.SendRequestPOST();
                return true;
            }
            catch (Exception e)
            {
                this._msgExceptionRegPersonal = e.Message;
                return false;
            }
        }
Esempio n. 16
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. 17
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. 18
0
        public tMaterial Find(int Codigo , int codigoMaterial)
        {
            Query query = new Query("api/students/show/" + Codigo);

            try
            {
                query.SendRequestGET();

                if (query.ResponseStatusCode != HttpStatusCode.OK)
                    throw new ArgumentNullException(query.ResponseContent, "ERROR AL OBTENER INFORMACION DEL MATERIAL ");

                return JsonConvert.DeserializeObject<tMaterial>(query.ResponseContent);
            }
            catch (Exception ex)
            {
                this._msgException = ex.Message;
                return null;
            }
        }
Esempio n. 19
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. 20
0
        public tApoderado Find( int CodigoStudents, int CodigoParent )
        {
            Query query = new Query( "api/students/" + CodigoStudents + "/parents/" + CodigoParent );

            try
            {
                query.SendRequestGET();

                if ( query.ResponseStatusCode != HttpStatusCode.OK )
                    throw new ArgumentNullException( "Docoumentos no encontrados", "NO SE ENCONTRO NIUNGUN PARIENTE" );

                return JsonConvert.DeserializeObject<tApoderado>( query.ResponseContent );
            }
            catch ( Exception ex )
            {
                this.MsgExceptionParents = ex.Message;
                return null;
            }
        }
Esempio n. 21
0
        public List<lMaterialOfAula>ListforAula(int codAula)
        {
            Query query = new Query("api/material/aula/" + codAula);

            try
            {
                query.SendRequestGET();

                if (query.ResponseStatusCode != HttpStatusCode.OK)
                    throw new ArgumentNullException("No se encontraron datos", "Materiales");

                return JsonConvert.DeserializeObject<List<lMaterialOfAula>>(query.ResponseContent);
            }
            catch (Exception ex)
            {
                this._msgExceptionRegMateriales = ex.Message;
                return null;
            }
        }
Esempio n. 22
0
        public bool SendLogin()
        {
            OpSendLogin objSend = new OpSendLogin();

            Query Oquery = new Query(this._Controller);

            try
            {
                objSend.UserNick = this._InputName;
                objSend.UserPass = this._InputPass;

                Oquery.RequestParameters = objSend;

                Oquery.SendRequestPOST();

                OpLogin obj = JsonConvert.DeserializeObject<OpLogin>( Oquery.ResponseContent );

                if( Oquery.ResponseStatusCode == HttpStatusCode.OK )
                {
                    this.setAppSettings( "UserName", obj.data.FullName );
                    this.setAppSettings( "UserType", obj.data.TypeUser );
                    this.setAppSettings( "UserPictureUrl", this.ConfigBaseUrl + obj.data.ImagePath );

                    this.AuthToken = Oquery.ResponseHeader[0].Value.ToString();

                    this._UserFullName  = obj.data.FullName;
                    this._UserType      = obj.data.TypeUser;
                    this._LocationImage = this.ConfigBaseUrl + obj.data.ImagePath;
                }
                else
                {
                    throw new Exception( obj.msg );
                }

                return true;
            }
            catch(Exception e)
            {
                this._msgExceptionLogin = e.Message;
                return false;
            }
        }
Esempio n. 23
0
        public tKardex Find(int CodigoMaterial, int CodigoIngreso)
        {
            Query query = new Query("api/material/"+ CodigoMaterial + "/entry/" + CodigoIngreso);

            try
            {
                query.SendRequestGET();

                if (query.ResponseStatusCode != HttpStatusCode.OK)
                    throw new ArgumentNullException("Docoumentos no encontrados", "No se encontro ningun Detalle");

                tKardex result = JsonConvert.DeserializeObject<tKardex>(query.ResponseContent);
                return result;
            }
            catch (Exception ex)
            {
                this.MsExecpcion = ex.Message;
                return null;
            }
        }
Esempio n. 24
0
        public int Insert()
        {
            Query query = new Query("api/students/insert");

            query.RequestParameters = this._data;

            try
            {
                query.SendRequestPOST();

                if (query.ResponseStatusCode != HttpStatusCode.Created)
                    throw new ArgumentNullException(query.MsgExceptionQuery, "ERROR");

                return Convert.ToInt32(query.ResponseContent); ;
            }
            catch (Exception e)
            {
                this._msgException = e.Message;
                return 0;
            }
        }
Esempio n. 25
0
        public int InsertReporteIndividual(int codigoMaterial, int codigoAula)
        {
            Query query = new Query("api/material/"+ codigoMaterial+ "/aula/"+ codigoAula + "/report");

            query.RequestParameters = this._reportar;

            try
            {
                query.SendRequestPOST();

                if (query.ResponseStatusCode != HttpStatusCode.Created)
                    throw new ArgumentNullException(query.MsgExceptionQuery, "ERROR");

                return Convert.ToInt32(query.ResponseContent); ;
            }
            catch (Exception e)
            {
                this._msgException = e.Message;
                return 0;
            }
        }
Esempio n. 26
0
        public int Insert( int CodigoStudent )
        {
            Query query = new Query( "api/students/" + CodigoStudent + "/parents" );

            query.RequestParameters = this._data;

            try
            {
                query.SendRequestPOST();

                if ( query.ResponseStatusCode != HttpStatusCode.Created )
                    throw new ArgumentNullException( query.MsgExceptionQuery, "ERROR AL REGISTRAR UN PARIENTE" );

                return Convert.ToInt32( query.ResponseContent ); ;
            }
            catch ( Exception e )
            {
                this.MsgExceptionParents = e.Message;
                return 0;
            }
        }
Esempio n. 27
0
        public bool VerifyApplication( string strUrl )
        {
            strUrl = (strUrl.Substring( ( strUrl.Length - 1 ), 1 ) != "/") ? strUrl + "/" : strUrl;

            Query query = new Query( "api", strUrl );

            try
            {
                query.SendRequestGET();

                if ( query.ResponseStatusCode != HttpStatusCode.Accepted )
                    throw new ArgumentNullException( "Existen errores en el servidor", "Errores en Servidor" );

                return true;

            }
            catch ( Exception e )
            {
                this._msgException = e.Message;
                return false;
            }
        }
Esempio n. 28
0
        public bool Update(int CodigoMaterial, int CodigoSalon)
        {
            Query query = new Query("api/students/update/" + CodigoMaterial);

            query.RequestParameters = this._data;

            try
            {
                query.SendRequestPUT();

                if (query.ResponseStatusCode != HttpStatusCode.OK)
                    throw new ArgumentNullException(query.MsgExceptionQuery, "ERROR");

                return Convert.ToBoolean(query.ResponseContent);

            }
            catch (Exception e)
            {
                this._msgExceptionSolMateriales = e.Message;
                return false;
            }
        }
Esempio n. 29
0
        public bool InfoInstitution()
        {
            Query query = new Query( "api/initial/periods" );

            try
            {
                query.SendRequestGET();

                if ( query.ResponseStatusCode == HttpStatusCode.NotFound )
                    throw new ArgumentNullException( "No se encontro recurso al cual acceder", "Recurso no encontrado" );
                else if ( query.ResponseStatusCode == HttpStatusCode.NoContent )
                    throw new ArgumentNullException( "No se han encontrado datos", "Lista Vacia" );
                else if ( query.ResponseStatusCode != HttpStatusCode.OK )
                    throw new ArgumentNullException( "Existe un error en el servidor:\n" + this._exceptionUbigeo, "Error en el Servidor" );

                InstitutionData data = JsonConvert.DeserializeObject< InstitutionData >( query.ResponseContent );

                return true;
            }
            catch ( Exception e )
            {
                this._exceptionUbigeo = e.Message;
                return false;
            }
        }
Esempio n. 30
0
        public DataSet ListUbigeo( DataSet dts )
        {
            Query query = new Query( this._ubigeoController );

            try
            {
                query.SendRequestGET();

                dts.Tables["Departamentos"].Clear();
                dts.Tables["Provincias"].Clear();
                dts.Tables["Distritos"].Clear();

                if ( query.ResponseStatusCode == HttpStatusCode.NotFound )
                    throw new ArgumentNullException( "No se encontro recurso al cual acceder", "Recurso no encontrado" );
                else if ( query.ResponseStatusCode == HttpStatusCode.NoContent )
                    throw new ArgumentNullException( "No se han encontrado datos", "Lista Vacia" );
                else if ( query.ResponseStatusCode != HttpStatusCode.OK )
                    throw new ArgumentNullException( "Existe un error en el servidor:\n" + this._exceptionUbigeo, "Error en el Servidor" );

                List<tDepartamentos> departamentos = JsonConvert.DeserializeObject<List<tDepartamentos>>( query.ResponseContent );

                int countProv = 1, countDist = 1;

                foreach ( tDepartamentos depItem in departamentos )
                {
                    string[] camposdep = new string[2] { depItem.Id.ToString(), depItem.Departamento};
                    dts.Tables["Departamentos"].Rows.Add(camposdep);

                    foreach ( tProvincias proItem in depItem.Provincias )
                    {
                        string[] campospro = new string[4] { countProv.ToString(), camposdep[0], proItem.Id.ToString(), proItem.Provincia };
                        dts.Tables["Provincias"].Rows.Add( campospro );

                        foreach ( tDistritos disItem in proItem.Distritos )
                        {
                            string[] camposdis = new string[4] { countDist.ToString(), campospro[0], disItem.Id.ToString(), disItem.Distrito };
                            dts.Tables["Distritos"].Rows.Add( camposdis );
                            countDist++;
                        }

                        countProv++;
                    }
                }

                return dts;

            }catch(Exception e)
            {
                this._exceptionUbigeo = e.Message;
                return null;
            }
        }