public ActionResult ExportAlbumByArtist(TaskModel viewModel)
        {
            viewModel.OperationResult.Clear();

            try
            {
                if (!IsAuthorized("ExportAlbumByArtist", viewModel.OperationResult))
                {
                    return(View("OperationResult", new OperationResultModel(viewModel.OperationResult)));
                }
                else if (ValidateModelState())
                {
                    string templateDirectory = Server.MapPath(LibraryHelper.AppSettings <string>("DirectoryTemplate"));
                    string fileDirectory     = Server.MapPath(LibraryHelper.AppSettings <string>("DirectoryExport"));
                    string filePath;

                    if (Application.ExportAlbumByArtistXLSX(viewModel.OperationResult, templateDirectory, fileDirectory, out filePath))
                    {
                        byte[] file = System.IO.File.ReadAllBytes(filePath);
                        return(File(file, LibraryHelper.GetContentType(ZFileTypes.ftXLSX), Path.GetFileName(filePath)));
                    }
                }
            }
            catch (Exception exception)
            {
                viewModel.OperationResult.ParseException(exception);
            }

            return(View(viewModel));
        }
        public NorthwindUnitOfWorkMongoDB()
            : base(LibraryHelper.AppSettings <string>("MongoDB.Northwind.Url"), LibraryHelper.AppSettings <string>("MongoDB.Northwind.Database"))
        {
            Domain = "Northwind";

            NorthwindMongoDBMap.CategoryMap();
            NorthwindMongoDBMap.CustomerCustomerDemoMap();
            NorthwindMongoDBMap.CustomerDemographicMap();
            NorthwindMongoDBMap.CustomerMap();
            NorthwindMongoDBMap.EmployeeMap();
            NorthwindMongoDBMap.EmployeeTerritoryMap();
            NorthwindMongoDBMap.OrderDetailMap();
            NorthwindMongoDBMap.OrderMap();
            NorthwindMongoDBMap.ProductMap();
            NorthwindMongoDBMap.RegionMap();
            NorthwindMongoDBMap.ShipperMap();
            NorthwindMongoDBMap.SupplierMap();
            NorthwindMongoDBMap.TerritoryMap();

            Repositories.Add(typeof(Category), new NorthwindCategoryRepositoryMongoDB(this));
            Repositories.Add(typeof(CustomerCustomerDemo), new NorthwindCustomerCustomerDemoRepositoryMongoDB(this));
            Repositories.Add(typeof(CustomerDemographic), new NorthwindCustomerDemographicRepositoryMongoDB(this));
            Repositories.Add(typeof(Customer), new NorthwindCustomerRepositoryMongoDB(this));
            Repositories.Add(typeof(Employee), new NorthwindEmployeeRepositoryMongoDB(this));
            Repositories.Add(typeof(EmployeeTerritory), new NorthwindEmployeeTerritoryRepositoryMongoDB(this));
            Repositories.Add(typeof(OrderDetail), new NorthwindOrderDetailRepositoryMongoDB(this));
            Repositories.Add(typeof(Order), new NorthwindOrderRepositoryMongoDB(this));
            Repositories.Add(typeof(Product), new NorthwindProductRepositoryMongoDB(this));
            Repositories.Add(typeof(Region), new NorthwindRegionRepositoryMongoDB(this));
            Repositories.Add(typeof(Shipper), new NorthwindShipperRepositoryMongoDB(this));
            Repositories.Add(typeof(Supplier), new NorthwindSupplierRepositoryMongoDB(this));
            Repositories.Add(typeof(Territory), new NorthwindTerritoryRepositoryMongoDB(this));

            //IMongoDatabase database = base.Database;
        }
        public ChinookUnitOfWorkOData()
            : base(new Container(new Uri(LibraryHelper.AppSettings <string>("OData.Chinook"))))
        {
            Domain = "Chinook";

            //DataServiceContext container = (DataServiceContext)base.Container;
        }
