Beispiel #1
0
 /// <summary>
 /// 开启服务
 /// </summary>
 /// <param name="appPath">程序路径</param>
 public static void StartService()
 {
     m_staffService        = new StaffService();
     m_awardService        = new AwardService();
     m_bsStockService      = new BSStockService();
     m_businessCardService = new BusinessCardService();
     m_calendarService     = new CalendarService();
     m_clueService         = new ClueService();
     m_dialogService       = new DialogService();
     m_dimensionService    = new DimensionService();
     m_exportService       = new ExportService();
     m_followService       = new FollowService();
     m_gitService          = new GitService();
     m_jidianService       = new JidianService();
     m_levelService        = new LevelService();
     m_masterService       = new MasterService();
     m_opinionService      = new OpinionService();
     m_personalService     = new PersonalService();
     m_projectService      = new ProjectService();
     m_remoteService       = new RemoteService();
     m_examService         = new ExamService();
     m_securityService     = new SecurityService();
     m_serverService       = new ServerService();
     SecurityService.Start();
 }
        private async void Export()
        {
            // #TODO: Make this a proper service, not the crap that it used to be
            try
            {
                bool success = await ExportService.ExportTextToSpeechFile(Text, SelectedVoice.Voice);

                if (success == true)
                {
                    // Show UX message telling exporting was successful
                    // #TODO Replace this with better UX
                    MessageService.ShowExportSuccessfulMessage();
                }
                else
                {
                    // Show UX message telling exporting failed
                    // #TODO Replace this with better UX
                    MessageService.ShowExportFailedMessage();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("MainViewModel - Export - Failed - " + ex);
                // Show UX message telling exporting failed
                // #TODO Replace this with better UX
                MessageService.ShowExportFailedMessage();
            }
        }
        public void ExportToPortableObjectReturnsNullNoUser()
        {
            //Arrage
            var loggerMock       = new Mock <ILoggerFactory>();
            var userRepoMock     = new Mock <IUserRepository>();
            var workoutRepoMock  = new Mock <IWorkoutRepository>();
            var exerciseRepoMock = new Mock <IExerciseRepository>();

            var mapperMock       = new Mock <IMapper>();
            var fileProviderMock = new Mock <IFIleProvider <PortableUserDto> >();
            var logger           = new Mock <ILogger>();

            loggerMock.Setup(l => l.CreateLogger(It.IsAny <string>())).Returns(logger.Object);


            userRepoMock.Setup(r => r.FindAsync(It.IsAny <int>())).ReturnsAsync((User)null);

            var SUT = new ExportService(loggerMock.Object, userRepoMock.Object, mapperMock.Object,
                                        fileProviderMock.Object, workoutRepoMock.Object, exerciseRepoMock.Object);
            var userid = Guid.NewGuid();
            //Act

            var result = SUT.ExportToPortableObjectAsync(userid).Result;

            Assert.Null(result);
        }
        public ActionResult <string> Get(int id)
        {
            var invocing = new ExportService();

            invocing.ExportInvoice(null, null);
            return("value");
        }
Beispiel #5
0
        public ActionResult Index()
        {
            ExportService <Feature> exportService = new ExportService <Feature>();

            ViewBag.ExportColumns = exportService.GetSelectList();
            return(View(featRepo.GetAll().ToList()));
        }
Beispiel #6
0
        public async Task ExportControllerTest__ThumbFalse_AddXmpFile_CreateListToExport()
        {
            var storage = new FakeIStorage(new List <string> {
                "/"
            }, new List <string>
            {
                _appSettings.DatabasePathToFilePath("/test.dng", false),
                _appSettings.DatabasePathToFilePath("/test.xmp", false),
                "/test.dng",
                "/test.xmp"
            });

            var selectorStorage = new FakeSelectorStorage(storage);

            var fileIndexResultsList = new List <FileIndexItem>
            {
                new FileIndexItem
                {
                    FileName        = "test.dng",
                    ParentDirectory = "/",
                    FileHash        = "FileHash",
                    Status          = FileIndexItem.ExifStatus.Ok
                }
            };
            var fakeQuery = new FakeIQuery(fileIndexResultsList);

            var export = new ExportService(fakeQuery, _appSettings, selectorStorage, new FakeIWebLogger());

            var filePaths = await export.CreateListToExport(fileIndexResultsList, false);

            Assert.AreEqual(true, filePaths[0].Contains("test.dng"));
            Assert.AreEqual(true, filePaths[1].Contains("test.xmp"));
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            if (!new CliParser().Parse(args, out var product, out var license))
            {
                return;
            }

            var exportService = new ExportService();

            try
            {
                Console.WriteLine(exportService.Export(product, license));
            }
            catch (Exception e)
            {
                if (e is System.Security.Cryptography.CryptographicException)
                {
                    Console.WriteLine("The key is not complete\n" +
                                      "\tMaybe the public key was provided!");
                }
                else if (e is System.Xml.XmlException)
                {
                    Console.WriteLine("The key is not a valid RSA xml key!");
                }
                else
                {
                    Console.WriteLine($"Unknown error\nError message:\n{e.Message}");
                }
            }
        }
Beispiel #8
0
        public void ExportControllerTest__ThumbTrue__FilePathToFileName()
        {
            var storage         = new StorageSubPathFilesystem(_appSettings, new FakeIWebLogger());
            var selectorStorage = new FakeSelectorStorage(storage);
            var export          = new ExportService(_query, _appSettings, selectorStorage, new FakeIWebLogger());
            var filePaths       = new List <string>
            {
                Path.Combine("test", "thumb.jpg")
            };

            _query.AddItem(new FileIndexItem
            {
                FileName        = "file.jpg",
                ParentDirectory = "/test",
                FileHash        = "thumb"
            });

            var fileNames = export.FilePathToFileName(filePaths, true);

            Assert.AreEqual("file.jpg", fileNames.FirstOrDefault());

            // This is a strange one:
            // We use thumb as base32 fileHashes but export
            // as file.jpg or the nice original name
        }
Beispiel #9
0
        public async Task ExportControllerTest__ThumbFalse_CreateListToExport()
        {
            var selectorStorage       = _serviceProvider.GetRequiredService <ISelectorStorage>();
            var hostFileSystemStorage =
                selectorStorage.Get(SelectorStorage.StorageServices
                                    .HostFilesystem);

            var export = new ExportService(_query, _appSettings, selectorStorage, new FakeIWebLogger());

            var createAnImageNoExif = new CreateAnImageNoExif();

            var item = new FileIndexItem
            {
                FileName        = createAnImageNoExif.FileName,
                ParentDirectory = "/",
                FileHash        = createAnImageNoExif.FileName.Replace(".jpg", "-test"),
                Status          = FileIndexItem.ExifStatus.Ok
            };

            await _query.AddItemAsync(item);

            var fileIndexResultsList = new List <FileIndexItem> {
                item
            };

            var filePaths = await export.CreateListToExport(fileIndexResultsList, false);

            Assert.AreEqual(true, filePaths.FirstOrDefault().Contains(item.FileName));

            Assert.AreEqual(FolderOrFileModel.FolderOrFileTypeList.File,
                            hostFileSystemStorage.IsFolderOrFile(filePaths.FirstOrDefault()));

            hostFileSystemStorage.FileDelete(createAnImageNoExif.FullFilePathWithDate);
        }
        private void ExecuteExportListCmd(object obj)
        {
            DataGrid          d = (DataGrid)obj;
            List <ExportMeta> l = new List <ExportMeta>();

            if (d.SelectedItems == null || d.SelectedItems.Count == 0)
            {
                MessageBox.Show("您还未选择导出任务");
                return;
            }

            foreach (var item in d.SelectedItems)
            {
                l.Add(item as ExportMeta);
            }

            foreach (var item in l)
            {
                Debug.WriteLine("选择任务:{0},任务编号:{1}", item.TaskCode, item.VideoId);
            }
            Debug.WriteLine("输出位置:{0}", TargetSource);

            //send Message
            //按钮禁止点击
            //显示进度条
            Messenger.Default.Send("exportIsRunning", "EVM2EV");
            //load metadata abnormaldata abnormaltype from database
            exportDatas = ExportService.GetService().GetExportListData(l);
            typeDict    = AbnormalService.GetService().GetAbnormalTypeModelsToDict();
            worker.RunWorkerAsync();
        }
Beispiel #11
0
        public void ShareOnFacebook(InkCanvas canvas)
        {
            Canvas = canvas;
            var imageStream = new MemoryStream();

            ExportService.ExportWithoutSaving(canvas, ImageFormat.Jpeg, imageStream);

            if (string.IsNullOrWhiteSpace(AuthService.FacebookAccessToken))
            {
                if (BrowserWindow?.IsVisible ?? false)
                {
                    return;
                }

                BrowserWindow = new BrowserView(FacebookAPI.FacebookAuthenticationUri);
                BrowserWindow.FacebookConnected += (s, e) =>
                {
                    var args = e as ConnectedEventArgs;
                    AuthService.FacebookAccessToken = args.ConnectionToken;
                    BrowserWindow.Close();
                    GetFacebookCaption(imageStream);
                };

                BrowserWindow.Show();
                return;
            }

            GetFacebookCaption(imageStream);
        }
        protected async Task ExportChannelAsync(IConsole console, Channel channel)
        {
            // Configure settings
            if (!string.IsNullOrWhiteSpace(DateFormat))
            {
                SettingsService.DateFormat = DateFormat !;
            }

            console.Output.Write($"Exporting channel [{channel.Name}]... ");
            var progress = console.CreateProgressTicker();

            // Get chat log
            var chatLog = await DataService.GetChatLogAsync(GetToken(), channel, After, Before, progress);

            // Generate file path if not set or is a directory
            var filePath = OutputPath;

            if (string.IsNullOrWhiteSpace(filePath) || ExportHelper.IsDirectoryPath(filePath))
            {
                // Generate default file name
                var fileName = ExportHelper.GetDefaultExportFileName(ExportFormat, chatLog.Guild,
                                                                     chatLog.Channel, After, Before);

                // Combine paths
                filePath = Path.Combine(filePath ?? "", fileName);
            }

            // Export
            await ExportService.ExportChatLogAsync(chatLog, filePath, ExportFormat, PartitionLimit);

            console.Output.WriteLine();
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            var exportService = new ExportService(new ExportService.Config
            {
                ReadyDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                              ApplicationRomingFolderName,
                                              "exportReady"),
                WorkingDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                ApplicationRomingFolderName,
                                                "exportPrepare"),
            });

            var persistenceFacade = new PersistenceFacade(persistenceConfig);
            var dbTemplateService = new DBTemplateService(persistenceFacade);

            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_3_0);
            services.AddSingleton <DBTemplateService>(dbTemplateService);
            services.AddSingleton <ExportService>(exportService);
            services.AddSingleton <ExportController>(new ExportController(dbTemplateService, exportService));
            services.AddSingleton <PersistenceFacade>(persistenceFacade);
            services.AddSingleton <DatabaseModelImportService>(new DatabaseModelImportService(new ImporterProxy(), persistenceFacade));
            services.AddLogging();
        }
