protected void btnguardar_Click(object sender, EventArgs e)
 {
     CentroFormacionWS.CentrosFormacionServiceClient proxy = new CentroFormacionWS.CentrosFormacionServiceClient();
     CentroFormacionWS.Mensaje MensajeCentroFormacion;
     if (Session["CentroFormacionExistente"] == null) /*Nuevo Registro*/
     {
         MensajeCentroFormacion = proxy.RegistrarCentroFormacion(txtinstitucion.Text, cbotipo.SelectedValue, txturl.Text, filarchivo.FileName);
     }
     else /*Modificar Registro*/
     {
         CentroFormacionWS.ECentroFormacion CentroFormacionExistente = (CentroFormacionWS.ECentroFormacion)Session["centroFormacionExistente"];
         string archivo = String.IsNullOrEmpty(filarchivo.FileName) ? CentroFormacionExistente.Archivo : filarchivo.FileName;
         MensajeCentroFormacion = proxy.ActualizarCentroFormacion(CentroFormacionExistente.Codigo, txtinstitucion.Text, cbotipo.SelectedValue, txturl.Text, archivo);
     }
     if (MensajeCentroFormacion.codigoMensaje == "E")
     {
         if (!String.IsNullOrEmpty(filarchivo.FileName))
         {
             CargarImagen(filarchivo.FileName);
         }
         ClientScript.RegisterStartupScript(this.GetType(), "Alerta", "<script>$('#mensaje').html(GenerarMensaje('" + MensajeCentroFormacion.textMensaje + "', 'ok'))</script>");
         lblTitulo.InnerHtml = "Registro de Centro de Formación";
         Session["CentroFormacionExistente"] = null;
         Limpiar();
     }
     else
     {
         ClientScript.RegisterStartupScript(this.GetType(), "Alerta", "<script>$('#mensaje').html(GenerarMensaje('" + MensajeCentroFormacion.textMensaje + "', 'error'))</script>");
     }
 }
Exemplo n.º 2
0
 public void TestRegistrar()
 {
     CentroFormacionWS.CentrosFormacionServiceClient proxy = new CentroFormacionWS.CentrosFormacionServiceClient();
     CentroFormacionWS.Mensaje MensajeCentroFormacion = proxy.RegistrarCentroFormacion("CIBERTE", "Instituto", "www.cibertec.edu.pe", "cibertec.png");
     Assert.AreEqual("E", MensajeCentroFormacion.codigoMensaje);
 }