public tb_sis_reporte_x_tb_empresa_Info GetInfo(int IdEmpresa, string CodReporte)
        {
            try
            {
                tb_sis_reporte_x_tb_empresa_Info info;

                using (Entities_general db = new Entities_general())
                {
                    var Entity = db.tb_sis_reporte_x_tb_empresa.Where(q => q.IdEmpresa == IdEmpresa && q.CodReporte == CodReporte).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(null);
                    }
                    else
                    {
                        info = new tb_sis_reporte_x_tb_empresa_Info
                        {
                            IdEmpresa      = Entity.IdEmpresa,
                            CodReporte     = Entity.CodReporte,
                            ReporteDisenio = Entity.ReporteDisenio,
                            Nom_Carpeta    = Entity.tb_sis_reporte.tb_modulo.Nom_Carpeta,
                            Reporte        = Entity.tb_sis_reporte.nom_reporte
                        }
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public bool GuardarDB(tb_sis_reporte_x_tb_empresa_Info info)
 {
     try
     {
         using (Entities_general db = new Entities_general())
         {
             var Entity = db.tb_sis_reporte_x_tb_empresa.Where(q => q.IdEmpresa == info.IdEmpresa && q.CodReporte == info.CodReporte).FirstOrDefault();
             if (Entity == null)
             {
                 db.tb_sis_reporte_x_tb_empresa.Add(new tb_sis_reporte_x_tb_empresa
                 {
                     IdEmpresa      = info.IdEmpresa,
                     CodReporte     = info.CodReporte,
                     ReporteDisenio = info.ReporteDisenio
                 });
             }
             else
             {
                 Entity.ReporteDisenio = info.ReporteDisenio;
             }
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public ActionResult Disenar(tb_sis_reporte_x_tb_empresa_Info model)
        {
            int    IdEmpresa  = Convert.ToInt32(SessionFixed.IdEmpresa);
            string CodReporte = Request.Params["fx_CodReporte"] != null ? Request.Params["fx_CodReporte"].ToString() : "";

            model.ReporteDisenio = ReportDesignerExtension.GetReportXml("ReportDesigner");
            model.IdEmpresa      = IdEmpresa;
            model.CodReporte     = CodReporte;
            bus_reporte_x_emp.GuardarDB(model);
            return(View(model));
        }
 public bool GuardarDB(tb_sis_reporte_x_tb_empresa_Info info)
 {
     try
     {
         return(odata.GuardarDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
        public ActionResult Disenar(int IdEmpresa = 0, string CodReporte = "")
        {
            var reporte = bus_reporte.get_info(CodReporte);
            var model   = bus_reporte_x_emp.GetInfo(IdEmpresa, CodReporte);

            XtraReport rpt = GetReport(reporte.Nom_Carpeta + "." + reporte.rpt_clase_rpt);

            if (model == null)
            {
                MemoryStream ms = new MemoryStream();
                rpt.SaveLayoutToXml(ms);
                ms.Position = 0;
                model       = new tb_sis_reporte_x_tb_empresa_Info
                {
                    IdEmpresa      = IdEmpresa,
                    CodReporte     = CodReporte,
                    ReporteDisenio = ms.ToArray()
                };
            }

            return(View(model));
        }