Beispiel #14
0
        public void ExportGrid(ExportType fileType)
        {
            switch (fileType)
            {
            case ExportType.XLSX:
                SaveFileDialogService.DefaultExt = "xlsx";
                SaveFileDialogService.Filter     = "Excel 2007+|*.xlsx";
                break;

            case ExportType.PDF:
                SaveFileDialogService.DefaultExt = "pdf";
                SaveFileDialogService.Filter     = "PDF|*.pdf";
                break;
            }

            if (SaveFileDialogService.ShowDialog())
            {
                var fileName = SaveFileDialogService.GetFullFileName();
                ExportService.ExportTo(fileType, fileName);
                if (MessageBoxService.ShowMessage("Would you like to open the file?", "Export finished",
                                                  MessageButton.YesNo) == MessageResult.Yes)
                {
                    Process.Start(fileName);
                }
            }
        }
        public void Exports_With_User_Defined_KeyValues_When_Available()
        {
            var service = new ExportService() as IExportService;
            var product = new Product {
                Id = Guid.NewGuid(), Name = "My Product",
            };
            var license = new License
            {
                LicenseType    = LicenseType.Standard,
                OwnerName      = "License Owner",
                ExpirationDate = null,
            };

            license.Data.Add(new UserData {
                Key = "KeyOne", Value = "ValueOne"
            });
            license.Data.Add(new UserData {
                Key = "KeyTwo", Value = "ValueTwo"
            });

            var path = Path.GetTempFileName();
            var file = new FileInfo(path);

            service.Export(product, license, file);

            var reader  = file.OpenText();
            var content = reader.ReadToEnd();

            Assert.NotNull(content);
            Assert.Contains("KeyOne=\"ValueOne\"", content);
            Assert.Contains("KeyTwo=\"ValueTwo\"", content);
        }
        public ActionResult ExportQuery(string databaseName, string query, string languages, bool includeStandardFields)
        {
            VerifyImportExportPermissions();

            Assert.IsNotNullOrEmpty(databaseName, "databaseName was not provided");
            Assert.IsNotNullOrEmpty(query, "query was not provided");

            try
            {
                var       database = Sitecore.Data.Database.GetDatabase(databaseName);
                DataTable dataTable;

                if (string.IsNullOrEmpty(languages))
                {
                    languages = Sitecore.Context.Language.Name;
                }

                var parsedLanguages = ParseLanguages(languages);
                var exportService   = new ExportService(database, parsedLanguages, includeStandardFields);

                dataTable = exportService.RetrieveItemsByQuery(query);

                WriteCsvToStream(Response.OutputStream, dataTable);
            }
            catch (Exception ex)
            {
                Sitecore.Diagnostics.Log.Error("Failure while exporting from BulkManager", ex);

                return(Content(ex.Message));
            }

            return(Content(""));
        }
Beispiel #17
0
        public App()
        {
            var waypointsService = new WaypointsService();
            var groupsService    = new GroupsService(waypointsService);

            GeoLayoutBuildingService = new GeoLayoutBuildingService(waypointsService, groupsService);
            SettingsService          = new SettingsService();

            var importService = new ImportService(
                new List <IGeoImporter>(new [] {
                new GpxImporter()
            }),
                new MultiFileDialogService(Current.MainWindow),
                waypointsService);

            var exportService = new ExportService(
                new List <IGeoExporter>(new [] {
                new GpxExporter()
            }),
                new SaveFileDialogService(Current.MainWindow),
                waypointsService);

            MainViewModel   = new MainViewModel(importService, exportService, waypointsService, groupsService, GeoLayoutBuildingService);
            MapViewModel    = new MapViewModel(waypointsService, groupsService, GeoLayoutBuildingService);
            GroupsViewModel = new GroupsViewModel(groupsService, waypointsService);
        }
Beispiel #18
0
        public HttpResponseMessage Export()
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK);

            List <ProductDTO> products = _unitOfWork.ProductRepository
                                         .Get()
                                         .Select(p => new ProductDTO()
            {
                ID             = p.ID,
                Name           = p.Name,
                Description    = p.Description,
                PurchasePrice  = p.PurchasePrice,
                SalesPrice     = p.SalesPrice,
                SpoilDate      = p.SpoilDate,
                UnitsAvailable = p.UnitsAvailable
            }).ToList();

            MediaTypeHeaderValue mediaType    = new MediaTypeHeaderValue("application/octet-stream");
            MemoryStream         memoryStream = new MemoryStream(ExportService.ExcelReport(products));

            response.Content = new StreamContent(memoryStream);
            response.Content.Headers.ContentType        = mediaType;
            response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("fileName")
            {
                FileName = "myReport.xls"
            };

            return(response);
        }
Beispiel #19
0
        public ActionResult Index()
        {
            ExportService <Member> exportService = new ExportService <Member>();

            ViewBag.ExportColumns = exportService.GetSelectList();
            return(View(memberRepo.GetAll().ToList()));
        }
Beispiel #20
0
        static void Main(string[] args)
        {
            AskInformation(ref appId, "Please provide your application id or EXIT:");
            AskInformation(ref appKey, "Please provide your application key or EXIT:");
            AskInformation(ref appVersion, "Please provide your app version or EXIT:");
            AskInformation(ref filePath, "Please provide your csv file path or EXIT:");

            var exportService = new ExportService(appId, appKey, appVersion);

            var data = exportService.Export().Result;

            var sb = new StringBuilder();

            sb.AppendLine("intent;utterance");

            data.ForEach(item =>
            {
                sb.AppendLine($"{item.Item1};{item.Item2}".Replace("\n", ""));
            });

            using (var writer = new StreamWriter(filePath, false, Encoding.UTF8))
            {
                writer.Write(sb.ToString());
            }

            System.Console.WriteLine($"{data.Count} lines wrote in {filePath}");
            System.Console.ReadLine();
        }
Beispiel #21
0
 /// <summary>
 /// 启动服务
 /// </summary>
 /// <param name="fileName">文件名</param>
 public static void startService()
 {
     readPlots();
     m_userCookieService   = new UserCookieService();
     m_exportService       = new ExportService();
     m_userSecurityService = new UserSecurityService();
     SecurityService.start();
 }
        public JsonResult Export(Guid id)
        {
            var service = new ExportService(Db);

            var prog = service.GetProgram(id, 33);

            return(Json(prog, JsonRequestBehavior.AllowGet));
        }
Beispiel #23
0
 public ChamadosController(RelProdContext context, UsuarioServices usuarioService, BuscaService buscaService, ExportService exportService, ChamadoService chamadoService)
 {
     _context         = context;
     _usuarioServices = usuarioService;
     _buscaService    = buscaService;
     _exportService   = exportService;
     _ChamadoService  = chamadoService;
 }
Beispiel #24
0
        private async void cbtnExport_Click(object sender, RoutedEventArgs e)
        {
            ExportService exportHelper = new ExportService();
            var           cbItem       = (ComboBoxItem)cboxVoices.SelectedItem;
            var           voice        = (VoiceInformation)cbItem.Tag;

            await exportHelper.ExportSpeechToFile(txtTextToSay.Text, voice);
        }
		public PowerBiController(EmbedService embedService, ExportService exportService, IMemoryCache cache, ILogger<PowerBiController> logger)
		{
			this.embedService = embedService;
			this.exportService = exportService;

			// Get service cache
			this.cache = cache;
			this.logger = logger;
		}
Beispiel #26
0
        public void TestGetZipFileString()
        {
            var exportDeviceName  = "testDevice";
            var exportDeviceBayId = "testBayId";
            var exportDateTime    = new DateTime(2018, 5, 25, 14, 30, 46);

            Assert.Equal($"20180525,143046000,{exportDeviceBayId},{exportDeviceName}.zip",
                         ExportService.GetZipFileName(exportDeviceName, exportDeviceBayId, exportDateTime));
        }
 void SetDefaultReport(IReportInfo reportInfo)
 {
     if (this.IsInDesignMode())
     {
         return;
     }
     ExportService.SetDefaultReport(reportInfo);
     PrintService.SetDefaultReport(reportInfo);
 }
 public ProductionDataController(IContext context, IHostingEnvironment hostingEnvironment)
 {
     _context = context;
     productionDataService = new ProductionDataService(_context);
     bulkInsertService = new BulkInsertService(_context);
     exportService = new ExportService(_context);
     loginService = new LoginService(_context);
     _hostingEnvironment = hostingEnvironment;
 }
