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 SharedJobIndex GetSharedJobIndex(SharedJobIndexId jabIndexId) { var jobIndex = jobIndexService.GetBy(new PMSAdminModel.JobIndices.AbstractJobIndexId(jabIndexId.Id)); var sharedJob = new SharedJobIndex(new SharedJobIndexId(jobIndex.Id.Id), jobIndex.Name, jobIndex.DictionaryName); return(sharedJob); }
public AbstractJobIndexId GetJobIndexIdBy(Period period, SharedJobIndexId sharedJobIndexId) { using (var tr = new TransactionScope()) { var res = jobIndexRep.GetJobIndexIdBy(period, sharedJobIndexId); tr.Complete(); return(res); } }
public IList <SharedJobIndexCustomField> GetSharedJobIndexCustomField(SharedJobIndexId sharedJobIndexId, List <SharedJobIndexCustomFieldId> fieldIdList) { using (var tr = new TransactionScope()) { var res = pmsAdminService.GetSharedCutomFieldListForJobIndex(sharedJobIndexId, fieldIdList); tr.Complete(); return(res); } }
public List <SharedJobIndexCustomField> GetSharedCutomFieldListForJobIndex(SharedJobIndexId sharedJobIndexId, IList <SharedJobIndexCustomFieldId> customFieldIdList) { var isValid = jobIndexService.IsValidCustomFieldIdList(new PMSAdminModel.JobIndices.AbstractJobIndexId(sharedJobIndexId.Id), customFieldIdList.Select(c => new CustomFieldTypeId(c.Id)) .ToList()); if (!isValid) { throw new ArgumentException("Invalid job customFieldIdList"); } var res = customFieldService.GetBy(customFieldIdList.Select(c => new CustomFieldTypeId(c.Id)).ToList()); return (res.Select( r => new SharedJobIndexCustomField(new SharedJobIndexCustomFieldId(r.Id.Id), r.Name, r.DictionaryName, r.MinValue, r.MaxValue)) .ToList()); }
public AbstractJobIndexId GetJobIndexIdBy(Period period, SharedJobIndexId sharedJobIndexId) { return(rep.Single <JobIndex>(j => j.PeriodId == period.Id && j.SharedJobIndexId.Id == sharedJobIndexId.Id).Id); }
private Dictionary <SharedJobIndexCustomField, string> getSharedJobIndexCustomFields(SharedJobIndexId jabIndexId, IDictionary <SharedJobIndexCustomFieldId, string> fieldIdValues) { var validateCustomFieldValues = new Dictionary <SharedJobIndexCustomField, string>(); var validateCustomFields = pmsAdminService.GetSharedCutomFieldListForJobIndex(jabIndexId, new List <SharedJobIndexCustomFieldId>(fieldIdValues.Keys)); foreach (var itm in validateCustomFields) { validateCustomFieldValues.Add(itm, fieldIdValues[itm.Id]); } return(validateCustomFieldValues); }