Exemplo n.º 1
0
        public List<Att_WorkdayEntity> ComputeWorkdayAdjust(ListQueryModel lstModel, string UserLogin)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                string status = string.Empty;

                #region xử lý lấy lstProfileIds theo OrgStructureID
                //List<Hre_ProfileEntity> lstProfile = new List<Hre_ProfileEntity>();
                //List<Guid> lstProfileIDs = new List<Guid>();
                //List<object> lstObj = new List<object>();
                //lstObj.Add(search.OrgStructureID);
                //lstObj.Add(null);
                //lstObj.Add(null);
                //if (search.ProfileName != null && search.OrgStructureID == null)
                //{
                //}
                //else
                //{
                //    lstProfile = GetData<Hre_ProfileEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status);
                //    lstProfileIDs = lstProfile.Select(s => s.ID).ToList();
                //}
                #endregion

                var lstWorkday = GetData<Att_WorkdayEntity>(lstModel, ConstantSql.hrm_att_sp_get_WorkDay, UserLogin, ref status);
                SetStatusLeaveOnWorkday(lstWorkday, unitOfWork);
                return lstWorkday;
            }
        }
 public void NUnit_Domain_GetCatRelativeType(ListQueryModel model)
 {
     Cat_RelativeTypeServices service = new Cat_RelativeTypeServices();
     //int count = service.Get().Count();
     int count = service.GetAllUseEntity<Cat_RelativeType>(ref status).Count();
     //NUnit.Framework.Assert.AreNotEqual(0, count);
     Console.Write("Total Record: " + count);
 }
Exemplo n.º 3
0
 public void NUnit_Domain_GetCatBanks(ListQueryModel model)
 {
     Cat_BankServices service = new Cat_BankServices();
     string status = string.Empty;
     int count = service.GetAllUseEntity<Cat_Bank>(ref status).Count();
     //NUnit.Framework.Assert.AreNotEqual(0, count);
     Console.Write("Total Record: " + count);
 }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
0
        public ActionResult GetReportDetailCard([DataSourceRequest] DataSourceRequest request, Can_ReportDetailCardSearchModel Model)
        {
            var service = new Can_ReportServices();
            var hrService = new Hre_ProfileServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request)
            };
            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;
            }
            if (Model.CanteenID != null) Model.CanteenIDs.Add(Model.CanteenID);
            if (Model.CateringID != null) Model.CateringIDs.Add(Model.CateringID);
            if (Model.LineID != null) Model.LineIDs.Add(Model.LineID);
            var result = service.ReportDetailCard(Model.CateringIDs, Model.CanteenIDs, Model.LineIDs, From, To, Model.OrgStructureID);
            var rs = result.Translate<Can_ReportDetailCardModel>();

            #region xử lý xuất báo cáo

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, rs);
                return Json(fullPath);
            }
            #endregion
            request.Page = 1;
            var dataSourceResult = result.ToDataSourceResult(request);
            return Json(rs.ToDataSourceResult(request));
        }
Exemplo n.º 6
0
        public ActionResult GetReportAdjustmentMealAllowancePayment([DataSourceRequest] DataSourceRequest request, Can_ReportAdjustmentMealAllowancePaymentModel Model)
        {
            var service = new Can_ReportServices();
            var hrService = new Hre_ProfileServices();
            var Actionservices = new ActionService(UserLogin);
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request)
            };
            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;
            }
            List<Guid?> OrgIds = new List<Guid?>();
            if (Model.OrgStructureID != null && Model.OrgStructureID.Count() > 0)
            {
                OrgIds = Model.OrgStructureID;
            }
            string strOrgIDs = Common.ListToString(OrgIds);
            string profileName = string.Empty;
            string codeEmp = string.Empty;
            if (Model.ProfileName != string.Empty)
            {
                profileName = Model.ProfileName;
            }

            if (Model.CodeEmp != string.Empty)
            {
                codeEmp = Model.CodeEmp;
            }
            List<Guid> lstProfileIDs = new List<Guid>();
            List<Object> Lstsearch = new List<object>();
            Lstsearch.Add(strOrgIDs);
            Lstsearch.Add(profileName);
            Lstsearch.Add(codeEmp);
            if (Model.OrgStructureID != null)
            {
                string status = string.Empty;
                lstProfileIDs = Actionservices.GetData<Hre_ProfileIdEntity>(Lstsearch, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(s => s.ID).ToList();
            }
            var result = service.ReportAdjustmentMealAllowancePayment(From, To, lstProfileIDs);
            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Exemplo n.º 7
0
        public ActionResult GetProfileQuitList([DataSourceRequest] DataSourceRequest request, Hre_ProfileQuitSearchModel model)
        {
            var profileServices = new Hre_ProfileServices();
            var service = new ActionService(UserLogin);
            bool isGroup = profileServices.IsGroupByOrgProfileQuit();

            if (isGroup == true)
            {
                #region Group theo DS phòng ban - DDF
                var rptServices = new Hre_ReportServices();
                string status = string.Empty;

                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 = service.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 = service.GetData<Cat_OrgStructureTypeEntity>(lstObjOrgType, ConstantSql.hrm_cat_sp_get_OrgStructureType, ref status).ToList();

                ListQueryModel lstModel = new ListQueryModel
                {
                    PageIndex = request.Page,
                    PageSize = request.PageSize,
                    Filters = ExtractFilterAttributes(request),
                    Sorts = ExtractSortAttributes(request),
                    AdvanceFilters = ExtractAdvanceFilterAttributes(model)
                };
                var lstEntity = service.GetData<Hre_ProfileEntity>(lstModel, ConstantSql.hrm_hr_sp_get_ProfileQuit, ref status);
                var lstProfileEntity = new List<Hre_ProfileEntity>();
                var lstProfileModel = new List<Hre_ProfileModel>();

                if (lstEntity != null)
                {
                    request.Page = 1;
                    foreach (var item in lstEntity)
                    {
                        var profileEntity = new Hre_ProfileEntity();
                        var orgName = new List<string>();
                        if (item.OrgStructureID != null)
                        {
                            orgName = rptServices.GetParentOrgName(lstOrg, lstOrgType, item.OrgStructureID);
                        }
                        // orgName = rptServices.GetParentOrgName(lstOrg, lstOrgType, item.OrgStructureID);
                        if (orgName.Count == 0)
                            continue;
                        if (orgName.Count < 3)
                        {
                            orgName.Insert(0, string.Empty);
                            if (orgName.Count < 3)
                            {
                                orgName.Insert(0, string.Empty);
                            }
                        }
                        profileEntity = item.CopyData<Hre_ProfileEntity>();
                        profileEntity.Channel = orgName[2];
                        profileEntity.Region = orgName[1];
                        profileEntity.Area = orgName[0];
                        lstProfileEntity.Add(profileEntity);
                    }
                    lstProfileModel = lstProfileEntity.Translate<Hre_ProfileModel>();
                    var dataSourceResult = lstProfileModel.ToDataSourceResult(request);
                    if (lstProfileModel.FirstOrDefault().GetPropertyValue("TotalRow") != null)
                    {
                        dataSourceResult.Total = lstProfileModel.Count() <= 0 ? 0 : (int)lstProfileModel.FirstOrDefault().GetPropertyValue("TotalRow");
                    }

                    return Json(dataSourceResult, JsonRequestBehavior.AllowGet);
                }
                #endregion
            }
            return GetListDataAndReturn<Hre_ProfileModel, Hre_ProfileEntity, Hre_ProfileQuitSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_ProfileQuit);

        }
Exemplo n.º 8
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));
        }
Exemplo n.º 9
0
        public ActionResult ExportWorkHistoryByListByTemplate([DataSourceRequest] DataSourceRequest request, Hre_WorkHistorySearchModel model)
        {
            string status = string.Empty;
            var actionService = new ActionService(UserLogin);
            var isDataTable = false;
            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 = actionService.GetData<Hre_WorkHistoryModel>(lstModel, ConstantSql.hrm_hr_sp_get_WorkHistory, ref status);
            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_WorkHistoryModel(),
                    FileName = "Hre_WorkHistory",
                    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));
        }