Beispiel #29
0
        void OnStartExport()
        {
            var scs = CheckSqlServerConnection("Source", _sourceServer, _sourceDatabase, _sourceUserName, GetPassword(true), false);

            if (string.IsNullOrEmpty(scs))
            {
                return;
            }

            var dcs = CheckSqlServerConnection("Destination", _destinationServer, _destinationDatabase, _destinationUserName, GetPassword(false), false);

            if (string.IsNullOrEmpty(dcs))
            {
                return;
            }

            if (_task != null && (_task.Status == TaskStatus.Running || _task.Status == TaskStatus.WaitingToRun || _task.Status == TaskStatus.WaitingForActivation))
            {
                return;
            }

            if (_tokenSource != null)
            {
                _tokenSource.Dispose();
            }

            _tokenSource = new CancellationTokenSource();
            var token = _tokenSource.Token;

            _task = Task.Run(() =>
            {
                ExportService es = new ExportService(scs, dcs, ListOfExported, token, TableName, LogInfo);
                es.Run();
            }, token);

            /*
             * try
             * {
             *  t.Wait();
             * }
             * catch (AggregateException e)
             * {
             *  var em = $"{e.Message} ";
             *  foreach (var ie in e.InnerExceptions)
             *      em = $" {em}{ie.GetType().Name},{ie.Message}";
             *
             *  ListOfExported.Add(WorkReader.CreateInfo("", 0, 0, em));
             * }
             * finally
             * {
             *  _tokenSource.Dispose();
             * }*/


            //_tokenSource.Dispose();
        }
        public void SetupDirectoriesAndFiles()
        {
            Directory.CreateDirectory("C:\\Temp\\UnitTestingOfPhilipp\\Repository\\2020");
            ConfigurationManager.AppSettings.Set("RepositoryDir", "C:\\Temp\\UnitTestingOfPhilipp\\Repository");
            var exportService = new ExportService();

            exportService.CreateXml(new MetadataItem(Guid.Parse("3fc6a223-369b-4efd-a0c4-f563ee6d67f8"), "Username",
                                                     "Dokumenten Bezeichnung", DateTime.Parse("01.01.2020 19:00:00"), "Verträge", "Notiz",
                                                     DateTime.Parse("30.06.2020 00:00:00"), "document.docx"));
        }
        /// <summary>
        /// SCORM Engine Service constructor that takes a single configuration parameter
        /// </summary>
        /// <param name="config">The Configuration object to be used to configure the Scorm Engine Service client</param>
        public ScormEngineService(Configuration config)
        {
            System.Net.ServicePointManager.Expect100Continue = false;

            configuration = config;
            courseService = new CourseService(configuration, this);
            dispatchService = new DispatchService(configuration, this);
            registrationService = new RegistrationService(configuration, this);
            invitationService = new InvitationService(configuration, this);
            uploadService = new UploadService(configuration, this);
            ftpService = new FtpService(configuration, this);
            exportService = new ExportService(configuration, this);
            reportingService = new ReportingService(configuration, this);
            debugService = new DebugService(configuration, this);
        }
Beispiel #32
0
        public void TestAllExportsCompletedEventIsReported()
        {
            AutoResetEvent evt = new AutoResetEvent(false);
            bool _allExportsDone = false;
            IExportService es = new ExportService(Dispatcher.CurrentDispatcher);

            MemberListExport mle = new MemberListExport();
            mle.Members = _handler.Database.MemberSet.AsEnumerable();
            mle.OutputPath = _testOutputName;

            Assert.IsFalse(es.ExportInProgress);
            es.AllExportsCompleted += delegate { _allExportsDone = true; evt.Set(); };
            es.QueueExportJob(mle);

            DispatcherUtil.DoEventsUntil(evt);

            Assert.IsTrue(_allExportsDone);
        }
Beispiel #33
0
        public ActionResult ExportHistoryApproveECLAIMByTemplate([DataSourceRequest] DataSourceRequest request, FIN_HistoryApproveECLAIMSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            var isDataTable = false;
            object obj = new FIN_HistoryApproveECLAIMModel();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var result = baseService.GetData<FIN_HistoryApproveECLAIMModel>(lstModel, ConstantSql.hrm_hr_sp_get_HistoryApprovedClaim, UserLogin, ref status);
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new FIN_HistoryApproveECLAIMModel(),
                    FileName = "FIN_HistoryApproveECLAIM",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            if (model.ExportId != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #34
0
        public void TestQueueingSeveralExportsReportsOnlyOneExportCompleted()
        {
            AutoResetEvent evt = new AutoResetEvent(false);
            bool _allExportsDone = false;
            IExportService es = new ExportService(Dispatcher.CurrentDispatcher);

            IPdfExport export = new FakeExport();
            export.OutputPath = _testOutputName;

            Assert.IsFalse(es.ExportInProgress);
            es.AllExportsCompleted += delegate {
                Assert.IsFalse(_allExportsDone);
                _allExportsDone = true; // this should be called only once
                evt.Set();
            };

            for (int i = 0; i < 15; ++i)
                es.QueueExportJob(export);

            DispatcherUtil.DoEventsUntil(evt, 8000);

            Assert.IsTrue(_allExportsDone);
        }
Beispiel #35
0
        public ActionResult ExportPersionalInformation([DataSourceRequest] DataSourceRequest request, Hre_PersionalInfoSearchModel model)
        {
            var service = new Hre_ProfileServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request)
            };
            var isDataTable = false;
            object obj = new DataTable();

            var result = service.GetPersionalInfo(model.id, UserLogin, model.IsCreateTemplate);

            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = true;
            }
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_PersionalInformationModel",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable

                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (model.ExportId != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #36
0
        public ActionResult GetDateEndAccidentTypeList([DataSourceRequest] DataSourceRequest request, Hre_AccidentModel model)
        {
            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_AccidentModel>(model, "Hre_ReportAccident", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }
            //DateTime From = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            //DateTime To = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1);

            #endregion
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = model.DateFrom != null ? model.DateFrom.Value : DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = model.DateTo != null ? model.DateTo.Value : DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            var service = new ActionService(UserLogin);

            List<object> listObj = new List<object>();
            DateTime? From = SqlDateTime.MinValue.Value;
            DateTime? To = SqlDateTime.MaxValue.Value;
            List<Guid?> OrgIds = new List<Guid?>();
            if (model.DateFrom != null)
            {
                From = model.DateFrom.Value;
            }
            if (model.DateTo != null)
            {
                To = model.DateTo.Value;
            }
            listObj.Add(From);
            listObj.Add(To);
            string strOrgIDs = null;
            if (!string.IsNullOrEmpty(model.OrgStructureID))
            {
                strOrgIDs = model.OrgStructureID;
            }
            listObj.Add(strOrgIDs);
            Guid? Acctype = Guid.Empty;
            if (model.AccidentTypeID != Guid.Empty)
            {
                Acctype = model.AccidentTypeID;
            }
            listObj.Add(Acctype);
            string status = string.Empty;
            var result = service.GetData<Hre_AccidentEntity>(listObj, ConstantSql.hrm_hr_sp_get_DateEndAccidentTypeList, ref status).ToList().Translate<Hre_AccidentModel>();
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_AccidentModel(),
                    FileName = "Hre_ReportAccident",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            if (model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportID, result, listHeaderInfo, model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
            //return GetListDataAndReturn<Hre_AccidentModel, Hre_AccidentEntity, Hre_ReportAccidentSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_DateEndAccidentTypeList);
        }
Beispiel #37
0
        public ActionResult GetReportBirthday([DataSourceRequest] DataSourceRequest request, Hre_ReportBirthdayModel Model)
        {
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = Model.DateFrom != null ? Model.DateFrom.Value : DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = Model.DateTo != null ? Model.DateTo.Value : DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            #region Tạo  Template
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportBirthdayModel(),
                    FileName = "Hre_ReportBirthday",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            #endregion  
            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportBirthdayModel>(Model, "Hre_ReportBirthday", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }

            #endregion

            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);
            List<object> listObj = new List<object>();
            List<Guid?> OrgIds = new List<Guid?>();
            listObj.Add(Model.DateFrom);
            listObj.Add(Model.DateTo);
            listObj.Add(Model.OrgStructureID);
            listObj.Add(Model.DateQuitFrom);
            listObj.Add(Model.DateQuitTo);
            listObj.Add(Model.WorkPlaceID);
            string status = string.Empty;
            var result = actionServices.GetData<Hre_ReportBirthdayEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptBirthday, ref status).ToList().Translate<Hre_ReportBirthdayModel>();

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result, listHeaderInfo, Model.ExportType);

                return Json(fullPath);
            }


            return Json(result.ToDataSourceResult(request));

        }
