/// <summary> /// Método para rescatar el valor de un atributo, dado un atributo y valor por el cual se filtrará el registro. /// ESTOS CAMPOS VIENEN DESDE EL CONTROLADOR LISTARCASOS, EN LOS METODOS CASOSPENDIENTES Y BUSQUEDADECASOS, ANTES DE AÑADIR LA FILA DE MOTIVO FILTRADO POR CODIGO /// </summary> /// <param name="tabla">Nombre de tabla a consultar</param> /// <param name="nomAtributoTabla">Atributo por el cual filtrar</param> /// <param name="valorEnviado">Valor enviado al atributo filtrado</param> /// <param name="valorObtenido">Valor obtenido de un atributo a elección</param> /// <returns></returns> public static string ObtenerAtributoParametricaByCod(string tabla, string nomAtributoTabla, string valorEnviado, string valorObtenido) { string lista = string.Empty; string campo = string.Empty; try { // XML Búsqueda string xmlGetEntities = @" <BizAgiWSParam> <EntityData> <EntityName>" + tabla + @"</EntityName> <Filters> <![CDATA[" + nomAtributoTabla + " = '" + valorEnviado + @"']]> </Filters> </EntityData> </BizAgiWSParam> "; //Escribir log CSV EscribirLog("Obtener atributos de parametricas", "ObtenerAtributoParametricaByCod", xmlGetEntities); //Fin CSV // Abrir conexión a servicio web //LipigasEntityManagerSoa.EntityManagerSOASoapClient servicioQuery = new LipigasEntityManagerSoa.EntityManagerSOASoapClient(); //DemoLipiEntity.EntityManagerSOASoapClient servicioQuery = new DemoLipiEntity.EntityManagerSOASoapClient(); DesEntity.EntityManagerSOASoapClient servicioQuery = new DesEntity.EntityManagerSOASoapClient(); // Buscar en Bizagi string respuesta = servicioQuery.getEntitiesAsString(xmlGetEntities); //Escribir log CSV EscribirLog("Respuesta", "ObtenerAtributoParametricaByCod", respuesta); //Fin CSV // Convertir a XML XmlDocument doc = new XmlDocument(); doc.LoadXml(respuesta); campo = doc.SelectSingleNode("/BizAgiWSResponse/Entities/" + tabla + "/" + valorObtenido).InnerText; //Escribir log CSV EscribirLog("Atributo rescatado", "ObtenerAtributoParametricaByCod", campo); //Fin CSV } catch (Exception ex) { //Escribir log CSV EscribirLog("ERROR", "ObtenerAtributoParametricaByCod", ex.Message); //Fin CSV } return(campo); }
/// <summary> /// Método para crear listas desplegables desde una paramétrica de Bizagi /// </summary> /// <param name="tabla">Nombre de tabla paramétrica</param> /// <param name="campoVisual">Campo que se va a mostrar como opción</param> /// <returns></returns> public static string ListarParametricaConPadre(string tabla, string campoVisual, string padre) { string lista = string.Empty; try { // XML Búsqueda string xmlGetEntities = @" <BizAgiWSParam> <EntityData> <EntityName>" + tabla + @"</EntityName> <Filters> <![CDATA[dsbl" + tabla + @" = " + false + @"]]> </Filters> </EntityData> </BizAgiWSParam> "; //Escribir log CSV EscribirLog("Listar motivo/submotivo", "ListarParametricaConPadre", xmlGetEntities); //Fin CSV // Abrir conexión a servicio web //LipigasEntityManagerSoa.EntityManagerSOASoapClient servicioQuery = new LipigasEntityManagerSoa.EntityManagerSOASoapClient(); //DemoLipiEntity.EntityManagerSOASoapClient servicioQuery = new DemoLipiEntity.EntityManagerSOASoapClient(); DesEntity.EntityManagerSOASoapClient servicioQuery = new DesEntity.EntityManagerSOASoapClient(); // Buscar en Bizagi string respuesta = servicioQuery.getEntitiesAsString(xmlGetEntities); //Escribir log CSV EscribirLog("Respuesta", "ListarParametricaConPadre", respuesta); //Fin CSV // Convertir a XML XmlDocument doc = new XmlDocument(); doc.LoadXml(respuesta); // Recorrer los resultados foreach (XmlNode item in doc.SelectNodes("/BizAgiWSResponse/Entities/" + tabla)) { // Obtener campos string id = item.Attributes["key"].Value; string campo = item.SelectSingleNode(campoVisual).InnerText; string campoPadre = item.SelectSingleNode(padre).InnerText; string motivoRelacion = campoPadre.Substring(0, campoPadre.Length - 1); // Crear opción lista += "<option data-father='" + motivoRelacion + @"' value='" + id + @"'>" + campo + @"</option>"; } //Escribir log CSV EscribirLog("Lista opciones generada", "ListarParametricaConPadre", lista); //Fin CSV } catch (Exception ex) { //Escribir log CSV EscribirLog("ERROR", "ListarParametrica", ex.Message); //Fin CSV } return(lista); }
public ActionResult Login(FormCollection collection, int?estado) { string datosJSON = string.Empty; string respuestaCasos = ""; string idUsuario = ""; string txtVacio = collection["txtVacio"]; FormCollection nulo = new FormCollection(); try { //Obtener valores ingresados en formulario de login string txtCorreo = collection["txtCorreo"]; string txtPass = collection["txtPass"]; if (txtCorreo != null) { txtCorreo.Trim(); } if (txtPass != null) { txtPass.Trim(); } //Escribir log CSV UtilController.EscribirLog("Credenciales ingresadas", "Login", "Correo: " + txtCorreo + ", Clave: " + txtPass); //Fin CSV //Consultar a tabla si correo y password coinciden string queryLogin = @"<BizAgiWSParam> <EntityData> <EntityName>ContratistasOTMedidor</EntityName> <Filters> <![CDATA[CorreoElectronico = '" + txtCorreo + @"' AND Pass = '******']]> </Filters> </EntityData> </BizAgiWSParam>"; //Escribir log CSV UtilController.EscribirLog("Consultar credenciales", "Login", queryLogin); //Fin CSV //LipigasEntityManagerSoa.EntityManagerSOASoapClient servicioQuery = new LipigasEntityManagerSoa.EntityManagerSOASoapClient(); //DemoLipiEntity.EntityManagerSOASoapClient servicioQuery = new DemoLipiEntity.EntityManagerSOASoapClient(); DesEntity.EntityManagerSOASoapClient servicioQuery = new DesEntity.EntityManagerSOASoapClient(); respuestaCasos = servicioQuery.getEntitiesAsString(queryLogin); respuestaCasos = respuestaCasos.Replace("\n", ""); respuestaCasos = respuestaCasos.Replace("\t", ""); respuestaCasos = respuestaCasos.Replace("\r", ""); //Escribir log CSV UtilController.EscribirLog("Respuesta", "Login", respuestaCasos); //Fin CSV //Transformar respuesta STRING de Bizagi a XML para poder recorrer los nodos XmlDocument doc = new XmlDocument(); doc.LoadXml(respuestaCasos); string correo = ""; string password = ""; //Obtener correo y pass de respuesta if (doc.SelectSingleNode("/BizAgiWSResponse/Entities/ContratistasOTMedidor/CorreoElectronico").InnerText != null) { correo = doc.SelectSingleNode("/BizAgiWSResponse/Entities/ContratistasOTMedidor/CorreoElectronico").InnerText; } if (doc.SelectSingleNode("/BizAgiWSResponse/Entities/ContratistasOTMedidor/Pass").InnerText != null) { password = doc.SelectSingleNode("/BizAgiWSResponse/Entities/ContratistasOTMedidor/Pass").InnerText; } //Escribir log CSV UtilController.EscribirLog("Credenciales rescatadas", "Login", "Correo: " + correo + ", Clave: " + password); //Fin CSV if (txtCorreo == correo && txtPass == password) { // Recorrer los resultados foreach (XmlNode item in doc.SelectNodes("/BizAgiWSResponse/Entities/ContratistasOTMedidor")) { // Obtener campos idUsuario = item.Attributes["key"].Value; Convert.ToInt32(idUsuario); } //Url.Action("ListarCasos", "CasosPendientes", new { collection = txtVacio, IDUsuario = idUsuario }); } } catch (Exception ex) { //Escribir log CSV UtilController.EscribirLog("ERROR", "Login", ex.Message); //Fin CSV return(RedirectToAction("Login", "Home", new { estado = 0 })); } //return Index(Convert.ToInt32(idUsuario), 1); return(RedirectToAction("Index", "Home", new { IDUsuario = idUsuario, estado = 1 })); }