public ActionResult Index(Rdep_Info model) { string nombre_file = "RDEP"; string xml = ""; rdep rdep = new rdep(); int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); int IdSucursal = Convert.ToInt32(SessionFixed.IdSucursal); rdep = bus_rpde.get_list(IdEmpresa, Convert.ToInt32(model.pe_anio), model.IdEmpleado); var ms = new MemoryStream(); var xw = XmlWriter.Create(ms); var serializer = new XmlSerializer(rdep.GetType()); XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("", ""); serializer.Serialize(xw, rdep, ns); xw.Flush(); ms.Seek(0, SeekOrigin.Begin); using (var sr = new StreamReader(ms, Encoding.UTF8)) { xml = sr.ReadToEnd(); } byte[] fileBytes = ms.ToArray(); return(File(fileBytes, "application/xml", nombre_file + ".xml")); }
public ActionResult Index() { #region Validar Session if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession)) { return(RedirectToAction("Login", new { Area = "", Controller = "Account" })); } SessionFixed.IdTransaccionSession = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString(); SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession; #endregion Rdep_Info model = new Rdep_Info(); return(View(model)); }
public ActionResult CmbEmpleado_rdep() { Rdep_Info model = new Rdep_Info(); return(PartialView("_CmbEmpleado_rdep", model)); }