Esempio n. 4
0
        public ChinookUnitOfWorkRavenDB()
            : base(LibraryHelper.AppSettings <string>("RavenDB.Chinook.Url"), LibraryHelper.AppSettings <string>("RavenDB.Chinook.Database"))
        {
            Domain = "Chinook";

            //IRavenDatabase database = base.Database;
        }
        public ActionResult ExportAlbumByArtist(TaskModel viewModel)
        {
            viewModel.OperationResult.Clear();

            try
            {
                if (!IsAuthorized("ExportAlbumByArtist", viewModel.OperationResult))
                {
                    return(View("OperationResult", new OperationResultModel(viewModel.OperationResult)));
                }
                else if (ValidateModelState())
                {
                    string templateDirectory = Server.MapPath(LibraryHelper.AppSettings <string>("DirectoryTemplate"));
                    string fileDirectory     = Server.MapPath(LibraryHelper.AppSettings <string>("DirectoryExport"));
                    string filePath;

                    if (Application.ExportAlbumByArtistXLSX(viewModel.OperationResult, templateDirectory, fileDirectory, out filePath))
                    {
                        return(JsonResultSuccess(filePath));
                    }
                }
            }
            catch (Exception exception)
            {
                viewModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(viewModel.OperationResult));
        }
        //private Timer timer;

        public ChinookService()
        {
            try
            {
                InitializeComponent();

                // Log

                LogDelete();

                // Directory

                string exePath = Assembly.GetExecutingAssembly().Location;

                string directory;
                // Z-Export
                directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, LibraryHelper.AppSettings <string>("DirectoryExport"));
                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }
                // Z-Import
                directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, LibraryHelper.AppSettings <string>("DirectoryImport"));
                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }
            }
            catch (Exception exception)
            {
                LogWrite(exception.Message);
            }
        }
        public ChinookUnitOfWorkMongoDB()
            : base(LibraryHelper.AppSettings <string>("MongoDB.Chinook.Url"), LibraryHelper.AppSettings <string>("MongoDB.Chinook.Database"))
        {
            Domain = "Chinook";

            ChinookMongoDBMap.AlbumMap();
            ChinookMongoDBMap.ArtistMap();
            ChinookMongoDBMap.CustomerMap();
            ChinookMongoDBMap.CustomerDocumentMap();
            ChinookMongoDBMap.EmployeeMap();
            ChinookMongoDBMap.GenreMap();
            ChinookMongoDBMap.InvoiceMap();
            ChinookMongoDBMap.InvoiceLineMap();
            ChinookMongoDBMap.MediaTypeMap();
            ChinookMongoDBMap.PlaylistMap();
            ChinookMongoDBMap.PlaylistTrackMap();
            ChinookMongoDBMap.TrackMap();

            Repositories.Add(typeof(Album), new ChinookAlbumRepositoryMongoDB(this));
            Repositories.Add(typeof(Artist), new ChinookArtistRepositoryMongoDB(this));
            Repositories.Add(typeof(Customer), new ChinookCustomerRepositoryMongoDB(this));
            Repositories.Add(typeof(CustomerDocument), new ChinookCustomerDocumentRepositoryMongoDB(this));
            Repositories.Add(typeof(Employee), new ChinookEmployeeRepositoryMongoDB(this));
            Repositories.Add(typeof(Genre), new ChinookGenreRepositoryMongoDB(this));
            Repositories.Add(typeof(Invoice), new ChinookInvoiceRepositoryMongoDB(this));
            Repositories.Add(typeof(InvoiceLine), new ChinookInvoiceLineRepositoryMongoDB(this));
            Repositories.Add(typeof(MediaType), new ChinookMediaTypeRepositoryMongoDB(this));
            Repositories.Add(typeof(Playlist), new ChinookPlaylistRepositoryMongoDB(this));
            Repositories.Add(typeof(PlaylistTrack), new ChinookPlaylistTrackRepositoryMongoDB(this));
            Repositories.Add(typeof(Track), new ChinookTrackRepositoryMongoDB(this));

            //IMongoDatabase database = base.Database;
        }
Esempio n. 8
0
        public NorthwindUnitOfWorkRavenDB()
            : base(LibraryHelper.AppSettings <string>("RavenDB.Northwind.Url"), LibraryHelper.AppSettings <string>("RavenDB.Northwind.Database"))
        {
            Domain = "Northwind";

            //IRavenDatabase database = base.Database;
        }
