コード例 #1
0
        public ActionResult ExportTo(string id, string OutputFormat)
        {
            ActionResult obj;
            var          model = Session[id + "_resultado"] as ListadoResultado;

            var settings = Session[id + "Settings"] as GridViewSettings;

            if (settings.Columns["Action"] != null)
            {
                settings.Columns.Remove(settings.Columns["Action"]);
            }

            switch (OutputFormat.ToUpper())
            {
            case "CSV":
                obj = GridViewExtension.ExportToCsv(settings, model.Listado, true);
                break;

            case "PDF":
                obj = GridViewExtension.ExportToPdf(settings, model.Listado, true);
                break;

            case "RTF":
                obj = GridViewExtension.ExportToRtf(settings, model.Listado, true);
                break;

            case "XLS":
                obj = GridViewExtension.ExportToXls(settings, model.Listado, true);
                break;

            case "XLSX":
                obj = GridViewExtension.ExportToXlsx(settings, model.Listado, true);
                break;

            default:
                obj = RedirectToAction("Index", "Home");
                break;
            }

            var result = obj as FileStreamResult;

            result.FileDownloadName = (model.TituloListado ?? "ListadosMarfil") + "." + OutputFormat.ToLower();
            return(result);
        }
コード例 #2
0
        public ActionResult ExportTo(string exportid, string OutputFormat)
        {
            ActionResult obj;
            var          model    = Session[session] as TarifasModel;
            var          settings = Session["TarifasSettings"]  as GridViewSettings;

            if (settings.Columns["Action"] != null)
            {
                settings.Columns.Remove(settings.Columns["Action"]);
            }

            switch (OutputFormat.ToUpper())
            {
            case "CSV":
                obj = GridViewExtension.ExportToCsv(settings, model.Lineas, true);
                break;

            case "PDF":
                obj = GridViewExtension.ExportToPdf(settings, model.Lineas, true);
                break;

            case "RTF":
                obj = GridViewExtension.ExportToRtf(settings, model.Lineas, true);
                break;

            case "XLS":
                obj = GridViewExtension.ExportToXls(settings, model.Lineas, true);
                break;

            case "XLSX":
                obj = GridViewExtension.ExportToXlsx(settings, model.Lineas, true);
                break;

            default:
                obj = RedirectToAction("Index");
                break;
            }

            var result = obj as FileStreamResult;

            result.FileDownloadName = (model.Descripcion ?? Tarifas.TituloEntidad) + "." + OutputFormat.ToLower();
            return(result);
        }
コード例 #3
0
        public ActionResult ExportDetailsTo(string OutputFormat)
        {
            ActionResult obj;
            var          model    = Session["_tablasvariaslin_"] as BaseTablasVariasModel;;
            var          settings = Session["TablavariaSettings"] as GridViewSettings;

            if (settings.Columns["Action"] != null)
            {
                settings.Columns.Remove(settings.Columns["Action"]);
            }

            switch (OutputFormat.ToUpper())
            {
            case "CSV":
                obj = GridViewExtension.ExportToCsv(settings, model.Lineas, true);
                break;

            case "PDF":
                obj = GridViewExtension.ExportToPdf(settings, model.Lineas, true);
                break;

            case "RTF":
                obj = GridViewExtension.ExportToRtf(settings, model.Lineas, true);
                break;

            case "XLS":
                obj = GridViewExtension.ExportToXls(settings, model.Lineas, true);
                break;

            case "XLSX":
                obj = GridViewExtension.ExportToXlsx(settings, model.Lineas, true);
                break;

            default:
                obj = RedirectToAction("Index");
                break;
            }

            var result = obj as FileStreamResult;

            result.FileDownloadName = (model.DisplayName ?? "ExportMarfil") + "." + OutputFormat.ToLower();
            return(result);
        }
コード例 #4
0
        public ActionResult ExportTo(GridViewExportFormat format)
        {
            var setting = GetGridViewSetting();
            var data    = QuotesProvider.GetQuotes();

            if (format == GridViewExportFormat.Pdf)
            {
                return(GridViewExtension.ExportToPdf(setting, data));
            }

            if (format == GridViewExportFormat.Rtf)
            {
                return(GridViewExtension.ExportToRtf(setting, data));
            }

            if (format == GridViewExportFormat.Xls)
            {
                return(GridViewExtension.ExportToXls(setting, data, new XlsExportOptionsEx {
                    ExportType = DevExpress.Export.ExportType.WYSIWYG
                }));
            }

            if (format == GridViewExportFormat.Xlsx)
            {
                return(GridViewExtension.ExportToXlsx(setting, data, new XlsxExportOptionsEx {
                    ExportType = DevExpress.Export.ExportType.WYSIWYG
                }));
            }

            if (format == GridViewExportFormat.Csv)
            {
                return(GridViewExtension.ExportToCsv(setting, data, new CsvExportOptionsEx {
                    ExportType = DevExpress.Export.ExportType.WYSIWYG
                }));
            }

            return(Content(string.Empty));
        }
