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_Detalle_Expediente obj = new WSGestion.MOD_Detalle_Expediente(); obj.DEX_id_expediente = Convert.ToInt32(txt_codigo_expediente.Value); obj.DEX_id_centro_atencion = Convert.ToInt32(txt_centro.Value); obj.DEX_fecha = Convert.ToDateTime(txt_fecha.Text).ToString("dd/MM/yyyy hh:mm:ss"); obj.DEX_peso = Convert.ToDecimal(txt_peso.Value); obj.DEX_longitud = Convert.ToDecimal(txt_logitud.Value); obj.DEX_id_articulo = Convert.ToInt32(txt_articulo.Value); obj.DEX_cantidad = Convert.ToDecimal(txt_cantidad.Value); wsgest.CRE_Detalle_Expediente(obj); Response.Redirect("frm_Grid_Detalle_Expediente.aspx"); } if (FormAccion == "Editar") { WSGestion.WSGestion wsgest = new WSGestion.WSGestion(); wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs"); WSGestion.MOD_Detalle_Expediente obj = new WSGestion.MOD_Detalle_Expediente(); obj.DEX_id_linea = Convert.ToInt32(txt_codigo.Value); obj.DEX_id_expediente = Convert.ToInt32(txt_codigo_expediente.Value); obj.DEX_id_centro_atencion = Convert.ToInt32(txt_centro.Value); obj.DEX_fecha = Convert.ToDateTime(txt_fecha.Text).ToString("dd/MM/yyyy hh:mm:ss"); obj.DEX_peso = Convert.ToDecimal(txt_peso.Value); obj.DEX_longitud = Convert.ToDecimal(txt_logitud.Value); obj.DEX_id_articulo = Convert.ToInt32(txt_articulo.Value); obj.DEX_cantidad = Convert.ToDecimal(txt_cantidad.Value); wsgest.UPD_Detalle_Expediente(obj); Response.Redirect("frm_Grid_Detalle_Expediente.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_Detalle_Expediente obj = new WSGestion.MOD_Detalle_Expediente(); obj = wsgest.SEL_GRID_BY_ID_Detalle_Expediente(codigo_linea,centro_expediente, centro_expediente); txt_codigo.Value = obj.DEX_id_linea.ToString(); txt_codigo_expediente.Value = obj.DEX_id_expediente.ToString(); txt_centro.Value = obj.DEX_id_centro_atencion.ToString(); DateTime Fecha = Convert.ToDateTime(obj.DEX_fecha); Fecha_Formato = Fecha.ToString("dd/MM/yyyy hh:mm:ss tt"); txt_fecha.Text = Fecha_Formato; txt_peso.Value = obj.DEX_peso.ToString(); txt_logitud.Value = obj.DEX_longitud.ToString(); txt_articulo.Value = obj.DEX_id_articulo.ToString(); txt_cantidad.Value = obj.DEX_cantidad.ToString(); txt_descripcion.Value = obj.ART_descripcion.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; } }