Esempio n. 9
0
        private static void Main(string[] args)
        {
            bool exit = false;

            Container container = new Container(new Uri(LibraryHelper.AppSettings <string>("OData.Chinook")));

            while (!exit)
            {
                Console.Clear();
                Console.WriteLine("Chinook OData Client Demo\n");
                Console.WriteLine("<0> EXIT");
                Console.WriteLine("<1> Album Demo");
                Console.WriteLine("<2> Genre Demo");
                Console.WriteLine("<3> LINQ Demo");
                Console.WriteLine("<4> CRUD Demo");
                Console.WriteLine("<5> UnitOfWork Demo { ZPersistenceOData }");
                Console.Write("\nChoose an option... ");

                ConsoleKeyInfo key = Console.ReadKey();
                Console.WriteLine();

                switch (key.KeyChar) // <ENTER> = '\r'
                {
                case ('0'):
                    exit = true;
                    break;

                case ('1'):
                    ODataAlbumDemo(container);
                    break;

                case ('2'):
                    ODataGenreDemo(container);
                    break;

                case ('3'):
                    ODataLINQDemo(container);
                    break;

                case ('4'):
                    ODataCRUDDemo(container);
                    break;

                case ('5'):
                    ODataUnitOfWorkDemo();
                    break;
                }

                if (!exit)
                {
                    Console.Write("\nPress <KEY> to continue... ");
                    Console.ReadKey();
                }
            }
        }
Esempio n. 10
0
        private static void LibraryEdmDemo(IEdmManager edmManager)
        {
            Console.WriteLine("\nEDM Demo\n");

            string rootDirectory = LibraryHelper.AppSettings <string>("EDM.FileSystemDirectory");

            Console.WriteLine("IMPORTANT: Create \"" + rootDirectory + "\" directory !");
            Console.Write("\nPress <KEY> to continue... ");
            Console.ReadKey();
            Console.WriteLine("\n");

            string txtFilePath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.txt";

            using (StreamWriter writer = new StreamWriter(txtFilePath))
            {
                writer.Write("EasyLOB");
            }

            byte[]     file;
            int        key;
            string     entityName = "Entity", exportPath;
            ZFileTypes fileType;

            // 1
            Console.WriteLine("1");

            key        = 1;
            fileType   = ZFileTypes.ftTXT;
            exportPath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.1.txt";

            Console.WriteLine("  Write TXT");
            edmManager.WriteFile(entityName, key, fileType, txtFilePath);
            Console.WriteLine("  Read TXT");
            file = edmManager.ReadFile(entityName, key, fileType);
            File.WriteAllBytes(exportPath, file);
            //Console.WriteLine("  Delete TXT");
            //edmManager.EdmEngine.DeleteFile(entityName, key, fileType);

            // 101
            Console.WriteLine("101");

            key        = 101;
            fileType   = ZFileTypes.ftTXT;
            exportPath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.101.txt";

            Console.WriteLine("  Write TXT");
            edmManager.WriteFile(entityName, key, fileType, txtFilePath);
            Console.WriteLine("  Read TXT");
            file = edmManager.ReadFile(entityName, key, fileType);
            File.WriteAllBytes(exportPath, file);
            //Console.WriteLine("  Delete TXT");
            //edmManager.edmEngine.DeleteFile(entityName, key, fileType);
        }
Esempio n. 11
0
        public EdmManagerFTP()
        {
            RootDirectory = LibraryHelper.AppSettings <string>("EDM.FTPRoot");

            ftpClient = new FtpClient();

            ftpClient.Host        = LibraryHelper.AppSettings <string>("EDM.FTPServer");
            ftpClient.Port        = LibraryHelper.AppSettings <int>("EDM.FTPPort");
            ftpClient.Credentials = new NetworkCredential(LibraryHelper.AppSettings <string>("EDM.FTPUser"),
                                                          LibraryHelper.AppSettings <string>("EDM.FTPPassword"));

            ftpClient.Connect();
        }
