Ejemplo n.º 1
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)));
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
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));
        }
Ejemplo n.º 6
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));

        }
Ejemplo n.º 7
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));
        }
Ejemplo n.º 8
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));
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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));
        }
Ejemplo n.º 11
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;
        }
Ejemplo n.º 12
0
        public ActionResult ExportContractListByTemplate([DataSourceRequest] DataSourceRequest request, Hre_ContractSearchModel model)
        {
            string status = string.Empty;
            var contractServices = new Hre_ContractServices();
            var isDataTable = false;
            object obj = new Hre_ProfileModel();
            var result = GetListData<Hre_ContractModel, Hre_ContractEntity, Hre_ContractSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_ContractList, ref status);
            DataTable tb = new DataTable();
            var actionServices = new ActionService(UserLogin);
            var _ConstractSearchModel = new Hre_ContractSearchModel();
            var _lsContractAll = GetListData<Hre_ContractModel, Hre_ContractEntity, Hre_ContractSearchModel>(request, _ConstractSearchModel, ConstantSql.hrm_hr_sp_get_Contract, ref status);

            var Lstobj = new List<object>();
            Lstobj.AddRange(new object[18]);
            Lstobj[16] = 1;
            Lstobj[17] = (int.MaxValue - 1);
            var _profileAll = actionServices.GetData<Hre_ProfileEntity>(Lstobj, ConstantSql.hrm_hr_sp_get_Profile, ref status);

            #region lay thong tin hop dong
            for (int i = 0; i < result.Count; i++)
            {
                #region Lay thong tin Profile
                var _profile = _profileAll.Where(s => s.ID == result[i].ProfileID && result[i].ProfileID != null).FirstOrDefault();
                if (_profile != null)
                {
                    if (_profile.PAddress != null)
                        result[i].PAddress = _profile.PAddress;

                    if (_profile.PDistrictName != null)
                        result[i].PDistrictName = _profile.PDistrictName;

                    if (_profile.PCountryName != null)
                        result[i].PCountryName = _profile.PCountryName;

                    if (_profile.PProvinceName != null)
                        result[i].PProvinceName = _profile.PProvinceName;

                    if (result[i].ProfileName != null)
                    {
                        var _profilename = result[i].ProfileName.Split(' ');
                        if (_profilename.Count() == 1)
                        {
                            result[i].FristName = result[i].ProfileName;
                        }
                        else
                        {
                            if (_profilename.Count() == 2)
                            {
                                result[i].FristName = _profilename[0];
                                result[i].LastName = _profilename[1];
                            }
                            else
                            {
                                result[i].FristName = _profilename[0];
                                result[i].LastName = _profilename[_profilename.Count() - 1];
                                for (int j = 1; j < _profilename.Count() - 1; j++)
                                {
                                    result[i].TenDem = result[i].TenDem + _profilename[j];
                                }
                            }

                        }
                    }
                }
                #endregion
                #region Lay thong tin hopn dong truoc do
                var _lsContract = _lsContractAll.Where(s => s.ID == result[i].ID && result[i].ID != null).ToList();
                if (_lsContract != null && _lsContract.Count >= 2)
                {
                    _lsContract = _lsContract.Where(m => m.DateSigned <= result[i].DateSigned).ToList();
                    if (_lsContract.Count >= 2)
                    {
                        Hre_ContractModel _contract = new Hre_ContractModel();
                        _lsContract = _lsContract.OrderByDescending(m => m.DateSigned).ToList();
                        _contract = _lsContract[0];
                        if (_contract.DateStart != null)
                        {
                            result[i].DateStartOld = _contract.DateStart;
                            result[i].DateStartOld_Day = _contract.DateStart.Day.ToString();
                            result[i].DateStartOld_Month = _contract.DateStart.Month.ToString();
                            result[i].DateStartOld_Year = _contract.DateStart_Year.ToString();
                        }
                        if (_contract.DateEnd != null)
                        {
                            result[i].DateEndOld = _contract.DateEnd;
                            result[i].DateEndOld_Day = _contract.DateEnd.Value.Day.ToString();
                            result[i].DateEndOld_Month = _contract.DateEnd.Value.Month.ToString();
                            result[i].DateEndOld_Year = _contract.DateEnd.Value.Year.ToString();
                        }
                        if (_contract.DateSigned != null)
                        {
                            result[i].DateSignedOld = _contract.DateSigned;
                            result[i].DateSignedOld_Day = _contract.DateSigned.Value.Day.ToString();
                            result[i].DateSignedOld_Month = _contract.DateSigned.Value.Month.ToString();
                            result[i].DateSignedOld_Year = _contract.DateSigned.Value.Year.ToString();
                        }
                    }

                }
                #endregion
            }

            #endregion


            var lstEntity = result.Translate<Hre_ContractEntity>();
            tb = contractServices.GetDataContract(lstEntity, UserLogin);

            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = tb,
                    FileName = "Hre_Contract",
                    OutPutPath = path,
                    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, lstEntity, null, model.ExportType);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Ejemplo n.º 13
