예제 #1
0
        /// <summary>
        /// Generates the goal data file.
        /// </summary>
        /// <param name="path">The path.</param>
        public void GenerateGoalDataFile(System.IO.MemoryStream path)
        {
            var excelService = new ExcelService();

            excelService.CreateExcelFile(
                path,
                (DocumentFormat.OpenXml.Packaging.WorkbookPart workBookPart) =>
            {
                DataTable goalTable = this.syngentaSIPUnitOfWork.DataRepository.GetGoalAmountData();
                excelService.AddDataTable(workBookPart, "Goal Amount", goalTable);
            });
        }
예제 #2
0
        /// <summary>
        /// Generates the salary data file.
        /// </summary>
        /// <param name="path">The path.</param>
        public void GenerateSalaryDataFile(System.IO.MemoryStream path)
        {
            var excelService = new ExcelService();

            excelService.CreateExcelFile(
                path,
                (DocumentFormat.OpenXml.Packaging.WorkbookPart workBookPart) =>
            {
                DataTable countryTable = this.syngentaSIPUnitOfWork.DataRepository.GetUserSalaryData();
                excelService.AddDataTable(workBookPart, "UserSalaryImport", countryTable);
            });
        }
예제 #3
0
        /// <summary>
        /// Generates the user data file.
        /// </summary>
        /// <param name="path">The path.</param>
        public void GenerateUserDataFile(System.IO.MemoryStream path, int countryId)
        {
            var excelService = new ExcelService();

            excelService.CreateExcelFile(
                path,
                (DocumentFormat.OpenXml.Packaging.WorkbookPart workBookPart) =>
            {
                DataTable userData = this.syngentaSIPUnitOfWork.DataRepository.GetUsersByCountryId(countryId);
                excelService.AddDataTable(workBookPart, "User", userData);

                DataTable salaryData = this.syngentaSIPUnitOfWork.DataRepository.GetUserSalaryData(countryId);
                excelService.AddDataTable(workBookPart, "UserSalary", salaryData);

                DataTable goalTable = this.syngentaSIPUnitOfWork.DataRepository.GetGoalAmountData(countryId);
                excelService.AddDataTable(workBookPart, "Goal Amount", goalTable);

                DataTable payoutHistory = this.syngentaSIPUnitOfWork.DataRepository.GetPayoutHistoryData(countryId);
                excelService.AddDataTable(workBookPart, "Payout History", payoutHistory);
            });
        }
예제 #4
0
        /// <summary>
        /// Generates the user track document file.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="countryId">The country identifier.</param>
        /// <exception cref="NotImplementedException"></exception>
        public void GenerateUserTrackDocumentFile(MemoryStream path, int year, int countryId = 0)
        {
            DataTable documentsReport = this.syngentaSIPUnitOfWork.DocumentRepository.GetUserDownloadedDocuments(countryId, year);

            IList <string> userDocumentsList    = this.storageService.GetListOfDocuments(year.ToString(), Constants.BlobSetting.UserStorageContainer);
            IList <string> countryDocumentsList = this.storageService.GetListOfDocuments(year.ToString(), Constants.BlobSetting.CountryStorageContainer);

            string employeeId                = string.Empty;
            string isUserDocumentUploaded    = string.Empty;
            string isCountryDocumentUploaded = string.Empty;

            foreach (DataRow row in documentsReport.Rows)
            {
                employeeId                = Convert.ToString(row["EmployeeID"]);
                isUserDocumentUploaded    = Convert.ToString(row["Is User Document Uploaded"]);
                isCountryDocumentUploaded = Convert.ToString(row["Is Country Document Uploaded"]);
                if (string.IsNullOrEmpty(employeeId).Equals(false))
                {
                    if (isUserDocumentUploaded.ToUpper().Equals("NO") && userDocumentsList.Any(x => x.StartsWith(string.Concat(employeeId, "_"))))
                    {
                        row["Is User Document Uploaded"] = "Yes";
                    }
                    if (isCountryDocumentUploaded.ToUpper().Equals("NO") && countryDocumentsList.Any(x => x.ToUpper().StartsWith(row["Country"].ToString().ToUpper())))
                    {
                        row["Is Country Document Uploaded"] = "Yes";
                    }
                }
            }

            var excelService = new ExcelService();

            excelService.CreateExcelFile(
                path,
                (DocumentFormat.OpenXml.Packaging.WorkbookPart workBookPart) =>
            {
                excelService.AddDataTable(workBookPart, "DocumentsReport", documentsReport);
            });
        }
예제 #5
0
        /// <summary>
        /// Generates the data file.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="id">The identifier.</param>
        public void GenerateDataFile(System.IO.MemoryStream path, int id)
        {
            var excelService = new ExcelService();

            excelService.CreateExcelFile(
                path,
                (DocumentFormat.OpenXml.Packaging.WorkbookPart workBookPart) =>
            {
                DataTable countryTable = this.syngentaSIPUnitOfWork.DataRepository.GetCountries(id);
                excelService.AddDataTable(workBookPart, "DataImportCountry", countryTable);

                DataTable incentivePayout = this.syngentaSIPUnitOfWork.DataRepository.GetIncentivePayout(id);
                excelService.AddDataTable(workBookPart, "IncentivePayout", incentivePayout);

                DataTable payoutCurveTable = this.syngentaSIPUnitOfWork.DataRepository.GetPayoutCurves(id);
                excelService.AddDataTable(workBookPart, "PayoutCurve", payoutCurveTable);

                DataTable roleTable = this.syngentaSIPUnitOfWork.DataRepository.GetRoles(id);
                excelService.AddDataTable(workBookPart, "Role", roleTable);

                DataTable measureTable = this.syngentaSIPUnitOfWork.DataRepository.GetMeasures(id);
                excelService.AddDataTable(workBookPart, "DataImportMeasure", measureTable);
            });
        }