Esempio n. 12
0
        public ActionResult ImportGenre(TaskImportGenreModel viewModel)
        {
            viewModel.OperationResult.Clear();

            string path = "";

            try
            {
                if (!IsAuthorized("ImportGenre", viewModel.OperationResult))
                {
                    return(View("OperationResult", new OperationResultModel(viewModel.OperationResult)));
                }
                else if (ValidateModelState())
                {
                    if (viewModel.Upload != null && viewModel.Upload.ContentLength > 0)
                    {
                        // Save file

                        string file = Path.GetFileName(viewModel.Upload.FileName);
                        path = Path.Combine(Server.MapPath(LibraryHelper.AppSettings <string>("DirectoryImport")), file);
                        viewModel.Upload.SaveAs(path);

                        // Read file and Create Genre

                        // Application
                        IChinookGenericApplication <Genre> genreApplication =
                            DependencyResolver.Current.GetService <IChinookGenericApplication <Genre> >();
                        Application.ImportGenreTXTApplication(viewModel.OperationResult, path, genreApplication);

                        // Persistence
                        IChinookUnitOfWork unitOfWork =
                            DependencyResolver.Current.GetService <IChinookUnitOfWork>();
                        Application.ImportGenreTXTPersistence(viewModel.OperationResult, path, unitOfWork);
                    }
                }
            }
            catch (Exception exception)
            {
                viewModel.OperationResult.ParseException(exception);
            }
            finally
            {
                if (!String.IsNullOrEmpty(path))
                {
                    System.IO.File.Delete(path);
                }
            }

            return(View(viewModel));
        }
Esempio n. 13
0
        private static void LibraryEdmFilePathDemo(IEdmManager edmManager)
        {
            Console.WriteLine("\nEDM Demo\n");

            string rootDirectory = LibraryHelper.AppSettings <string>("EDM.FileSystemDirectory");

            Console.WriteLine("IMPORTANT: Create \"" + rootDirectory + "\" directory !");
            Console.Write("\nPress <KEY> to continue... ");
            Console.ReadKey();
            Console.WriteLine("\n");

            string txtFilePath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.txt";

            using (StreamWriter writer = new StreamWriter(txtFilePath))
            {
                writer.Write("EasyLOB");
            }

            byte[] file;
            string edmFilePath, exportPath;

            // 1
            Console.WriteLine("A/B/C");

            edmFilePath = "A/B/C/txt.txt";
            exportPath  = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.1.txt";

            Console.WriteLine("  Write TXT");
            edmManager.WriteFile(edmFilePath, txtFilePath);
            Console.WriteLine("  Read TXT");
            file = edmManager.ReadFile(edmFilePath);
            File.WriteAllBytes(exportPath, file);
            //Console.WriteLine("  Delete TXT");
            //edmManager.EdmEngine.DeleteFile(edmFilePath);

            // 101
            Console.WriteLine("101");

            edmFilePath = "A/D/E/txt.txt";
            exportPath  = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.101.txt";

            Console.WriteLine("  Write TXT");
            edmManager.WriteFile(edmFilePath, txtFilePath);
            Console.WriteLine("  Read TXT");
            file = edmManager.ReadFile(edmFilePath);
            File.WriteAllBytes(exportPath, file);
            //Console.WriteLine("  Delete TXT");
            //edmManager.EdmEngine.DeleteFile(edmFilePath);
        }
        public NorthwindUnitOfWorkRedis()
            : base(LibraryHelper.AppSettings <string>("Redis.Northwind"))
        {
            Domain = "Northwind";

            ModelConfig <Category> .Id(x => x.CategoryId);

            ModelConfig <CustomerCustomerDemo> .Id(x => x.CustomerId);

            ModelConfig <CustomerDemographic> .Id(x => x.CustomerTypeId);

            ModelConfig <Customer> .Id(x => x.CustomerId);

            ModelConfig <Employee> .Id(x => x.EmployeeId);

            ModelConfig <EmployeeTerritory> .Id(x => x.EmployeeId);

            ModelConfig <OrderDetail> .Id(x => x.OrderId);

            ModelConfig <Order> .Id(x => x.OrderId);

            ModelConfig <Product> .Id(x => x.ProductId);

            ModelConfig <Region> .Id(x => x.RegionId);

            ModelConfig <Shipper> .Id(x => x.ShipperId);

            ModelConfig <Supplier> .Id(x => x.SupplierId);

            ModelConfig <Territory> .Id(x => x.TerritoryId);

            Repositories.Add(typeof(Category), new NorthwindCategoryRepositoryRedis(this));
            Repositories.Add(typeof(CustomerCustomerDemo), new NorthwindCustomerCustomerDemoRepositoryRedis(this));
            Repositories.Add(typeof(CustomerDemographic), new NorthwindCustomerDemographicRepositoryRedis(this));
            Repositories.Add(typeof(Customer), new NorthwindCustomerRepositoryRedis(this));
            Repositories.Add(typeof(Employee), new NorthwindEmployeeRepositoryRedis(this));
            Repositories.Add(typeof(EmployeeTerritory), new NorthwindEmployeeTerritoryRepositoryRedis(this));
            Repositories.Add(typeof(OrderDetail), new NorthwindOrderDetailRepositoryRedis(this));
            Repositories.Add(typeof(Order), new NorthwindOrderRepositoryRedis(this));
            Repositories.Add(typeof(Product), new NorthwindProductRepositoryRedis(this));
            Repositories.Add(typeof(Region), new NorthwindRegionRepositoryRedis(this));
            Repositories.Add(typeof(Shipper), new NorthwindShipperRepositoryRedis(this));
            Repositories.Add(typeof(Supplier), new NorthwindSupplierRepositoryRedis(this));
            Repositories.Add(typeof(Territory), new NorthwindTerritoryRepositoryRedis(this));

            //IRedisClient client = base.Client;
        }