Exemplo n.º 10
0
        public ActionResult GetReportSummaryDependantList([DataSourceRequest] DataSourceRequest request, Hre_ReportSummaryDependantModel model)
        {
            string status = string.Empty;
            var service = new BaseService();
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "MonthOfExpiry", Value = model.MonthOfExpiry };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1 };
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };

            var ReportServices = new Hre_ReportServices();
            var actionService = new ActionService(UserLogin);
            List<object> paraDependant = new List<object>();
            paraDependant.AddRange(new object[11]);
            paraDependant[0] = model.ProfileName;
            paraDependant[1] = model.CodeEmp;
            paraDependant[2] = model.OrgStructureID;
            paraDependant[3] = model.JobTitleID;
            paraDependant[4] = model.PositionID;
            paraDependant[5] = model.DependantName;
            paraDependant[6] = model.RelationID;
            paraDependant[7] = null;
            paraDependant[8] = null;
            paraDependant[9] = 1;
            paraDependant[10] = int.MaxValue - 1;
            var lstDependant = actionService.GetData<Hre_DependantEntity>(paraDependant, ConstantSql.hrm_hr_sp_get_Dependant, ref status);

            if (model.MonthOfExpiry != null && lstDependant != null)
            {
                lstDependant = lstDependant.Where(s => (s.MonthOfEffect <= model.MonthOfExpiry && model.MonthOfExpiry <= s.MonthOfExpiry)
                    || (s.MonthOfEffect <= model.MonthOfExpiry && s.MonthOfExpiry == null)).ToList();
            }

            var result = ReportServices.GetReportSummaryDependant(lstDependant, model.IsCreateTemplate);

            var isDataTable = false;
            object obj = new DataTable();
            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_ReportSummaryDependantEntity",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable

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

            #region Validate
            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportSummaryDependantModel>(model, "Hre_ReportSummaryDependant", ref message);
            if (!checkValidate)
            {
                return Json(message, JsonRequestBehavior.AllowGet);
            }
            #endregion

            if (model.ExportId != Guid.Empty)
            {
                string fullPath = "";
                if (model.MonthOfExpiry != null)
                {
                    fullPath = ExportService.Export(model.ExportId, result, listHeaderInfo, model.ExportType);
                }
                else
                {
                    fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);
                }

                return Json(fullPath);
            }
            #region mapping dataTable to dataList
            List<Hre_ReportSummaryDependantModel> dataList = new List<Hre_ReportSummaryDependantModel>();
            Hre_ReportSummaryDependantModel aTSource = null;

            if (result.Rows.Count > 0)
            {
                const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic;
                var objFieldNames = (from PropertyInfo aProp in typeof(Hre_ReportSummaryDependantModel).GetProperties(flags)
                                     select new
                                     {
                                         Name = aProp.Name,
                                         Type = Nullable.GetUnderlyingType(aProp.PropertyType) ?? aProp.PropertyType
                                     }).ToList();
                var dataTblFieldNames = (from DataColumn aHeader in result.Columns
                                         select new { Name = aHeader.ColumnName, Type = aHeader.DataType }).ToList();
                var commonFields = objFieldNames.Intersect(dataTblFieldNames).ToList();
                foreach (DataRow dataRow in result.AsEnumerable().ToList())
                {
                    aTSource = new Hre_ReportSummaryDependantModel();
                    foreach (var aField in commonFields)
                    {
                        PropertyInfo propertyInfos = aTSource.GetType().GetProperty(aField.Name);
                        if (dataRow[aField.Name] == DBNull.Value)
                            continue;
                        propertyInfos.SetValue(aTSource, dataRow[aField.Name], null);
                    }
                    dataList.Add(aTSource);
                }
            }
            #endregion
            return Json(dataList.ToDataSourceResult(request));
        }
Exemplo n.º 11
0
        public ActionResult GetCandidateList([DataSourceRequest] DataSourceRequest request, Rec_CandidateSearchModel model)
        {
            if (model.Evaluated == HRM.Infrastructure.Utilities.EnumDropDown.StatusHealth.E_ACCEPT.ToString())
            {
                model.IsEvaluated = true;
            }
            else if (model.Evaluated == HRM.Infrastructure.Utilities.EnumDropDown.StatusHealth.E_NOTACCEPT.ToString())
            {
                model.IsEvaluated = false;
            }

            string status = string.Empty;
            var service = new BaseService();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var listEntity = service.GetData<Rec_CandidateEntity>(lstModel, ConstantSql.hrm_rec_sp_get_Candidate, UserLogin, ref status);

            var listModel = new List<Rec_CandidateModel>();
            if (listEntity != null)
            {
                request.Page = 1;
                foreach (var item in listEntity)
                {
                    if (item.ReasonFailFilter != null)
                    {
                        List<string> lsititem = item.ReasonFailFilter.Split(',').ToList();
                        string Stringresult = string.Empty;
                        foreach (var itemstring in lsititem)
                        {
                            Stringresult += itemstring.TranslateString() + ',';
                        }
                        Stringresult = Stringresult.Substring(0, Stringresult.Length - 1);
                        item.ReasonFailFilter = Stringresult;
                    }
                    var newModle = (Rec_CandidateModel)typeof(Rec_CandidateModel).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);
            }
            var listModelNull = new List<Rec_CandidateModel>();
            ModelState.AddModelError("Id", status);
            return Json(listModelNull.ToDataSourceResult(request, ModelState));
        }
Exemplo n.º 12
0
        public ActionResult ExportAllInterviewDetailListNew([DataSourceRequest] DataSourceRequest request, Rec_InterviewCampaignDetailSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<object> objshis = new List<object>();
            List<Rec_InterviewCampaignDetailModel> resultInterviewCampaignDetail = new List<Rec_InterviewCampaignDetailModel>();
            var InterviewServices = new Rec_InterviewCampaignDetailServices();

            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var result = baseService.GetData<Rec_InterviewCampaignDetailModel>(lstModel, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail, UserLogin, ref status);
            if (result != null)
            {
                var InTerCamDetaiServices = new Rec_InterviewCampaignDetailServices();
                var HistoryServices = new Rec_RecruitmentHistoryServices();
                var lstCandidateIDS = result.Select(s => s.CandidateID).Distinct().ToList();
                //string temp = string.Empty;
                //foreach (Guid item in lstCandidateIDS)
                //{
                //    temp += item;
                //    temp += ",";
                //}
                //if (temp.Length > 0)
                //{
                //    temp = temp.Substring(0, temp.Length - 1);
                //}

               // var lstCandidateHistory = HistoryServices.GetData<Rec_RecruitmentHistoryEntity>(Common.DotNetToOracle(temp), ConstantSql.hrm_rec_sp_get_RecHisByListCandidateID, UserLogin, ref status).ToList();
                var lstCandidateHistory = new List<Rec_RecruitmentHistoryEntity>();
                int _total = lstCandidateIDS.Count;
                int _totalPage = _total / 100 + 1;
                int _pageSize = 100;
                for (int _page = 1; _page <= _totalPage; _page++)
                {
                    int _skip = _pageSize * (_page - 1);
                    var _listCurrenPage = lstCandidateIDS.Skip(_skip).Take(_pageSize).ToList();
                    string _strselectedIDs = Common.DotNetToOracle(string.Join(",", _listCurrenPage));

                    var lstRecruitmentHistory = baseService.GetData<Rec_RecruitmentHistoryEntity>(_strselectedIDs, ConstantSql.hrm_rec_sp_get_RecHisByListCandidateID, UserLogin, ref status).ToList();
                    if (lstRecruitmentHistory != null && lstRecruitmentHistory.Count > 0)
                    {
                        lstCandidateHistory.AddRange(lstRecruitmentHistory);
                    }
                }
                foreach (var item in result)
                {
                    //var IlInterviewcampaugnDetail = result.Where(s => s.CandidateID == item.CandidateID).ToList();
                    var ObjHisCandidate = lstCandidateHistory.Where(s => s.ID == item.RecruitmentHistoryID).FirstOrDefault();
                    if (ObjHisCandidate == null)
                    {
                        continue;
                    }
                    Rec_JobVacancyEntity entityJobVacancy = null;
                    if (ObjHisCandidate != null && ObjHisCandidate.JobVacancyID != Guid.Empty && ObjHisCandidate.JobVacancyID != null)
                    {
                        entityJobVacancy = service.GetByIdUseStore<Rec_JobVacancyEntity>(ObjHisCandidate.JobVacancyID.Value, ConstantSql.hrm_rec_sp_get_JobVacancyId, ref status);
                    }
                    if (entityJobVacancy != null)
                    {
                        if (item.LevelInterview != null && item.LevelInterview == entityJobVacancy.NoLevelInterview)
                        {
                            continue;
                        }
                    }
                    if (item.LevelInterview == null && (ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_PASS.ToString()
                     && ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_FAIL.ToString()
                        ))
                    {
                        if (ObjHisCandidate != null)
                        {
                            if (ObjHisCandidate.LevelInterview == null)
                            {
                                item.LevelInterview = 1;
                                resultInterviewCampaignDetail.Add(item);
                            }
                            else
                            {
                                item.LevelInterview = ObjHisCandidate.LevelInterview + 1;
                                resultInterviewCampaignDetail.Add(item);
                            }
                        }
                    }
                }
            }
            resultInterviewCampaignDetail = resultInterviewCampaignDetail.Distinct().ToList();
            if (status == NotificationType.Success.ToString())
            {
                status = ExportService.Export(resultInterviewCampaignDetail, model.GetPropertyValue("ValueFields").TryGetValue<string>().Split(','));
            }
            return Json(status);

        }
