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_Cita obj = new WSGestion.MOD_Cita(); obj.CIT_id_centro_atencion = Convert.ToInt32 (txt_cea_codigo.Value); obj.CIT_id_mascota = codigo_mascota; obj.CIT_fecha = Convert.ToDateTime(txt_fecha.Text).ToString("MM/dd/yyyy hh:mm:ss"); obj.CIT_estado = dl_estado.SelectedValue; wsgest.CRE_Cita(obj); Response.Redirect("frm_Grid_Cita.aspx"); } if (FormAccion == "Editar") { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Cita obj = new WSGestion.MOD_Cita(); obj.CIT_id_centro_atencion =Convert.ToInt32(txt_cea_codigo.Value) ; obj.CIT_id_mascota = codigo_mascota; obj.CIT_fecha = Convert.ToDateTime(txt_fecha.Text).ToString("MM/dd/yyyy hh:mm:ss"); obj.CIT_estado = dl_estado.SelectedValue; obj.CIT_id_cita = Convert.ToInt32(txt_codigo.Value); wsgest.UPD_Cita(obj); Response.Redirect("frm_Grid_Cita.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 Carga_Editar() { try { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Cita obj = new WSGestion.MOD_Cita(); obj = wsgest.SEL_GRID_BY_ID_Cita(codigo_seleccionado,centro); txt_codigo.Value = obj.CIT_id_cita.ToString(); DateTime Fecha = Convert.ToDateTime(obj.CIT_fecha); Fecha_Formato = Fecha.ToString("MM/dd/yyyy hh:mm:ss tt"); txt_cea_codigo.Value = obj.CIT_id_centro_atencion.ToString(); txt_cea_nombre.Value = obj.CEA_nombre; if (obj.CIT_estado == "1") { dl_estado.SelectedValue = "1"; } else { dl_estado.SelectedValue = "2"; } } 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; } }