public async Task <ActionResult> Export(ExportModel model)
        {
            model.ProjectName = (await ProjectService.GetProjectAsync(model.ProjectGuid.GetValueOrDefault())).Name;

            var directory1 = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            Directory.CreateDirectory(directory1);

            foreach (var definitionId in model.DefinitionIds)
            {
                var definition = await ReleaseDefinitionsService.GetDefinitionJsonAsync(model.ProjectGuid.GetValueOrDefault(), definitionId);

                var token = JToken.Parse(definition);
                var file  = $"{FileUtility.RemoveInvalidFileCharacters(token["name"].ToString())}.json";
                System.IO.File.WriteAllText(Path.Combine(directory1, file), FormatJson(definition));
            }

            var friendlyFileName = $"{model.ProjectName.Replace(" ", "-")}_ReleaseDefinitions_{DateTime.Now:yyyy-MM-dd_HH-mm}.zip";
            var archive          = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            System.IO.Compression.ZipFile.CreateFromDirectory(directory1, archive);

            Directory.Delete(directory1, true);

            return(File(System.IO.File.OpenRead(archive), "application/zip", friendlyFileName));
        }
Ejemplo n.º 2
0
        private void SaveMultipleLevel(ExportModel info, TextureArray2D texture)
        {
            Debug.Assert(info.TexFormat.Format.HasGliFormat);

            var numLayer        = info.Layer == -1 ? models.Images.NumLayers : 1;
            var numLevels       = info.Mipmap == -1 ? models.Images.NumMipmaps : 1;
            var supportCropping = numLevels == 1;

            var width  = info.GetCropWidth();
            var height = info.GetCropHeight();

            if (!info.UseCropping && numLevels == 1)
            {
                // set full width and height
                width  = models.Images.GetWidth(info.Mipmap);
                height = models.Images.GetHeight(info.Mipmap);
            }

            Debug.Assert(width > 0);
            Debug.Assert(height > 0);
            if (!supportCropping)
            {
                width  = models.Images.Width;
                height = models.Images.Height;
            }

            // allocate
            ImageLoader.CreateStorage(info.TexFormat.Format.GliFormat, width, height, numLayer, numLevels);

            // store data
            for (var layerIdx = 0; layerIdx < numLayer; ++layerIdx)
            {
                for (var levelIdx = 0; levelIdx < numLevels; ++levelIdx)
                {
                    ImageLoader.GetLevelSize(levelIdx, out var bufSize);
                    var data = texture.GetData(
                        numLayer == 1 ? info.Layer : layerIdx,
                        numLevels == 1 ? info.Mipmap : levelIdx,
                        info.TexFormat.Format, info.UseCropping && supportCropping,
                        info.CropStartX, info.CropStartY, ref width, ref height,
                        models.GlData.ExportShader, (int)bufSize);

                    ImageLoader.StoreLevel(layerIdx, levelIdx, data, (UInt64)data.Length);
                }
            }

            // save texture
            if (info.FileType == ExportModel.FileFormat.Ktx)
            {
                ImageLoader.SaveKtx(info.Filename);
            }
            else if (info.FileType == ExportModel.FileFormat.Ktx2)
            {
                ImageLoader.SaveKtx2(info.Filename);
            }
            else if (info.FileType == ExportModel.FileFormat.Dds)
            {
                ImageLoader.SaveDDS(info.Filename);
            }
        }
Ejemplo n.º 3
0
        public ExcelExportResultModel Export <T>(ExportModel model, IList <T> entities) where T : class, new()
        {
            if (model == null)
            {
                throw new NullReferenceException("Excel导出信息不存在");
            }

            //设置列对应的属性类型
            SetColumnPropertyType <T>(model);

            var saveName = Guid.NewGuid() + model.Format.ToDescription();
            var saveDir  = Path.Combine(Options.TempPath, "Export", DateTime.Now.Format("yyyyMMdd"));

            if (!Directory.Exists(saveDir))
            {
                Directory.CreateDirectory(saveDir);
            }

            var result = new ExcelExportResultModel
            {
                SaveName = saveName,
                FileName = model.FileName,
                Path     = Path.Combine(saveDir, saveName)
            };

            using var fs = new FileStream(result.Path, FileMode.Create, FileAccess.Write);

            //创建文件
            _exportHandler.CreateExcel(model, entities, fs);

            return(result);
        }