Exemplo n.º 13
0
        public ActionResult GetIntervieCampaignDetailList([DataSourceRequest] DataSourceRequest request, Rec_InterviewCampaignDetailSearchModel model)
        {
            List<Rec_InterviewCampaignDetailModel> resultInterviewCampaignDetail = new List<Rec_InterviewCampaignDetailModel>();

            string status = string.Empty;
            var baseService = new BaseService();
            var actionService = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<object> objshis = new List<object>();

            var InterviewServices = new Rec_InterviewCampaignDetailServices();

            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            int? level = (model != null && model.LevelInterview != 0) ? model.LevelInterview : null;
            List<object> lstModels = new List<object>();
            lstModels.AddRange(new object[16]);
            lstModels[0] = model.CandidateName;
            lstModels[1] = model.DateFrom;
            lstModels[2] = model.DateTo;
            lstModels[3] = model.CodeCandidate;
            lstModels[4] = model.RankID;
            lstModels[5] = model.OrgStructureID;
            lstModels[6] = model.JobVacancyID;
            lstModels[7] = model.PositionID;
            lstModels[8] = level;
            lstModels[13] = model.WorkPlaceID;
            lstModels[14] = 1;
            lstModels[15] = Int32.MaxValue - 1;

            var result = actionService.GetData<Rec_InterviewCampaignDetailModel>(lstModels, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail, ref status);
            #region Load Chi tiet ke hoach chua phong van
            if (result != null)
            {
                var InTerCamDetaiServices = new Rec_InterviewCampaignDetailServices();
                var HistoryServices = new Rec_RecruitmentHistoryServices();
                var lstCandidateIDS = result.Select(s => s.CandidateID).Distinct().ToList();

                var lstCandidateHistory = new List<Rec_RecruitmentHistoryEntity>();
                int _total = lstCandidateIDS.Count;
                int _totalPage = _total / 100 + 1;
                int _pageSize = 100;
                for (int _page = 1; _page <= _totalPage; _page++)
                {
                    int _skip = _pageSize * (_page - 1);
                    var _listCurrenPage = lstCandidateIDS.Skip(_skip).Take(_pageSize).ToList();
                    string _strselectedIDs = Common.DotNetToOracle(string.Join(",", _listCurrenPage));

                    var lstRecruitmentHistory = baseService.GetData<Rec_RecruitmentHistoryEntity>(_strselectedIDs, ConstantSql.hrm_rec_sp_get_RecHisByListCandidateID, UserLogin, ref status).ToList();
                    if (lstRecruitmentHistory != null && lstRecruitmentHistory.Count > 0)
                    {
                        lstCandidateHistory.AddRange(lstRecruitmentHistory);
                    }
                }

                foreach (var item in result)
                {
                    bool IsAdd = false;
                    //var IlInterviewcampaugnDetail = result.Where(s => s.CandidateID == item.CandidateID).ToList();
                    var ObjHisCandidate = lstCandidateHistory.Where(s => s.ID == item.RecruitmentHistoryID).FirstOrDefault();
                    if (ObjHisCandidate == null)
                    {
                        continue;
                    }
                    if (item.LevelInterview == null)
                    {
                        IsAdd = true;
                    }

                    Rec_JobVacancyEntity entityJobVacancy = null;
                    if (ObjHisCandidate != null && ObjHisCandidate.JobVacancyID != Guid.Empty && ObjHisCandidate.JobVacancyID != null)
                    {
                        entityJobVacancy = actionService.GetByIdUseStore<Rec_JobVacancyEntity>(ObjHisCandidate.JobVacancyID.Value, ConstantSql.hrm_rec_sp_get_JobVacancyId, ref status);
                    }
                    if (entityJobVacancy != null)
                    {
                        if (item.LevelInterview != null && item.LevelInterview == entityJobVacancy.NoLevelInterview)
                        {
                            continue;
                        }
                    }
                    if (item.LevelInterview == null && (ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_PASS.ToString()
                     && ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_FAIL.ToString()
                        ))
                    {
                        if (ObjHisCandidate != null)
                        {
                            if (ObjHisCandidate.LevelInterview == null)
                            {
                                item.LevelInterview = 1;
                            }
                            else
                            {
                                item.LevelInterview = ObjHisCandidate.LevelInterview + 1;
                            }

                            if (IsAdd == true)
                            {
                                resultInterviewCampaignDetail.Add(item);
                            }
                        }
                    }
                }
            }
            resultInterviewCampaignDetail = resultInterviewCampaignDetail.Distinct().ToList();
            #endregion

            var isDataTable = false;
            object obj = new Rec_InterviewCampaignDetailModel();
            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 };
            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = resultInterviewCampaignDetail;
                isDataTable = false;
            }
            if (model != null && model.IsCreateTemplate)
            {

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

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

            var objInterview = new List<object>();
            objInterview.AddRange(new object[2]);
            objInterview[0] = 1;
            objInterview[1] = int.MaxValue - 1;
            var lstInterView = baseService.GetData<Rec_InterviewModel>(objInterview, ConstantSql.hrm_rec_sp_get_InterviewDataReport, UserLogin, ref status).ToList();


            if (model.ExportId != Guid.Empty)
            {
                foreach (var item in resultInterviewCampaignDetail)
                {
                    var dataLevel1 = lstInterView.Where(s => s.CandidateID == item.ID && s.LevelInterview == 1).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel2 = lstInterView.Where(s => s.CandidateID == item.ID && s.LevelInterview == 2).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel3 = lstInterView.Where(s => s.CandidateID == item.ID && s.LevelInterview == 3).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel4 = lstInterView.Where(s => s.CandidateID == item.ID && s.LevelInterview == 4).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel5 = lstInterView.Where(s => s.CandidateID == item.ID && s.LevelInterview == 5).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    if (dataLevel1 != null)
                    {
                        item.Score1_1 = dataLevel1.Score1;
                        item.Score1_2 = dataLevel1.Score2;
                        item.Score1_3 = dataLevel1.Score3;
                        item.KQ1 = dataLevel1.ResultInterviewView;
                        item.LanguageCode1 = dataLevel1.LanguageCode;
                        item.DateInterview1 = dataLevel1.DateInterview;
                    }
                    if (dataLevel2 != null)
                    {
                        item.Score2_1 = dataLevel2.Score1;
                        item.Score2_2 = dataLevel2.Score2;
                        item.Score2_3 = dataLevel2.Score3;
                        item.KQ2 = dataLevel2.ResultInterviewView;
                        item.LanguageCode2 = dataLevel2.LanguageCode;
                        item.DateInterview2 = dataLevel2.DateInterview;
                    }
                    if (dataLevel3 != null)
                    {
                        item.Score3_1 = dataLevel3.Score1;
                        item.Score3_2 = dataLevel3.Score2;
                        item.Score3_3 = dataLevel3.Score3;
                        item.KQ3 = dataLevel3.ResultInterviewView;
                        item.LanguageCode3 = dataLevel3.LanguageCode;
                        item.DateInterview3 = dataLevel3.DateInterview;
                    }
                    if (dataLevel4 != null)
                    {
                        item.Score4_1 = dataLevel4.Score1;
                        item.Score4_2 = dataLevel4.Score2;
                        item.Score4_3 = dataLevel4.Score3;
                        item.KQ4 = dataLevel4.ResultInterviewView;
                        item.LanguageCode4 = dataLevel4.LanguageCode;
                        item.DateInterview4 = dataLevel4.DateInterview;
                    }
                    if (dataLevel5 != null)
                    {
                        item.Score5_1 = dataLevel5.Score1;
                        item.Score5_2 = dataLevel5.Score2;
                        item.Score5_3 = dataLevel5.Score3;
                        item.KQ5 = dataLevel5.ResultInterviewView;
                        item.LanguageCode5 = dataLevel5.LanguageCode;
                        item.DateInterview5 = dataLevel5.DateInterview;
                    }
                }
                var fullPath = ExportService.Export(model.ExportId, resultInterviewCampaignDetail, listHeaderInfo, model.ExportType);
                return Json(fullPath);
            }

            // return Json(resultInterviewCampaignDetail.ToDataSourceResult(request));
            return Json(resultInterviewCampaignDetail.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
            //var result = GetListDataAndReturn<Rec_InterviewCampaignDetailModel, Rec_InterviewCampaignDetailEntity, Rec_InterviewCampaignDetailSearchModel>(request, model, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail);
            //return result;
        }
Exemplo n.º 14
0
        public ActionResult GetEnrolledCandidates([DataSourceRequest] DataSourceRequest request, Rec_EnrolledCandidateSearchModel model)
        {
            // return GetListDataAndReturn<Rec_CandidateModel, Rec_CandidateEntity, Rec_EnrolledCandidateSearchModel>(request, model, ConstantSql.hrm_rec_sp_get_EnrolledCandidates);

            string status = string.Empty;
            var service = new BaseService();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var listEntity = service.GetData<Rec_CandidateEntity>(lstModel, ConstantSql.hrm_rec_sp_get_EnrolledCandidates, UserLogin, ref status);
            var listModel = new List<Rec_CandidateModel>();
            if (listEntity != null)
            {
                var ObjResultInterview = new List<object>();
                ObjResultInterview.AddRange(new object[24]);
                ObjResultInterview[22] = 1;
                ObjResultInterview[23] = int.MaxValue - 1;
                var lstResultInterview = service.GetData<Rec_InterviewEntity>(ObjResultInterview, ConstantSql.hrm_rec_sp_get_Interview, UserLogin, ref status).ToList();
                request.Page = 1;
                foreach (var item in listEntity)
                {
                    var resultInterviewByCandidate = lstResultInterview.Where(s => s.CandidateID == item.ID).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    if (resultInterviewByCandidate != null)
                    {
                        item.Score1 = resultInterviewByCandidate.Score1;
                        item.Score2 = resultInterviewByCandidate.Score2;
                        item.Score3 = resultInterviewByCandidate.Score3;
                        item.ResultInterview = resultInterviewByCandidate.ResultInterviewView;
                    }

                    var newModle = (Rec_CandidateModel)typeof(Rec_CandidateModel).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);
            }
            var listModelNull = new List<Rec_CandidateModel>();
            ModelState.AddModelError("Id", status);
            return Json(listModelNull.ToDataSourceResult(request, ModelState));

        }
Exemplo n.º 15
0
        public ActionResult ExportAllWaitingInterviewList([DataSourceRequest] DataSourceRequest request, Rec_WaitingInterviewSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<Rec_RecruitmentHistoryModel> resultRecruitmentHistory = new List<Rec_RecruitmentHistoryModel>();
            Rec_RecruitmentHistoryModel ObjRecruitmentHistory = null;
            var InterviewServices = new Rec_InterviewServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var lstWaitingInterview = baseService.GetData<Rec_RecruitmentHistoryModel>(lstModel, ConstantSql.hrm_rec_sp_get_WaitingInterList, UserLogin, ref status);

            if (lstWaitingInterview == null || lstWaitingInterview.Count == 0)
            {
                return null;
            }
            lstWaitingInterview = lstWaitingInterview.Where(s => s.JobVacancyID != null).ToList();
            var lstrechisids = lstWaitingInterview.Select(s => s.ID).ToList();
            var resultCampaignDetail = new List<Rec_InterviewCampaignDetailModel>();
            int _total = lstrechisids.Count;
            int _totalPage = _total / 100 + 1;
            int _pageSize = 100;
            for (int _page = 1; _page <= _totalPage; _page++)
            {
                int _skip = _pageSize * (_page - 1);
                var _listCurrenPage = lstrechisids.Skip(_skip).Take(_pageSize).ToList();
                string _strselectedIDs = Common.DotNetToOracle(string.Join(",", _listCurrenPage));

                var lstCampaignDetail = baseService.GetData<Rec_InterviewCampaignDetailModel>(_strselectedIDs, ConstantSql.hrm_rec_sp_get_InCamDetailByLstRechisIDs, UserLogin, ref status).ToList();
                if (lstCampaignDetail != null && lstCampaignDetail.Count > 0)
                {
                    resultCampaignDetail.AddRange(lstCampaignDetail);
                }
            }

            var lstjobvacancyids = lstWaitingInterview.Where(s => s.JobVacancyID != null).Select(s => s.JobVacancyID).Distinct().ToList();
            string strJobVacancyIds = string.Empty;
            foreach (Guid item in lstjobvacancyids)
            {
                strJobVacancyIds += item;
                strJobVacancyIds += ",";
            }
            if (strJobVacancyIds.Length > 0)
            {
                strJobVacancyIds = strJobVacancyIds.Substring(0, strJobVacancyIds.Length - 1);
            }
            var lstJobVacancy = baseService.GetData<Rec_JobVacancyEntity>(Common.DotNetToOracle(strJobVacancyIds), ConstantSql.hrm_rec_sp_get_JobVacancyByIds, UserLogin, ref status);
            foreach (var his in lstWaitingInterview)
            {
                ObjRecruitmentHistory = new Rec_RecruitmentHistoryModel();
                var lstresultCampaignDetail = resultCampaignDetail.Where(s => s.RecruitmentHistoryID == his.ID && s.LevelInterview == null).ToList();
                if (his.JobVacancyID.HasValue)
                {
                    var entityJobVacancy = lstJobVacancy.Where(s => s.ID == his.JobVacancyID).FirstOrDefault();
                    if (his.LevelInterview == null)
                        his.LevelInterview = 0;
                    if (entityJobVacancy != null && his.LevelInterview != entityJobVacancy.NoLevelInterview && lstresultCampaignDetail.Count == 0 && his.Status != HRM.Infrastructure.Utilities.Interview.E_PASS.ToString())
                    {
                        ObjRecruitmentHistory = his;
                        resultRecruitmentHistory.Add(ObjRecruitmentHistory);
                    }
                }
            }

            status = ExportService.Export(resultRecruitmentHistory, model.GetPropertyValue("ValueFields").TryGetValue<string>().Split(','));

            return Json(status);
        }
Exemplo n.º 16
0
        public ActionResult ExportIntervieCampaignDetaiByTemplate([DataSourceRequest] DataSourceRequest request, Rec_InterviewCampaignDetailSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<object> objshis = new List<object>();
            List<Rec_InterviewCampaignDetailModel> resultInterviewCampaignDetail = new List<Rec_InterviewCampaignDetailModel>();
            var InterviewServices = new Rec_InterviewCampaignDetailServices();

            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var result = baseService.GetData<Rec_InterviewCampaignDetailModel>(lstModel, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail, UserLogin, ref status);
            #region Load Chi tiet ke hoach chua phong van
            if (result != null)
            {
                var InTerCamDetaiServices = new Rec_InterviewCampaignDetailServices();
                var HistoryServices = new Rec_RecruitmentHistoryServices();
                var lstCandidateIDS = result.Select(s => s.CandidateID).Distinct().ToList();
                string temp = string.Empty;
                foreach (Guid item in lstCandidateIDS)
                {
                    temp += item;
                    temp += ",";
                }
                if (temp.Length > 0)
                {
                    temp = temp.Substring(0, temp.Length - 1);
                }
                var lstCandidateHistory = HistoryServices.GetData<Rec_RecruitmentHistoryEntity>(Common.DotNetToOracle(temp), ConstantSql.hrm_rec_sp_get_RecHisByListCandidateID, UserLogin, ref status).ToList();
                foreach (var item in result)
                {
                    //var IlInterviewcampaugnDetail = result.Where(s => s.CandidateID == item.CandidateID).ToList();
                    var ObjHisCandidate = lstCandidateHistory.Where(s => s.ID == item.RecruitmentHistoryID).FirstOrDefault();
                    if (ObjHisCandidate == null)
                    {
                        continue;
                    }
                    Rec_JobVacancyEntity entityJobVacancy = null;
                    if (ObjHisCandidate != null && ObjHisCandidate.JobVacancyID != Guid.Empty && ObjHisCandidate.JobVacancyID != null)
                    {
                        entityJobVacancy = service.GetByIdUseStore<Rec_JobVacancyEntity>(ObjHisCandidate.JobVacancyID.Value, ConstantSql.hrm_rec_sp_get_JobVacancyId, ref status);
                    }
                    if (entityJobVacancy != null)
                    {
                        if (item.LevelInterview != null && item.LevelInterview == entityJobVacancy.NoLevelInterview)
                        {
                            continue;
                        }
                    }
                    if (item.LevelInterview == null && (ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_PASS.ToString()
                     && ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_FAIL.ToString()
                        ))
                    {
                        if (ObjHisCandidate != null)
                        {
                            if (ObjHisCandidate.LevelInterview == null)
                            {
                                item.LevelInterview = 1;
                                resultInterviewCampaignDetail.Add(item);
                            }
                            else
                            {
                                item.LevelInterview = ObjHisCandidate.LevelInterview + 1;
                                resultInterviewCampaignDetail.Add(item);
                            }
                        }
                    }
                }
            }
            resultInterviewCampaignDetail = resultInterviewCampaignDetail.Distinct().ToList();
            #endregion

            var isDataTable = false;
            object obj = new Rec_InterviewCampaignDetailModel();
            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 };
            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = resultInterviewCampaignDetail;
                isDataTable = false;
            }
            if (model != null && model.IsCreateTemplate)
            {

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

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Rec_InterviewCampaignDetailModel",
                    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, resultInterviewCampaignDetail, listHeaderInfo, model.ExportType);
                return Json(fullPath);
            }

            return Json(resultInterviewCampaignDetail.ToDataSourceResult(request));
        }
