Beispiel #1
0
        public ActionResult RazonSocial(string rutempresa)
        {
            System.Xml.XmlDocument xDocumento = new System.Xml.XmlDocument();
            servMEDAtencionProxy.servMEDAtencion obj = new servMEDAtencionProxy.servMEDAtencion();
            var sRespuesta = obj.wsValidaEmpSiso(rutempresa);

            if (sRespuesta != null)
            {
                xDocumento.LoadXml(sRespuesta);

                XMLReader readXML = new XMLReader();
                var data = readXML.ReturnListOfEmpresa(xDocumento);

                if (data[0].GlsError != null)
                {
                    string razonsocial = data[0].GlsError;
                    string[] razonsocial2 = razonsocial.Split(';');

                    if (razonsocial2.Count() > 1)
                    {
                        return Json(new { razonsocial = razonsocial2[1] });
                    }
                    else
                    {
                        return Json(new { razonsocial = razonsocial2[0] });
                    }
                }
            }

            return Json(new { razonsocial = "No existe" });
        }
        // GET: Encuesta
        public ActionResult Index()
        {

            //XMLReader readXML = new XMLReader();
            //var data = readXML.RetrunListOfEncuesta();

            //Session["Resp"] = null;
            Session["dictionary"] = null;
            var dictionary = new Dictionary<string, string>();
            Session["dictionary"] = dictionary;
            Session["ENCUESTA_ID"] = null;

            System.Xml.XmlDocument xDocumento = new System.Xml.XmlDocument();
            List<Encuesta> data = new List<Encuesta>();
            ServiceITLProxy.ServiceITL obj = new ServiceITLProxy.ServiceITL();
            var sRespuesta = obj.Encuesta("");

            if (sRespuesta != null)
            {
                xDocumento.LoadXml(sRespuesta);

                XMLReader readXML = new XMLReader();
                data = readXML.ReturnListOfEncuesta(xDocumento);

            }

            return View(data.ToList());

        }
