private void copyAbstractJobIndex(Period currentPeriod, AbstractJobIndexId sourceAbstractJobIndexId, AbstractJobIndexId parentId) { List<AbstractJobIndex> childs = new List<AbstractJobIndex>(); JobIndexGroup newJobIndexGroup = null; var srvManagerJobIndex = jobIndexServiceFactory.Create(); try { var jobIndexService = srvManagerJobIndex.GetService(); var sourceAbstractJobIndex = jobIndexService.GetJobIndexById(sourceAbstractJobIndexId); if (sourceAbstractJobIndex is JobIndexGroup) { var sourceGroup = sourceAbstractJobIndex as JobIndexGroup; newJobIndexGroup = jobIndexService.AddJobIndexGroup(currentPeriod.Id, parentId, sourceGroup.Name, sourceGroup.DictionaryName); childs = jobIndexService.GetAllAbstractJobIndexByParentId(sourceGroup.Id); } else if (sourceAbstractJobIndex is JobIndex) { var sourceJobIndex = sourceAbstractJobIndex as JobIndex; jobIndexService.AddJobIndex(currentPeriod.Id, parentId, sourceJobIndex.SharedJobIndexId, sourceJobIndex.CustomFieldValues.ToDictionary(c => c.Key, c => c.Value), sourceJobIndex.IsInquireable, sourceJobIndex.CalculationOrder, sourceJobIndex.CalculationLevel); } } finally { jobIndexServiceFactory.Release(srvManagerJobIndex); } foreach (AbstractJobIndex abstactIndex in childs) copyAbstractJobIndex(currentPeriod, abstactIndex.Id, newJobIndexGroup.Id); }
public JobJobIndex(AbstractJobIndexId jobIndexId, bool showforTopLevel, bool showforSameLevel, bool showforLowLevel) { this.jobIndexId = jobIndexId; this.showforTopLevel = showforTopLevel; this.showforSameLevel = showforSameLevel; this.showforLowLevel = showforLowLevel; }
public JobIndexCategory AddJobIndexCategory(AbstractJobIndexId parentId, string name, string dictionaryName) { try { using (var scope = new TransactionScope()) { var id = jobIndexRep.GetNextId(); JobIndexCategory parent = null; if (parentId != null) { parent = jobIndexRep.GetJobIndexCategory(new AbstractJobIndexId(parentId.Id)); } var jobIndexCategory = new JobIndexCategory(id, parent, name, dictionaryName); jobIndexRep.Add(jobIndexCategory); scope.Complete(); return(jobIndexCategory); } } catch (Exception exp) { var res = jobIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public JobIndexGroup AddJobIndexGroup(PeriodId periodId, AbstractJobIndexId parentId, string name, string dictionaryName) { try { using (var tr = new TransactionScope()) { var id = jobIndexRep.GetNextId(); var period = periodRep.GetById(periodId); JobIndexGroup parent = null; if (parentId != null) { parent = jobIndexRep.GetJobIndexGroupById(new AbstractJobIndexId(parentId.Id)); } var jobIndexGroup = new JobIndexGroup(id, period, parent, name, dictionaryName); jobIndexRep.Add(jobIndexGroup); tr.Complete(); return(jobIndexGroup); } } catch (Exception exp) { var res = jobIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public JobIndex AddJobIndex(PeriodId periodId, AbstractJobIndexId groupId, SharedJobIndexId jobIndexId, IDictionary <SharedJobIndexCustomFieldId, string> customFieldValues, bool isInquireable, int calculationOrder, long calculationLevel) { try { using (var tr = new TransactionScope()) { var period = periodRep.GetById(periodId); var sharedJob = pmsAdminService.GetSharedJobIndex(jobIndexId); var id = jobIndexRep.GetNextId(); if (groupId == null) { throw new ArgumentException("groupId is null"); } var group = jobIndexRep.GetJobIndexGroupById(groupId); var jobIndex = new JobIndex(id, period, sharedJob, group, isInquireable, calculationLevel, calculationOrder); var validateCustomFldValues = getSharedJobIndexCustomFields(jobIndexId, customFieldValues); jobIndex.UpdateCustomFields(validateCustomFldValues); jobIndexRep.Add(jobIndex); tr.Complete(); return(jobIndex); } } catch (Exception exp) { var res = jobIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public JobIndexCategory UpdateJobIndexCategory(AbstractJobIndexId jobIndexCatId, AbstractJobIndexId parentId, string name, string dictionaryName) { //todo:(medium)Update not working try { using (var scope = new TransactionScope()) { JobIndexCategory parent = null; if (parentId != null) { parent = jobIndexRep.GetJobIndexCategory(parentId); } var jobIndexCategory = new JobIndexCategory(jobIndexCatId, parent, name, dictionaryName); jobIndexRep.Update(jobIndexCategory); scope.Complete(); return(jobIndexCategory); } } catch (Exception exp) { var res = jobIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public JobIndex UpdateJobIndex(AbstractJobIndexId jobIndexId, AbstractJobIndexId categoryId, string name , string dictionaryName, IList <CustomFieldTypeId> customFieldTypeIdList) { try { using (var scope = new TransactionScope()) { if (categoryId == null) { throw new ArgumentException("CategoryId is null"); } var category = jobIndexRep.GetJobIndexCategory(categoryId); var jobIndex = jobIndexRep.GetJobIndex(jobIndexId); var jobIndexCustomFields = customFieldRep.GetAll(EntityTypeEnum.JobIndex) .Where(c => customFieldTypeIdList.Contains(c.Id)).ToList(); jobIndex.Update(name, dictionaryName, category, jobIndexCustomFields); jobIndexRep.Update(jobIndex); scope.Complete(); return(jobIndex); } } catch (Exception exp) { var res = jobIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public JobIndex AddJobIndex(AbstractJobIndexId categoryId, string name , string dictionaryName, IList <CustomFieldTypeId> customFieldTypeIdList, Guid transferId) { try { using (var scope = new TransactionScope()) { var id = jobIndexRep.GetNextId(); var category = jobIndexRep.GetJobIndexCategory(categoryId); var jobIndex = new JobIndex(id, category, name, dictionaryName); assignJobIndexCustomField(jobIndex, customFieldTypeIdList); jobIndex.TransferId = transferId; jobIndexRep.Add(jobIndex); scope.Complete(); return(jobIndex); } } catch (Exception exp) { var res = jobIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public JobIndexForJob(AbstractJobIndexId jobIndexId, bool showforTopLevel, bool showforSameLevel, bool showforLowLevel) { JobIndexId = jobIndexId; ShowforLowLevel = showforLowLevel; ShowforTopLevel = showforTopLevel; ShowforSameLevel = showforSameLevel; }
public JobIndexGroup UpdateJobIndexGroup(AbstractJobIndexId jobIndexGroupId, AbstractJobIndexId parentId, string name, string dictionaryName) { try { using (var tr = new TransactionScope()) { JobIndexGroup parent = null; if (parentId != null) { parent = jobIndexRep.GetJobIndexGroupById(parentId); } var group = jobIndexRep.GetJobIndexGroupById(jobIndexGroupId); if (parentId != null && parent.PeriodId != group.PeriodId) { throw new ArgumentException("parentId is not valid"); } group.Update(parent, name, dictionaryName); tr.Complete(); return(group); } } catch (Exception exp) { var res = jobIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public bool IsValidCustomFieldIdList(AbstractJobIndexId jobIndexId, IList <CustomFieldTypeId> customFieldTypeIds) { var jobIndex = (JobIndex)jobIndexRep.GetById(jobIndexId); var customFieldList = customFieldRep.Find(customFieldTypeIds); return(jobIndex.IsValidCustomFields(customFieldList)); }
public List <AbstractJobIndex> GetAllAbstractJobIndexByParentId(AbstractJobIndexId id) { using (var tr = new TransactionScope()) { var res = jobIndexRep.GetAllAbstractJobIndexByParentId(id); tr.Complete(); return(res); } }
public SharedJobIndexId GetSharedJobIndexIdBy(AbstractJobIndexId abstractJobIndexId) { using (var tr = new TransactionScope()) { var res = jobIndexRep.GetSharedJobIndexIdBy(abstractJobIndexId); tr.Complete(); return(res); } }
public AbstractJobIndex GetJobIndexById(AbstractJobIndexId jobIndexId) { using (var tr = new TransactionScope()) { var res = jobIndexRep.GetById(jobIndexId); tr.Complete(); return(res); } }
public List <AbstractJobIndex> GetAllAbstractJobIndexByParentId(AbstractJobIndexId id) { var jobIndexChilds = rep.Find <JobIndex>(u => u.Group.Id == id).ToList(); var jobIndexGroupChilds = rep.Find <JobIndexGroup>(u => u.Parent.Id == id).ToList(); List <AbstractJobIndex> res = new List <AbstractJobIndex>(jobIndexChilds); res.AddRange(jobIndexGroupChilds); return(res); }
public List <CustomFieldType> GetAllCustomField(AbstractJobIndexId jobIndexId) { var jobIndex = Session.Query <JobIndex>().Single(j => j.Id == jobIndexId); var res = new List <CustomFieldType>(); foreach (var customFieldTypeId in jobIndex.CustomFieldTypeIdList) { res.Add(GetById(customFieldTypeId)); } return(res); }
//private List<AbstractJobIndexId> getJobIndexIdsForCopy(Period currentPeriod, IReadOnlyList<AbstractJobIndexId> jobIndexIdList) //{ // var srvManagerJobIndex = jobIndexServiceFactory.Create(); // try // { // var jobIndexService = srvManagerJobIndex.GetService(); // List<SharedJobIndexId> sharedJobIndexIds = jobIndexService.GetSharedJobIndexIdBy(jobIndexIdList.ToList()); // List<AbstractJobIndexId> res = jobIndexService.GetJobIndexIdsBy(currentPeriod, sharedJobIndexIds); // return res; // } // finally // { // jobIndexServiceFactory.Release(srvManagerJobIndex); // } //} private AbstractJobIndexId getJobIndexIdForCopy(Period currentPeriod, AbstractJobIndexId jobIndexId) { var srvManagerJobIndex = jobIndexServiceFactory.Create(); try { var jobIndexService = srvManagerJobIndex.GetService(); var sharedJobIndexId = jobIndexService.GetSharedJobIndexIdBy(jobIndexId); AbstractJobIndexId res = jobIndexService.GetJobIndexIdBy(currentPeriod, sharedJobIndexId); return res; } finally { jobIndexServiceFactory.Release(srvManagerJobIndex); } }
public void DeleteAbstractJobIndex(AbstractJobIndexId jobIndexId) { try { using (var scope = new TransactionScope()) { jobIndexRep.Delete(jobIndexId); scope.Complete(); } } catch (Exception exp) { var res = jobIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public InquiryJobIndexPoint(InquiryJobIndexPointId id, JobPositionInquiryConfigurationItem configurationItem, JobIndex jobIndex, string jobIndexValue) { if (id == null) { throw new ArgumentNullException("inquiryJobIndexPointId"); } this.id = id; if (id == null) { throw new ArgumentNullException("configurationItem"); } configurationItemId = configurationItem.Id; if (id == null) { throw new ArgumentNullException("jobIndex"); } jobIndexId = jobIndex.Id; this.jobIndexValue = jobIndexValue; }
public JobIndex UpdateJobIndex(AbstractJobIndexId jobIndexId, AbstractJobIndexId groupId, IDictionary <SharedJobIndexCustomFieldId, string> customFieldValues, bool isInquireable, int calculationOrder, long calculationLevel) { try { using (var tr = new TransactionScope()) { if (groupId == null) { throw new ArgumentException("groupId is null"); } var group = jobIndexRep.GetJobIndexGroupById(groupId); if (group == null) { throw new ArgumentException("group is null"); } var jobIndex = jobIndexRep.GetJobIndexById(jobIndexId); if (group.PeriodId != jobIndex.PeriodId) { throw new ArgumentException("groupId is not valid"); } var customFldValues = getSharedJobIndexCustomFields(jobIndex.SharedJobIndexId, customFieldValues); jobIndex.Update(group, isInquireable, customFldValues, periodChecker, calculationOrder, calculationLevel); jobIndexRep.Update(jobIndex); tr.Complete(); return(jobIndex); } } catch (Exception exp) { var res = jobIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public List <InquiryJobIndexPoint> GetAllBy(PeriodId periodId, EmployeeId inquirerEmployeeId, AbstractJobIndexId jobIndexId) { return (rep.Find( i => i.ConfigurationItemId.InquirerId.PeriodId == periodId && i.ConfigurationItemId.InquirerId.EmployeeNo == inquirerEmployeeId.EmployeeNo && i.JobIndexId == jobIndexId) .ToList()); }
public InquiryJobIndexPoint GetBy(JobPositionInquiryConfigurationItemId configurationItemId, AbstractJobIndexId jobIndexId) { return(rep.Find(i => i.ConfigurationItemId.InquirerId.EmployeeNo == configurationItemId.InquirerId.EmployeeNo && i.ConfigurationItemId.InquirerJobPositionId.SharedJobPositionId.Id == configurationItemId.InquirerJobPositionId.SharedJobPositionId.Id && i.ConfigurationItemId.InquirySubjectId.EmployeeNo == configurationItemId.InquirySubjectId.EmployeeNo && i.ConfigurationItemId.InquirySubjectJobPositionId.SharedJobPositionId.Id == configurationItemId.InquirySubjectJobPositionId.SharedJobPositionId.Id && i.ConfigurationItemId.InquirerId.PeriodId == configurationItemId.InquirerId.PeriodId && i.JobIndexId == jobIndexId).Single()); }
public JobIndexCategory GetJobIndexCategory(AbstractJobIndexId id) { return(rep.Single <JobIndexCategory>(p => p.Id == id)); }
public JobIndex GetJobIndex(AbstractJobIndexId id) { return(rep.Single <JobIndex>(p => p.Id == id)); }
public void Delete(AbstractJobIndexId jobIndexId) { var abstractJobIndex = GetById(jobIndexId); rep.Delete(abstractJobIndex); }
public AbstractJobIndex GetById(AbstractJobIndexId jobIndexId) { return(rep.FindByKey(jobIndexId)); }
public JobIndexGroup GetJobIndexGroupById(AbstractJobIndexId id) { return(rep.Single <JobIndexGroup>(u => u.Id == id)); }
public SharedJobIndexId GetSharedJobIndexIdBy(AbstractJobIndexId abstractJobIndexId) { //return rep.Find<JobIndex>(i => abstractJobIndexIds.Contains(i.Id)).Select(i => i.SharedJobIndexId).ToList(); return(rep.Single <JobIndex>(j => j.Id == abstractJobIndexId).SharedJobIndexId); }
public InquiryJobIndexPoinItem(JobPositionInquiryConfigurationItemId configurationItemId, AbstractJobIndexId jobIndexId, string jobIndexValue) { ConfigurationItemId = configurationItemId; JobIndexId = jobIndexId; JobIndexValue = jobIndexValue; }
public JobIndex GetBy(AbstractJobIndexId jobIndexId) { return(jobIndexRep.GetJobIndex(jobIndexId)); }