Ejemplo n.º 4
0
 public void ParsedWaybillsToExcel([DataBind("filter")] ParsedWaybillsFilter filter)
 {
     if(filter.Session == null)
         filter.Session = DbSession;
     var result = ExportModel.GetParcedWaybills(filter);
     this.RenderFile("Отчет о состоянии формализованных накладных.xls", result);
 }
Ejemplo n.º 5
0
        public ActionResult Index(ExportModel model)
        {
            var data = _soLieuNhapLieuService.GetSoLieuNhapLieusXuatFile(model.fromDate,
                                                                         model.toDate, model.fromNumber, model.toNumber);

            return(View(data));
        }
Ejemplo n.º 6
0
 public void ExcelClientConditionsMonitoring()
 {
     var filter = new ClientConditionsMonitoringFilter();
     filter.Session = DbSession;
     BindObjectInstance(filter, IsPost ? ParamStore.Form : ParamStore.QueryString, "filter", AutoLoadBehavior.NullIfInvalidKey);
     this.RenderFile("Мониторинг_выставления_условий_клиенту.xls", ExportModel.GetClientConditionsMonitoring(filter));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// This method is used to load the export model from memory if available or from the database.
        /// </summary>
        /// <param name="context">Contains the <see cref="IFrameworkContext{IDataRepository}"/> object used for accessing the Vasont data repository.</param>
        /// <param name="exportId">Contains the identity of the export.</param>
        /// <returns>
        /// Returns the <see cref="ExportModel" /> model.
        /// </returns>
        public static ExportModel LoadExportModelCache(this IFrameworkContext <IDataRepository> context, long exportId)
        {
            string      exportCacheKey = $"Tenant_{context.Settings.TenantInfo.DomainKey}_Export{exportId}";
            ExportModel model          = null;

            // load XML link type model from the cache if it exists
            if (context.Cache.Contains(exportCacheKey))
            {
                model = context.Cache.Get <ExportModel>(exportCacheKey);
            }
            else
            {
                Export export = context.DataRepository.Exports
                                .AsNoTracking()
                                .FirstOrDefault(e => e.ExportId == exportId);

                if (export != null)
                {
                    model = new ExportModel(export);

                    if (!context.Cache.Contains(exportCacheKey))
                    {
                        context.Cache.Add(exportCacheKey, model);
                    }
                }
                else
                {
                    context.ErrorManager.Warning(Resources.ExportNotFoundText);
                }
            }

            return(model);
        }
Ejemplo n.º 8
0
        public IActionResult Test(InputEncapsulationModel input)
        {
            List <InputModel> inputList = input.InputModels;

            if (inputList.Count == 0)
            {
                return(NoContent());
            }
            else
            {
                if (input.SortID == "" | input.SortID == null)
                {
                    input.SortID = "Falcon lijn.Pers-groep.WP6.DataBlocksGlobal.DB_PressRxD.in.ps3AVForcePress";
                }
                List <InputModel>  valList    = inputList.Where(i => i.id == input.SortID).ToList();
                List <ExportModel> returnList = new List <ExportModel>();
                foreach (InputModel val in valList)
                {
                    ExportModel exportModel = new ExportModel();
                    exportModel.ID = 1;
                    exportModel.y  = double.Parse(val.v);
                    exportModel.x  = double.Parse(val.t);
                    returnList.Add(exportModel);
                }
                return(Ok(returnList));
                // return format of type [ ID,y,x ] in which ID is ID y = v x = t
            }
        }
Ejemplo n.º 9
0
        public void Initialize()
        {
            exportModel = ServiceLocator.Current.GetInstance <MainViewModel>().export;
            rLastPeriod = ServiceLocator.Current.GetInstance <DashboardViewModel>().LastPeriod;

            productionList = exportModel.productionList;

            produceItemProductionList = new List <produceItemsItem>();
            WorkplacesTimesNew        = new ObservableCollection <WorkplaceTimeModel>();

            workspaces   = WorkspacesModel.GetInstance().GetWorkspaces();
            produceItems = ProduceItemsModel.GetInstance().GetProduceItems();

            produceItemProductionList = ProduceItemsModel.GetInstance().GetProduceItems();

            workspaces.ForEach(w =>
            {
                string description = w.label.de;
                var shift          = 1;
                var model          = new WorkplaceTimeModel(w.id, description, 0, 0, 0, 0, 0, shift, 0);
                WorkplacesTimesNew.Add(model);
            });

            calcSetUpNew();

            productionList.ForEach(i => calculateProductionTimeNew(i.article, i.quantity));

            createMapOldTimeOrdersInWork(rLastPeriod);

            createMapOldWaitinglistWorkstations(rLastPeriod);

            oldSetUpTime(rLastPeriod, produceItems);

            calculate();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 设置列属性
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="model"></param>
        private void SetColumnPropertyType <T>(ExportModel model) where T : class, new()
        {
            if (model.Columns == null || !model.Columns.Any())
            {
                return;
            }

            var objectType = typeof(T);

            if (!_exportObjectProperties.TryGetValue(objectType.TypeHandle, out Dictionary <string, PropertyInfo> types))
            {
                types = new Dictionary <string, PropertyInfo>();
                var properties = objectType.GetProperties();
                foreach (var property in properties)
                {
                    types.Add(property.Name.ToLower(), property);
                }

                _exportObjectProperties.TryAdd(objectType.TypeHandle, types);
            }

            foreach (var column in model.Columns)
            {
                column.PropertyInfo = types.FirstOrDefault(m => m.Key.EqualsIgnoreCase(column.Name)).Value;
            }
        }
Ejemplo n.º 11
0
        public Models(int numPipelines = 1)
        {
            NumPipelines = numPipelines;
            CheckDeviceCapabilities();

            SharedModel        = new SharedModel();
            Images             = new ImagesModel(SharedModel.ScaleShader);
            TextureCache       = new TextureCache(Images);
            pixelValueShader   = new PixelValueShader(SharedModel);
            polarConvertShader = new ConvertPolarShader(SharedModel.QuadShader);

            Export = new ExportModel(SharedModel);
            Filter = new FiltersModel(Images);
            //Gif = new GifModel(sharedModel.QuadShader);
            Progress = new ProgressModel();

            for (int i = 0; i < numPipelines; ++i)
            {
                pipelines.Add(new ImagePipeline(i));
                pipelines.Last().PropertyChanged += PipeOnPropertyChanged;
            }
            Pipelines = pipelines;

            stats     = new StatisticsModel(SharedModel);
            thumbnail = new ThumbnailModel(SharedModel.QuadShader);

            // pipeline controller
            pipelineController = new PipelineController(this);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            ModelCls mymodel  = new ModelCls(); //新建模型对象,存储建立的模型
            string   path0    = null;           //路径
            int      typeFile = 1;              //文件类型,1为midas mgt,2为abaqus inp
            bool     cmd      = false;          //文件输出指令,True为输出

            DA.GetData(3, ref cmd);
            if (DA.GetData(0, ref mymodel) && DA.GetData(1, ref path0) && DA.GetData(2, ref typeFile) && cmd)
            {
                ExportModel myExport = null;
                switch (typeFile)
                {
                case 1:
                    myExport = new ExportGen(mymodel, path0);
                    break;

                case 2:
                    myExport = new ExportAbaqus(mymodel, path0);
                    break;
                }
                Process process = Process.Start(myExport.Pathfile);//打开输出的文件,便于直接复制
                process.Dispose();
            }
        }
Ejemplo n.º 13
0
        private async void ImportButton_Click(object sender, RoutedEventArgs e)
        {
            var file = await IOTools.OpenLocalFile(".guanzhi");

            if (file != null)
            {
                string text = await FileIO.ReadTextAsync(file);

                var model     = JsonConvert.DeserializeObject <ExportModel>(text);
                var tipDialog = new ConfirmDialog("导入提醒", $"您将导入用户名为'{model.UserName}'用户的相关配置及历史记录。这会覆盖您目前的配置及记录,是否确认?");
                var result    = await tipDialog.ShowAsync();

                if (result == ContentDialogResult.Primary)
                {
                    bool importResult = await ExportModel.ImportModel(model);

                    if (importResult)
                    {
                        var closeDialog = new ConfirmDialog("请重启软件", "配置及历史记录已成功导入,现在请关闭软件,重新启动应用", "关闭", "关闭", "还是关闭");
                        await closeDialog.ShowAsync();

                        App.Current.Exit();
                    }
                }
            }
        }
Ejemplo n.º 14
0
 public void FormPositionToExcel([DataBind("filter")] FormPositionFilter filter)
 {
     if(filter.Session == null)
         filter.Session = DbSession;
     var result = ExportModel.GetFormPosition(filter);
     this.RenderFile("Отчет о состоянии формализуемых полей.xls", result);
 }
        private void addUsedForms(SearchModel model)
        {
            ExportModel exportModel = new ExportModel();

            exportModel.formIds       = model.formIds;
            exportModel.formResultIds = model.sisIds;

            exportModel.formNames = new Dictionary <int, string>();

            foreach (int?nFormId in exportModel.formIds)
            {
                if (nFormId != null)
                {
                    int       formId = (int)nFormId;
                    def_Forms form   = formsRepo.GetFormById(formId);
                    if (form != null)
                    {
                        string name = form.identifier;
                        exportModel.formNames.Add(formId, name);
                    }
                }
            }

            Session["ExportModel"] = exportModel;

            model.usedForms = exportModel.formNames;
            if (model.usedForms.Count() > 1)
            {
                model.usedForms.Add(-1, "All");
            }
        }
Ejemplo n.º 16
0
        public Step1ViewModel()
        {
            exportModel = ServiceLocator.Current.GetInstance <MainViewModel>().export;

            Sellwish1 = 0;
            Sellwish2 = 0;
            Sellwish3 = 0;

            selldirect1 = 0;
            selldirect2 = 0;
            selldirect3 = 0;

            selldirect1price = 0L;
            selldirect2price = 0L;
            selldirect3price = 0L;

            selldirect1fine = 0L;
            selldirect2fine = 0L;
            selldirect3fine = 0L;

            forecast11 = 0;
            forecast21 = 0;
            forecast31 = 0;

            forecast12 = 0;
            forecast22 = 0;
            forecast32 = 0;

            forecast13 = 0;
            forecast23 = 0;
            forecast33 = 0;

            NextCommand = new RelayCommand(NextClick);
        }
Ejemplo n.º 17
0
 public void ExcelWhoWasNotUpdated()
 {
     var filter = new WhoWasNotUpdatedFilter();
     filter.Session = DbSession;
     BindObjectInstance(filter, IsPost ? ParamStore.Form : ParamStore.QueryString, "filter", AutoLoadBehavior.NullIfInvalidKey);
     this.RenderFile("Кто_не_обновлялся_с_опред._даты.xls", ExportModel.ExcelWhoWasNotUpdated(filter));
 }
Ejemplo n.º 18
0
        public async Task <ActionResult> Export(ExportModel model)
        {
            model.ProjectName = (await ProjectService.GetProjectAsync(model.ProjectGuid.GetValueOrDefault())).Name;

            var directory1 = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            Directory.CreateDirectory(directory1);

            foreach (var groupId in model.GroupIds)
            {
                var group = await TaskGroupService.GetTaskGroupAsync(model.ProjectGuid.GetValueOrDefault(), groupId);

                var file = $"{FileUtility.RemoveInvalidFileCharacters(group.Name)}.json";
                System.IO.File.WriteAllText(Path.Combine(directory1, file), JsonConvert.SerializeObject(group, Formatting.Indented));
            }

            var friendlyFileName = $"{model.ProjectName.Replace(" ", "-")}_TaskGroups_{DateTime.Now:yyyy-MM-dd_HH-mm}.zip";
            var archive          = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            System.IO.Compression.ZipFile.CreateFromDirectory(directory1, archive);

            Directory.Delete(directory1, true);

            return(File(System.IO.File.OpenRead(archive), "application/zip", friendlyFileName));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 导出excel数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns>filename</returns>
        public string ExportExcelData(JqGridPostData model)
        {
            string   tableName = model.QuerySet.TableName;
            FapTable ftb       = _dbContext.Table(tableName);
            string   fileName  = $"{ftb.TableComment}_{UUIDUtils.Fid}.xlsx";
            string   filePath  = Path.Combine(Environment.CurrentDirectory, FapPlatformConstants.TemporaryFolder, fileName);
            Pageable pageable  = AnalysisPostData(model);

            pageable.QueryCols = model.QuerySet.ExportCols;
            string sql = pageable.Wraper.MakeExportSql();

            if (pageable.Parameters != null && pageable.Parameters.Count > 0)
            {
                foreach (var param in pageable.Parameters)
                {
                    sql = sql.Replace("@" + param.Key, "'" + param.Value + "'");
                }
            }
            ExportModel em = new ExportModel()
            {
                DataSql = sql, FileName = filePath, TableName = tableName, ExportCols = pageable.QueryCols
            };

            bool result = _officeService.ExportExcel(em);

            return(result ? fileName : "");
        }
Ejemplo n.º 20
0
        public ActionResult Index(ExportModel Expmodel, TrainBookingRequestModel model, FormCollection frm, int?page)
        {
            TrainBookingRequestRepository _rep = new TrainBookingRequestRepository();
            var ts = (TravelSession)Session["TravelPortalSessionInfo"];

            model.StatusId      = 1;
            model.PagedList     = _rep.GetBrachPendingBookingPagedList(model, page, ts.LoginTypeId);
            ViewData["DisList"] = new SelectList(defaultProvider.GetDistributorList(ts.LoginTypeId), "DistributorId", "DistributorName");
            if (TrainGeneralRepository.Message != null)
            {
                model.Message = TrainGeneralRepository.Message;
            }
            else
            {
                model.Message = _msg;
            }
            GetExportTypeClicked(Expmodel, frm);

            if (Expmodel != null &&
                (Expmodel.ExportTypeExcel != null ||
                 Expmodel.ExportTypeWord != null ||
                 Expmodel.ExportTypeCSV != null ||
                 Expmodel.ExportTypePdf != null))
            {
                try
                {
                    if (Expmodel.ExportTypeExcel != null)
                    {
                        Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel;
                    }
                    else if (Expmodel.ExportTypeWord != null)
                    {
                        Expmodel.ExportTypeWord = Expmodel.ExportTypeWord;
                    }
                    else if (Expmodel.ExportTypePdf != null)
                    {
                        Expmodel.ExportTypePdf = Expmodel.ExportTypePdf;
                    }

                    var exportData = _rep.BranchList(model, ts.LoginTypeId).Select(m => new
                    {
                        SNo              = m.SNo,
                        Passenger_Name   = m.FullName,
                        Sector           = m.Sector,
                        DepartureDate    = m.DepartureDate,
                        RequestDate      = m.CreateDate,
                        TicketStatusName = m.StatusName,
                        RequestBy        = m.CreatedByName,
                        Request_ID       = "AH-TR-" + m.TrainPNRId.ToString().PadLeft(5, '0')
                    });

                    App_Class.AppCollection.Export(Expmodel, exportData, "TrainBookingRequestList");
                }
                catch (Exception ex)
                {
                    ATLTravelPortal.Utility.ErrorLogging.LogException(ex);
                }
            }
            return(View(model));
        }
Ejemplo n.º 21
0
        public ActionResult <ExportModel> AllVehicles(DateTime dayOf)
        {
            var export = m_Context.Export.FirstOrDefault(c => c.export_date.Date == dayOf.Date && c.export_type == "Vehicle");

            if (export == null)
            {
                ExportHelper helper   = new ExportHelper(m_appSettings.SecurityConnection);
                string       fileName = "Vehicle_Data_" + dayOf.ToString("yyyy.MM.dd") + ".json";

                //Kick off the file export & return
                Task task = Task.Run(() => helper.ExportVehicleData(dayOf, m_appSettings.ExportFileLocation, fileName));
                //NOTE: In a production environment the files would mostly be generated by a scheduled nightly job.
                //If they *were* being generated on-demand, then this method would most likely write the request to a
                //queue of some sort where a seperate process would pick it up and process it. That
                //would be a preferred approach, so as not to overburden the web server with file generation. We are
                //launching it here on a background task just for demonstration purposes.

                return(StatusCode(202));
            }

            var result = new ExportModel
            {
                location = m_appSettings.ApiBase + $"/download/{export.Id}"
            };


            return(result);
        }
Ejemplo n.º 22
0
        void ExportToSql(ExportModel data, AppOptionInfo opts, EntityMap entityMap, CodeGenRunner codeGenRunner, string template, List <string> files)
        {
            var fileName = GetFileName(entityMap.Name, entityMap.SortOrder, opts.OutputFile);

            codeGenRunner.GenerateCodeFromTemplate(data, template, codeGenRunner.WorkingFolder, fileName);
            files.Add(Path.Combine(codeGenRunner.WorkingFolder, fileName));
        }
        public ActionResult ExcelExport(string GridModel)
        {
            ExportModel exportModel = new ExportModel();

            exportModel = (ExportModel)JsonConvert.DeserializeObject(GridModel, typeof(ExportModel));  // Deserialized the GridModel
            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                IApplication application = excelEngine.Excel;
                application.DefaultVersion = ExcelVersion.Excel2013;
                IWorkbook   workbook   = application.Workbooks.Create(1);
                IWorksheet  worksheet  = workbook.Worksheets[0];
                IEnumerable DataSource = order;

                //Import the data to worksheet
                IList <OrdersDetails> reports = DataSource.AsQueryable().Cast <OrdersDetails>().ToList();
                worksheet.ImportData(reports, 2, 1, true);
                MemoryStream stream = new MemoryStream();
                workbook.SaveAs(stream);
                stream.Position = 0;

                //Download the Excel file in the browser
                FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/excel");

                fileStreamResult.FileDownloadName = "Output.xlsx";

                return(fileStreamResult);
            }
        }
Ejemplo n.º 24
0
 public void ExcelAnalysisOfWorkDrugstores()
 {
     var filter = new AnalysisOfWorkDrugstoresFilter();
     filter.Session = DbSession;
     BindObjectInstance(filter, IsPost ? ParamStore.Form : ParamStore.QueryString, "filter", AutoLoadBehavior.NullIfInvalidKey);
     this.RenderFile("Сравнительный_анализ_работы_аптек.xls", ExportModel.ExcelAnalysisOfWorkDrugstores(filter));
 }
Ejemplo n.º 25
0
        public ActionResult Index(BusPNRModel model, int?page, ExportModel Expmodel, FormCollection frm)
        {
            Session["FromDate"] = model.FromDate;
            Session["ToDate"]   = model.ToDate;
            BusPNRModel _model            = new BusPNRModel();
            UnIssuedTicketRepository _rep = new UnIssuedTicketRepository();

            BusGeneralRepository.SetRequestPageRow();
            try
            {
                var ts = (TravelSession)Session["TravelPortalSessionInfo"];
                ViewData["AgentList"] = new SelectList(defaultProvider.GetDistributorAgentList(ts.LoginTypeId), "AgentId", "AgentName");
                _model.TabularList    = _rep.GetDistributorPagedIssueList(page, model.FromDate, model.ToDate, model.AgentId, ts.LoginTypeId);
            }
            catch (Exception ex)
            {
                _model.Message = BusGeneralRepository.CatchException(ex);
            }

            //export
            BookedTicketReportController crtBKT = new BookedTicketReportController();

            crtBKT.GetExportTypeClicked(Expmodel, frm);

            if (Expmodel != null && (Expmodel.ExportTypeExcel != null || Expmodel.ExportTypeWord != null || Expmodel.ExportTypeCSV != null || Expmodel.ExportTypePdf != null))
            {
                try
                {
                    if (Expmodel.ExportTypeExcel != null)
                    {
                        Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel;
                    }
                    else if (Expmodel.ExportTypeWord != null)
                    {
                        Expmodel.ExportTypeWord = Expmodel.ExportTypeWord;
                    }
                    else if (Expmodel.ExportTypePdf != null)
                    {
                        Expmodel.ExportTypePdf = Expmodel.ExportTypePdf;
                    }

                    var exportData = _model.TabularList.Select(m => new
                    {
                        Passenger_Name = m.FullName,
                        Operator_Name  = m.BusMasterName,
                        DepartureDate  = TimeFormat.DateFormat(m.DepartureDate.ToString()),
                        DepartureTime  = TimeFormat.GetAMPMTimeFormat(m.DepartureTime.ToString()),
                        Category       = m.BusCategoryName,
                        Type           = m.Type
                    });
                    App_Class.AppCollection.Export(Expmodel, exportData, "Issued Ticket");
                }
                catch
                {
                }
            }

            _model.Message = _res;
            return(View(_model));
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Exports the specified entity map.
        /// </summary>
        /// <param name="entityMap">The entity map.</param>
        /// <param name="exportIdentityColumn">if set to <c>true</c> [export identity column].</param>
        /// <param name="exportDatabaseGeneratedColumn">if set to <c>true</c> [export database generated column].</param>
        /// <returns></returns>
        public ExportModel Export(EntityMap entityMap, bool exportIdentityColumn = true, bool exportDatabaseGeneratedColumn = true)
        {
            var model = new ExportModel
            {
                ImportDialect      = importDialect,
                ExportDialect      = exportDialect,
                Map                = entityMap,
                TypeConverterStore = typeConverter
            };

            model.Options.ExportIdentityColumn           = exportIdentityColumn;
            model.Options.ExportDatabaseGeneratedColumns = exportDatabaseGeneratedColumn;

            IDbAccess dbAccess = new DbAccess(dbConnector);

            using (var conn = dbConnector.CreateNewConnection())
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }

                var dataBag = dbAccess.ExecuteDictionary(conn, model.SelectSqlStatement());
                model.DataBag = dataBag;
            }

            return(model);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 设置列名
        /// </summary>
        private void SetColumnName(ExcelWorksheet sheet, ExportModel model, ref int index)
        {
            if (!model.ShowColName)
            {
                return;
            }

            sheet.Row(index).Height = 25;
            for (int i = 0; i < model.Columns.Count; i++)
            {
                var col  = model.Columns[i];
                var cell = sheet.Cells[index, i + 1];
                cell.Value           = col.Label;
                cell.Style.Font.Size = 12;
                cell.Style.Font.Bold = true;
                cell.Style.Font.Color.SetColor(Color.CornflowerBlue);
                cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                cell.Style.VerticalAlignment   = ExcelVerticalAlignment.Center;

                if (col.Width > 0)
                {
                    sheet.Column(i + 1).Width = col.Width;
                }
                else
                {
                    sheet.Column(i + 1).AutoFit();
                }
            }
            index++;
        }
        public ActionResult Index(ExportModel Expmodel, BookedTicketModels model, FormCollection frm, int?pageNo, int?flag)
        {
            var ts = SessionStore.GetTravelSession();

            //var agentsByDistributor = distributorManagementProvider.GetAllAgentsByDistributorId(ts.AppUserId);
            //var details = ser.ListBookedReport(model.AgentId, model.FromDate, model.ToDate);
            //var result = agentsByDistributor.SelectMany(b => details.Where(x => x.AgentId == b.AgentId).ToList());

            var details = ser.ListBookedReport(model.AgentId, model.FromDate, model.ToDate);
            var result  = details.Where(x => x.DistributorId == ts.LoginTypeId);

            model.BookedTicketList = result;

            model.BookedTicketList = result;
            //export
            GetExportTypeClicked(Expmodel, frm);
            if (Expmodel != null && (Expmodel.ExportTypeExcel != null || Expmodel.ExportTypeWord != null || Expmodel.ExportTypeCSV != null || Expmodel.ExportTypePdf != null))
            {
                try
                {
                    if (Expmodel.ExportTypeExcel != null)
                    {
                        Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel;
                    }
                    else if (Expmodel.ExportTypeWord != null)
                    {
                        Expmodel.ExportTypeWord = Expmodel.ExportTypeWord;
                    }
                    else if (Expmodel.ExportTypePdf != null)
                    {
                        Expmodel.ExportTypePdf = Expmodel.ExportTypePdf;
                    }

                    var exportData = model.BookedTicketList.Select(m => new
                    {
                        Agent_Name         = m.AgentName,
                        GDSReferenceNumber = m.GDSRefrenceNumber,
                        PassengerName      = m.PassengerName,
                        Sector             = m.Sector,
                        Flight_Date        = m.FlightDate,
                        BookedOn           = m.BookedOn,
                        BookedBy           = m.BookedBy
                    });
                    App_Class.AppCollection.Export(Expmodel, exportData, "Booked Ticket");
                }
                catch
                {
                }
            }

            ViewData["AirlineTypes"] = new SelectList(ser.GetAirlineTypesList(), "AirineTypeId", "TypeName");

            //var agents = defaultProvider.GetAgentList().Where(x => x.CreatedBy == ts.AppUserId);
            var agents = defaultProvider.GetAgentList().Where(x => x.DistributorId == ts.LoginTypeId);

            ViewData["AgentList"] = new SelectList(agents, "AgentId", "AgentName");

            return(View(model));
        }
Ejemplo n.º 29
0
        public ActionResult Index(ExportModel Expmodel, AgentCLApprovedModel model, FormCollection frm, int?pageNo, int?flag)
        {
            var ts = (TravelSession)Session["TravelPortalSessionInfo"];

            if (ts.UserTypeId == 6)
            {
                model.DistributorID = ts.LoginTypeId;
            }
            model.AgentCLApprovedListExport = agentCLApprovedProvider.GetAgentCLApprovedList(model.FromDate, model.ToDate, model.UserID, model.DistributorID, model.AgentId);


            //export
            BookedTicketReportController crtBKT = new BookedTicketReportController();

            crtBKT.GetExportTypeClicked(Expmodel, frm);

            if (Expmodel != null && (Expmodel.ExportTypeExcel != null || Expmodel.ExportTypeWord != null || Expmodel.ExportTypeCSV != null || Expmodel.ExportTypePdf != null))
            {
                try
                {
                    if (Expmodel.ExportTypeExcel != null)
                    {
                        Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel;
                    }
                    else if (Expmodel.ExportTypeWord != null)
                    {
                        Expmodel.ExportTypeWord = Expmodel.ExportTypeWord;
                    }
                    else if (Expmodel.ExportTypePdf != null)
                    {
                        Expmodel.ExportTypePdf = Expmodel.ExportTypePdf;
                    }

                    var exportData = model.AgentCLApprovedListExport.Select(m => new
                    {
                        Brach_Office = m.BranchOfficeName,
                        Distributor  = m.DistributorName,
                        Agent_Name   = m.AgentName,
                        Agent_Code   = m.AgentCode,
                        Currency     = m.Currency,
                        Amount       = m.Amount,
                        Type         = m.Type,
                        Requestion   = m.Requestion,
                        Checker_Date = m.CheckerDate,
                        CheckerBy    = m.CheckedBy
                    });

                    App_Class.AppCollection.Export(Expmodel, exportData, "Issued Ticket");
                }
                catch
                {
                }
            }


            model.UsersOption = new SelectList(agentCLApprovedProvider.GetDistributorUsers(model.DistributorID), "AppUserId", "FullName");
            model.AgentOption = new SelectList(agentCLApprovedProvider.GetAgentsByDistributorId(model.DistributorID ?? 0), "AgentId", "AgentName", model.AgentId);
            return(View(model));
        }
Ejemplo n.º 30
0
        public ActionResult Index(ExportModel Expmodel, AgentCLApprovedModel model, FormCollection frm, int?pageNo, int?flag, int?page)
        {
            var ts = (TravelSession)Session["TravelPortalSessionInfo"];


            int currentPageIndex = page.HasValue ? page.Value : 1;
            int defaultPageSize  = 50;

            //export
            BookedTicketReportController crtBKT = new BookedTicketReportController();

            crtBKT.GetExportTypeClicked(Expmodel, frm);

            if (Expmodel != null && (Expmodel.ExportTypeExcel != null || Expmodel.ExportTypeWord != null || Expmodel.ExportTypeCSV != null || Expmodel.ExportTypePdf != null))
            {
                model.AgentCLApprovedListExport = agentReceiptsProvider.GetAgentCLApprovedList(model.FromDate, model.ToDate, model.UserID, model.DistributorID, model.AgentId);
                try
                {
                    if (Expmodel.ExportTypeExcel != null)
                    {
                        Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel;
                    }
                    else if (Expmodel.ExportTypeWord != null)
                    {
                        Expmodel.ExportTypeWord = Expmodel.ExportTypeWord;
                    }
                    else if (Expmodel.ExportTypePdf != null)
                    {
                        Expmodel.ExportTypePdf = Expmodel.ExportTypePdf;
                    }

                    var exportData = model.AgentCLApprovedListExport.Select(m => new
                    {
                        BranchOffice_Name = m.BranchOfficeName,
                        Distributor_Name  = m.DistributorName,
                        Agent_Name        = m.AgentName,
                        Agent_Code        = m.AgentCode,
                        Currency          = m.Currency,
                        Amount            = m.Amount,
                        Narration         = m.Comments,
                        VoucherNo         = m.VoucherNo,
                        CreatedBy         = m.CheckedBy,
                        CreatedDate       = m.CheckerDate
                    });

                    App_Class.AppCollection.Export(Expmodel, exportData, "Agent Receipts");
                }
                catch
                {
                }
            }
            model.AgentReceiptList   = agentReceiptsProvider.GetAgentCLApprovedList(model.FromDate, model.ToDate, model.UserID, model.DistributorID, model.AgentId).ToPagedList(currentPageIndex, defaultPageSize);
            model.UsersOption        = new SelectList(defaultProvider.GetUserList(), "AppUserId", "FullName");
            model.BranchOfficeOption = new SelectList(branchOfficeManagementProvider.GetAll(), "BranchOfficeId", "BranchOfficeName", model.BranchOfficeId);
            model.DistributorOption  = new SelectList(agentclaapprovedprovider.GetAllDistributorsByBranchOfficeId(model.BranchOfficeId ?? 0), "DistributorId", "DistributorName");
            model.AgentOption        = new SelectList(agentclaapprovedprovider.GetAgentsByDistributorId(model.DistributorID ?? 0), "AgentId", "AgentName", model.AgentId);

            return(View(model));
        }