コード例 #5
0
        private ActionResult ExportToType(string OutputFormat, GridViewSettings exportSettings, dynamic model)
        {
            switch (OutputFormat.ToUpper())
            {
            case "CSV":
                return(GridViewExtension.ExportToCsv(exportSettings, model));

            case "PDF":
                return(GridViewExtension.ExportToPdf(exportSettings, model));

            case "RTF":
                return(GridViewExtension.ExportToRtf(exportSettings, model));

            case "XLS":
                return(GridViewExtension.ExportToXls(exportSettings, model));

            case "XLSX":
                return(GridViewExtension.ExportToXlsx(exportSettings, model));

            default:
                return(RedirectToAction("Index"));
            }
        }
コード例 #6
0
        public ActionResult ExportToPdf()
        {
            var data = GetListIndex();

            return(GridViewExtension.ExportToPdf(CreateExportGridViewSettings(), data));
        }
コード例 #7
0
        public ActionResult ExportTo(GridViewExportFormat?exportFormat, int companyId, DateTime d_From, DateTime d_To)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR");
            string _CompanyName = (from tt in DB.Companies
                                   where tt.ID == companyId && tt.IS_DELETED == false
                                   select new { tt.NAME }).FirstOrDefault().NAME;

            if (exportFormat == null || !GridViewExportHelper.ExportFormatsInfo.ContainsKey(exportFormat.Value))
            {
                return(RedirectToAction("CompanyAlarmListPartial", companyId));
            }

            //DateTime dts = Convert.ToDateTime(datePck);
            string date1 = Convert.ToString(d_From);

            date1 = date1.Substring(0, date1.Length - 9);
            DateTime date_1 = Convert.ToDateTime(date1);

            DateTime date_2;
            DateTime date2 = Convert.ToDateTime(d_To);

            if (date2.Hour == 00)
            {
                date_2 = date2.AddHours(23);
                date_2 = date_2.AddMinutes(59);
            }
            else
            {
                date_2 = date2;
            }

            var _list = (from tt in DB.AlarmStatus
                         join t in DB.Stations on tt.STATION_ID equals t.ID
                         where t.COMPANY_ID == companyId
                         select new { tt.INVERTER_ID, tt.ERROR_NUMBER, tt.START_DATE, tt.STATION_ID, tt.END_DATE, t.NAME }).OrderBy(X => X.START_DATE).ToList();



            var _listInv       = DB.Inverters.ToList();
            var _listAlarmDesc = DB.AlarmDesc.ToList();
            List <AlarmStatusDTO> _ListDataSource = new List <AlarmStatusDTO>();

            for (int i = 0; i < _list.Count; i++)
            {
                AlarmStatusDTO alarmStatus = new AlarmStatusDTO();

                alarmStatus.INVERTER_ID = _list[i].INVERTER_ID;

                TBL_INVERTER _TblInv = _listInv.Where(x => x.ID == _list[i].INVERTER_ID).FirstOrDefault();

                if (_TblInv != null)
                {
                    alarmStatus.INV_NAME = _TblInv.NAME;
                }
                else
                {
                    alarmStatus.INV_NAME = "-";
                }

                alarmStatus.ERROR_NUMBER = _list[i].ERROR_NUMBER;
                //alarmStatus.STATUS = _list[i].STATUS;
                alarmStatus.START_DATE   = _list[i].START_DATE;
                alarmStatus.STATION_NAME = _list[i].NAME;
                alarmStatus.END_DATE     = _list[i].END_DATE;
                alarmStatus.STATION_ID   = _list[i].STATION_ID;

                alarmStatus.ERROR_NUMBER_NAME = _listAlarmDesc.Where(a => a.ERROR_NUMBER == _list[i].ERROR_NUMBER).FirstOrDefault().ERROR_DESC;
                //switch (_list[i].ERROR_NUMBER)
                //{
                //	case "0001":
                //		alarmStatus.ERROR_NUMBER_NAME = "Communication Error";
                //		break;
                //	case "0002":
                //		alarmStatus.ERROR_NUMBER_NAME = "Station Voltage L2 Fault";
                //		break;
                //	case "0003":
                //		alarmStatus.ERROR_NUMBER_NAME = "Station Voltage L1 Fault";
                //		break;
                //	case "0004":
                //		alarmStatus.ERROR_NUMBER_NAME = "Station Voltage L3 Fault";
                //		break;
                //	case "0005":
                //		alarmStatus.ERROR_NUMBER_NAME = "EKK No Connection";
                //		break;
                //	case "0006":
                //		alarmStatus.ERROR_NUMBER_NAME = "No Main Voltage";
                //		break;
                //	case "0007":
                //		alarmStatus.ERROR_NUMBER_NAME = "No Production";
                //		break;
                //	case "0008":
                //		alarmStatus.ERROR_NUMBER_NAME = "AC Voltage Fault";
                //		break;
                //}

                _ListDataSource.Add(alarmStatus);
            }

            List <CompanyAlarmStatusExportDTO> _ListExport = new List <CompanyAlarmStatusExportDTO>();

            var _TempList = _ListDataSource.Where(x => x.START_DATE >= date_1 && x.START_DATE <= date_2) /*.OrderBy(x => x.START_DATE)*/.ToList();


            for (int i = 0; i < _TempList.Count; i++)
            {
                CompanyAlarmStatusExportDTO _ExportDto = new CompanyAlarmStatusExportDTO();

                _ExportDto.ID               = i + 1;
                _ExportDto.DEVICE           = _TempList[i].INV_NAME;
                _ExportDto.ERROR_DEFINITION = _TempList[i].ERROR_NUMBER_NAME;
                _ExportDto.ALERT_START_DATE = _TempList[i].START_DATE.ToString();
                _ExportDto.ALERT_END_DATE   = _TempList[i].END_DATE.ToString();


                _ExportDto.STATION_NAME = _TempList[i].STATION_NAME;



                _ListExport.Add(_ExportDto);
            }

            string     filename = _CompanyName + " (" + date1.ToString() + " - " + date2.ToShortDateString() + ")";
            GridHelper gh       = new GridHelper(companyId);

            if (exportFormat == GridViewExportFormat.Xls)
            {
                XlsExportOptionsEx exportOptions = new XlsExportOptionsEx();
                exportOptions.CustomizeCell += new DevExpress.Export.CustomizeCellEventHandler(exportOptions_CustomizeCell);
                return(GridViewExtension.ExportToXls(gh.GridStationSetting, _ListExport, filename, exportOptions));
            }
            else if (exportFormat == GridViewExportFormat.Pdf)
            {
                return(GridViewExtension.ExportToPdf(gh.GridStationSetting, _ListExport, filename));
            }
            else if (exportFormat == GridViewExportFormat.Xlsx)
            {
                return(GridViewExtension.ExportToXlsx(gh.GridStationSetting, _ListExport, filename));
            }
            return(View(companyId));
        }
