Example #1
0
        public ActionResult ReportBuilder()
        {
            ListDatabaseObjects          db       = new ListDatabaseObjects();
            DataTable                    dt       = db.getAllViews();
            SqlReportModel               model    = new SqlReportModel();
            List <SqlViewsPropertyModel> vwFields = new List <SqlViewsPropertyModel>();
            List <SqlViewsModel>         vwList   = new List <SqlViewsModel>();

            vwList = Converter.GetEntityList <SqlViewsModel>(dt);

            var roles   = AdminService.GetRoles();
            var modules = AdminService.GetModules();

            //ViewBag.Tables = vwList;
            ViewBag.TableProperties = vwFields;
            ViewBag.Modules         = modules;
            ViewBag.Tables          = Converter.GetEntityList <SqlViewsModel>(dt);
            var selectedRoles = new List <RolesModel>();

            model.AvailableRoles = roles;
            model.SelectedRoles  = new List <RolesModel>();
            //model.AvailableFields = vwFields;
            //model.SelectedFields = new List<SqlViewsPropertyModel>();

            ViewBag.Roles         = new MultiSelectList(roles, "RoleId", "RoleName");
            ViewBag.SelectedRoles = new MultiSelectList(selectedRoles, "RoleId", "RoleName");
            ViewBag.fields        = new MultiSelectList(vwFields, "ID", "fieldName");

            return(View("ReportBuilder", model));
        }
Example #2
0
        public ActionResult ReportViewer(SqlReportModel model)
        {
            ListDatabaseObjects db = new ListDatabaseObjects();
            var           dbView   = db.getAllViews();
            DataTable     dt       = db.getAllViews();
            SqlViewsModel vwModel  = new SqlViewsModel();
            List <SqlViewsPropertyModel> vwPropertyList = new List <SqlViewsPropertyModel>();

            List <SqlViewsModel> vwList = new List <SqlViewsModel>();

            foreach (DataRow row in dt.Rows)
            {
                vwList.Add(new SqlViewsModel
                {
                    ID   = row["ID"].ToString(),
                    name = row["name"].ToString()
                });
            }
            ViewBag.Tables  = vwList;
            ViewBag.Reports = dt;
            //WebGridClass.GetDetailsForGrid(vwList, "View List", "ID");
            return(View("ReportViewer", model));
        }
Example #3
0
        public ActionResult EditReport(int ReportID)
        {
            SqlReportModel model = new SqlReportModel();

            ListDatabaseObjects          db       = new ListDatabaseObjects();
            DataTable                    dt       = db.getAllViews();
            List <SqlViewsPropertyModel> vwFields = new List <SqlViewsPropertyModel>();
            List <SqlViewsModel>         vwList   = new List <SqlViewsModel>();

            vwList = Converter.GetEntityList <SqlViewsModel>(dt);

            var roles   = AdminService.GetRoles();
            var modules = AdminService.GetModules();

            ViewBag.TableProperties = vwFields;
            ViewBag.Modules         = modules;
            ViewBag.Tables          = vwList;
            var selectedRoles = new List <RolesModel>();

            model.AvailableRoles = roles;
            model.SelectedRoles  = new List <RolesModel>();

            ViewBag.Roles         = new MultiSelectList(roles, "RoleId", "RoleName");
            ViewBag.SelectedRoles = new MultiSelectList(selectedRoles, "RoleId", "RoleName");
            ViewBag.fields        = new MultiSelectList(vwFields, "ID", "fieldName");

            if (ReportID > 0)
            {
                DataSet dsReport = db.getReportDetails(ReportID);
                var     result   = new { };
                if (dsReport != null && dsReport.Tables.Count > 0)
                {
                    var     dtReport        = Converter.GetEntities <SqlViewsModel>(dsReport.Tables[0]);
                    var     dtFields        = Converter.GetEntityList <ReportFieldModel>(dsReport.Tables[1]);
                    var     dtFilter        = Converter.GetEntityList <FilterFieldModel>(dsReport.Tables[2]);
                    var     dtSelectedRoles = Converter.GetEntityList <RolesModel>(dsReport.Tables[3]);
                    var     dtRoles         = Converter.GetEntities <RolesModel>(dsReport.Tables[4]);
                    DataRow report          = (dsReport.Tables[0].Rows.Count > 0) ? dsReport.Tables[0].Rows[0] : null;
                    model = Converter.DataRowTonEntity <SqlReportModel>(report);
                    model.dtReportFields  = dtFields;
                    model.dtFilterFields  = dtFilter;
                    ViewBag.SelectedRoles = dtSelectedRoles;
                    ViewBag.Roles         = new MultiSelectList(dtRoles, "RoleID", "RoleName");;
                }
            }

            return(View(model));
        }
Example #4
0
        // GET: DynamicReport
        public ActionResult Index()
        {
            ListDatabaseObjects db = new ListDatabaseObjects();
            var     dbView         = db.getAllViews();
            DataSet dsReport       = db.getReportDetails(-1);

            ViewBag.Tables = dbView;
            DataTable dtReports = dsReport.Tables[0];
            var       reports   = Converter.GetEntities <SqlReportModel>(dtReports);


            //WebGridClass wg = new WebGridClass();
            //var table = wg.GetDetailsFromDataTableForGrid<SqlReportModel>(dtReport, "View List", "ID");
            return(View());
            //return View("DynamicReports", dbView);
            //var data = new WebGridClass();
            //data = WebGridClass.HoldWebGridDetails;
            //return View(data);
        }