Beispiel #38
0
        public ActionResult GetReportProfileDiscipline([DataSourceRequest] DataSourceRequest request, Hre_ReportProfileDisciplineModel Model)
        {
            #region Code cũ
            //var service = new Hre_ReportServices();
            //var hrService = new Hre_ProfileServices();
            //var isDataTable = false;
            //object obj = new Hre_ReportProfileDisciplineModel();
            //List<object> listObj = new List<object>();
            //DateTime From = SqlDateTime.MinValue.Value;
            //DateTime To = SqlDateTime.MaxValue.Value;
            //List<Guid?> OrgIds = new List<Guid?>();
            //if (Model.DateFrom != null)
            //{
            //    From = Model.DateFrom.Value;
            //    listObj.Add(From);
            //}
            //else
            //{
            //    listObj.Add(null);
            //}
            //if (Model.DateTo != null)
            //{
            //    To = Model.DateTo.Value;
            //    listObj.Add(To);
            //}
            //else
            //{
            //    listObj.Add(null);
            //}

            //string strOrgIDs = null;
            //if (!string.IsNullOrEmpty(Model.OrgStructureID))
            //{
            //    strOrgIDs = Model.OrgStructureID;
            //}

            //listObj.Add(strOrgIDs);


            //string status = string.Empty;
            //var result = hrService.GetData<Hre_ReportProfileDisciplineEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptDiscripline, ref status).ToList().Translate<Hre_ReportProfileDisciplineModel>();

            //if (Model.IsCreateTemplateForDynamicGrid)
            //{
            //    obj = result;
            //    isDataTable = true;
            //}
            //if (Model != null && Model.IsCreateTemplate)
            //{
            //    var path = Common.GetPath("Templates");
            //    ExportService exportService = new ExportService();
            //    ConfigExport cfgExport = new ConfigExport()
            //    {
            //        Object = obj,
            //        FileName = "Hre_ReportProfileDisciplineModel",
            //        OutPutPath = path,
            //        DownloadPath = Hrm_Main_Web + "Templates",
            //        IsDataTable = isDataTable
            //    };
            //    var str = exportService.CreateTemplate(cfgExport);
            //    return Json(str);
            //}

            //if (Model.ExportID != Guid.Empty)
            //{
            //    if (result != null && result.Count > 0)
            //    {
            //        #region lấy Org và OrgType

            //        var orgServices = new Cat_OrgStructureServices();
            //        var lstObjOrg = new List<object>();
            //        lstObjOrg.Add(null);
            //        lstObjOrg.Add(null);
            //        lstObjOrg.Add(null);
            //        lstObjOrg.Add(1);
            //        lstObjOrg.Add(int.MaxValue - 1);
            //        var lstOrg = orgServices.GetData<Cat_OrgStructureEntity>(lstObjOrg, ConstantSql.hrm_cat_sp_get_OrgStructure, ref status).ToList();

            //        var orgTypeService = new Cat_OrgStructureTypeServices();
            //        var lstObjOrgType = new List<object>();
            //        lstObjOrgType.Add(null);
            //        lstObjOrgType.Add(null);
            //        lstObjOrgType.Add(1);
            //        lstObjOrgType.Add(int.MaxValue - 1);
            //        var lstOrgType = orgTypeService.GetData<Cat_OrgStructureTypeEntity>(lstObjOrgType, ConstantSql.hrm_cat_sp_get_OrgStructureType, ref status).ToList();
            //        #endregion

            //        foreach (var item in result)
            //        {
            //            Guid? orgId = item.OrgStructureID1;
            //            var org = lstOrg.FirstOrDefault(s => s.ID == item.OrgStructureID1);
            //            var orgBranch = LibraryService.GetNearestParentEntity(orgId, OrgUnit.E_BRANCH, lstOrg, lstOrgType);
            //            var orgGroup = LibraryService.GetNearestParentEntity(orgId, OrgUnit.E_GROUP, lstOrg, lstOrgType);
            //            var orgOrg = LibraryService.GetNearestParentEntity(orgId, OrgUnit.E_DEPARTMENT, lstOrg, lstOrgType);
            //            var orgTeam = LibraryService.GetNearestParentEntity(orgId, OrgUnit.E_TEAM, lstOrg, lstOrgType);
            //            var orgSection = LibraryService.GetNearestParentEntity(orgId, OrgUnit.E_SECTION, lstOrg, lstOrgType);
            //            var orgDivision = LibraryService.GetNearestParentEntity(orgId, OrgUnit.E_DIVISION, lstOrg, lstOrgType);

            //            item.BranchName = orgBranch != null ? orgBranch.OrgStructureName : string.Empty;
            //            item.GroupName = orgGroup != null ? orgGroup.OrgStructureName : string.Empty;
            //            item.DepartmentName = orgOrg != null ? orgOrg.OrgStructureName : string.Empty;
            //            item.TeamName = orgTeam != null ? orgTeam.OrgStructureName : string.Empty;
            //            item.SectionName = orgSection != null ? orgSection.OrgStructureName : string.Empty;
            //            item.DivisionName = orgDivision != null ? orgDivision.OrgStructureName : string.Empty;

            //            item.DisciplineCount = result.Where(s => s.ProfileID == item.ProfileID).Count();
            //        }

            //    }
            //    string[] valueField = null;
            //    if (Model.ValueFields != null)
            //    {
            //        valueField = Model.ValueFields.Split(',');
            //    }
            //    var fullPath = ExportService.Export(Model.ExportID, result, null, Model.ExportType);

            //    return Json(fullPath);
            //}
            //return Json(result.ToDataSourceResult(request)); 
            #endregion

            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = Model.DateFrom ?? DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = Model.DateTo ?? DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };

            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportProfileDisciplineModel(),
                    FileName = "Hre_ReportProfileDiscipline",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportProfileDisciplineModel>(Model, "Hre_ReportProfileDiscipline", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }
            #endregion

            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);
            List<object> listObj = new List<object>();
            listObj.Add(Model.DateFrom);
            listObj.Add(Model.DateTo);
            listObj.Add(Model.OrgStructureID);

            string status = string.Empty;

            var result = actionServices.GetData<Hre_ReportProfileDisciplineEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptDiscripline, ref status).ToList().Translate<Hre_ReportProfileDisciplineModel>();
            var lstprofileids = result.Select(s => s.ProfileID).ToList();

            foreach (var item in result)
            {
                Guid profileID = item.ProfileID;
                item.count = result.Count(s => s.ProfileID == profileID);
            }


            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result, listHeaderInfo, Model.ExportType);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #39
0
        public ActionResult GetDateEndInfoListss([DataSourceRequest] DataSourceRequest request, Hre_VisaInfoSearchModel Model)
        {
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = Model.DateEnd ?? DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = Model.DateTo ?? DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };

            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_VisaInfoModel(),
                    FileName = "Hre_VisaInfoModel",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            var service = new ActionService(UserLogin);
            List<object> listObj = new List<object>();
            listObj.Add(Model.DateEnd);
            listObj.Add(Model.DateTo);
            listObj.Add(null);
            listObj.Add(null);
            string status = string.Empty;
            var result = service.GetData<Hre_VisaInfoEntity>(listObj, ConstantSql.hrm_hr_sp_get_VisaInfoDateEndList, ref status).ToList().Translate<Hre_VisaInfoModel>();
            var lstprofileids = result.Select(s => s.Visa_ID).ToList();

            foreach (var item in result)
            {
                Guid profileID = item.Visa_ID;
                // item.Visa_ID. = result.Count(s => s.Visa_ID == profileID);
            }


            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result, listHeaderInfo, Model.ExportType);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #40
0
        public ActionResult GetReportHDTJob([DataSourceRequest] DataSourceRequest request, Hre_ReportHDTJobModel model)
        {
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportHDTJobModel(),
                    FileName = "Hre_ReportHDTJob",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportHDTJobModel>(model, "Hre_ReportHDTJob", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }

            #endregion

            var actionServices = new ActionService(UserLogin);
            var hrService = new Hre_ProfileServices();

            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (model.DateFrom != null)
            {
                From = model.DateFrom.Value;
            }
            if (model.DateTo != null)
            {
                To = model.DateTo.Value;
            }
            string status = string.Empty;
            var hdtJobServices = new Hre_HDTJobServices();
            List<object> listObjHDTJob = new List<object>();
            listObjHDTJob.Add(model.OrgStructureID);
            listObjHDTJob.Add(model.DateFrom);
            listObjHDTJob.Add(model.DateTo);
            var result = actionServices.GetData<Hre_ReportHDTJobEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_RptHDTJob, ref status).ToList().Translate<Hre_ReportHDTJobModel>();

            if (model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportID, result, listHeaderInfo, null, model.ExportType);

                return Json(fullPath);
            }


            return Json(result.ToDataSourceResult(request));
        }
Beispiel #41
0
        public ActionResult ExportPurchaseRequest(string purchaseID, Guid? exportID, bool isCreateTemplate, bool isCreateTemplateForDynamicGrid)
        {

            string status = string.Empty;
            var baseService = new BaseService();
            ExportFileType exportFileType = ExportFileType.Excel;
            var actionServices = new ActionService(UserLogin);
            var objs = new List<object>();
            objs.Add(Common.ConvertToGuid(purchaseID));
            var entityPR = actionServices.GetByIdUseStore<Fin_PurchaseRequestModel>(Common.ConvertToGuid(purchaseID), ConstantSql.hrm_hr_sp_get_PurchaseRequestById, ref status);
            var lstPRItem = actionServices.GetData<Fin_PurchaseRequestItemModel>(objs, ConstantSql.hrm_cat_sp_get_PRItemByPRID, ref status);
            DataTable table = new DataTable("Fin_PurchaseRequestModel");
            if (entityPR != null && lstPRItem != null)
            {

                table.Columns.Add("FunctionName");
                table.Columns.Add("BudgetOwnerName");
                table.Columns.Add("ChannelName");
                table.Columns.Add("BudgetChargedIn");
                table.Columns.Add("From");
                table.Columns.Add("To");
                table.Columns.Add("SupplierName");
                table.Columns.Add("Description");
                table.Columns.Add("Code");
                table.Columns.Add("CateCodeType");
                table.Columns.Add("Name");
                table.Columns.Add("ProjectName");
                table.Columns.Add("PurchaseItemName");
                table.Columns.Add("PurchaseItemCost");
                table.Columns.Add("Quantity", typeof(double));
                table.Columns.Add("UnitPrice", typeof(double));
                table.Columns.Add("Amount", typeof(double));

                foreach (var item in lstPRItem)
                {
                    DataRow dr = table.NewRow();

                    dr["FunctionName"] = entityPR.FunctionName;
                    dr["BudgetOwnerName"] = entityPR.BudgetOwnerName;
                    dr["ChannelName"] = entityPR.ChannelName;
                    dr["BudgetChargedIn"] = entityPR.BudgetChargedIn == null ? string.Empty : entityPR.BudgetChargedIn.Value.ToShortDateString();
                    dr["From"] = entityPR.From == null ? string.Empty : entityPR.From.Value.ToShortDateString(); ;
                    dr["To"] = entityPR.To == null ? string.Empty : entityPR.To.Value.ToShortDateString();
                    dr["SupplierName"] = entityPR.SupplierName;
                    dr["Description"] = entityPR.Description;

                    dr["Code"] = item.Code == null ? string.Empty : item.Code;
                    dr["CateCodeType"] = item.CateCodeType == null ? string.Empty : item.CateCodeType;
                    dr["Name"] = item.Name == null ? string.Empty : item.Name;
                    dr["ProjectName"] = item.ProjectName == null ? string.Empty : item.ProjectName;
                    dr["PurchaseItemName"] = item.PurchaseItemName == null ? string.Empty : item.PurchaseItemName;
                    dr["PurchaseItemCost"] = item.PurchaseItemCost == null ? string.Empty : item.PurchaseItemCost;
                    dr["Quantity"] = item.Quantity == null ? 0 : item.Quantity.Value;
                    dr["UnitPrice"] = item.UnitPrice == null ? 0 : item.UnitPrice.Value;
                    dr["Amount"] = item.Amount == null ? 0 : item.Amount.Value;
                    table.Rows.Add(dr);
                }
                var result = table;

                object obj = new Fin_PurchaseRequestModel();
                var isDataTable = false;

                if (isCreateTemplateForDynamicGrid)
                {
                    obj = result;
                    isDataTable = true;
                }
                if (isCreateTemplate)
                {
                    var path = Common.GetPath("Templates");
                    ExportService exportService = new ExportService();
                    ConfigExport cfgExport = new ConfigExport()
                    {
                        Object = obj,
                        FileName = "Fin_PurchaseRequestModel",
                        OutPutPath = path,
                        DownloadPath = Hrm_Main_Web + "Templates",
                        IsDataTable = isDataTable
                    };
                    var str = exportService.CreateTemplate(cfgExport);
                    return Json(str);
                }

            }
            if (exportID != null)
            {
                var fullPath = ExportService.Export((Guid)exportID, table, exportFileType);
                return Json(fullPath);
            }

            return null;
        }
