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; } }
public bool Update(int Codigo , int codigoAula) { Query query = new Query("api/students/update/" + Codigo); query.RequestParameters = this._data; try { query.SendRequestPUT(); if (query.ResponseStatusCode != HttpStatusCode.OK) throw new ArgumentNullException(query.MsgExceptionQuery, "HUBO UN ERROR AL INTENTAR MODIFICAR AL APODERADO"); return Convert.ToBoolean(query.ResponseContent); } catch (Exception e) { this._msgException = e.Message; return false; } }
public bool Modify( int Codigo ) { Query query = new Query( "api/personal/" + Codigo ); if ( !string.IsNullOrEmpty( this._data.ImageKey ) && !string.IsNullOrEmpty( this._data.ImageSrc ) ) { this._file.Add( this._data.ImageKey, this._data.ImageSrc ); this._data.ImageSrc = string.Empty; } query.RequestParameters = this._data; if ( this._file.Any() ) query.AddRequestFiles( this._file ); try { query.SendRequestPUT(); 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; } }
public bool SendLogOut() { var parameters = new Dictionary<string, string>(); Query Oquery = new Query( this._Controller ); OpLogin objlogin = new OpLogin(); OpLoginData objdata = new OpLoginData(); objlogin.msg = "Soy un mensaje"; objdata.FullName = "soy un fullname"; objdata.ImagePath = "soy un imagepath"; objdata.TypeUser = "******"; objlogin.data = objdata; Oquery.RequestParameters = objlogin; try { Oquery.SendRequestPUT("0"); if ( Oquery.ResponseStatusCode == HttpStatusCode.Accepted ) { this.setAppSettings( "UserName", "" ); this.setAppSettings( "UserType", "" ); this.setAppSettings( "UserPictureUrl", "" ); this.AuthToken = ""; } return true; } catch ( Exception e ) { this._msgExceptionLogin = e.Message; return false; } }
public bool Update() { Query oQuery = new Query( "api/institution/information/" + this._data.Codigo ); oQuery.RequestParameters = this._data; try { oQuery.SendRequestPUT("put"); 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.Accepted ) { throw new ArgumentNullException( "Error en el Servidor la consulta a sido detenida" ); } return Convert.ToBoolean( oQuery.ResponseContent ); } catch ( Exception e ) { this.ExceptionInfo = e.Message; return false; } }
public tMaterial Update( int Codigo ) { Query oQuery = new Query( "api/control/material/" + Codigo ); this._dataMaterial.Category = this._dataCategoria; this._dataMaterial.Marca = this._dataMarca; oQuery.RequestParameters = this._dataMaterial; try { oQuery.SendRequestPUT("put"); 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<tMaterial>( resp.data ); } catch ( Exception e ) { this._ExceptionCM = e.Message; return null; } }
public bool Modify() { Query oQuery = new Query( "api/institution/branches/" + this._data.Codigo ); try { oQuery.RequestParameters = this._data; oQuery.SendRequestPUT("put"); 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; } }
public bool ModifyStudent( int Codigo ) { Query query = new Query( this._AlumnoCtrl + "/" + Codigo ); this._dataMain.Alumno = this._dataAlumno; if ( !string.IsNullOrEmpty( this._dataAlumno.ImageKey ) && !string.IsNullOrEmpty( this._dataAlumno.ImageSrc ) ) { this._File.Add( this._dataAlumno.ImageKey, this._dataAlumno.ImageSrc ); this._dataMain.Alumno.ImageSrc = string.Empty; } query.RequestParameters = this._dataMain; if ( this._File.Any() ) query.AddRequestFiles( this._File ); try { query.SendRequestPUT(); if ( query.ResponseStatusCode != HttpStatusCode.Accepted ) throw new ArgumentNullException( query.MsgExceptionQuery, "ERROR AL MODIFICAR EL ESTUDIANTE" ); return true; } catch ( Exception e ) { this._msgExceptionRegAlumno = e.Message; return false; } }
public bool SendLogOut() { Query Oquery = new Query( this._Controller ); try { Oquery.SendRequestPUT(); if ( Oquery.ResponseStatusCode == HttpStatusCode.Accepted ) { this.setAppSettings( "UserName", "" ); this.setAppSettings( "UserType", "" ); this.setAppSettings( "UserPictureUrl", "" ); this.AuthToken = ""; } return true; } catch ( Exception e ) { this._msgExceptionLogin = e.Message; return false; } }
public bool UpdateQuantityIngresosOfMaterial(int CodigoMaterial, int CodigoIngreso) { Query query = new Query("api/material/" + CodigoMaterial + "/entry/" + CodigoIngreso); query.RequestParameters = this._data; try { query.SendRequestPUT(); if (query.ResponseStatusCode != HttpStatusCode.OK) throw new ArgumentNullException(query.MsgExceptionQuery, "Error al modificar la cantidad del Ingreso"); return Convert.ToBoolean(query.ResponseContent); } catch (Exception e) { this._msgException = e.Message; return false; } }
public bool Update() { Query oQuery = new Query( "api/institution/history/" + this._data.Codigo ); oQuery.RequestParameters = this._data; try { oQuery.SendRequestPUT( "put" ); if ( oQuery.ResponseStatusCode == HttpStatusCode.NotModified ) { throw new ArgumentNullException( oQuery.ResponseContent, "NO SE ACTUALIZÓ 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; } }