Exemplo n.º 17
0
        public ActionResult GetReportProfileIsWaitingStopWorkingList([DataSourceRequest] DataSourceRequest request, Hre_ReportProfileWaitingStopWorkingSearchModel model)
        {
            string status = string.Empty;
            //var isDataTable = false;
            var actionService = new ActionService(UserLogin);
            //object obj = new Hre_ProfileModel();

            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 };
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            if ((model.IsCreateTemplate == true && model.IsCreateTemplateForDynamicGrid == true) || model.ExportId != Guid.Empty)
            {
                lstModel = new ListQueryModel
                {
                    PageSize = int.MaxValue - 1,
                    PageIndex = 1,
                    Filters = ExtractFilterAttributes(request),
                    Sorts = ExtractSortAttributes(request),
                    AdvanceFilters = ExtractAdvanceFilterAttributes(model)
                };
            }

            var listProfile = actionService.GetData<Hre_ProfileEntity>(lstModel, ConstantSql.hrm_hr_sp_get_ProfileWaitingStopWoking, ref status);
            var ReportServices = new Hre_ReportServices();
            var result = ReportServices.GetReportProfileWaitingStopWorking(listProfile);
            var isDataTable = false;
            object obj = new DataTable();
            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_ReportProfileWaitingStopWorkingEntity",
                    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 = string.Empty;
                if (headerInfo1.Value == null || headerInfo2.Value == null)
                {
                    fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);
                }
                else
                {
                    fullPath = ExportService.Export(model.ExportId, result, listHeaderInfo, model.ExportType);
                }
                return Json(fullPath);
            }
            //return new JsonResult() { Data = result.ToDataSourceResult(request), MaxJsonLength = int.MaxValue };
            #region mapping dataTable to dataList
            List<Hre_ReportProfileWaitingStopWorkingModel> dataList = new List<Hre_ReportProfileWaitingStopWorkingModel>();
            Hre_ReportProfileWaitingStopWorkingModel aTSource = null;

            if (result.Rows.Count > 0)
            {
                const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic;
                var objFieldNames = (from PropertyInfo aProp in typeof(Hre_ReportProfileWaitingStopWorkingModel).GetProperties(flags)
                                     select new
                                     {
                                         Name = aProp.Name,
                                         Type = Nullable.GetUnderlyingType(aProp.PropertyType) ?? aProp.PropertyType
                                     }).ToList();
                var dataTblFieldNames = (from DataColumn aHeader in result.Columns
                                         select new { Name = aHeader.ColumnName, Type = aHeader.DataType }).ToList();
                var commonFields = objFieldNames.Intersect(dataTblFieldNames).ToList();
                foreach (DataRow dataRow in result.AsEnumerable().ToList())
                {
                    aTSource = new Hre_ReportProfileWaitingStopWorkingModel();
                    foreach (var aField in commonFields)
                    {
                        PropertyInfo propertyInfos = aTSource.GetType().GetProperty(aField.Name);
                        if (dataRow[aField.Name] == DBNull.Value)
                            continue;
                        propertyInfos.SetValue(aTSource, dataRow[aField.Name], null);
                    }
                    dataList.Add(aTSource);
                }
            }
            #endregion
            return Json(dataList.ToDataSourceResult(request));
        }
