public string ActionCancel(string selectedIds, string userLogin) { using (var context = new VnrHrmDataContext()) { string message = string.Empty; var unitOfWork = (IUnitOfWork)(new UnitOfWork(context)); var repo = new Hre_StopWorkingRepository(unitOfWork); var profileServices = new Hre_ProfileServices(); string status = string.Empty; List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList(); var lstStopWorkings = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList(); foreach (var StopWorking in lstStopWorkings) { var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(StopWorking.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault(); profile.StatusSyn = StopWorking.LastStatusSyn; StopWorking.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_CANCEL.ToString(); profile.StopWorkType = null; profile.TypeSuspense = null; profile.RequestDate = null; profile.DateQuit = null; profile.ResReasonID = null; profile.IsHoldSal = false; profile.ResignNo = null; profile.TypeOfStop = null; profileServices.Edit(profile); } repo.SaveChanges(); message = NotificationType.Success.ToString(); return message; } }
public string ActionCancel(string selectedIds, string userLogin) { using (var context = new VnrHrmDataContext()) { string message = string.Empty; var unitOfWork = (IUnitOfWork)(new UnitOfWork(context)); var repo = new Hre_StopWorkingRepository(unitOfWork); var profileServices = new Hre_ProfileServices(); string status = string.Empty; List <Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList(); var lstStopWorkings = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList(); foreach (var StopWorking in lstStopWorkings) { var profile = profileServices.GetData <Hre_ProfileEntity>(Common.DotNetToOracle(StopWorking.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault(); profile.StatusSyn = StopWorking.LastStatusSyn; StopWorking.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_CANCEL.ToString(); profile.StopWorkType = null; profile.TypeSuspense = null; profile.RequestDate = null; profile.DateQuit = null; profile.ResReasonID = null; profile.IsHoldSal = false; profile.ResignNo = null; profile.TypeOfStop = null; profileServices.Edit(profile); } repo.SaveChanges(); message = NotificationType.Success.ToString(); return(message); } }
public string ActionCancelComback(string selectedIds) { using (var context = new VnrHrmDataContext()) { string message = string.Empty; var unitOfWork = (IUnitOfWork)(new UnitOfWork(context)); var repo = new Hre_StopWorkingRepository(unitOfWork); var profileServices = new Hre_ProfileServices(); string status = string.Empty; List <Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList(); var lstSuspenses = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList(); foreach (var Suspense in lstSuspenses) { Suspense.DateComeBack = null; Suspense.RequestDateComeBack = null; Suspense.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString(); } repo.SaveChanges(); message = NotificationType.Success.ToString(); return(message); } }
public List<Hre_ReportDependantProfileQuitEntity> GetReportDependantProfileQuits(DateTime? dateFrom, DateTime? dateTo, Guid? workPlaceID, string orgStructureID, string userLogin) { string status = string.Empty; List<Hre_ReportDependantProfileQuitEntity> lstReportDependantProfileQuit = new List<Hre_ReportDependantProfileQuitEntity>(); using (var context = new VnrHrmDataContext()) { var unitOfWork = (IUnitOfWork)(new UnitOfWork(context)); var basevices = new BaseService(); var hdtJobServices = new Hre_HDTJobServices(); var ProfileServices = new Hre_ProfileServices(); List<object> listObjHDTJob = new List<object>(); listObjHDTJob.Add(orgStructureID); listObjHDTJob.Add(workPlaceID); listObjHDTJob.Add(dateFrom); listObjHDTJob.Add(dateTo); listObjHDTJob.Add(1); listObjHDTJob.Add(Int32.MaxValue - 1); var lstDependant = hdtJobServices.GetData<Hre_DependantEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_ReportDependantProfileQuit, userLogin, ref status).ToList(); if (lstDependant.Count == 0) { return lstReportDependantProfileQuit; } Guid[] lstprofileIds = lstDependant.Select(x => Guid.Parse(x.ProfileID.ToString())).ToArray(); var repostopwoking = new Hre_StopWorkingRepository(unitOfWork); var profileids = repostopwoking.FindBy(s => s.IsDelete == null && s.ProfileID != null && lstprofileIds.Contains(s.ProfileID.Value) && (s.StopWorkType == HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_SUSPENSE.ToString() || s.StopWorkType == HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_STOP.ToString() )).Select(s => s.ProfileID).ToList(); if (profileids != null && profileids.Count > 0) { lstDependant = lstDependant.Where(s => profileids.Contains(s.ProfileID)).ToList(); } foreach (var Dependant in lstDependant) { Hre_ReportDependantProfileQuitEntity entity = new Hre_ReportDependantProfileQuitEntity(); entity.CodeEmp = Dependant.CodeEmp; entity.ProfileName = Dependant.ProfileName; entity.DependantName = Dependant.DependantName; entity.DateOfBirth = Dependant.DateOfBirth; entity.DateQuit = Dependant.DateQuit; entity.MonthOfEffect = Dependant.MonthOfEffect; lstReportDependantProfileQuit.Add(entity); } } return lstReportDependantProfileQuit; }
public string ActionCancelComback(string selectedIds) { using (var context = new VnrHrmDataContext()) { string message = string.Empty; var unitOfWork = (IUnitOfWork)(new UnitOfWork(context)); var repo = new Hre_StopWorkingRepository(unitOfWork); var profileServices = new Hre_ProfileServices(); string status = string.Empty; List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList(); var lstSuspenses = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList(); foreach (var Suspense in lstSuspenses) { Suspense.DateComeBack = null; Suspense.RequestDateComeBack = null; Suspense.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString(); } repo.SaveChanges(); message = NotificationType.Success.ToString(); return message; } }
public string ActionApprovedComeBack(string selectedIds, string userLogin) { using (var context = new VnrHrmDataContext()) { string message = string.Empty; string status = string.Empty; var unitOfWork = (IUnitOfWork)(new UnitOfWork(context)); var repo = new Hre_StopWorkingRepository(unitOfWork); var profileServices = new Hre_ProfileServices(); var contractSevices = new Hre_ContractServices(); var ContractExtendServices = new Hre_ContractExtendServices(); var contractTypeSevices = new Cat_ContractTypeServices(); List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList(); // var lstSuspenses = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList(); var services = new BaseService(); var lstObj = new List<object>(); lstObj.AddRange(new object[14]); lstObj[12] = 1; lstObj[13] = int.MaxValue - 1; var lstSuspenses = services.GetData<Hre_StopWorkingEntity>(lstObj, ConstantSql.hrm_hr_sp_get_RegisterComback, userLogin, ref status).ToList().Translate<Hre_StopWorking>(); lstSuspenses = lstSuspenses.Where(s => lstIds.Contains(s.ID)).ToList(); var lstSuspense = new List<Hre_StopWorkingEntity>(); foreach (var Suspense in lstSuspenses) { var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(Suspense.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault(); Suspense.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString(); Suspense.StatusComeBack = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString(); profile.StatusSyn = Suspense.LastStatusSyn; profile.RequestDate = null; profile.DateQuit = null; profile.IsHoldSal = false; profile.TypeSuspense = null; profile.StopWorkType = null; profile.ResReasonID = null; profile.TypeOfStop = null; profile.ResignNo = null; profileServices.Edit(profile); var contract = contractSevices.GetData<Hre_ContractEntity>(Common.DotNetToOracle(Suspense.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ContractsByProfileId, userLogin, ref status).OrderByDescending(s => s.DateStart).FirstOrDefault(); if (contract != null) { var contractType = contractSevices.GetData<Cat_ContractTypeEntity>(Common.DotNetToOracle(contract.ContractTypeID.ToString()), ConstantSql.hrm_cat_sp_get_ContractTypeById, userLogin, ref status).FirstOrDefault(); if (Suspense.TypeSuspense == HRM.Infrastructure.Utilities.EnumDropDown.TypeSuspense.E_MILITARY.ToString()) { int month = 0; if (contractType == null) { continue; } if (contractType.ValueTime != null) { month = (int)contractType.ValueTime.Value; if (contractType.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_YEAR.ToString()) { month = month * 12; } contract.DayContract = month; if (contract.DateEnd != null) { if (Suspense.DateComeBack <= contract.DateEnd.Value) { if (Suspense.DateStop != null) { double daySus = ((Suspense.DateComeBack.Value.Subtract(Suspense.DateStop.Value)).TotalDays / 30); contract.DayExtend = (int)Math.Floor(daySus); if (contract.DateExtend == null) { contract.DateExtend = contract.DateEnd.Value.AddMonths(contract.DayExtend.Value); } else { contract.DateExtend = contract.DateExtend.Value.AddMonths(contract.DayExtend.Value); } } } else { if (Suspense.DateStop != null) { double daySus = (contract.DateEnd.Value.Subtract(Suspense.DateStop.Value)).TotalDays / 30; contract.DayExtend = (int)Math.Floor(daySus); if (contract.DateExtend == null) { contract.DateExtend = contract.DateEnd.Value.AddMonths(contract.DayExtend.Value); } else { contract.DateExtend = contract.DateExtend.Value.AddMonths(contract.DayExtend.Value); } Suspense.DateComeBack = Suspense.DateComeBack.Value.AddMonths(contract.DayExtend.Value); } } } } contract.StatusEvaluation = HRM.Infrastructure.Utilities.EnumDropDown.Status.E_APPROVED.ToString(); Hre_ContractExtendEntity contractExtend = new Hre_ContractExtendEntity(); contractExtend.ContractID = contract.ID; contractExtend.DateStart = Suspense.DateComeBack; contractExtend.DateEnd = contract.DateExtend; contractSevices.Edit(contract); ContractExtendServices.Add(contractExtend); } } repo.Edit(Suspense); } repo.SaveChanges(); message = NotificationType.Success.ToString(); return message; } }
public string ActionApprovedComeBack(string selectedIds, string userLogin) { using (var context = new VnrHrmDataContext()) { string message = string.Empty; string status = string.Empty; var unitOfWork = (IUnitOfWork)(new UnitOfWork(context)); var repo = new Hre_StopWorkingRepository(unitOfWork); var profileServices = new Hre_ProfileServices(); var contractSevices = new Hre_ContractServices(); var ContractExtendServices = new Hre_ContractExtendServices(); var contractTypeSevices = new Cat_ContractTypeServices(); List <Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList(); // var lstSuspenses = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList(); var services = new BaseService(); var lstObj = new List <object>(); lstObj.AddRange(new object[14]); lstObj[12] = 1; lstObj[13] = int.MaxValue - 1; var lstSuspenses = services.GetData <Hre_StopWorkingEntity>(lstObj, ConstantSql.hrm_hr_sp_get_RegisterComback, userLogin, ref status).ToList().Translate <Hre_StopWorking>(); lstSuspenses = lstSuspenses.Where(s => lstIds.Contains(s.ID)).ToList(); var lstSuspense = new List <Hre_StopWorkingEntity>(); foreach (var Suspense in lstSuspenses) { var profile = profileServices.GetData <Hre_ProfileEntity>(Common.DotNetToOracle(Suspense.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault(); Suspense.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString(); Suspense.StatusComeBack = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_APPROVED.ToString(); profile.StatusSyn = Suspense.LastStatusSyn; profile.RequestDate = null; profile.DateQuit = null; profile.IsHoldSal = false; profile.TypeSuspense = null; profile.StopWorkType = null; profile.ResReasonID = null; profile.TypeOfStop = null; profile.ResignNo = null; profileServices.Edit(profile); var contract = contractSevices.GetData <Hre_ContractEntity>(Common.DotNetToOracle(Suspense.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ContractsByProfileId, userLogin, ref status).OrderByDescending(s => s.DateStart).FirstOrDefault(); if (contract != null) { var contractType = contractSevices.GetData <Cat_ContractTypeEntity>(Common.DotNetToOracle(contract.ContractTypeID.ToString()), ConstantSql.hrm_cat_sp_get_ContractTypeById, userLogin, ref status).FirstOrDefault(); if (Suspense.TypeSuspense == HRM.Infrastructure.Utilities.EnumDropDown.TypeSuspense.E_MILITARY.ToString()) { int month = 0; if (contractType == null) { continue; } if (contractType.ValueTime != null) { month = (int)contractType.ValueTime.Value; if (contractType.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_YEAR.ToString()) { month = month * 12; } contract.DayContract = month; if (contract.DateEnd != null) { if (Suspense.DateComeBack <= contract.DateEnd.Value) { if (Suspense.DateStop != null) { double daySus = ((Suspense.DateComeBack.Value.Subtract(Suspense.DateStop.Value)).TotalDays / 30); contract.DayExtend = (int)Math.Floor(daySus); if (contract.DateExtend == null) { contract.DateExtend = contract.DateEnd.Value.AddMonths(contract.DayExtend.Value); } else { contract.DateExtend = contract.DateExtend.Value.AddMonths(contract.DayExtend.Value); } } } else { if (Suspense.DateStop != null) { double daySus = (contract.DateEnd.Value.Subtract(Suspense.DateStop.Value)).TotalDays / 30; contract.DayExtend = (int)Math.Floor(daySus); if (contract.DateExtend == null) { contract.DateExtend = contract.DateEnd.Value.AddMonths(contract.DayExtend.Value); } else { contract.DateExtend = contract.DateExtend.Value.AddMonths(contract.DayExtend.Value); } Suspense.DateComeBack = Suspense.DateComeBack.Value.AddMonths(contract.DayExtend.Value); } } } } contract.StatusEvaluation = HRM.Infrastructure.Utilities.EnumDropDown.Status.E_APPROVED.ToString(); Hre_ContractExtendEntity contractExtend = new Hre_ContractExtendEntity(); contractExtend.ContractID = contract.ID; contractExtend.DateStart = Suspense.DateComeBack; contractExtend.DateEnd = contract.DateExtend; contractSevices.Edit(contract); ContractExtendServices.Add(contractExtend); } } repo.Edit(Suspense); } repo.SaveChanges(); message = NotificationType.Success.ToString(); return(message); } }