protected void btn_guardar_ServerClick(object sender, EventArgs e) { if (this.Page.IsValid) { try { if (FormAccion == "Agregar") { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Mascota obj = new WSGestion.MOD_Mascota(); txt_codigo.Value = "0"; obj.MAS_id_mascota = Convert.ToInt32(txt_codigo.Value); obj.MAS_id_raza = Convert.ToInt32(dlRaza.SelectedValue); obj.MAS_nombre = txt_nombre.Value; obj.MAS_fecha_nacimiento = txt_fecha_nacimiento.Text; obj.MAS_sexo = dl_sexo.SelectedValue; obj.MAS_color = txt_color.Value; obj.MAS_observaciones = txt_observaciones.Value; obj.DXM_id_dueno = Convert.ToInt32( txt_codigo_dueno.Value); wsgest.CRE_Mascota(obj); Response.Redirect("frm_Grid_Mascota.aspx"); } if (FormAccion == "Editar") { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Mascota obj = new WSGestion.MOD_Mascota(); obj.MAS_id_mascota = Convert.ToInt32(txt_codigo.Value); obj.MAS_id_raza = Convert.ToInt32(dlRaza.SelectedValue); obj.MAS_nombre = txt_nombre.Value; obj.MAS_fecha_nacimiento = txt_fecha_nacimiento.Text; obj.MAS_sexo = dl_sexo.SelectedValue; obj.MAS_color = txt_color.Value; obj.MAS_observaciones = txt_observaciones.Value; obj.DXM_id_dueno = Convert.ToInt32(txt_codigo_dueno.Value); wsgest.UPD_Mascota(obj); Response.Redirect("frm_Grid_Mascota.aspx"); } } catch (Exception exc) { Alert_Mensaje.Attributes["class"] = "alert alert-danger"; mensaje_alerta = exc.ToString(); titulo_mensaje_alerta = "Error: "; Alert_Mensaje.Visible = true; } } }
private void Cargar() { try { DateTime oDate; WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Mascota obj = new WSGestion.MOD_Mascota(); obj = wsgest.SEL_GRID_BY_ID_Mascota(codigo_seleccionado); lbl_id_mascota.Text = obj.MAS_id_mascota.ToString(); lbl_raza.Text = obj.RAZ_descripcion; lbl_nombre_mascota.Text = obj.MAS_nombre; oDate = DateTime.Parse(obj.MAS_fecha_nacimiento); lbl_fecha_nacimiento.Text = oDate.ToShortDateString(); lbl_color.Text = obj.MAS_color; lbl_observaciones.Text = obj.MAS_observaciones; if (obj.MAS_sexo == "M") { lbl_sexo.Text = "Macho"; } else { lbl_sexo.Text = "Hembra"; } WSGestion.MOD_Dueno obj2 = new WSGestion.MOD_Dueno(); obj2 = wsgest.SEL_GRID_BY_ID_Dueno(codigo_seleccionado_dueno); lbl_nombre_dueno.Text = obj2.DUE_nombre + " " + obj2.DUE_apellido1 + " " + obj2.DUE_apellido2; lbl_id_dueno.Text = obj2.DUE_id_dueno.ToString(); lbl_telefono.Text = obj2.DUE_telefono; lbl_celular.Text = obj2.DUE_celular; WSGestion.MOD_Expediente obj3 = new WSGestion.MOD_Expediente(); obj3 = wsgest.SEL_GRID_Expediente_BY_ID_Mascota(codigo_seleccionado,centro); lbl_numero_expediente.Text = obj3.EXP_id_expediente.ToString(); codigo_expediente_seleccionado = obj3.EXP_id_expediente; oDate = DateTime.Parse(obj3.EXP_fecha_creacion); lbl_fecha_generacion.Text = oDate.ToShortDateString(); } catch (Exception) { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Codigo_Select"] = "0"; } }
private void Cargar() { try { DateTime oDate; WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Expediente obj3 = new WSGestion.MOD_Expediente(); obj3 = wsgest.SEL_GRID_Expediente_BY_ID_Mascota(codigo_seleccionado, centro); lbl_numero_expediente.Text = obj3.EXP_id_expediente.ToString(); if (obj3.EXP_id_expediente != 0) { codigo_expediente_seleccionado = obj3.EXP_id_expediente; oDate = DateTime.Parse(obj3.EXP_fecha_creacion); lbl_fecha_generacion.Text = oDate.ToShortDateString(); WSGestion.MOD_Mascota obj = new WSGestion.MOD_Mascota(); obj = wsgest.SEL_GRID_BY_ID_Mascota(codigo_seleccionado); lbl_id_mascota.Text = obj.MAS_id_mascota.ToString(); lbl_raza.Text = obj.RAZ_descripcion; lbl_nombre_mascota.Text = obj.MAS_nombre; oDate = DateTime.Parse(obj.MAS_fecha_nacimiento); lbl_fecha_nacimiento.Text = oDate.ToShortDateString(); lbl_color.Text = obj.MAS_color; lbl_observaciones.Text = obj.MAS_observaciones; if (obj.MAS_sexo == "M") { lbl_sexo.Text = "Macho"; } else { lbl_sexo.Text = "Hembra"; } WSGestion.MOD_Dueno obj2 = new WSGestion.MOD_Dueno(); obj2 = wsgest.SEL_GRID_BY_ID_Dueno(codigo_seleccionado_dueno); lbl_nombre_dueno.Text = obj2.DUE_nombre + " " + obj2.DUE_apellido1 + " " + obj2.DUE_apellido2; lbl_id_dueno.Text = obj2.DUE_id_dueno.ToString(); lbl_telefono.Text = obj2.DUE_telefono; lbl_celular.Text = obj2.DUE_celular; } else { Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Codigo_Select"] = "0"; Alert_Mensaje.Attributes["class"] = "alert alert-warning"; mensaje_alerta = "No se tiene un expediente para la mascota"; titulo_mensaje_alerta = "Advertencia: "; Alert_Mensaje.Visible = true; } } 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; } }
private void Carga_Editar() { try { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Mascota obj = new WSGestion.MOD_Mascota(); obj = wsgest.SEL_GRID_BY_ID_Mascota(codigo_seleccionado); txt_codigo.Value = obj.MAS_id_mascota.ToString(); dlRaza.SelectedIndex = obj.MAS_id_raza; txt_nombre.Value = obj.MAS_nombre; DateTime Fecha = Convert.ToDateTime(obj.MAS_fecha_nacimiento); Fecha_Formato = Fecha.ToString("MM/dd/yyyy"); txt_color.Value = obj.MAS_color; txt_observaciones.Value = obj.MAS_observaciones; dl_sexo.SelectedValue = obj.MAS_sexo; WSGestion.MOD_Dueno obj2 = new WSGestion.MOD_Dueno(); obj2 = wsgest.SEL_GRID_BY_ID_Dueno(Convert.ToInt32(wsgest.SEL_Mascota_Dueno(codigo_seleccionado))); txt_nombre_dueno.Value = obj2.DUE_nombre + " " + obj2.DUE_apellido1 + " " + obj2.DUE_apellido2; txt_codigo_dueno.Value = obj2.DUE_id_dueno.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; } }
private void Cargar_Datos_Cita() { try { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Mascota obj = new WSGestion.MOD_Mascota(); obj = wsgest.SEL_GRID_BY_ID_Mascota(codigo_mascota); lbl_id_mascota.Text = obj.MAS_id_mascota.ToString(); lbl_nombre_mascota.Text = obj.MAS_nombre; WSGestion.MOD_Dueno obj2 = new WSGestion.MOD_Dueno(); obj2 = wsgest.SEL_GRID_BY_ID_Dueno(codigo_seleccionado_dueno); lbl_nombre_dueno.Text = obj2.DUE_nombre + " " + obj2.DUE_apellido1 + " " + obj2.DUE_apellido2; lbl_id_dueno.Text = obj2.DUE_id_dueno.ToString(); lbl_telefono.Text = obj2.DUE_telefono; lbl_celular.Text = obj2.DUE_celular; } 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; } }