Exemplo n.º 18
0
        public ActionResult ExportAllCandidateList([DataSourceRequest] DataSourceRequest request, Rec_CandidateSearchModel model)
        {
            string status = string.Empty;
            var service = new BaseService();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = int.MaxValue - 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var listEntity = service.GetData<Rec_CandidateEntity>(lstModel, ConstantSql.hrm_rec_sp_get_Candidate, UserLogin, ref status);
            if (model.Evaluated == HRM.Infrastructure.Utilities.EnumDropDown.StatusHealth.E_ACCEPT.ToString())
            {
                listEntity = listEntity.Where(s => s.PassFilterResume == true).ToList();
            }
            if (model.Evaluated == HRM.Infrastructure.Utilities.EnumDropDown.StatusHealth.E_NOTACCEPT.ToString())
            {
                listEntity = listEntity.Where(s => s.PassFilterResume == false).ToList();
            }
            var listModel = new List<Rec_CandidateModel>();
            if (listEntity != null)
            {
                foreach (var item in listEntity)
                {
                    if (item.ReasonFailFilter != null)
                    {
                        List<string> lsititem = item.ReasonFailFilter.Split(',').ToList();
                        string Stringresult = string.Empty;
                        foreach (var itemstring in lsititem)
                        {
                            Stringresult += itemstring.TranslateString() + ',';
                        }
                        Stringresult = Stringresult.Substring(0, Stringresult.Length - 1);
                        item.ReasonFailFilter = Stringresult;
                    }
                }
            }
            status = ExportService.Export(listEntity, model.GetPropertyValue("ValueFields").TryGetValue<string>().Split(','));

            return Json(status);
        }