Esempio n. 15
0
        /// <summary>
        /// Report Initialization method that is triggered when report begin processed.
        /// </summary>
        /// <param name="reportOptions">The ReportViewer options.</param>
        public void OnInitReportOptions(ReportViewerOptions reportOptions)
        {
            //throw new NotImplementedException();

            // Add RDL Server and database credentials here
            // Report Server
            string user     = LibraryHelper.AppSettings <string>("Report.RDLUser");
            string password = LibraryHelper.AppSettings <string>("Report.RDLPassword");

            reportOptions.ReportModel.ReportServerCredential = new System.Net.NetworkCredential(user, password);
            // Data Source
            string connectionName = "Chinook";

            string[] userPassword = AdoNetHelper.GetUserPassword(connectionName);
            DataSourceCredentials dataSourceCredentials = new DataSourceCredentials(connectionName, userPassword[0], userPassword[1]);

            reportOptions.ReportModel.DataSourceCredentials.Add(dataSourceCredentials);
        }
Esempio n. 16
0
        private static void Main(string[] args)
        {
            string         exePath     = Assembly.GetExecutingAssembly().Location;
            FileSystemInfo exeFileInfo = new FileInfo(exePath);

            // Is application already running ?

            if (LibraryHelper.IsApplicationAlreadyRunning())
            {
                System.Console.WriteLine("Another instance of \"{0}\" is already running", exeFileInfo.Name);
                //NLogHelper.Warning("Another instance of \"{0}\" is already running", fileInfo.Name);

                return;
            }

            // Unity

            UnityHelper.RegisterMappings(Container);

            LogManager = (ILogManager)Container.Resolve <ILogManager>();

            // Directory

            string directory;

            // Z-Export
            directory = Path.Combine(Path.GetDirectoryName(exePath), LibraryHelper.AppSettings <string>("DirectoryExport"));
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            // Z-Import
            directory = Path.Combine(Path.GetDirectoryName(exePath), LibraryHelper.AppSettings <string>("DirectoryImport"));
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            // Shell Server
            //MainShell();

            // Hangfire Server
            MainHangfire();
        }