Beispiel #3
0
        public ActionResult ShowEmpresa(Empresa e)
        {
            if (ModelState.IsValid)
            {

                Session["RutEmpresa"] = e.RutEmpresa;
                Session["NombreEmpresa"] = e.NombreEmpresa;
                Session["RutEmpresa"] = e.RutEmpresa;
                Session["RepCargo"] = e.RepCargo;
                Session["RepEmail"] = e.RepEmail;
                Session["RepNombre"] = e.RepNombre;
                Session["RepRut"] = e.RepRut;
                Session["RepTelefono"] = e.RepTelefono;

                if (TempData["Correo"] != null)
                {
                    TempData.Remove("Correo");
                }

                TempData.Add("Correo", e.RepEmail);

                servMEDAtencionProxy.servMEDAtencion obj = new servMEDAtencionProxy.servMEDAtencion();
                var sRespuesta = obj.wsValidaEmpSiso(e.RutEmpresa);

                System.Xml.XmlDocument xDocumento = new System.Xml.XmlDocument();

                if (sRespuesta != null)
                {

                    xDocumento.LoadXml(sRespuesta);

                    XMLReader readXML = new XMLReader();
                    var data = readXML.ReturnListOfEmpresa(xDocumento);

                    if (data[0].Codigo == 1)
                    {
                        return RedirectToAction("Index", "Encuesta");
                    }

                }
            }
            return View();
        }
        // GET: Encuesta
        public ActionResult ListSubFamilia(string iddet, string finalizada)
        {

            //Cargo variable encuesta ID & Respuestas ini
            if (Session["ENCUESTA_ID"] == null)
            {
                Session["ENCUESTA_ID"] = iddet;
            }
            

            var data = new List<Encuesta>();

          
            if (TempData["ListSubFamilia"] == null)
            {
                //XMLReader readXML = new XMLReader();
                //data = readXML.RetrunListOfSubFamilia(iddet);

                System.Xml.XmlDocument xDocumento = new System.Xml.XmlDocument();
                ServiceITLProxy.ServiceITL obj = new ServiceITLProxy.ServiceITL();
                var sRespuesta = obj.SubFamilia(iddet);

                if (sRespuesta != null)
                {
                    xDocumento.LoadXml(sRespuesta);

                    XMLReader readXML = new XMLReader();
                    data = readXML.ReturnListOfSubFamilia(xDocumento);
                    //ViewBag.contadorSE = data.Count;
                    Session["contadorSE"] = data.Count;
                    TempData["ListSubFamilia"] = data;
                }


            }
            else
            {
                data = TempData["ListSubFamilia"] as List<Encuesta>;
                TempData.Keep("ListSubFamilia");
            }

            //inicializa datos de SubFamilia 
            var myEnc = data.ToList();

            var found = myEnc.FirstOrDefault(c => c.ID_ENCUESTA_SUB == iddet);
            if (found != null)
            {
                found.Finalizada = "S";
            }


            return View(data.ToList());
        }
        // GET: Encuesta
        public ActionResult ListDetalleSubFamilia(string idenc, string idsubenc, int totnum, int preg, int contadorse)
        {
           
            ViewBag.encuestaid = idenc;
            ViewBag.grupoen = idenc;
            ViewBag.subencid = idsubenc;
            ViewBag.totpreg = totnum;
            ViewBag.pregunta = preg;
            //contador sub encuestas

            //ViewBag.contadorse = contadorse;
            //Session["ContadorSE"] = contadorse;
           

            List<Encuesta> data = new List<Encuesta>();
            System.Xml.XmlDocument xDocumento = new System.Xml.XmlDocument();
            ServiceITLProxy.ServiceITL obj = new ServiceITLProxy.ServiceITL();
            var sRespuesta = obj.Detalle(idenc, idsubenc);

            if (sRespuesta != null)
            {
                xDocumento.LoadXml(sRespuesta);

                XMLReader readXML = new XMLReader();
                data = readXML.ReturnListOfDetalle(xDocumento);

                var query = data.Where(p => p.ID_ENCUESTA == idenc);
                query = query.Where(p => p.ID_ENCUESTA_SUB == idsubenc);
                query = query.Where(p => p.Num_Orden == preg);

                var myList = query.ToList();

                //inicializa datos de encuesta 
                if (TempData["Encuesta"] == null)
                {
                    Encuesta enc = new Encuesta();
                    List<Encuesta> lisobj = new List<Encuesta>();
                    TempData["Encuesta"] = lisobj;
                }

                //manipulo datos encuesta
                var obj2 = TempData["Encuesta"] as List<Encuesta>;
                TempData.Keep("Encuesta");

                var found = obj2.FirstOrDefault(c => c.Cod_Num == myList[0].Cod_Num);
                if (found != null)
                {
                    found.Respuesta = "2";
                    TempData["Encuesta"] = obj2;
                }
                else
                {
                    Encuesta enc = new Encuesta();
                    enc.ID_ENCUESTA = myList[0].ID_ENCUESTA;
                    enc.ID_ENCUESTA_SUB = myList[0].ID_ENCUESTA_SUB;
                    enc.NOM_ENCUESTA_SUB = myList[0].NOM_ENCUESTA_SUB;
                    enc.Cod_Num = myList[0].Cod_Num;
                    enc.Num_Orden = myList[0].Num_Orden;
                    enc.Gls_Pregunta = myList[0].Gls_Pregunta;
                    enc.Cant_Preguntas = myList[0].Cant_Preguntas;
                    enc.Respuesta = "1";


                    obj2.Add(enc);
                    TempData["Encuesta"] = obj2;
                }

                return View(query.ToList());

            }

            //lee datos XML
            //XMLReader readXML = new XMLReader();
            //var data = readXML.RetrunListOfDetSubFamilia();
            //var query = data.Where(p => p.Val_Par_Alf_Num == ViewBag.grupoen);
            //query = query.Where(p => p.Num_Orden == ViewBag.pregunta);

            //var myList = query.ToList();

            return View();

        }