Exemplo n.º 19
0
        public ActionResult GetApproverList([DataSourceRequest] DataSourceRequest request, FIN_ApproverECLAIMSearchModel model)
        {
            if (model != null)
            {
                model.ProfileID = Common.DotNetToOracle(model.ProfileID);
            }

            //#region lay ds approver hiển thị trên 1 dòng ứng với profile

            var actionService = new ActionService(UserLogin);
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = 1,
                PageSize = int.MaxValue - 1,//request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var status = string.Empty;
            var listEntity = actionService.GetData<FIN_ApproverECLAIMEntity>(lstModel, ConstantSql.hrm_fin_sp_get_ApproverECLAIM, ref status).ToList();
            if (model.OrderNo.HasValue)
            {
                listEntity = listEntity.Where(s => s.OrderNo != null && s.OrderNo.Value == model.OrderNo.Value).ToList();
            }
            if (listEntity != null)
            {
                // request.Page = 1;
                //var listModel = listEntity.Translate<FIN_ApproverECLAIMModel>();
                var listModel = listEntity;
                var profileIds = listModel.GroupBy(p => new { p.ProfileID, p.ApprovedType }).ToList();
                var approverReturn = new List<FIN_ApproverECLAIMModel>();
                var approverNames = string.Empty;
                foreach (var profileId in profileIds)
                {
                    var approvers = listModel.Where(p => p.ProfileID == profileId.Key.ProfileID && p.ApprovedType == profileId.Key.ApprovedType).OrderBy(p => p.OrderNo).ToList();
                    var approver = approvers.FirstOrDefault();
                    approverNames = string.Empty;
                    foreach (var finApproverModel in approvers)
                    {
                        approverNames += finApproverModel.OrderNo + " - " + finApproverModel.ApprovedName + " , ";
                    }
                    var fin = new FIN_ApproverECLAIMModel();
                    if (approver != null)
                    {
                        fin.ID = approver.ID;
                        fin.ProfileName = approver.ProfileName;
                        fin.ApprovedType = approver.ApprovedType;
                        fin.ApprovedTypeView = approver.ApprovedTypeView;
                        fin.ProfileID = profileId.Key.ProfileID;
                    }
                    fin.ApprovedName = approverNames.Substring(0, approverNames.Length - 2);
                    approverReturn.Add(fin);
                }


                var dataSourceResult = approverReturn.ToDataSourceResult(request);
                dataSourceResult.Total = approverReturn.Count();
                return Json(dataSourceResult, JsonRequestBehavior.AllowGet);
            }
            var listModelNull = new List<FIN_ApproverECLAIMModel>();
            ModelState.AddModelError("Id", status);
            return Json(listModelNull.ToDataSourceResult(request, ModelState));
        }
Exemplo n.º 20
0
        //[Tho.Bui] - Load theo lich su ung vien
        public ActionResult GetWaitingInterList([DataSourceRequest] DataSourceRequest request, Rec_WaitingInterviewSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<Rec_RecruitmentHistoryModel> resultRecruitmentHistory = new List<Rec_RecruitmentHistoryModel>();
            Rec_RecruitmentHistoryModel ObjRecruitmentHistory = null;
            var InterviewServices = new Rec_InterviewServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var lstWaitingInterview = baseService.GetData<Rec_RecruitmentHistoryModel>(lstModel, ConstantSql.hrm_rec_sp_get_WaitingInterList, UserLogin, ref status);

            if (lstWaitingInterview == null || lstWaitingInterview.Count == 0)
            {
                return null;
            }

          

            lstWaitingInterview = lstWaitingInterview.Where(s => s.JobVacancyID != null).ToList();

            var lstrechisids = lstWaitingInterview.Select(s => s.ID).Distinct().ToList();

            var objCampaignDetail = new List<object>();
            objCampaignDetail.AddRange(new object[16]);
            objCampaignDetail[14] = 1;
            objCampaignDetail[15] = int.MaxValue - 1;
            var resultCampaignDetail = baseService.GetData<Rec_InterviewCampaignDetailModel>(objCampaignDetail, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail, UserLogin, ref status);

            resultCampaignDetail = resultCampaignDetail.Where(s => s.RecruitmentHistoryID != null && lstrechisids.Contains(s.RecruitmentHistoryID.Value)).ToList();

            var lstjobvacancyids = lstWaitingInterview.Where(s => s.JobVacancyID != null).Select(s => s.JobVacancyID).Distinct().ToList();
            string strJobVacancyIds = string.Empty;
            foreach (Guid item in lstjobvacancyids)
            {
                strJobVacancyIds += item;
                strJobVacancyIds += ",";
            }
            if (strJobVacancyIds.Length > 0)
            {
                strJobVacancyIds = strJobVacancyIds.Substring(0, strJobVacancyIds.Length - 1);
            }
            var lstJobVacancy = baseService.GetData<Rec_JobVacancyEntity>(Common.DotNetToOracle(strJobVacancyIds), ConstantSql.hrm_rec_sp_get_JobVacancyByIds, UserLogin, ref status);
            #region Kết quả là rớt hoặc vỏng phỏng vấn = cuối thì KHÔNG load vào danh sách chờ phỏng vấn
            foreach (var his in lstWaitingInterview)
            {
                ObjRecruitmentHistory = new Rec_RecruitmentHistoryModel();
                var lstresultCampaignDetail = resultCampaignDetail.Where(s => s.RecruitmentHistoryID == his.ID && s.LevelInterview == null).ToList();
                if (his.JobVacancyID.HasValue)
                {
                    var entityJobVacancy = lstJobVacancy.Where(s => s.ID == his.JobVacancyID).FirstOrDefault();
                    if (entityJobVacancy != null && his.LevelInterview != entityJobVacancy.NoLevelInterview && lstresultCampaignDetail.Count == 0 && his.Status != HRM.Infrastructure.Utilities.Interview.E_PASS.ToString())
                    {
                        ObjRecruitmentHistory = his;
                        resultRecruitmentHistory.Add(ObjRecruitmentHistory);
                    }
                }
            }
            #endregion
            return Json(resultRecruitmentHistory.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 21
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));
        }
Exemplo n.º 22
0
 public ActionResult GetRecruitmentCampaignList([DataSourceRequest] DataSourceRequest request, Rec_RecruitmentCampaignSearchModel model)
 {
     //return GetListDataAndReturn<Rec_RecruitmentCampaignModel, Rec_RecruitmentCampaignEntity, Rec_RecruitmentCampaignSearchModel>(request, model, ConstantSql.hrm_rec_sp_get_RecruitmentCampaign);
     string status = string.Empty;
     var service = new BaseService();
     ListQueryModel lstModel = new ListQueryModel
     {
         PageIndex = request.Page,
         PageSize = request.PageSize,
         Filters = ExtractFilterAttributes(request),
         Sorts = ExtractSortAttributes(request),
         AdvanceFilters = ExtractAdvanceFilterAttributes(model)
     };
     var listEntity = service.GetData<Rec_RecruitmentCampaignEntity>(lstModel, ConstantSql.hrm_rec_sp_get_RecruitmentCampaign, UserLogin, ref status);
     List<object> lstObjCosDetail = new List<object>();
     lstObjCosDetail.Add(1);
     lstObjCosDetail.Add(int.MaxValue - 1);
     var listRecCosDetail = service.GetData<Rec_RecCostDetailEntity>(lstObjCosDetail, ConstantSql.hrm_rec_sp_get_RecCosDetail, UserLogin,ref status);
     var listModel = new List<Rec_RecruitmentCampaignModel>();
     if (listEntity != null)
     {
         request.Page = 1;
         foreach (var item in listEntity)
         {
             var lstCosdetailByRecruimentcampain = listRecCosDetail.Where(s => s.RecCampaignID == item.ID).Sum(s => s.Amount);
             if (lstCosdetailByRecruimentcampain != null && lstCosdetailByRecruimentcampain != 0)
             {
                 item.Budget = lstCosdetailByRecruimentcampain;
             }
             var newModle = (Rec_RecruitmentCampaignModel)typeof(Rec_RecruitmentCampaignModel).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);
     }
     var listModelNull = new List<Rec_RecruitmentCampaignModel>();
     ModelState.AddModelError("Id", status);
     return Json(listModelNull.ToDataSourceResult(request, ModelState));
 }