Esempio n. 17
0
        public ChinookUnitOfWorkRedis()
            : base(LibraryHelper.AppSettings <string>("Redis.Chinook"))
        {
            Domain = "Chinook";

            ModelConfig <Album> .Id(x => x.AlbumId);

            ModelConfig <Artist> .Id(x => x.ArtistId);

            ModelConfig <Customer> .Id(x => x.CustomerId);

            ModelConfig <CustomerDocument> .Id(x => x.CustomerDocumentId);

            ModelConfig <Employee> .Id(x => x.EmployeeId);

            ModelConfig <Genre> .Id(x => x.GenreId);

            ModelConfig <Invoice> .Id(x => x.InvoiceId);

            ModelConfig <InvoiceLine> .Id(x => x.InvoiceLineId);

            ModelConfig <MediaType> .Id(x => x.MediaTypeId);

            ModelConfig <Playlist> .Id(x => x.PlaylistId);

            ModelConfig <PlaylistTrack> .Id(x => x.PlaylistTrackId); // !!!

            ModelConfig <Track> .Id(x => x.TrackId);

            Repositories.Add(typeof(Album), new ChinookAlbumRepositoryRedis(this));
            Repositories.Add(typeof(Artist), new ChinookArtistRepositoryRedis(this));
            Repositories.Add(typeof(Customer), new ChinookCustomerRepositoryRedis(this));
            Repositories.Add(typeof(CustomerDocument), new ChinookCustomerDocumentRepositoryRedis(this));
            Repositories.Add(typeof(Employee), new ChinookEmployeeRepositoryRedis(this));
            Repositories.Add(typeof(Genre), new ChinookGenreRepositoryRedis(this));
            Repositories.Add(typeof(Invoice), new ChinookInvoiceRepositoryRedis(this));
            Repositories.Add(typeof(InvoiceLine), new ChinookInvoiceLineRepositoryRedis(this));
            Repositories.Add(typeof(MediaType), new ChinookMediaTypeRepositoryRedis(this));
            Repositories.Add(typeof(Playlist), new ChinookPlaylistRepositoryRedis(this));
            Repositories.Add(typeof(PlaylistTrack), new ChinookPlaylistTrackRepositoryRedis(this));
            Repositories.Add(typeof(Track), new ChinookTrackRepositoryRedis(this));

            //IRedisClient client = base.Client;
        }
Esempio n. 18
0
        public ChinookMongoDB()
        {
            _database = new MongoClient(LibraryHelper.AppSettings <string>("MongoDB.Chinook.Url"))
                        .GetDatabase(LibraryHelper.AppSettings <string>("MongoDB.Chinook.Database"));

            ChinookMongoDBMap.AlbumMap();
            ChinookMongoDBMap.ArtistMap();
            ChinookMongoDBMap.CustomerMap();
            ChinookMongoDBMap.EmployeeMap();
            ChinookMongoDBMap.GenreMap();
            ChinookMongoDBMap.InvoiceMap();
            ChinookMongoDBMap.InvoiceLineMap();
            ChinookMongoDBMap.MediaTypeMap();
            ChinookMongoDBMap.PlaylistMap();
            ChinookMongoDBMap.PlaylistTrackMap();
            ChinookMongoDBMap.TrackMap();

            ChinookMongoDBMap.CustomerDocumentMap();
        }
Esempio n. 19
0
        public ChinookRavenDB()
        {
            _documentStore = new DocumentStore
            {
                Url             = LibraryHelper.AppSettings <string>("RavenDB.Chinook.Url"),
                DefaultDatabase = LibraryHelper.AppSettings <string>("RavenDB.Chinook.Database")
            };

            // entity/1
            //_documentStore.Conventions
            //    .DocumentKeyGenerator = (dbname, commands, entity) => _documentStore.Conventions.GetTypeTagName(entity.GetType()) + "/";

            // DocumentId = entity/1
            _documentStore.Conventions
            .FindIdentityProperty = property => property.Name == "DocumentId";

            // entity/1 instead of entities/1
            _documentStore.Conventions
            .FindTypeTagName = type => type.Name;

            _documentStore.Initialize();
        }
        public ActionResult AutoRefresh()
        {
            string dashboardDirectory = "Chinook";

            string dashboardName = (string)HttpContext.Session["DashboardSyncfusionAutoRefresh"];

            if (String.IsNullOrEmpty(dashboardName))
            {
                dashboardName = "Dashboard";
            }
            else if (dashboardName == "Dashboard")
            {
                dashboardName = "Dashboard-2";
            }
            else if (dashboardName == "Dashboard-2")
            {
                dashboardName = "Dashboard-3";
            }
            else
            {
                dashboardName = "Dashboard";
            }
            HttpContext.Session["DashboardSyncfusionAutoRefresh"] = dashboardName;

            ViewBag.ReportPath = Path.Combine(Server.MapPath(LibraryHelper.AppSettings <string>("Dashboard.SyncfusionDirectory")), dashboardDirectory, dashboardName + ".sydx")
                                 .Replace("\\", "\\\\");

            DashboardViewer dashboardViewer = new DashboardViewer();

            ViewBag.Errormessage = dashboardViewer.Errormessage;
            string url = LibraryHelper.AppSettings <string>("Dashboard.SyncfusionUrl");

            ViewBag.ServiceURL = String.IsNullOrEmpty(url) ? dashboardViewer.ServiceUrl : url;

            Response.AddHeader("Refresh", "10");

            return(View("DashboardSyncfusion"));
        }