Beispiel #42
0
        public ActionResult GetReportWorkHistoryDept([DataSourceRequest] DataSourceRequest request, Hre_ReportWorkHistoryDeptModel Model)
        {
            #region Validate
            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportWorkHistoryDeptModel>(Model, "Hre_ReportWorkHistoryDept", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }

            #endregion

            var actionServices = new ActionService(UserLogin);
            var profileServices = new Hre_ProfileServices();
            var rptServices = new Hre_ReportServices();
            List<object> listObj = new List<object>();
            listObj.Add(Model.DateFrom);
            listObj.Add(Model.DateTo);
            listObj.Add(Model.ProfileName);
            listObj.Add(Model.CodeEmp);
            listObj.Add(Model.JobTitleID);
            listObj.Add(Model.PositionID);
            listObj.Add(Model.OrgStructureIDs);
            listObj.Add(Model.TypeOfTransferID);
            listObj.Add(Model.SalaryClassID);
            listObj.Add(Model.WorkPlaceID);
            listObj.Add(Model.Status);
            listObj.Add(1);
            listObj.Add(int.MaxValue - 1);
            string status = string.Empty;
            var result = actionServices.GetData<Hre_ReportWorkHistoryDeptEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptWorkHistoryDept, ref status).ToList().Translate<Hre_ReportWorkHistoryDeptModel>();
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = Model.DateFrom != null ? Model.DateFrom : DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = Model.DateTo != null ? Model.DateTo : DateTime.Now };
            HeaderInfo headerInfo3 = new HeaderInfo() { Name = "WorkPlaceName", Value = ((result != null && result.FirstOrDefault() != null) && result.FirstOrDefault().WorkPlaceName != null) ? result.FirstOrDefault().WorkPlaceName : "" };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2, headerInfo3 };
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportWorkHistoryDeptModel(),
                    FileName = "Hre_ReportWorkHistoryDept",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            bool isgroup = profileServices.IsGroupByOrgProfileQuit();
            if (isgroup == true)
            {
                List<Hre_ReportWorkHistoryDeptModel> resultNew = new List<Hre_ReportWorkHistoryDeptModel>();
                if (result.Count > 0)
                {
                    var orgServices = new Cat_OrgStructureServices();
                    var lstObjOrg = new List<object>();
                    lstObjOrg.Add(null);
                    lstObjOrg.Add(null);
                    lstObjOrg.Add(null);
                    lstObjOrg.Add(1);
                    lstObjOrg.Add(int.MaxValue - 1);
                    var lstOrg = actionServices.GetData<Cat_OrgStructureEntity>(lstObjOrg, ConstantSql.hrm_cat_sp_get_OrgStructure, ref status).ToList();

                    var orgTypeService = new Cat_OrgStructureTypeServices();
                    var lstObjOrgType = new List<object>();
                    lstObjOrgType.Add(null);
                    lstObjOrgType.Add(null);
                    lstObjOrgType.Add(1);
                    lstObjOrgType.Add(int.MaxValue - 1);
                    var lstOrgType = actionServices.GetData<Cat_OrgStructureTypeEntity>(lstObjOrgType, ConstantSql.hrm_cat_sp_get_OrgStructureType, ref status).ToList();

                    foreach (var item in result)
                    {
                        var orgName = new List<string>();
                        if (item.OrgStructureID != null)
                        {
                            orgName = rptServices.GetParentOrgName(lstOrg, lstOrgType, item.OrgStructureID);
                            if (orgName.Count < 3)
                            {
                                orgName.Insert(0, string.Empty);
                                if (orgName.Count < 3)
                                {
                                    orgName.Insert(0, string.Empty);
                                }
                            }
                        }
                        if (orgName.Count > 0)
                        {
                            item.Channel = orgName[2];
                            item.Region = orgName[1];
                            item.Area = orgName[0];
                        }
                        resultNew.Add(item);
                    }
                }
                if (Model.ExportID != Guid.Empty)
                {
                    var fullPath = ExportService.Export(Model.ExportID, resultNew, listHeaderInfo, Model.ExportType);

                    return Json(fullPath);
                }

                return Json(resultNew.ToDataSourceResult(request));
            }

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result, listHeaderInfo, Model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #43
0
        //public ActionResult CreateTemplate(CreateTemplateModel model)
        //{
        //    if (model != null)
        //    {
        //        var service = new BaseService();
        //        Cat_ExportEntity exportEntity = new Cat_ExportEntity()
        //        {
        //            ExportName = model.TemplateName,
        //            IsColumnDynamic = model.IsDynamic,
        //            ScreenName = model.ScreenName,
        //            TemplateFile = model.TemplateFile
        //        };

        //        service.Add(exportEntity);
        //    }
        //    return Json("");
        //}
        public ActionResult GetReportHCGender([DataSourceRequest] DataSourceRequest request, Hre_ReportHCGenderModel model)
        {
            var service = new Hre_ReportServices();
            var hrService = new Hre_ProfileServices();
            object obj = new Hre_ReportHCGenderModel();
            var isDataTable = false;
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            var result = service.GetReportHCGender(model.MonthSearch, model.JobtitleID, model.OrgStructureID, model.OrgStructureTypeID, model.Gender, model.isIncludeQuitEmp, model.IsCreateTemplate, UserLogin);

            if (model.IsCreateTemplateForDynamicGrid)
            {
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);
                obj = result;
                isDataTable = true;
            }
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_ReportHCGenderModel",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (model.ExportID != Guid.Empty)
            {
                result.Rows[0].Delete();
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);
                //  var row = result.Rows.Count;
                //    result.Rows[row - 1].Delete();

                string[] valueField = null;
                if (model.ValueFields != null)
                {
                    valueField = model.ValueFields.Split(',');
                }
                var fullPath = ExportService.Export(model.ExportID, result, listHeaderInfo, model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #44
0
        public ActionResult GetReportPrenancy([DataSourceRequest] DataSourceRequest request, Hre_ReportPregnancyModel Model)
        {
            #region Validate
            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportPregnancyModel>(Model, "Hre_ReportPregnancy", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }
            #endregion

            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);
            string status = string.Empty;

            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (Model.DateStart != null)
            {
                From = Model.DateStart.Value;
            }
            if (Model.DateEnd != null)
            {
                To = Model.DateEnd.Value;
            }
            var isDataTable = false;
            object obj = new Hre_ReportPregnancyModel();

            List<object> listObj = new List<object>();
            listObj.Add(Model.DateStart);
            listObj.Add(Model.DateEnd);
            listObj.Add(Model.OrgStructureID);
            listObj.Add(Model.ProfileName);
            listObj.Add(Model.CodeEmp);
            var result = actionServices.GetData<Hre_ReportPregnancyEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptPrenancy, ref status).ToList();

            var orgServices = new Cat_OrgStructureServices();
            var lstObjOrg = new List<object>();
            lstObjOrg.Add(null);
            lstObjOrg.Add(null);
            lstObjOrg.Add(null);
            lstObjOrg.Add(1);
            lstObjOrg.Add(int.MaxValue - 1);
            var lstOrg = actionServices.GetData<Cat_OrgStructureEntity>(lstObjOrg, ConstantSql.hrm_cat_sp_get_OrgStructure, ref status).ToList();

            var orgTypeService = new Cat_OrgStructureTypeServices();
            var lstObjOrgType = new List<object>();
            lstObjOrgType.Add(null);
            lstObjOrgType.Add(null);
            lstObjOrgType.Add(1);
            lstObjOrgType.Add(int.MaxValue - 1);
            var lstOrgType = actionServices.GetData<Cat_OrgStructureTypeEntity>(lstObjOrgType, ConstantSql.hrm_cat_sp_get_OrgStructureType, ref status).ToList();

            var lstRptPrenancyEntity = new List<Hre_ReportPregnancyEntity>();

            foreach (var item in result)
            {
                var pregnancyEntity = new Hre_ReportPregnancyEntity();
                var orgName = service.GetParentOrgName(lstOrg, lstOrgType, item.OrgID);
                if (orgName.Count < 3)
                {
                    orgName.Insert(0, string.Empty);
                    if (orgName.Count < 3)
                    {
                        orgName.Insert(0, string.Empty);
                    }
                }
                pregnancyEntity = item.CopyData<Hre_ReportPregnancyEntity>();
                pregnancyEntity.Channel = orgName[2];
                pregnancyEntity.Region = orgName[1];
                pregnancyEntity.Area = orgName[0];
                lstRptPrenancyEntity.Add(pregnancyEntity);
            }

            var lstRptPrenancyModel = lstRptPrenancyEntity.Translate<Hre_ReportPregnancyModel>();


            if (Model.IsCreateTemplateForDynamicGrid)
            {
                obj = lstRptPrenancyModel;
                isDataTable = true;
            }
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_ReportPregnancyModel",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (Model.ExportID != Guid.Empty)
            {

                string[] valueField = null;
                if (Model.ValueFields != null)
                {
                    valueField = Model.ValueFields.Split(',');
                }
                var fullPath = ExportService.Export(Model.ExportID, lstRptPrenancyModel, null, Model.ExportType);

                return Json(fullPath);
            }
            return Json(lstRptPrenancyModel.ToDataSourceResult(request));
        }