Exemplo n.º 23
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));
        }
Exemplo n.º 24
0
        public ActionResult GetWaitingInterviewList([DataSourceRequest] DataSourceRequest request, Rec_WaitingInterviewSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<Rec_CandidateModel> resultCandidate = new List<Rec_CandidateModel>();
            Rec_CandidateModel ObjCandidate = null;
            var InterviewServices = new Rec_InterviewServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var result = baseService.GetData<Rec_CandidateModel>(lstModel, ConstantSql.hrm_rec_sp_get_WaitingInterviewList, UserLogin, ref status);
            #region Kết quả là rớt hoặc vỏng phỏng vấn = cuối thì KHÔNG load vào danh sách chờ phỏng vấn

            result = result.Where(s => s.Status != HRM.Infrastructure.Utilities.Interview.E_FAIL.ToString()).ToList();
            foreach (var item in result)
            {
                ObjCandidate = new Rec_CandidateModel();
                objs = new List<object>();
                objs.Add(item.ID);
                objs.Add(1);
                objs.Add(10000);
                //var resultInterview = baseService.GetData<Rec_InterviewModel>(objs, ConstantSql.hrm_rec_sp_get_InterviewByCandidateID, ref status);
                //Danh sach ke hoach cua ung vien
                var resultCampaignDetail = baseService.GetData<Rec_InterviewCampaignDetailModel>(objs, ConstantSql.hrm_rec_sp_get_InCamDetailByCddId, UserLogin, ref status).ToList();
                if (item.JobVacancyID.HasValue)
                {
                    var entityJobVacancy = service.GetByIdUseStore<Rec_JobVacancyEntity>(item.JobVacancyID.Value, ConstantSql.hrm_rec_sp_get_JobVacancyId, ref status);
                    if (item.LevelInterview == null)
                        item.LevelInterview = 0;
                    if (item.LevelInterview != entityJobVacancy.NoLevelInterview && item.LevelInterview == resultCampaignDetail.Count)
                    {
                        ObjCandidate = item;
                        resultCandidate.Add(ObjCandidate);
                    }
                }
            }
            #endregion
            return Json(resultCandidate.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 25
0
 public ActionResult GetReportMealTimeSummary([DataSourceRequest] DataSourceRequest request, Can_ReportMealTimeSummaryModel Model)
 {
     var service = new Can_ReportServices();
     var hrService = new Hre_ProfileServices();
     ListQueryModel lstModel = new ListQueryModel
     {
         PageIndex = request.Page,
         PageSize = request.PageSize,
         Filters = ExtractFilterAttributes(request),
         Sorts = ExtractSortAttributes(request)
     };
     DateTime From = DateTime.Now.AddMonths(-1);
     DateTime To = DateTime.Now;
     if (Model.DateFrom != null)
     {
         From = Model.DateFrom.Value;
     }
     if (Model.DateTo != null)
     {
         To = Model.DateTo.Value;
     }
     string status = string.Empty;
     var result = service.ReportMealTimeSummary(Model.CateringIDs,
         Model.CanteenIDs,
         Model.LineIDs,
         From,
         To,
         Model.OrgIDs);
     if (Model.ExportID != Guid.Empty)
     {
         var fullPath = ExportService.Export(Model.ExportID, result);
         return Json(fullPath);
     }
     return Json(result.ToDataSourceResult(request));
 }
Exemplo n.º 26
0
        //var result = GetListDataAndReturn<Rec_CandidateModel, Rec_CandidateEntity, Rec_CandidateSearchModel>(request, model, ConstantSql.hrm_rec_sp_get_WaitingInterviewList);
        //return result;
        //}

        public ActionResult ExportWatingInterviewByTemplate([DataSourceRequest] DataSourceRequest request, Rec_WaitingInterviewSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<Rec_RecruitmentHistoryModel> resultRecruitmentHistory = new List<Rec_RecruitmentHistoryModel>();
            Rec_RecruitmentHistoryModel ObjRecruitmentHistory = null;
            var InterviewServices = new Rec_InterviewServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var lstWaitingInterview = baseService.GetData<Rec_RecruitmentHistoryModel>(lstModel, ConstantSql.hrm_rec_sp_get_WaitingInterList, UserLogin, ref status);

            if (lstWaitingInterview == null || lstWaitingInterview.Count == 0)
            {
                return null;
            }
            lstWaitingInterview = lstWaitingInterview.Where(s => s.JobVacancyID != null).ToList();


            var lstrechisids = lstWaitingInterview.Select(s => s.ID).Distinct().ToList();

            var objCampaignDetail = new List<object>();
            objCampaignDetail.AddRange(new object[16]);
            objCampaignDetail[14] = 1;
            objCampaignDetail[15] = int.MaxValue - 1;
            var resultCampaignDetail = baseService.GetData<Rec_InterviewCampaignDetailModel>(objCampaignDetail, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail, UserLogin, ref status);

            resultCampaignDetail = resultCampaignDetail.Where(s => s.RecruitmentHistoryID != null && lstrechisids.Contains(s.RecruitmentHistoryID.Value)).ToList();

            var lstjobvacancyids = lstWaitingInterview.Where(s => s.JobVacancyID != null).Select(s => s.JobVacancyID).Distinct().ToList();
            string strJobVacancyIds = string.Empty;
            foreach (Guid item in lstjobvacancyids)
            {
                strJobVacancyIds += item;
                strJobVacancyIds += ",";
            }
            if (strJobVacancyIds.Length > 0)
            {
                strJobVacancyIds = strJobVacancyIds.Substring(0, strJobVacancyIds.Length - 1);
            }
            var lstJobVacancy = baseService.GetData<Rec_JobVacancyEntity>(Common.DotNetToOracle(strJobVacancyIds), ConstantSql.hrm_rec_sp_get_JobVacancyByIds, UserLogin, ref status);
            #region Kết quả là rớt hoặc vỏng phỏng vấn = cuối thì KHÔNG load vào danh sách chờ phỏng vấn
            foreach (var his in lstWaitingInterview)
            {
                ObjRecruitmentHistory = new Rec_RecruitmentHistoryModel();
                var lstresultCampaignDetail = resultCampaignDetail.Where(s => s.RecruitmentHistoryID == his.ID && s.LevelInterview == null).ToList();
                if (his.JobVacancyID.HasValue)
                {
                    var entityJobVacancy = lstJobVacancy.Where(s => s.ID == his.JobVacancyID).FirstOrDefault();
                    if (entityJobVacancy != null && his.LevelInterview != entityJobVacancy.NoLevelInterview && lstresultCampaignDetail.Count == 0 && his.Status != HRM.Infrastructure.Utilities.Interview.E_PASS.ToString())
                    {
                        ObjRecruitmentHistory = his;
                        resultRecruitmentHistory.Add(ObjRecruitmentHistory);
                    }
                }
            }
            #endregion

            var isDataTable = false;
            object obj = new Rec_RecruitmentHistoryModel();
            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = resultRecruitmentHistory;
                isDataTable = false;
            }
            if (model != null && model.IsCreateTemplate)
            {

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

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

            var objInterview = new List<object>();
            objInterview.AddRange(new object[2]);
            objInterview[0] = 1;
            objInterview[1] = int.MaxValue - 1;
            var lstInterView = baseService.GetData<Rec_InterviewModel>(objInterview, ConstantSql.hrm_rec_sp_get_InterviewDataReport, UserLogin, ref status).ToList();

            foreach (var item in resultRecruitmentHistory)
            {
                if (lstInterView.Count > 0)
                {
                    var dataLevel1 = lstInterView.Where(s => s.CandidateID == item.CandidateID && s.LevelInterview == 1).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel2 = lstInterView.Where(s => s.CandidateID == item.CandidateID && s.LevelInterview == 2).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel3 = lstInterView.Where(s => s.CandidateID == item.CandidateID && s.LevelInterview == 3).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel4 = lstInterView.Where(s => s.CandidateID == item.CandidateID && s.LevelInterview == 4).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel5 = lstInterView.Where(s => s.CandidateID == item.CandidateID && s.LevelInterview == 5).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    if(dataLevel1 != null)
                    {
                        item.Score1_1 = dataLevel1.Score1;
                        item.Score1_2 = dataLevel1.Score2;
                        item.Score1_3 = dataLevel1.Score3;
                        item.KQ1 = dataLevel1.ResultInterviewView;
                        item.LanguageCode1 = dataLevel1.LanguageCode;
                        item.DateInterview1 = dataLevel1.DateInterview;
                    }
                    if (dataLevel2 != null)
                    {
                        item.Score2_1 = dataLevel2.Score1;
                        item.Score2_2 = dataLevel2.Score2;
                        item.Score2_3 = dataLevel2.Score3;
                        item.KQ2 = dataLevel2.ResultInterviewView;
                        item.LanguageCode2 = dataLevel2.LanguageCode;
                        item.DateInterview2 = dataLevel2.DateInterview;
                    }
                    if (dataLevel3 != null)
                    {
                        item.Score3_1 = dataLevel3.Score1;
                        item.Score3_2 = dataLevel3.Score2;
                        item.Score3_3 = dataLevel3.Score3;
                        item.KQ3 = dataLevel3.ResultInterviewView;
                        item.LanguageCode3 = dataLevel3.LanguageCode;
                        item.DateInterview3 = dataLevel3.DateInterview;
                    }
                    if (dataLevel4 != null)
                    {
                        item.Score4_1 = dataLevel4.Score1;
                        item.Score4_2 = dataLevel4.Score2;
                        item.Score4_3 = dataLevel4.Score3;
                        item.KQ4 = dataLevel4.ResultInterviewView;
                        item.LanguageCode4 = dataLevel4.LanguageCode;
                        item.DateInterview4 = dataLevel4.DateInterview;
                    }
                    if (dataLevel5 != null)
                    {
                        item.Score5_1 = dataLevel5.Score1;
                        item.Score5_2 = dataLevel5.Score2;
                        item.Score5_3 = dataLevel5.Score3;
                        item.KQ5 = dataLevel5.ResultInterviewView;
                        item.LanguageCode5 = dataLevel5.LanguageCode;
                        item.DateInterview5 = dataLevel5.DateInterview;
                    }
                }
            }

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

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

            return Json(resultRecruitmentHistory.ToDataSourceResult(request));
        }
Exemplo n.º 27
0
        public ActionResult GetReportMultiSlideCard([DataSourceRequest] DataSourceRequest request, Can_ReportMultiSlideCardSearchModel Model)
        {
            var service = new Can_ReportServices();
            var hrService = new Hre_ProfileServices();
            var Actionservices = new ActionService(UserLogin);
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request)
            };
            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;
            }
            List<Guid?> OrgIds = new List<Guid?>();
            if (Model.OrgStructureID != null && Model.OrgStructureID.Count() > 0)
            {
                OrgIds = Model.OrgStructureID;
            }
            string strOrgIDs = Common.ListToString(OrgIds);
            string status = string.Empty;
            string profilename = null;
            string codeemp = null;
            List<object> objectsearch = new List<object>();
            objectsearch.Add(strOrgIDs);
            objectsearch.Add(profilename);
            objectsearch.Add(codeemp);
            List<Guid> lstProfileIDs = Actionservices.GetData<Hre_ProfileIdEntity>(objectsearch, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(s => s.ID).ToList();
            var result = service.ReportMultiSlideCard(Model.CateringID, Model.CanteenID, Model.LineID, Model.WorkPlaceID, From, To, lstProfileIDs, Model.IsIncludeQuitEmp);
            var rs = result.Translate<Can_ReportMultiSlideCardModel>();

            #region xử lý xuất báo cáo

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, rs);
                return Json(fullPath);
            }
            #endregion
            request.Page = 1;
            var dataSourceResult = result.ToDataSourceResult(request);
            return Json(rs.ToDataSourceResult(request));
        }
 public void NUnit_CutOffDuration_Domain_Get(ListQueryModel model)
 {
     Att_CutOffDurationServices service = new Att_CutOffDurationServices();
     var repo = service.GetDataCondition<Att_CutOffDurationEntity>(model, ConstantSql.hrm_att_sp_get_CutOffDurations, ref status);
     Console.Write("Total Record: " + repo.Count());
 }