Esempio n. 21
0
        public ActionResult Syncfusion(string dashboardDirectory, string dashboardName)
        {
            ZOperationResult operationResult = new ZOperationResult();

            try
            {
                if (String.IsNullOrEmpty(dashboardName))
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    if (!String.IsNullOrEmpty(dashboardDirectory))
                    {
                        ViewBag.ReportPath = Path.Combine(Server.MapPath(LibraryHelper.AppSettings <string>("Dashboard.SyncfusionDirectory")), dashboardDirectory, dashboardName + ".sydx")
                                             .Replace("\\", "\\\\");
                    }
                    else
                    {
                        ViewBag.ReportPath = Path.Combine(Server.MapPath(LibraryHelper.AppSettings <string>("Dashboard.SyncfusionDirectory")), dashboardName + ".sydx")
                                             .Replace("\\", "\\\\");
                    }

                    DashboardViewer dashboardViewer = new DashboardViewer();
                    ViewBag.Errormessage = dashboardViewer.Errormessage;
                    string url = LibraryHelper.AppSettings <string>("Dashboard.SyncfusionUrl");
                    ViewBag.ServiceURL = String.IsNullOrEmpty(url) ? dashboardViewer.ServiceUrl : url;

                    return(View("Syncfusion"));
                }
            }
            catch (Exception exception)
            {
                operationResult.ParseException(exception);
                return(View("OperationResult", new OperationResultModel(operationResult)));
            }
        }
Esempio n. 22
0
        public ActionResult Clean(TaskModel viewModel)
        {
            viewModel.OperationResult.Clear();

            try
            {
                if (!IsAuthorized("Clean", viewModel.OperationResult))
                {
                    return(View("OperationResult", new OperationResultModel(viewModel.OperationResult)));
                }
                else if (ValidateModelState())
                {
                    // Z-Export

                    if (viewModel.OperationResult.Ok)
                    {
                        Application.Clean(viewModel.OperationResult, Server.MapPath(LibraryHelper.AppSettings <string>("DirectoryExport")));
                    }

                    // Z-Import

                    if (viewModel.OperationResult.Ok)
                    {
                        Application.Clean(viewModel.OperationResult, Server.MapPath(LibraryHelper.AppSettings <string>("DirectoryImport")));
                    }

                    viewModel.OperationResult.StatusMessage = TaskCleanResources.Task + " Ok";
                }
            }
            catch (Exception exception)
            {
                viewModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(viewModel.OperationResult));
        }
Esempio n. 23
0
        public virtual ActionResult ImportGenreAjax()
        {
            ZOperationResult operationResult = new ZOperationResult();
            string           path            = "";
            bool             isUploaded      = false;

            try
            {
                if (!IsAuthorized("ImportGenre", operationResult))
                {
                    return(View("OperationResult", new OperationResultModel(operationResult)));
                }
                else
                {
                    HttpPostedFileBase upload = Request.Files["Upload"];
                    if (upload != null && upload.ContentLength != 0)
                    {
                        // Save file

                        string file = Path.GetFileName(upload.FileName);
                        path = Server.MapPath(LibraryHelper.AddDirectorySeparator(LibraryHelper.AppSettings <string>("DirectoryImport")) + file);
                        upload.SaveAs(path);

                        isUploaded = true;

                        // Read file and Create Genre

                        // Application
                        //IChinookGenericApplication<Genre> genreApplication =
                        //    DependencyResolver.Current.GetService<IChinookGenericApplication<Genre>>();
                        //Application.ImportGenreTXTApplication(operationResult, path, genreApplication);

                        // OR

                        // Persistence
                        //IChinookUnitOfWork unitOfWork =
                        //    DependencyResolver.Current.GetService<IChinookUnitOfWork>();
                        //Application.ImportGenreTXTPersistence(operationResult, path, unitOfWork);
                    }
                }
            }
            catch (Exception exception)
            {
                operationResult.ParseException(exception);
            }
            finally
            {
                if (!String.IsNullOrEmpty(path))
                {
                    System.IO.File.Delete(path);
                }
            }

            if (operationResult.Ok)
            {
                return(JsonResultSuccess(new { IsUploaded = isUploaded, OperationResult = operationResult }));
            }
            else
            {
                return(JsonResultFailure(new { OperationResult = operationResult }));
            }
        }