0
        public ActionResult GetContractList([DataSourceRequest] DataSourceRequest request, Hre_ContractSearchModel model)
        {
            string status = string.Empty;
            var isDataTable = false;

            var result = GetListData<Hre_ContractModel, Hre_ContractEntity, Hre_ContractSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_ContractList, ref status);
            if (model.IsLastestContract == true && result != null)
            {
                var lstProfileID = result.Select(s => s.ProfileID).Distinct().ToList();
                if (lstProfileID.Count > 0)
                {
                    result = result.Where(s => lstProfileID.Contains(s.ProfileID)).OrderByDescending(s => s.DateStart).DistinctBy(s => s.ProfileID).ToList();
                }
            }

            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ContractModel(),
                    FileName = "Hre_Contract",
                    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);
            }

            var listModel = new List<Hre_ContractModel>();
            if (result != null)
            {
                request.Page = 1;
                foreach (var item in result)
                {
                    var newModle = (Hre_ContractModel)typeof(Hre_ContractModel).CreateInstance();
                    foreach (var property in item.GetType().GetProperties())
                    {
                        newModle.SetPropertyValue(property.Name, item.GetPropertyValue(property.Name));
                    }
                    listModel.Add(newModle);
                }
                var dataSourceResult = listModel.ToDataSourceResult(request);
                if (listModel.FirstOrDefault().GetPropertyValue("TotalRow") != null)
                {
                    dataSourceResult.Total = listModel.Count() <= 0 ? 0 : (int)listModel.FirstOrDefault().GetPropertyValue("TotalRow");
                }
                return Json(dataSourceResult, JsonRequestBehavior.AllowGet);
            }
            return Json(result.ToDataSourceResult(request));
        }
Ejemplo n.º 14
0
        public ActionResult ExportAllContractEndList([DataSourceRequest] DataSourceRequest request, Hre_ContractEndSearchModel model)
        {
            Hre_ContractServices ActionServices = new Hre_ContractServices();
            string status = string.Empty;
            var result = GetListData<Hre_ContractModel, Hre_ContractEntity, Hre_ContractEndSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_ContractEnd, ref status);
            var lstEntity = result.Translate<Hre_ContractEntity>();
            DataTable tb = ActionServices.GetDataContract(lstEntity, UserLogin);
            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);
            }
            if (model.ExportId != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportId, tb, null, model.ExportType);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Ejemplo n.º 15
0
        public ActionResult GetEvaluationContractWaitingList([DataSourceRequest] DataSourceRequest request, Hre_EvaluationContractWaitingApprovedSearchModel model)
        {
            int _page = request.Page;
            var service = new Hre_ReportServices();
            var ActionService = new ActionService(UserLogin);
            var contractServices = new Hre_ContractServices();
            string status = string.Empty;
            request.Page = 1;
            request.PageSize = int.MaxValue - 1;
            var result = GetListData<Hre_ContractModel, Hre_ContractEntity, Hre_EvaluationContractWaitingApprovedSearchModel>(request, model,
                ConstantSql.hrm_hr_sp_get_EvaluationContractWaitingApprove, ref status);
            if (result != null)
            {
                result = result.Where(s => s.StatusEvaluation != "E_APPROVED" && s.ContractResult != null).ToList();
            }
            var lstObjContractType = new List<object>();
            lstObjContractType.AddRange(new object[6]);
            lstObjContractType[4] = 1;
            lstObjContractType[5] = int.MaxValue - 1;
            var lstContractType = ActionService.GetData<Cat_ContractTypeEntity>(lstObjContractType, ConstantSql.hrm_cat_sp_get_ContractType, ref status);

            if (model.IsMissingInformation == true)
            {
                result = result.Where(s => s.DateEndNextContract == null).ToList();
            }

            var lstContractEntity = result.Translate<Hre_ContractEntity>();
            DataTable tableData = contractServices.GetDataContract(lstContractEntity, UserLogin);
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = model.DateStart == null ? DateTime.Now : model.DateStart };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = model.DateEnd == null ? DateTime.Now : model.DateEnd };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            var isDataTable = false;
            DataTable obj = null;
            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = tableData;
                isDataTable = true;
            }

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

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_ContractEntity",
                    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, tableData, listHeaderInfo, model.ExportType);

                return Json(fullPath);
            }
            var listModel = new List<Hre_ContractModel>();
            if (result != null)
            {
                request.Page = _page;
                foreach (var item in result)
                {
                    var newModle = (Hre_ContractModel)typeof(Hre_ContractModel).CreateInstance();
                    foreach (var property in item.GetType().GetProperties())
                    {
                        newModle.SetPropertyValue(property.Name, item.GetPropertyValue(property.Name));
                    }
                    listModel.Add(newModle);
                }
                var dataSourceResult = listModel.ToDataSourceResult(request);
                if (listModel.FirstOrDefault().GetPropertyValue("TotalRow") != null)
                {
                    dataSourceResult.Total = result.Count;
                }
                return Json(dataSourceResult, JsonRequestBehavior.AllowGet);
            }
            return Json(result.ToDataSourceResult(request));

        }
Ejemplo n.º 16
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));

        }
Ejemplo n.º 17
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));
        }
Ejemplo n.º 18
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));
        }
Ejemplo n.º 19
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));
        }
Ejemplo n.º 20
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));
        }
Ejemplo n.º 21
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);
        }
Ejemplo n.º 22
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);
        }
Ejemplo n.º 23
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));
        }
Ejemplo n.º 24
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));
        }
Ejemplo n.º 25
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));
        }
Ejemplo n.º 26
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));
        }
Ejemplo n.º 27
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));
        }
Ejemplo n.º 28
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));
        }
Ejemplo n.º 29
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));
        }
Ejemplo n.º 30
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));
        }
Ejemplo n.º 31
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));
        }