public UnitIndexCategory UpdateUnitIndexCategory(AbstractUnitIndexId unitIndexCatId, AbstractUnitIndexId parentId, string name, string dictionaryName) { //todo:(medium)Update not working try { using (var scope = new TransactionScope()) { UnitIndexCategory parent = null; if (parentId != null) { parent = unitIndexRep.GetUnitIndexCategory(parentId); } var unitIndexCategory = new UnitIndexCategory(unitIndexCatId, parent, name, dictionaryName); unitIndexRep.Update(unitIndexCategory); scope.Complete(); return(unitIndexCategory); } } catch (Exception exp) { var res = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public UnitUnitIndex(AbstractUnitIndexId unitIndexId, bool showforTopLevel, bool showforSameLevel, bool showforLowLevel) { this.unitIndexId = unitIndexId; this.showforTopLevel = showforTopLevel; this.showforSameLevel = showforSameLevel; this.showforLowLevel = showforLowLevel; }
public UnitIndex UpdateUnitIndex(AbstractUnitIndexId unitIndexId, AbstractUnitIndexId 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 = unitIndexRep.GetUnitIndexCategory(categoryId); var unitIndex = unitIndexRep.GetUnitIndex(unitIndexId); var unitIndexCustomFields = customFieldRep.GetAll(EntityTypeEnum.UnitIndex) .Where(c => customFieldTypeIdList.Contains(c.Id)).ToList(); unitIndex.Update(name, dictionaryName, category, unitIndexCustomFields); unitIndexRep.Update(unitIndex); scope.Complete(); return(unitIndex); } } catch (Exception exp) { var res = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public UnitEmployee(Employee employee, Unit unit, DateTime fromDate, DateTime toDate, IDictionary <UnitCustomField, string> employeeUnitCustomFieldValues, AbstractUnitIndexId abstractUnitIndexId) { if (unit == null) { throw new ArgumentNullException("Unit"); } if (unit.Id == null) { throw new ArgumentException("Unit.Id"); } if (abstractUnitIndexId == null) { throw new ArgumentNullException("UnitIndexId"); } // this._unitIndexId = abstractUnitIndexId; this._unit = unit; this.fromDate = fromDate; this.toDate = toDate.Date; if (employee == null || employee.Id == null) { throw new ArgumentNullException("employee"); } this.employeeId = employee.Id; this.employeeUnitCustomFieldValues = employeeUnitCustomFieldValues.ToDictionary(e => e.Key.Id, e => e.Value); }
public virtual void AddCustomInquirer(EmployeeId employeeId, AbstractUnitIndexId unitIndexId)//, UnitId emploeeyUnitId) { configurationItemList.Add( new UnitInquiryConfigurationItem( new UnitInquiryConfigurationItemId(null, employeeId, Id, unitIndexId), this, false, true)); // JobPositionLevel.None)); }
public UnitIndexGroup UpdateUnitIndexGroup(AbstractUnitIndexId unitIndexGroupId, AbstractUnitIndexId parentId, string name, string dictionaryName) { try { using (var tr = new TransactionScope()) { UnitIndexGroup parent = null; if (parentId != null) { parent = unitIndexRep.GetUnitIndexGroupById(parentId); } var group = unitIndexRep.GetUnitIndexGroupById(unitIndexGroupId); 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 = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public bool IsValidCustomFieldIdList(AbstractUnitIndexId unitIndexId, IList <CustomFieldTypeId> customFieldTypeIds) { var unitIndex = (UnitIndex)unitIndexRep.GetById(unitIndexId); var customFieldList = customFieldRep.Find(customFieldTypeIds); return(unitIndex.IsValidCustomFields(customFieldList)); }
public UnitIndex AddUnitIndex(PeriodId periodId, AbstractUnitIndexId groupId, SharedUnitIndexId unitIndexId, IDictionary <SharedUnitIndexCustomFieldId, string> customFieldValues, bool isInquireable, int calculationOrder, long calculationLevel) { try { using (var tr = new TransactionScope()) { var period = periodRep.GetById(periodId); var sharedUnit = pmsAdminService.GetSharedUnitIndex(unitIndexId); var id = unitIndexRep.GetNextId(); if (groupId == null) { throw new ArgumentException("groupId is null"); } var group = unitIndexRep.GetUnitIndexGroupById(groupId); var unitIndex = new UnitIndex(id, period, sharedUnit, group, isInquireable, calculationLevel, calculationOrder); var validateCustomFldValues = getSharedUnitIndexCustomFields(unitIndexId, customFieldValues); unitIndex.UpdateCustomFields(validateCustomFldValues); unitIndexRep.Add(unitIndex); tr.Complete(); return(unitIndex); } } catch (Exception exp) { var res = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public UnitIndexCategory AddUnitIndexCategory(AbstractUnitIndexId parentId, string name, string dictionaryName) { try { using (var scope = new TransactionScope()) { var id = unitIndexRep.GetNextId(); UnitIndexCategory parent = null; if (parentId != null) { parent = unitIndexRep.GetUnitIndexCategory(new AbstractUnitIndexId(parentId.Id)); } var unitIndexCategory = new UnitIndexCategory(id, parent, name, dictionaryName); unitIndexRep.Add(unitIndexCategory); scope.Complete(); return(unitIndexCategory); } } catch (Exception exp) { var res = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public UnitIndex AddUnitIndex(AbstractUnitIndexId categoryId, string name , string dictionaryName, IList <CustomFieldTypeId> customFieldTypeIdList, Guid transferId) { try { using (var scope = new TransactionScope()) { var id = unitIndexRep.GetNextId(); var category = unitIndexRep.GetUnitIndexCategory(categoryId); var unitIndex = new UnitIndex(id, category, name, dictionaryName); assignUnitIndexCustomField(unitIndex, customFieldTypeIdList); unitIndex.TransferId = transferId; unitIndexRep.Add(unitIndex); scope.Complete(); return(unitIndex); } } catch (Exception exp) { var res = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public UnitIndexGroup AddUnitIndexGroup(PeriodId periodId, AbstractUnitIndexId parentId, string name, string dictionaryName) { try { using (var tr = new TransactionScope()) { var id = unitIndexRep.GetNextId(); var period = periodRep.GetById(periodId); UnitIndexGroup parent = null; if (parentId != null) { parent = unitIndexRep.GetUnitIndexGroupById(new AbstractUnitIndexId(parentId.Id)); } var unitIndexGroup = new UnitIndexGroup(id, period, parent, name, dictionaryName); unitIndexRep.Add(unitIndexGroup); tr.Complete(); return(unitIndexGroup); } } catch (Exception exp) { var res = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public UnitIndexForUnit(AbstractUnitIndexId jobIndexId, bool showforTopLevel, bool showforSameLevel, bool showforLowLevel) { UnitIndexId = jobIndexId; ShowforLowLevel = showforLowLevel; ShowforTopLevel = showforTopLevel; ShowforSameLevel = showforSameLevel; }
public AbstractUnitIndex GetUnitIndexById(AbstractUnitIndexId unitIndexId) { using (var tr = new TransactionScope()) { var res = unitIndexRep.GetById(unitIndexId); tr.Complete(); return(res); } }
public SharedUnitIndexId GetSharedUnitIndexIdBy(AbstractUnitIndexId abstractUnitIndexId) { using (var tr = new TransactionScope()) { var res = unitIndexRep.GetSharedUnitIndexIdBy(abstractUnitIndexId); tr.Complete(); return(res); } }
public List <AbstractUnitIndex> GetAllAbstractUnitIndexByParentId(AbstractUnitIndexId id) { using (var tr = new TransactionScope()) { var res = unitIndexRep.GetAllAbstractUnitIndexByParentId(id); tr.Complete(); return(res); } }
public UnitInquiryConfigurationItemId(UnitId inquirerUnitId, EmployeeId inquirerId, UnitId inquirySubjectUnitId, AbstractUnitIndexId abstractUnitIndexId)//, EmployeeId inquirySubjectId) { this.inquirerId = inquirerId; this.inquirySubjectUnitId = inquirySubjectUnitId; // this.inquirySubjectId = inquirySubjectId; this.inquirerUnitId = inquirerUnitId; this.unitIndexIdUintPeriod = abstractUnitIndexId; }
public List <AbstractUnitIndex> GetAllAbstractUnitIndexByParentId(AbstractUnitIndexId id) { var unitIndexChilds = rep.Find <UnitIndex>(u => u.Group.Id == id).ToList(); var unitIndexGroupChilds = rep.Find <UnitIndexGroup>(u => u.Parent.Id == id).ToList(); List <AbstractUnitIndex> res = new List <AbstractUnitIndex>(unitIndexChilds); res.AddRange(unitIndexGroupChilds); return(res); }
public void Update(UnitInquiryConfigurationItemId configurationItemId, AbstractUnitIndexId unitIndexId, string unitIndexValue) { using (var tr = new TransactionScope()) { InquiryUnitIndexPoint inquiryUnitIndexPoint = inquiryUnitIndexPointRep.GetBy(configurationItemId); inquiryUnitIndexPoint.SetValue(unitIndexValue, periodChecker); tr.Complete(); } }
public void DeleteAbstractUnitIndex(AbstractUnitIndexId unitIndexId) { try { using (var scope = new TransactionScope()) { unitIndexRep.Delete(unitIndexId); scope.Complete(); } } catch (Exception exp) { var res = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public InquiryUnitIndexPoint(InquiryUnitIndexPointId id, UnitInquiryConfigurationItem configurationItem, AbstractUnitIndexId unitIndex, string unitIndexValue) { if (id == null) { throw new ArgumentNullException("inquiryUnitIndexPointId"); } this.id = id; if (configurationItem == null) { throw new ArgumentNullException("configurationItem"); } configurationItemId = configurationItem.Id; if (id == null) { throw new ArgumentNullException("unitIndex"); } // unitIndexId = unitIndex; this.unitIndexValue = unitIndexValue; }
public UnitIndex UpdateUnitIndex(AbstractUnitIndexId unitIndexId, AbstractUnitIndexId groupId, IDictionary <SharedUnitIndexCustomFieldId, 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 = unitIndexRep.GetUnitIndexGroupById(groupId); if (group == null) { throw new ArgumentException("group is null"); } var unitIndex = unitIndexRep.GetUnitIndexById(unitIndexId); if (group.PeriodId != unitIndex.PeriodId) { throw new ArgumentException("groupId is not valid"); } var customFldValues = getSharedUnitIndexCustomFields(unitIndex.SharedUnitIndexId, customFieldValues); unitIndex.Update(group, isInquireable, customFldValues, periodChecker, calculationOrder, calculationLevel); unitIndexRep.Update(unitIndex); tr.Complete(); return(unitIndex); } } catch (Exception exp) { var res = unitIndexRep.TryConvertException(exp); if (res == null) { throw; } throw res; } }
public SharedUnitIndexId GetSharedUnitIndexIdBy(AbstractUnitIndexId abstractUnitIndexId) { //return rep.Find<UnitIndex>(i => abstractUnitIndexIds.Contains(i.Id)).Select(i => i.SharedUnitIndexId).ToList(); return(rep.Single <UnitIndex>(j => j.Id == abstractUnitIndexId).SharedUnitIndexId); }
public List <CustomFieldType> GetAllCustomField(AbstractUnitIndexId unitIndexId) { var unitIndex = Session.Query <UnitIndex>().Single(j => j.Id == unitIndexId); return(Session.Query <CustomFieldType>().Where(c => unitIndex.CustomFieldTypeIdList.Contains(c.Id)).ToList()); }
public UnitIndex GetBy(AbstractUnitIndexId unitIndexId) { return(unitIndexRep.GetUnitIndex(unitIndexId)); }
public UnitIndexCategory GetUnitIndexCategory(AbstractUnitIndexId id) { return(rep.Single <UnitIndexCategory>(p => p.Id == id)); }
public UnitIndexGroup GetUnitIndexGroupById(AbstractUnitIndexId id) { return(rep.Single <UnitIndexGroup>(u => u.Id == id)); }
public virtual void UpdateInquirersBy(Employee inquirySubject, AbstractUnitIndexId unitIndexId) { AddCustomInquirer(inquirySubject.Id, unitIndexId); }
public AbstractUnitIndex GetById(AbstractUnitIndexId unitIndexId) { return(rep.FindByKey(unitIndexId)); }
public void Delete(AbstractUnitIndexId unitIndexId) { var abstractIndex = GetById(unitIndexId); rep.Delete(abstractIndex); }
public UnitIndex GetUnitIndex(AbstractUnitIndexId id) { return(rep.Single <UnitIndex>(p => p.Id == id)); }