Beispiel #45
0
        public ActionResult GetReportProfileNew([DataSourceRequest] DataSourceRequest request, Hre_ReportProfileNewModel Model)
        {
            string status = string.Empty;
            var services = new Hre_ReportServices();
            var isDataTable = false;
            object obj = new Hre_ReportProfileNewModel();

            #region Validate
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = Model.DateFrom };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = Model.DateTo };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportProfileNewModel>(Model, "Hre_ReportProfileNew", ref message);
            if (!checkValidate)
            {
                return Json(message, JsonRequestBehavior.AllowGet);
            }
            DateTime From = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            DateTime To = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1);

            #endregion
            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
            }

            var result = services.GetReportProfileNew(
                From,
                To, 
                Model.OrgStructureID,
                Model.IsCreateTemplate,
                Model.CodeEmp,
                Model.ProfileName,
                Model.SalaryClassID,
                Model.CodeCandidate,
                Model.WorkPlaceID,
                Model.EmpTypeID,
                UserLogin
                );

            if (Model != null && Model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = true;
            }
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportProfileNewModel(),
                    FileName = "Hre_ReportProfileNew",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result, listHeaderInfo, Model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #46
0
        public ActionResult GetReportReward([DataSourceRequest] DataSourceRequest request, Hre_ReportRewardModel Model)
        {
            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportRewardModel>(Model, "Hre_ReportReward", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }

            #endregion
            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);
            var isDataTable = false;
            object obj = new Hre_ReportRewardModel();
            List<object> listObj = new List<object>();
            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            List<Guid?> OrgIds = new List<Guid?>();
            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
                listObj.Add(From);
            }
            else
            {
                listObj.Add(null);
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
                listObj.Add(To);
            }
            else
            {
                listObj.Add(null);
            }

            string strOrgIDs = null;
            if (!string.IsNullOrEmpty(Model.OrgStructureID))
            {
                strOrgIDs = Model.OrgStructureID;
            }

            listObj.Add(strOrgIDs);


            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = From };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = To };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };

            string status = string.Empty;
            var result = actionServices.GetData<Hre_ReportRewardEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptReward, ref status).ToList().Translate<Hre_ReportRewardModel>();

            if (Model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = true;
            }
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_ReportReward",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result, listHeaderInfo, Model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #47
0
        public ActionResult GetReportEducationCharList([DataSourceRequest] DataSourceRequest request, Hre_ReportEducationChartListModel Model)
        {
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = Model.DateFrom != null ? Model.DateFrom : DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = Model.DateTo != null ? Model.DateTo : DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportEducationChartListModel(),
                    FileName = "Hre_ReportEducationChartList",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportEducationChartListModel>(Model, "Hre_ReportProfileNew", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }
            DateTime From = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            DateTime To = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1);

            #endregion

            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
            }
            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);
            List<object> strOrgIDs = new List<object>();
            strOrgIDs.AddRange(new object[3]);
            strOrgIDs[0] = (object)Model.OrgStructureID;

            string status = string.Empty;
            List<Guid> lstProfileIDs = actionServices.GetData<Hre_ProfileIdEntity>(strOrgIDs, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(s => s.ID).ToList();
            var result = service.GetReportEducationCharList(From, To, lstProfileIDs, Model.AppliedForThisPeriod).ToList().Translate<Hre_ReportEducationChartListModel>();

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result, Model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #48
0
        public ActionResult GetReportHCSales([DataSourceRequest] DataSourceRequest request, Hre_ReportHCSalesModel model)
        {
            var service = new Hre_ReportServices();
            var eva_Service = new Eva_ReportServices();
            var hrService = new Hre_ProfileServices();

            //List<object> listObj = new List<object>();
            //listObj.Add(model.OrgStructureID);
            //listObj.Add(string.Empty);
            //listObj.Add(string.Empty);

            //string status = string.Empty;

            //var listEntity = hrService.GetData<Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, ref status).Select(s => s.ID).ToList();

            var result = eva_Service.GetReportHCSales(model.dateSearch, model.OrgStructureID, model.IsCreateTemplate, UserLogin);
            //var rs = result.Translate<Hre_ReportMonthlyHCModel>();

            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            object obj = new Hre_ReportHCSalesModel();
            var isDataTable = false;
            if (model.IsCreateTemplateForDynamicGrid)
            {
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);
                obj = result;
                isDataTable = true;
            }
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_ReportHCSalesModel",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (model.ExportID != Guid.Empty)
            {
                //var row = result.Rows.Count;
                // result.Rows[row - 1].Delete();
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);

                var fullPath = ExportService.Export(model.ExportID, result, listHeaderInfo, model.ExportType);

                return Json(fullPath);
            }
            //0string dataReturn = result.ConvertDataTabletoString();
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #49
0
        public ActionResult GetReportProfileComeBack([DataSourceRequest] DataSourceRequest request, Hre_ReportProfileComeBackModel Model)
        {
            string status = string.Empty;
            var actionServices = new ActionService(UserLogin);
            var contractServices = new Hre_ContractServices();
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = Model.DateFrom };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = Model.DateTo };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };

            #region Validate
            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportProfileComeBackModel>(Model, "Hre_ReportProfileComeBack", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }
            #endregion
            List<object> lstpara = new List<object>();
            lstpara.Add(Model.DateFrom);
            lstpara.Add(Model.DateTo);
            lstpara.Add(Model.OrgStructureIDs);
            lstpara.Add(Model.ProfileName);
            lstpara.Add(Model.CodeEmp);
            lstpara.Add(Model.RankID);
            lstpara.Add(Model.WorkPlaceID);
            var result = actionServices.GetData<Hre_ReportProfileComeBackModel>(lstpara, ConstantSql.hrm_hr_sp_get_RptProfileComBack, ref status);

            var lstResultEntity = result.Translate<Hre_ReportProfileComeBackEntity>();

            var dataResult = contractServices.GetDataContractByProfileID(lstResultEntity, UserLogin);

            var isDataTable = false;
            DataTable obj = null;
            if (Model.IsCreateTemplateForDynamicGrid)
            {
                obj = dataResult;
                isDataTable = true;
            }


            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_ReportProfileComeBackEntity",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = true
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, dataResult, listHeaderInfo, Model.ExportType);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #50
0
        public ActionResult GetReportMonthlyHC([DataSourceRequest] DataSourceRequest request, Hre_ReportMonthlyHCModel model)
        {
            var service = new Hre_ReportServices();
            var hrService = new Hre_ProfileServices();
            object obj = new Hre_ReportMonthlyHCModel();
            var isDataTable = false;
            //List<object> listObj = new List<object>();
            //listObj.Add(model.OrgStructureID);
            //listObj.Add(string.Empty);
            //listObj.Add(string.Empty);

            //string status = string.Empty;

            //var listEntity = hrService.GetData<Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, ref status).Select(s => s.ID).ToList();

            var result = service.GetReportMonthlyHC(model.dateSearch, model.JobtitleID, model.OrgStructureID, model.OrgStructureTypeID, model.IsCreateTemplate, UserLogin);
            var rs = result.Translate<Hre_ReportMonthlyHCModel>();

            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = true;
            }
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_ReportMonthlyHCModel",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            if (model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportID, result, null, model.ExportType);

                return Json(fullPath);
            }
            //0string dataReturn = result.ConvertDataTabletoString();
            return Json(rs.ToDataSourceResult(request));
        }
Beispiel #51
0
        public ActionResult GetReportCodeNotInSystem([DataSourceRequest] DataSourceRequest request, Hre_ReportCodeNotInSystemModel Model)
        {
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = Model.DateFrom != null ? Model.DateFrom : DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = Model.DateTo != null ? Model.DateTo : DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportCodeNotInSystemModel(),
                    FileName = " Hre_ReportCodeNotInSystem",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            var actionServices = new ActionService(UserLogin);
            var hrService = new Hre_ProfileServices();
            //ListQueryModel lstModel = new ListQueryModel
            //{
            //    PageIndex = request.Page,
            //    Filters = ExtractFilterAttributes(request),
            //    Sorts = ExtractSortAttributes(request)
            //};
            List<object> listobj = new List<object>();
            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
            }
            listobj.Add(From);
            listobj.Add(To);
            string status = string.Empty;
            var result = actionServices.GetData<Hre_ReportCodeNotInSystemEntity>(listobj, ConstantSql.hrm_hr_sp_get_RptCodeNotInSystem, ref status).ToList().Translate<Hre_ReportCodeNotInSystemModel>();
            //var result = service.GetReportCodeNotInSystem(From, To).ToList().Translate<Hre_ReportCodeNotInSystemModel>();

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result, Model.ExportType);

                return Json(fullPath);
            }

            return Json(result.ToDataSourceResult(request));
        }
Beispiel #52
0
        public ActionResult ExportRelativesListByTemplate([DataSourceRequest] DataSourceRequest request, Hre_RelativesSearchModel model)
        {

            string status = string.Empty;
            var isDataTable = false;
            object obj = new Hre_RelativesModel();
            var actionServices = new ActionService(UserLogin);
            var result = GetListData<Hre_RelativesModel, Hre_RelativesEntity, Hre_RelativesSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_Relatives, ref status);

            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = false;
            }
            if (model != null && model.IsCreateTemplate)
            {

                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_RelativesModel",
                    OutPutPath = path,
                    // HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            if (model.ExportId != Guid.Empty)
            {

                var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);
                return Json(fullPath);
            }

            return Json(result.ToDataSourceResult(request));


            //return GetListDataAndReturn<Hre_RelativesModel, Hre_RelativesEntity, Hre_RelativesSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_Relatives);
        }
