コード例 #1
0
        protected void btn_guardar_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (FormAccion == "Agregar")
                {
                    WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                    wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                    WSGestion.MOD_Medico_Veterinario obj = new WSGestion.MOD_Medico_Veterinario();

                    obj.MVE_nombre = txt_nombre.Value;
                    obj.MVE_apellido1 = txt_apellido1.Value;
                    obj.MVE_apellido2 = txt_apellido2.Value;
                    obj.MVE_cod_medico_veterinario = Convert.ToInt32( txt_codigo.Value);
                    obj.MVE_id_medico_veterinario = Convert.ToInt32(txt_codigo.Value);
                    obj.MVE_id_estado_medico_veterinario = Convert.ToInt32(dlEstado.SelectedValue);
                    wsgest.CRE_Medico_Veterinario(obj);
                    Response.Redirect("frm_Grid_Medico_Veterinario.aspx");
                }

                if (FormAccion == "Editar")
                {
                    WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                    wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                    WSGestion.MOD_Medico_Veterinario obj = new WSGestion.MOD_Medico_Veterinario();

                    obj.MVE_nombre = txt_nombre.Value;
                    obj.MVE_apellido1 = txt_apellido1.Value;
                    obj.MVE_apellido2 = txt_apellido2.Value;
                    obj.MVE_cod_medico_veterinario = Convert.ToInt32(txt_codigo.Value);
                    obj.MVE_id_medico_veterinario = Convert.ToInt32(txt_codigo.Value);
                    obj.MVE_id_estado_medico_veterinario = Convert.ToInt32(dlEstado.SelectedValue);
                    wsgest.UPD_Medico_Veterinario(obj);
                    Response.Redirect("frm_Grid_Medico_Veterinario.aspx");
                }
            }

            catch (Exception exc)
            {
                Alert_Mensaje.Attributes["class"] = "alert alert-danger";
                mensaje_alerta = exc.ToString();
                titulo_mensaje_alerta = "Error: ";
                Alert_Mensaje.Visible = true;
            }
        }
コード例 #2
0
        private void Carga_Editar()
        {
            try
            {
                WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                WSGestion.MOD_Medico_Veterinario obj = new WSGestion.MOD_Medico_Veterinario();
                obj = wsgest.SEL_GRID_BY_ID_Medico_Veterinario(codigo_seleccionado);
                txt_codigo.Value = codigo_seleccionado.ToString();
                txt_nombre.Value = obj.MVE_nombre;
                txt_apellido1.Value = obj.MVE_apellido1;
                txt_apellido2.Value = obj.MVE_apellido2;
                dlEstado.SelectedValue = obj.ESTMED_id_estado_medico_veterinario.ToString();

            }
            catch (Exception exc)
            {
                WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Codigo_Select"] = "0";
                Alert_Mensaje.Attributes["class"] = "alert alert-danger";
                mensaje_alerta = exc.ToString();
                titulo_mensaje_alerta = "Error: ";
                Alert_Mensaje.Visible = true;
            }
        }