コード例 #8
0
        public ActionResult ExportTo(GridViewExportFormat?exportFormat, int stationId, DateTime d_From, DateTime d_To)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR");
            string _stationName = (from tt in DB.Stations
                                   where tt.ID == stationId && tt.IS_DELETED == false
                                   select new { tt.NAME }).FirstOrDefault().NAME;

            if (exportFormat == null || !GridViewExportHelper.ExportFormatsInfo.ContainsKey(exportFormat.Value))
            {
                return(RedirectToAction("AlarmListPartial", stationId));
            }

            //DateTime dts = Convert.ToDateTime(datePck);
            string date1 = Convert.ToString(d_From);

            date1 = date1.Substring(0, date1.Length - 9);
            DateTime date_1 = Convert.ToDateTime(date1);

            DateTime date_2;
            DateTime date2 = Convert.ToDateTime(d_To);

            if (date2.Hour == 00)
            {
                date_2 = date2.AddHours(23);
                date_2 = date_2.AddMinutes(59);
            }
            else
            {
                date_2 = date2;
            }

            var stationName    = DB.Stations.Where(a => a.ID == stationId).FirstOrDefault().NAME;
            var _listAlarmDesc = DB.AlarmDesc.ToList();
            var _list          = DB.AlarmStatus.Where(x => x.STATION_ID == stationId).OrderBy(x => x.START_DATE).ToList();

            var _listInv = DB.Inverters.ToList();

            List <AlarmStatusDTO> _ListDataSource = new List <AlarmStatusDTO>();

            for (int i = 0; i < _list.Count; i++)
            {
                AlarmStatusDTO alarmStatus = new AlarmStatusDTO();

                alarmStatus.INVERTER_ID = _list[i].INVERTER_ID;

                TBL_INVERTER _TblInv = _listInv.Where(x => x.ID == _list[i].INVERTER_ID).FirstOrDefault();

                if (_TblInv != null)
                {
                    alarmStatus.INV_NAME = _TblInv.NAME;
                }
                else
                {
                    alarmStatus.INV_NAME = stationName;
                }

                alarmStatus.ERROR_NUMBER = _list[i].ERROR_NUMBER;
                //alarmStatus.STATUS = _list[i].STATUS;
                alarmStatus.START_DATE = _list[i].START_DATE;

                alarmStatus.END_DATE   = _list[i].END_DATE;
                alarmStatus.STATION_ID = _list[i].STATION_ID;

                alarmStatus.ERROR_NUMBER_NAME = _listAlarmDesc.Where(a => a.ERROR_NUMBER == _list[i].ERROR_NUMBER).FirstOrDefault().ERROR_DESC;

                _ListDataSource.Add(alarmStatus);
            }

            List <AlarmStatusExportDTO> _ListExport = new List <AlarmStatusExportDTO>();

            var _TempList = _ListDataSource.Where(x => x.START_DATE >= date_1 && x.START_DATE <= date_2) /*.OrderBy(x => x.START_DATE)*/.ToList();


            for (int i = 0; i < _TempList.Count; i++)
            {
                AlarmStatusExportDTO _ExportDto = new AlarmStatusExportDTO();

                _ExportDto.ID               = i + 1;
                _ExportDto.DEVICE           = _TempList[i].INV_NAME;
                _ExportDto.ERROR_DEFINITION = _TempList[i].ERROR_NUMBER_NAME;
                _ExportDto.ALERT_START_DATE = _TempList[i].START_DATE.ToString();
                _ExportDto.ALERT_END_DATE   = _TempList[i].END_DATE.ToString();

                _ListExport.Add(_ExportDto);
            }

            string     filename = _stationName + " (" + date1.ToString() + " - " + date2.ToShortDateString() + ")";
            GridHelper gh       = new GridHelper(stationId);

            if (exportFormat == GridViewExportFormat.Xls)
            {
                XlsExportOptionsEx exportOptions = new XlsExportOptionsEx();
                exportOptions.CustomizeCell += new DevExpress.Export.CustomizeCellEventHandler(exportOptions_CustomizeCell);
                return(GridViewExtension.ExportToXls(gh.GridStationSetting, _ListExport, filename, exportOptions));
            }
            else if (exportFormat == GridViewExportFormat.Pdf)
            {
                return(GridViewExtension.ExportToPdf(gh.GridStationSetting, _ListExport, filename));
            }
            else if (exportFormat == GridViewExportFormat.Xlsx)
            {
                return(GridViewExtension.ExportToXlsx(gh.GridStationSetting, _ListExport, filename));
            }
            return(View(stationId));
        }
コード例 #9
0
 public ActionResult ExportToPdf()
 {
     return(GridViewExtension.ExportToPdf(CreateExportGridViewSettings(), GetListIndex()));
 }
コード例 #10
0
 public ActionResult ExportTo()
 {
     return(GridViewExtension.ExportToPdf(GridViewHelper.GetExportSettings(Request.Params["ExportColumnsNames"]), TestModel.GetDS()));
 }
コード例 #11
0
 public ActionResult ExportarPDF()
 {
     return(GridViewExtension.ExportToPdf(CreateExportGridViewSettings(), SalesService.Instance.listCustomers()));
 }
コード例 #12
0
        public ActionResult Export()
        {
            var model = Product.GetProducts();

            return(GridViewExtension.ExportToPdf(ExportHelper.GetGridViewSettings(true), model));
        }
コード例 #13
0
 public ActionResult ExportTo()
 {
     return(GridViewExtension.ExportToPdf(GridViewHelper.GetExportSettings(Request.Params["ExportColumnsNames"]), NorthwindDataProvider.GetEmployees()));
 }