Beispiel #53
0
        public ActionResult GetReportProfileQuit([DataSourceRequest] DataSourceRequest request, Hre_ReportProfileQuitModel Model)
        {
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = Model.DateStart != null ? Model.DateStart : DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = Model.DateEnd != null ? Model.DateEnd : DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportProfileQuitModel(),
                    FileName = "Hre_ReportProfileQuit",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportProfileQuitModel>(Model, "Hre_ReportProfileQuit", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }

            #endregion

            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);
            //DateTime From = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            //DateTime To = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1);
            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (Model.DateStart != null)
            {
                From = Model.DateStart.Value;
            }
            if (Model.DateEnd != null)
            {
                To = Model.DateEnd.Value;
            }

            List<object> listObj = new List<object>();
            listObj.Add(Model.OrgStructureID);
            listObj.Add(From);
            listObj.Add(To);

            string status = string.Empty;
            var result = actionServices.GetData<Hre_ReportProfileQuitEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptQuitProfile, ref status).ToList().Translate<Hre_ReportProfileQuitModel>();
            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result, listHeaderInfo, Model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #54
0
        public ActionResult ExportHDTJobListByTemplate([DataSourceRequest] DataSourceRequest request, Hre_HDTJobSearchModel model)
        {
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = model.DateFrom == null ? DateTime.Now : model.DateFrom };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = model.DateTo == null ? DateTime.Now : model.DateTo };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            string status = string.Empty;
            var isDataTable = false;
            object obj = new Hre_ProfileModel();
            var actionServices = new ActionService(UserLogin);
            List<object> lstObjSearch = new List<object>();
            lstObjSearch.Add(model.ProfileName);
            lstObjSearch.Add(model.CodeEmp);
            lstObjSearch.Add(model.HDTJobTypeID);
            lstObjSearch.Add(model.JobTitleID);
            lstObjSearch.Add(model.PositionID);
            lstObjSearch.Add(model.OrgStructureID);
            lstObjSearch.Add(model.DateFrom);
            lstObjSearch.Add(model.DateTo);
            lstObjSearch.Add(model.Price);
            lstObjSearch.Add(model.IsCreateTemplate);
            lstObjSearch.Add(model.ExportId);
            lstObjSearch.Add(model.ExportType);
            lstObjSearch.Add(1);
            lstObjSearch.Add(int.MaxValue - 1);
            var result = actionServices.GetData<Hre_HDTJobEntity>(lstObjSearch, ConstantSql.hrm_hr_sp_get_HDTJob, ref status);
            var profileServices = new Hre_ProfileServices();
            var listResult = profileServices.getHDTJobByPrice(result, model.DateFrom, model.DateTo).Translate<Hre_HDTJobModel>();
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_HDTJobModel(),
                    FileName = "Hre_HDTJob",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (model.ExportId != Guid.Empty)
            {
                if (model.DateFrom != null && model.DateTo != null)
                {
                    var fullPath = ExportService.Export(model.ExportId, listResult, listHeaderInfo, model.ExportType);
                    return Json(fullPath);
                }
                else
                {
                    var fullPath = ExportService.Export(model.ExportId, listResult, null, model.ExportType);
                    return Json(fullPath);
                }

            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #55
0
        public ActionResult GetExpiryContract([DataSourceRequest] DataSourceRequest request, Hre_ReportExpiryContractModel Model)
        {
            string status = string.Empty;
            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);
            var profileServices = new Hre_ProfileServices();
            var contractServices = new Hre_ContractServices();
            BaseService baseServices = new BaseService();
            bool isshowloopcontract = profileServices.IsNotUseExpiryContractLoop();

            var ShowAfterDate1 = actionServices.GetData<Sys_AllSettingEntity>("HRM_HRE_CONTRACT_ALERT_EXPRIDAY_VALUEAFTE", ConstantSql.hrm_sys_sp_get_AllSettingByKey, ref status).FirstOrDefault();
            var ShowBeforDate1 = actionServices.GetData<Sys_AllSettingEntity>("HRM_HRE_CONTRACT_ALERT_EXPRIDAY_VALUEBEFOR", ConstantSql.hrm_sys_sp_get_AllSettingByKey, ref status).FirstOrDefault();
            DateTime? dateTo = null;
            DateTime? dateFrom = null;
            if (isshowloopcontract == false)
            {
                dateTo = DateTime.Now.AddDays(Convert.ToDouble(ShowAfterDate1.Value1));
                dateFrom = DateTime.Now.AddDays(-Convert.ToDouble(ShowBeforDate1.Value1));
            }
            var isDataTable = false;
            object obj = new Hre_ReportExpiryContractModel();
         
            //var lstProfile = new List<Hre_ProfileEntity>();
            var objProfile = new List<object>();
            objProfile.AddRange(new object[2]);
            objProfile[0] = 1;
            objProfile[1] = int.MaxValue - 1;
            var lstProfile = actionServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileDataAll, ref status).ToList();

            var lstObjContractType = new List<object>();
            lstObjContractType.Add(null);
            lstObjContractType.Add(null);
            lstObjContractType.Add(null);
            lstObjContractType.Add(null);
            lstObjContractType.Add(1);
            lstObjContractType.Add(int.MaxValue - 1);

            var lstContractType = actionServices.GetData<CatContractTypeModel>(lstObjContractType, ConstantSql.hrm_cat_sp_get_ContractType, ref status).ToList();

            List<object> listObj = new List<object>();
            listObj.Add(Model.OrgStructureID);
            listObj.Add(Model.Status);
            listObj.Add(dateFrom);
            listObj.Add(dateTo);
            listObj.Add(Model.CodeEmp);
            listObj.Add(Model.ProfileName);
            listObj.Add(Model.IDNo);
            listObj.Add(Model.WorkPlaceID);
            listObj.Add(Model.DateSignedFrom);
            listObj.Add(Model.DateSignedTo);
            listObj.Add(Model.ContractNo);
            listObj.Add(1);
            listObj.Add(int.MaxValue - 1);

            var result = actionServices.GetData<Hre_ReportExpiryContractEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptExpireContract, ref status).Where(s => s.StatusEvaluation != WorkdayStatus.E_APPROVED.ToString()).ToList().Translate<Hre_ReportExpiryContractModel>();

           var objContract = new List<object>();
            objContract.AddRange(new object[21]);
            objContract[19] = 1;
            objContract[20] = int.MaxValue - 1;
            var lstContracts = actionServices.GetData<Hre_ContractEntity>(objContract, ConstantSql.hrm_hr_sp_get_Contract, ref status).ToList();
           
            Guid[] _RankDetailForNextContract = null;
            if (!string.IsNullOrEmpty(Model.RankDetailForNextContractIds))
            {
                _RankDetailForNextContract = Model.RankDetailForNextContractIds.Split(',').Select(s => Guid.Parse(s)).ToArray();
            }
            if (Model.ContractTypeID != null)
            {
                result = result.Where(s => s.ContractTypeID == Model.ContractTypeID).ToList();
            }
            if (!string.IsNullOrEmpty(Model.Status))
            {
                result = result.Where(s => s.Status == Model.Status).ToList();
            }

            var lstModel = new List<Hre_ReportExpiryContractModel>();


            if (_RankDetailForNextContract != null)
            {
                result = result.Where(s => _RankDetailForNextContract.Contains(s.RankDetailForNextContract != null ? s.RankDetailForNextContract.Value : Guid.Empty)).ToList();
            }

            if (Model.EvaType == EnumDropDown.EvaExpiryContract.E_EVA_CONTRACT.ToString())
            {
                result = result.Where(s => s.StatusEvaluation != WorkdayStatus.E_APPROVED.ToString() && s.ContractResult != null).ToList();
                if (isshowloopcontract == false)
                {
                    var model = new Hre_ReportExpiryContractModel();
                    foreach (var item in result)
                    {
                        var ContractByProfileID = lstContracts.Where(s => s.ProfileID == item.ProfileID).OrderByDescending(s => s.DateCreate).FirstOrDefault();
                        if (ContractByProfileID != null)
                        {
                            if (ContractByProfileID.DateCreate != null && ContractByProfileID.DateCreate.Value.ToShortDateString() != DateTime.Now.ToShortDateString())
                            {
                                if (item.DateExtend != null && item.DateExtend >= dateFrom && item.DateExtend <= dateTo)
                                {
                                    model = item;
                                    lstModel.Add(model);
                                }
                                if (item.DateExtend == null && item.DateEnd != null && item.DateEnd >= dateFrom && item.DateEnd <= dateTo)
                                {
                                    model = item;
                                    lstModel.Add(model);
                                }
                            }
                        }
                    }
                }
                else
                {
                    foreach (var item in result)
                    {
                        var dateSenior = new TimeSpan();
                        double monthSenior = 0;
                        var profileEntity = lstProfile.Where(s => s.ID == item.ProfileID).FirstOrDefault();
                        if (profileEntity != null && profileEntity.DateHire != null && Model.DateEnd != null)
                        {
                            dateSenior = Model.DateEnd.Value.Subtract(profileEntity.DateHire.Value);
                            monthSenior = Math.Floor(dateSenior.TotalDays / 30);
                        }

                        item.MonthSenior = (double?)monthSenior;
                        var dateCheck = DateTime.Now;
                        var model = new Hre_ReportExpiryContractModel();
                        var contractTypeEntity = lstContractType.Where(s => item.ContractTypeID == s.ID).FirstOrDefault();
                            if (item.ContractResult == null)
                            {
                                if (contractTypeEntity != null && contractTypeEntity.ExpiryContractLoop != null)
                                {
                                    var dateExpiry = dateCheck.AddDays(contractTypeEntity.ExpiryContractLoop.Value);

                                    if (item.DateExtend != null && item.DateExtend <= dateExpiry)
                                    {
                                        model = item;
                                        lstModel.Add(model);
                                    }
                                    if (item.DateExtend == null && item.DateEnd != null && item.DateEnd.Value <= dateExpiry)
                                    {
                                        model = item;
                                        lstModel.Add(model);
                                    }
                                }
                            }
                        
                    }
                }

            }
            else if (Model.EvaType == EnumDropDown.EvaExpiryContract.E_NONEEVA_CONTRACT.ToString()) 
            {
                result = result.Where(s =>  s.ContractResult == null).ToList();
                if (isshowloopcontract == false)
                {
                    var model = new Hre_ReportExpiryContractModel();
                    foreach (var item in result)
                    {
                        var ContractByProfileID = lstContracts.Where(s => s.ProfileID == item.ProfileID).OrderByDescending(s => s.DateCreate).FirstOrDefault();
                        if (ContractByProfileID != null)
                        {
                            if (ContractByProfileID.DateCreate != null && ContractByProfileID.DateCreate.Value.ToShortDateString() != DateTime.Now.ToShortDateString())
                            {
                                if (item.DateExtend != null && item.DateExtend >= dateFrom && item.DateExtend <= dateTo)
                                {
                                    model = item;
                                    lstModel.Add(model);
                                }
                                if (item.DateExtend == null && item.DateEnd != null && item.DateEnd >= dateFrom && item.DateEnd <= dateTo)
                                {
                                    model = item;
                                    lstModel.Add(model);
                                }
                            }
                        }
                    }
                }
                else
                {
                    foreach (var item in result)
                    {
                        var dateSenior = new TimeSpan();
                        double monthSenior = 0;
                        var profileEntity = lstProfile.Where(s => s.ID == item.ProfileID).FirstOrDefault();
                        if (profileEntity != null && profileEntity.DateHire != null && Model.DateEnd != null)
                        {
                            dateSenior = Model.DateEnd.Value.Subtract(profileEntity.DateHire.Value);
                            monthSenior = Math.Floor(dateSenior.TotalDays / 30);
                        }

                        item.MonthSenior = (double?)monthSenior;
                        var dateCheck = DateTime.Now;
                        var model = new Hre_ReportExpiryContractModel();
                        var contractTypeEntity = lstContractType.Where(s => item.ContractTypeID == s.ID).FirstOrDefault();
                        if (item.ContractResult == null)
                        {
                            if (contractTypeEntity != null && contractTypeEntity.ExpiryContractLoop != null)
                            {
                                var dateExpiry = dateCheck.AddDays(contractTypeEntity.ExpiryContractLoop.Value);

                                if (item.DateExtend != null && item.DateExtend <= dateExpiry)
                                {
                                    model = item;
                                    lstModel.Add(model);
                                }
                                if (item.DateExtend == null && item.DateEnd != null && item.DateEnd.Value <= dateExpiry)
                                {
                                    model = item;
                                    lstModel.Add(model);
                                }
                            }
                        }

                    }
                }
            }
            else
            {
                if (isshowloopcontract == false)
                {
                    var model = new Hre_ReportExpiryContractModel();
                    foreach (var item in result)
                    {
                        var ContractByProfileID = lstContracts.Where(s => s.ProfileID == item.ProfileID).OrderByDescending(s => s.DateCreate).FirstOrDefault();
                        if (ContractByProfileID != null)
                        {
                            if (ContractByProfileID.DateCreate != null && ContractByProfileID.DateCreate.Value.ToShortDateString() != DateTime.Now.ToShortDateString())
                            {
                                if (item.DateExtend != null && item.DateExtend >= dateFrom && item.DateExtend <= dateTo)
                                {
                                    model = item;
                                    lstModel.Add(model);
                                }
                                if (item.DateExtend == null && item.DateEnd != null && item.DateEnd >= dateFrom && item.DateEnd <= dateTo)
                                {
                                    model = item;
                                    lstModel.Add(model);
                                }
                            }
                        }
                    }
                }
                else
                {
                    foreach (var item in result)
                    {
                        var dateSenior = new TimeSpan();
                        double monthSenior = 0;
                        var profileEntity = lstProfile.Where(s => s.ID == item.ProfileID).FirstOrDefault();
                        if (profileEntity != null && profileEntity.DateHire != null && Model.DateEnd != null)
                        {
                            dateSenior = Model.DateEnd.Value.Subtract(profileEntity.DateHire.Value);
                            monthSenior = Math.Floor(dateSenior.TotalDays / 30);
                        }

                        item.MonthSenior = (double?)monthSenior;
                        var dateCheck = DateTime.Now;
                        var model = new Hre_ReportExpiryContractModel();
                        var contractTypeEntity = lstContractType.Where(s => item.ContractTypeID == s.ID).FirstOrDefault();
                      
                            if (contractTypeEntity != null && contractTypeEntity.ExpiryContractLoop != null)
                            {
                                var dateExpiry = dateCheck.AddDays(contractTypeEntity.ExpiryContractLoop.Value);

                                if (item.DateExtend != null && item.DateExtend <= dateExpiry)
                                {
                                    model = item;
                                    lstModel.Add(model);
                                }
                                if (item.DateExtend == null && item.DateEnd != null && item.DateEnd.Value <= dateExpiry)
                                {
                                    model = item;
                                    lstModel.Add(model); 
                                }
                            }
                    }
                }
            }
            
            #region Lấy phụ lục hợp đông
            var _ReportService = new Hre_ContractServices();
            var lisEntity = result.Translate<Hre_ContractEntity>();
            DataTable tb = _ReportService.GetDataContract(lisEntity, UserLogin);
            #endregion
            #region Xuất template

            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = tb,
                    FileName = "Hre_ContractEntity",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = true
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            #endregion

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, tb, Model.ExportType);
                return Json(fullPath);
            }
            return Json(lstModel.ToDataSourceResult(request));
        }