Exemplo n.º 29
0
 public ActionResult GetReportSumaryReturnMoneyEat([DataSourceRequest] DataSourceRequest request, Can_ReportSumaryReturnMoneyEatSearchModel Model)
 {
     var service = new Can_ReportServices();
     var hrService = new Hre_ProfileServices();
     ListQueryModel lstModel = new ListQueryModel
     {
         PageIndex = request.Page,
         PageSize = request.PageSize,
         Filters = ExtractFilterAttributes(request),
         Sorts = ExtractSortAttributes(request)
     };
     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 result = service.GetReportSumaryReturnMoneyEat(Model.CateringIDs, Model.CanteenIDs, Model.LineIDs, Model.WorkPlaceID, From, To, Model.OrgStructureID, Model.CodeEmp, Model.IsIncludeQuitEmp);
     #region xử lý xuất báo cáo
     if (Model.ExportID != Guid.Empty)
     {
         var fullPath = ExportService.Export(Model.ExportID, result);
         return Json(fullPath);
     }
     #endregion
     request.Page = 1;
     var dataSourceResult = result.ToDataSourceResult(request);
     return Json(result.ToDataSourceResult(request));
 }
Exemplo n.º 30
0
        public ActionResult GetReportInsuranceList([DataSourceRequest] DataSourceRequest request, Ins_ReportInsuranceTotalSearchModel 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)
            };
            //    List<Hre_ProfileEntity> listProfile = service.GetData<Hre_ProfileEntity>(lstModel, ConstantSql.hrm_sal_sp_getdata_Profile, ref status);
            var ReportServices = new Ins_InsuranceReportServices();
            DateTime _DateFrom = DateTime.MinValue;
            DateTime _DateTo = DateTime.MaxValue;
            if (model != null && model.DateFrom != null)
            {
                _DateFrom = model.DateFrom.Value;
            }
            if (model != null && model.DateTo != null)
            {
                _DateTo = model.DateTo.Value;
            }
            var result = ReportServices.BC_INSURANCETOTAL(_DateFrom, _DateTo, model.OrgStructureIDs, model.SocialInsPlaceIDs, UserLogin);
            var isDataTable = false;
            object obj = new DataTable();
            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 = "Ins_ReportInsuranceTotalEntity",
                    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 new JsonResult() { Data = result.ToDataSourceResult(request), MaxJsonLength = int.MaxValue };
            #region mapping dataTable to dataList
            List<Ins_ReportInsuranceTotalModel> dataList = new List<Ins_ReportInsuranceTotalModel>();
            Ins_ReportInsuranceTotalModel aTSource = null;

            if (result.Rows.Count > 0)
            {
                const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic;
                var objFieldNames = (from PropertyInfo aProp in typeof(Ins_ReportInsuranceTotalModel).GetProperties(flags)
                                     select new
                                     {
                                         Name = aProp.Name,
                                         Type = Nullable.GetUnderlyingType(aProp.PropertyType) ?? aProp.PropertyType
                                     }).ToList();
                var dataTblFieldNames = (from DataColumn aHeader in result.Columns
                                         select new { Name = aHeader.ColumnName, Type = aHeader.DataType }).ToList();
                var commonFields = objFieldNames.Intersect(dataTblFieldNames).ToList();
                foreach (DataRow dataRow in result.AsEnumerable().ToList())
                {
                    aTSource = new Ins_ReportInsuranceTotalModel();
                    foreach (var aField in commonFields)
                    {
                        PropertyInfo propertyInfos = aTSource.GetType().GetProperty(aField.Name);
                        if (dataRow[aField.Name] == DBNull.Value)
                            continue;
                        propertyInfos.SetValue(aTSource, dataRow[aField.Name], null);
                    }
                    dataList.Add(aTSource);
                }
            }
            #endregion
            return Json(dataList.ToDataSourceResult(request));
        }