public string obtPreguntaById(int id_pregunta) { string outTxt = ""; List <DataTable> listado = Models.clsValoracion.obtPreguntaById(id_pregunta); if (listado.Count > 1) { DataTable dt_encabezado = listado[0]; DataTable dt_detalle = listado[1]; AuditoriasCiudadanas.App_Code.funciones datos_func = new AuditoriasCiudadanas.App_Code.funciones(); if (dt_encabezado.Rows.Count > 0) { outTxt += datos_func.convertToJson(dt_encabezado); } if (dt_detalle.Rows.Count > 0) { outTxt += "<||>" + datos_func.convertToJson(dt_detalle); } } return(outTxt); }
protected void Page_Load(object sender, EventArgs e) { string tipo = ""; string page = ""; int tipo_aux = 0; int page_aux = 0; ModelDataRecurso objReturn = new ModelDataRecurso(); if (HttpContext.Current.Request.HttpMethod == "POST") { NameValueCollection pColl = Request.Params; if (pColl.AllKeys.Contains("tipo")) { tipo = Request.Params.GetValues("tipo")[0].ToString(); } if (pColl.AllKeys.Contains("pagina")) { page = Request.Params.GetValues("pagina")[0].ToString(); } if (!string.IsNullOrEmpty(tipo)) { tipo_aux = Convert.ToInt16(tipo); } if (!string.IsNullOrEmpty(page)) { page_aux = Convert.ToInt16(page); } AuditoriasCiudadanas.Controllers.CapacitacionController datos = new Controllers.CapacitacionController(); objReturn = datos.ObtListadoRecursoMutimediaByPag(page_aux, tipo_aux); } AuditoriasCiudadanas.App_Code.funciones datos_func = new AuditoriasCiudadanas.App_Code.funciones(); string outTxt = string.Empty; outTxt = datos_func.convertToJsonObj(objReturn); Response.Write(outTxt); }
protected void Page_Load(object sender, EventArgs e) { string id_departamento = ""; if (HttpContext.Current.Request.HttpMethod == "POST") { NameValueCollection pColl = Request.Params; if (pColl.AllKeys.Contains("id_departamento")) { id_departamento = Request.Params.GetValues("id_departamento")[0].ToString(); } } DataTable dt_municipios = new DataTable(); string outTxt = ""; AuditoriasCiudadanas.Controllers.GeneralController datos = new AuditoriasCiudadanas.Controllers.GeneralController(); dt_municipios = datos.obtMunicipiosByDep(id_departamento); AuditoriasCiudadanas.App_Code.funciones datos_func = new AuditoriasCiudadanas.App_Code.funciones(); outTxt = datos_func.convertToJson(dt_municipios); Response.Write(outTxt); }
protected void Page_Load(object sender, EventArgs e) { DataTable dt_proyectos = new DataTable(); string outTxt = ""; string texto = ""; if (HttpContext.Current.Request.HttpMethod == "POST") { NameValueCollection pColl = Request.Params; if (pColl.AllKeys.Contains("texto")) { texto = Request.Params.GetValues("texto")[0].ToString().ToUpper(); } } AuditoriasCiudadanas.Controllers.ProyectosController datos = new AuditoriasCiudadanas.Controllers.ProyectosController(); dt_proyectos = datos.listarProyectos(); AuditoriasCiudadanas.App_Code.funciones datos_func = new AuditoriasCiudadanas.App_Code.funciones(); //outTxt = datos_func.convertToJson(dt_proyectos); if (!string.IsNullOrEmpty(texto)) { var filas = dt_proyectos.AsEnumerable().Where(x => x.Field<string>("id").ToUpper().StartsWith(texto)); if (filas.Count() > 0) { DataTable dt_aux = filas.CopyToDataTable<DataRow>(); outTxt = datos_func.convertToJson(dt_aux); } } else { outTxt = datos_func.convertToJson(dt_proyectos); } Response.Write(outTxt); }
protected void Page_Load(object sender, EventArgs e) { DataTable dt_municipios = new DataTable(); string outTxt = ""; string texto = ""; if (HttpContext.Current.Request.HttpMethod == "POST") { //string nombre,string email,string celular,string hash_clave,int idperfil,int id_departamento,int id_municipio NameValueCollection pColl = Request.Params; if (pColl.AllKeys.Contains("texto")) { texto = Request.Params.GetValues("texto")[0].ToString().ToUpper(); } } AuditoriasCiudadanas.Controllers.GeneralController datos = new AuditoriasCiudadanas.Controllers.GeneralController(); dt_municipios = datos.obtMunicipios(); AuditoriasCiudadanas.App_Code.funciones datos_func = new AuditoriasCiudadanas.App_Code.funciones(); if (!string.IsNullOrEmpty(texto)) { var filas = dt_municipios.AsEnumerable().Where(x => x.Field <string>("municipio").ToUpper().StartsWith(texto)); if (filas.Count() > 0) { DataTable dt_aux = filas.CopyToDataTable <DataRow>(); outTxt = datos_func.convertToJson(dt_aux); } } else { outTxt = datos_func.convertToJson(dt_municipios); } Response.Write(outTxt); }
protected void Page_Load(object sender, EventArgs e) { try { if (HttpContext.Current.Request.HttpMethod == "POST") { string tipo = ""; string id_usuario = ""; string titulo = ""; string descripcion = ""; string ruta = ""; string cod_error = ""; string msg_error = ""; int tipo_aux = 0; int id_usuario_aux = 0; string outTxt = ""; string fecha = DateTime.Now.ToString("yyyy-MM-dd"); NameValueCollection pColl = Request.Params; if (pColl.AllKeys.Contains("tipo")) { tipo = Request.Params.GetValues("tipo")[0].ToString(); if (!string.IsNullOrEmpty(tipo)) { tipo_aux = Convert.ToInt16(tipo); } } if (pColl.AllKeys.Contains("id_usuario")) { id_usuario = Request.Params.GetValues("id_usuario")[0].ToString(); if (!string.IsNullOrEmpty(id_usuario)) { id_usuario_aux = Convert.ToInt16(id_usuario); } } if (pColl.AllKeys.Contains("titulo")) { titulo = Request.Params.GetValues("titulo")[0].ToString(); } if (pColl.AllKeys.Contains("desc")) { descripcion = Request.Params.GetValues("desc")[0].ToString(); } string pathrefer = Request.UrlReferrer.ToString(); string dir_upload = ConfigurationManager.AppSettings["ruta_audiencias"]; string Serverpath = HttpContext.Current.Server.MapPath("~/" + dir_upload); HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile postedFile = hfc[i]; string file; if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE") { string[] files = postedFile.FileName.Split(new char[] { '\\' }); file = files[files.Length - 1]; } else // In case of other browsers { file = postedFile.FileName; } if (!Directory.Exists(Serverpath)) { Directory.CreateDirectory(Serverpath); } string fileDirectory = Serverpath; if (Request.QueryString["fileName"] != null) { file = Request.QueryString["fileName"]; if (File.Exists(fileDirectory + "\\" + file)) { File.Delete(fileDirectory + "\\" + file); } } string ext = Path.GetExtension(fileDirectory + "\\" + file); //file = Guid.NewGuid() + ext; // Creating a unique name for the file fileDirectory = Serverpath + "\\" + file; postedFile.SaveAs(fileDirectory); if (File.Exists(fileDirectory)) { ruta = fileDirectory; Controllers.CapacitacionController datos = new Controllers.CapacitacionController(); outTxt = datos.addRecursoMultimedia(tipo_aux, titulo, descripcion, ruta, id_usuario_aux); string[] separador = new string[] { "<||>" }; var result = outTxt.Split(separador, StringSplitOptions.None); cod_error = result[0]; msg_error = result[1]; } else { cod_error = "-1"; msg_error = "Error al guardar archivo pdf"; } } DataTable dt_errores = new DataTable(); dt_errores.Columns.Add("cod_error", typeof(string)); dt_errores.Columns.Add("msg_error", typeof(string)); dt_errores.Rows.Add(cod_error, msg_error); AuditoriasCiudadanas.App_Code.funciones datos_func = new AuditoriasCiudadanas.App_Code.funciones(); outTxt = datos_func.convertToJson(dt_errores); Response.Write(outTxt); } } catch (Exception exp) { Response.Write(exp.Message); } }
protected void Page_Load(object sender, EventArgs e) { string bpin_proyecto = ""; string titulo = ""; string descripcion = ""; string[] rutas = { "", "" }; int id_usuario_aux = 0; string outTxt = ""; string ruta = ""; string cod_error = ""; string msg_error = ""; string id_usuario = ""; string opcion = ""; string idInfo = ""; if (HttpContext.Current.Request.HttpMethod == "POST") { NameValueCollection pColl = Request.Params; if (pColl.AllKeys.Contains("cod_bpin")) { bpin_proyecto = Request.Params.GetValues("cod_bpin")[0].ToString(); } if (pColl.AllKeys.Contains("titulo")) { titulo = Request.Params.GetValues("titulo")[0].ToString(); } if (pColl.AllKeys.Contains("descripcion")) { descripcion = Request.Params.GetValues("descripcion")[0].ToString(); } if (pColl.AllKeys.Contains("id_usuario")) { id_usuario = Request.Params.GetValues("id_usuario")[0].ToString(); if (!string.IsNullOrEmpty(id_usuario)) { id_usuario_aux = Convert.ToInt16(id_usuario); } } if (pColl.AllKeys.Contains("opcion")) { opcion = Request.Params.GetValues("opcion")[0].ToString(); } if (pColl.AllKeys.Contains("id_info")) { idInfo = Request.Params.GetValues("id_info")[0].ToString(); } string pathrefer = Request.UrlReferrer.ToString(); string dir_upload = ConfigurationManager.AppSettings["ruta_infoTecnica"]; string Serverpath = HttpContext.Current.Server.MapPath("~/" + dir_upload); var postedFile = Request.Files[0]; string file; if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE") { string[] files = postedFile.FileName.Split(new char[] { '\\' }); file = files[files.Length - 1]; } else // In case of other browsers { file = postedFile.FileName; } if (!Directory.Exists(Serverpath)) { Directory.CreateDirectory(Serverpath); } string fileDirectory = Serverpath; if (Request.QueryString["fileName"] != null) { file = Request.QueryString["fileName"]; if (File.Exists(fileDirectory + "\\" + file)) { File.Delete(fileDirectory + "\\" + file); } } string ext = Path.GetExtension(fileDirectory + "\\" + file); fileDirectory = Serverpath + "\\" + file; postedFile.SaveAs(fileDirectory); if (File.Exists(fileDirectory)) { ruta = dir_upload + "/" + file; rutas[0] = ruta; Response.AddHeader("Vary", "Accept"); try { if (Request["HTTP_ACCEPT"].Contains("application/json")) { Response.ContentType = "application/json"; } else { Response.ContentType = "text/plain"; } } catch { Response.ContentType = "text/plain"; } if (opcion.Equals("new") || string.IsNullOrEmpty(idInfo)) { //add info tecnica AuditoriasCiudadanas.Controllers.ProyectosController datos = new AuditoriasCiudadanas.Controllers.ProyectosController(); outTxt = datos.addInfoTecnica(bpin_proyecto, titulo, descripcion, rutas, id_usuario_aux); string[] separador = new string[] { "<||>" }; var result = outTxt.Split(separador, StringSplitOptions.None); cod_error = result[0]; msg_error = result[1]; } else { //editar info tecnica if (!string.IsNullOrEmpty(idInfo)) { AuditoriasCiudadanas.Controllers.ProyectosController datos = new AuditoriasCiudadanas.Controllers.ProyectosController(); int idInfo_aux = Convert.ToInt16(idInfo); outTxt = datos.modifInfoTecnica(idInfo_aux, titulo, descripcion, rutas, id_usuario_aux); string[] separador = new string[] { "<||>" }; var result = outTxt.Split(separador, StringSplitOptions.None); cod_error = result[0]; msg_error = result[1]; } } } else { cod_error = "-1"; msg_error = "Error al subir al archivo"; } DataTable dt_errores = new DataTable(); dt_errores.Columns.Add("cod_error", typeof(string)); dt_errores.Columns.Add("msg_error", typeof(string)); dt_errores.Rows.Add(cod_error, msg_error); AuditoriasCiudadanas.App_Code.funciones datos_func = new AuditoriasCiudadanas.App_Code.funciones(); outTxt = datos_func.convertToJson(dt_errores); Response.Write(outTxt); //Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { try { if (HttpContext.Current.Request.HttpMethod == "POST") { string opcion = ""; var nodo_principal = false; string outTxt = ""; string ruta = ""; string num_asistentes = ""; int num_asistentes_aux = 0; string cod_error = ""; string msg_error = ""; string fecha = DateTime.Now.ToString("yyyy-MM-dd"); string xml_txt = ""; string xml_adjuntos = ""; NameValueCollection pColl = Request.Params; if (pColl.AllKeys.Contains("opcion")) { opcion = Request.Params.GetValues("opcion")[0].ToString(); } if (pColl.AllKeys.Contains("xml")) { xml_txt = HttpUtility.UrlDecode(Request.Params.GetValues("xml")[0].ToString()); } if (opcion.Equals("img")) { string pathrefer = Request.UrlReferrer.ToString(); string dir_upload = ConfigurationManager.AppSettings["ruta_audiencias"]; string Serverpath = HttpContext.Current.Server.MapPath("~/" + dir_upload); HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { xml_adjuntos += "<adjuntos>"; HttpPostedFile postedFile = hfc[i]; string file; if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE") { string[] files = postedFile.FileName.Split(new char[] { '\\' }); file = files[files.Length - 1]; } else // In case of other browsers { file = postedFile.FileName; } if (!Directory.Exists(Serverpath)) { Directory.CreateDirectory(Serverpath); } string fileDirectory = Serverpath; if (Request.QueryString["fileName"] != null) { file = Request.QueryString["fileName"]; if (File.Exists(fileDirectory + "\\" + file)) { File.Delete(fileDirectory + "\\" + file); } } string ext = Path.GetExtension(fileDirectory + "\\" + file); //file = Guid.NewGuid() + ext; // Creating a unique name for the file fileDirectory = Serverpath + "\\" + file; postedFile.SaveAs(fileDirectory); if (File.Exists(fileDirectory)) { ruta = fileDirectory; xml_adjuntos += "<id_tipo_adjunto>7</id_tipo_adjunto>"; xml_adjuntos += "<url_img>" + ruta + "</url_img>"; xml_adjuntos += "<fecha>" + fecha + "</fecha>"; Response.AddHeader("Vary", "Accept"); try { if (Request["HTTP_ACCEPT"].Contains("application/json")) { Response.ContentType = "application/json"; } else { Response.ContentType = "text/plain"; } } catch { Response.ContentType = "text/plain"; } } else { outTxt = "-1<||>Error al subir archivo"; cod_error = "-1"; msg_error = "Error al subir al archivo"; } xml_adjuntos += "</adjuntos>"; } } else { var stream = HttpContext.Current.Request.InputStream; byte[] buffer = new byte[stream.Length]; stream.Read(buffer, 0, buffer.Length); xml_txt = Encoding.UTF8.GetString(buffer); //separa nodo de otros XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml_txt); //remover nodo asistentes XmlElement el_principal = (XmlElement)xmlDoc.SelectSingleNode("/compromisos"); if (el_principal != null) { nodo_principal = true; xml_txt = el_principal.InnerXml; } XmlElement el = (XmlElement)xmlDoc.SelectSingleNode("/compromisos/num_asistentes"); if (el != null) { el.ParentNode.RemoveChild(el); foreach (XmlNode nodo in el) { num_asistentes = nodo.InnerText; } } if (!string.IsNullOrEmpty(num_asistentes)) { num_asistentes_aux = Convert.ToInt16(num_asistentes); } } if (!string.IsNullOrEmpty(xml_txt)) { string xml_info = "<compromisos>"; xml_info += xml_txt; xml_info += xml_adjuntos; xml_info += "</compromisos>"; AuditoriasCiudadanas.Controllers.AudienciasController datos = new AuditoriasCiudadanas.Controllers.AudienciasController(); outTxt = datos.insCompromisos(xml_info, num_asistentes_aux); string[] separador = new string[] { "<||>" }; var result = outTxt.Split(separador, StringSplitOptions.None); cod_error = result[0]; msg_error = result[1]; } else { cod_error = "-1"; msg_error = "Error al crear registro: @xml invalido"; } DataTable dt_errores = new DataTable(); dt_errores.Columns.Add("cod_error", typeof(string)); dt_errores.Columns.Add("msg_error", typeof(string)); dt_errores.Rows.Add(cod_error, msg_error); AuditoriasCiudadanas.App_Code.funciones datos_func = new AuditoriasCiudadanas.App_Code.funciones(); outTxt = datos_func.convertToJson(dt_errores); Response.Write(outTxt); //Response.End(); } } catch (Exception exp) { Response.Write(exp.Message); } }
protected void Page_Load(object sender, EventArgs e) { //Crear usuario en bd string outTxt = ""; string tema = ""; string id_lugar = ""; string fecha = ""; string cod_bpin = ""; string id_usuario = ""; int id_usuario_aux = 0; int id_lugar_aux = 0; string ruta = ""; string cod_error = ""; string msg_error = ""; DateTime fecha_aux = DateTime.Now; System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); try { if (HttpContext.Current.Request.HttpMethod == "POST") { NameValueCollection pColl = Request.Params; if (pColl.AllKeys.Contains("id_usuario")) { id_usuario = Request.Params.GetValues("id_usuario")[0].ToString(); if (!string.IsNullOrEmpty(id_usuario)) { id_usuario_aux = Convert.ToInt16(id_usuario); } } if (pColl.AllKeys.Contains("tema")) { tema = Request.Params.GetValues("tema")[0].ToString(); } if (pColl.AllKeys.Contains("id_lugar")) { id_lugar = Request.Params.GetValues("id_lugar")[0].ToString(); if (!string.IsNullOrEmpty(id_lugar)) { id_lugar_aux = Convert.ToInt16(id_lugar); } } if (pColl.AllKeys.Contains("fecha")) { fecha = Request.Params.GetValues("fecha")[0].ToString(); if (!string.IsNullOrEmpty(fecha)) { fecha_aux = DateTime.Parse(fecha); } } if (pColl.AllKeys.Contains("cod_bpin")) { cod_bpin = Request.Params.GetValues("cod_bpin")[0].ToString(); } string pathrefer = Request.UrlReferrer.ToString(); string dir_upload = ConfigurationManager.AppSettings["ruta_actas"]; string Serverpath = HttpContext.Current.Server.MapPath("~/" + dir_upload); var postedFile = Request.Files[0]; string file; if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE") { string[] files = postedFile.FileName.Split(new char[] { '\\' }); file = files[files.Length - 1]; } else // In case of other browsers { file = postedFile.FileName; } if (!Directory.Exists(Serverpath)) { Directory.CreateDirectory(Serverpath); } string fileDirectory = Serverpath; if (Request.QueryString["fileName"] != null) { file = Request.QueryString["fileName"]; if (File.Exists(fileDirectory + "\\" + file)) { File.Delete(fileDirectory + "\\" + file); } } string ext = Path.GetExtension(fileDirectory + "\\" + file); //file = Guid.NewGuid() + ext; // Creating a unique name for the file fileDirectory = Serverpath + "\\" + file; postedFile.SaveAs(fileDirectory); if (File.Exists(fileDirectory)) { ruta = fileDirectory; Response.AddHeader("Vary", "Accept"); try { if (Request["HTTP_ACCEPT"].Contains("application/json")) { Response.ContentType = "application/json"; } else { Response.ContentType = "text/plain"; } } catch { Response.ContentType = "text/plain"; } AuditoriasCiudadanas.Controllers.AudienciasController datos = new AuditoriasCiudadanas.Controllers.AudienciasController(); outTxt = datos.insActaReuniones(cod_bpin, fecha_aux, tema, ruta, id_usuario_aux, id_lugar_aux); string[] separador = new string[] { "<||>" }; var result = outTxt.Split(separador, StringSplitOptions.None); cod_error = result[0]; msg_error = result[1]; } else { outTxt = "-1<||>Error al subir archivo"; cod_error = "-1"; msg_error = "Error al subir al archivo"; } cod_error = "-1"; msg_error = "Error al subir al archivo"; DataTable dt_errores = new DataTable(); dt_errores.Columns.Add("cod_error", typeof(string)); dt_errores.Columns.Add("msg_error", typeof(string)); dt_errores.Rows.Add(cod_error, msg_error); AuditoriasCiudadanas.App_Code.funciones datos_func = new AuditoriasCiudadanas.App_Code.funciones(); outTxt = datos_func.convertToJson(dt_errores); Response.Write(outTxt); //Response.End(); } } catch (Exception exp) { Response.Write(exp.Message); } }