Beispiel #56
0
        public ActionResult GetReportProfileWorking([DataSourceRequest] DataSourceRequest request, Hre_ReportProfileWorkingModel Model)
        {
            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportProfileWorkingModel>(Model, "Hre_ReportProfileWorking", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }

            #endregion

            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);

            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
            }
            var isDataTable = false;
            object obj = new Hre_ReportProfileWorkingEntity();
            List<object> listObj = new List<object>();
            listObj.Add(Model.OrgStructureID);
            listObj.Add(Model.DateFrom);
            listObj.Add(Model.DateTo);
            listObj.Add(Model.CodeEmp);
            string status = string.Empty;
            var result = actionServices.GetData<Hre_ReportProfileWorkingEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptWorkingProfile, ref status);

            if (Model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = true;
            }
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_ReportProfileWorkingEntity",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (Model.ExportID != Guid.Empty)
            {

                string[] valueField = null;
                if (Model.ValueFields != null)
                {
                    valueField = Model.ValueFields.Split(',');
                }
                var fullPath = ExportService.Export(Model.ExportID, result, null, Model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
Beispiel #57
0
        public ActionResult ExportProfileIsBackList([DataSourceRequest] DataSourceRequest request, Hre_ProfileSearchIsBackListModel model)
        {
            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ProfileSearchIsBackListModel>(model, "Hre_ReportProfileIsBackList", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }

            #endregion
            var service = new Hre_ReportServices();
            var hrService = new Hre_ProfileServices();
            string status = string.Empty;

            object obj = new Hre_ProfileSearchIsBackListModel();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var result = GetListData<Hre_ReportProfileIsBackListModel, Hre_ReportProfileIsBackListEntity, Hre_ProfileSearchIsBackListModel>(request, model, ConstantSql.hrm_hr_sp_get_ProfileIsBackList, ref status);

            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportProfileIsBackListModel(),
                    FileName = "Hre_ReportProfileIsBackList",
                    OutPutPath = path,
                    //HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportID, result, null, model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #58
0
        public ActionResult ExportProfileAllListByTemplate([DataSourceRequest] DataSourceRequest request, Hre_ProfileAllSearchModel model)
        {
            string status = string.Empty;
            var isDataTable = false;
            var service = new BaseService();
            object obj = new Hre_ProfileModel();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var result = GetListData<Hre_ProfileModel, Hre_ProfileEntity, Hre_ProfileAllSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_ProfileAll, ref status);


            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = false;
            }
            if (model != null && model.IsCreateTemplate)
            {

                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_ProfileModel",
                    OutPutPath = path,
                    // HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (model.ExportId != Guid.Empty)
            {

                var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);
                return Json(fullPath);
            }

            return Json(result.ToDataSourceResult(request));
        }
Beispiel #59
0
        public ActionResult GetReportOrgProfle([DataSourceRequest] DataSourceRequest request, CatOrgStructureModel Model)
        {
            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);
            List<object> listObj = new List<object>();
            List<Guid?> OrgIds = new List<Guid?>();
            string strOrgIDs = null;
            if (!string.IsNullOrEmpty(Model.OrgStructureID))
            {
                strOrgIDs = Model.OrgStructureID;
            }
            listObj.Add(strOrgIDs);
            string status = string.Empty;
            var result = actionServices.GetData<Cat_OrgStructureEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptOrgProfile, ref status).ToList().Translate<CatOrgStructureModel>();

            object obj = new CatOrgStructureModel();
            var isDataTable = false;
            if (Model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = true;
            }
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "CatOrgStructureModel",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result, Model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #60
0
        public ActionResult GetReportSeniority([DataSourceRequest] DataSourceRequest request, Hre_ReportSeniorityModel Model)
        {
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = Model.DateSeniority != null ? Model.DateSeniority.Value : DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1 };
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportSeniorityModel(),
                    FileName = "Hre_ReportSeniority",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportSeniorityModel>(Model, "Hre_ReportSeniority", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }

            #endregion
            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);

            DateTime DateSeniority = DateTime.Now;
            List<Guid?> OrgIds = new List<Guid?>();
            if (Model.DateSeniority != null)
            {
                DateSeniority = Model.DateSeniority.Value;
            }

            string strOrgIDs = null;
            if (!string.IsNullOrEmpty(Model.OrgStructureID))
            {
                strOrgIDs = Model.OrgStructureID;
            }
            List<object> listObj = new List<object>();
            listObj.Add(strOrgIDs);
            listObj.Add(string.Empty);
            listObj.Add(string.Empty);

            string status = string.Empty;
            var listEntity = actionServices.GetData<Hre_ProfileEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, ref status).ToList();
            if (listEntity.Count == 0)
            {
                return Json(null);
            }
            var result = service.GetReportSeniority(DateSeniority, listEntity).ToList().Translate<Hre_ReportSeniorityModel>();

            if (Model.ExportID != Guid.Empty)
            {
                string[] valueField = null;
                if (Model.ValueFields != null)
                {
                    valueField = Model.ValueFields.Split(',');
                }
                var fullPath = ExportService.Export(Model.ExportID, result, listHeaderInfo, Model.ExportType);

                return Json(fullPath);
            }


            return Json(result.ToDataSourceResult(request));

        }