Esempio n. 24
0
        public static string ExportGenreTXT()
        {
            LogManager.Trace(GetLog("Export Genre TXT", "Start"));

            string filePath = "";

            try
            {
                string         exePath       = Assembly.GetExecutingAssembly().Location;
                FileSystemInfo exeFileInfo   = new FileInfo(exePath);
                string         fileDirectory = Path.Combine(Path.GetDirectoryName(exePath), LibraryHelper.AppSettings <string>("DirectoryExport"));

                ZOperationResult   operationResult = new ZOperationResult();
                ChinookApplication application     =
                    (ChinookApplication)Container.Resolve <IChinookApplication>();
                ChinookGenericApplication <Genre> genreApplication =
                    (ChinookGenericApplication <Genre>)Container.Resolve <IChinookGenericApplication <Genre> >();

                // Clean Z-Export

                application.Clean(operationResult, fileDirectory);

                // Text File

                LogManager.Trace(GetLog("Export Genre", "Text File"));

                if (!application.ExportGenreTXT(operationResult, fileDirectory, genreApplication,
                                                out filePath))
                {
                    LogManager.LogOperationResult(operationResult);
                }
            }
            catch (Exception exception)
            {
                LogManager.LogException(exception);
            }

            LogManager.Trace(GetLog("Export Genre", "Stop"));

            return(filePath);
        }
Esempio n. 25
0
 public EdmManagerFileSystem()
 {
     RootDirectory = LibraryHelper.AppSettings <string>("EDM.FileSystemDirectory");
 }
Esempio n. 26
0
        public static void ExportGenreXLSX()
        {
            LogManager.Trace(GetLog("Export Genre XLSX", "Start"));

            string filePath = "";

            try
            {
                string         exePath       = Assembly.GetExecutingAssembly().Location;
                FileSystemInfo exeFileInfo   = new FileInfo(exePath);
                string         fileDirectory = Path.Combine(Path.GetDirectoryName(exePath), LibraryHelper.AppSettings <string>("DirectoryExport"));

                ZOperationResult   operationResult = new ZOperationResult();
                ChinookApplication application     =
                    (ChinookApplication)Container.Resolve <IChinookApplication>();

                // WorkSheet

                LogManager.Trace(GetLog("Export Genre", "Worksheet"));
                if (application.ExportGenreXLSX(operationResult, fileDirectory,
                                                out filePath))
                {
                    LogManager.Trace(GetLog("Export Genre", "e-mail"));

                    string body = @"
Hi,

Attached you will find the [Genre.xlsx] worksheet.

Sincerely,
Chinook";
                    (new MailManager()).Mail("Chinook", "EasyLOB", "*****@*****.**",
                                             "Chinook - Export Genre", body, false, new string[] { filePath });
                }
                else
                {
                    LogManager.LogOperationResult(operationResult);
                }
            }
            catch (Exception exception)
            {
                LogManager.LogException(exception);
            }
            //finally
            //{
            //    if (!String.IsNullOrEmpty(filePath))
            //    {
            //        File.Delete(filePath);
            //    }
            //}

            LogManager.Trace(GetLog("Export Genre", "Stop"));
        }
Esempio n. 27
0
        public ChinookRedis()
        {
            _client = new RedisClient(LibraryHelper.AppSettings <string>("Redis.Chinook"));

            ModelConfig <Genre> .Id(x => x.GenreId);
        }