public UnitIndexCategoryVM(IPMSController appController, IUnitIndexServiceWrapper unitIndexCategoryService) { this.appController = appController; this.unitIndexCategoryService = unitIndexCategoryService; UnitIndexCategory = new UnitIndexCategoryDTO(); DisplayName = "دسته شاخص "; }
public void ShowUnitIndexCategoryView(UnitIndexCategoryDTO unitIndexCategory, ActionType action) { var view = ServiceLocator.Current.GetInstance <IUnitIndexCategoryView>(); ((UnitIndexCategoryVM)view.ViewModel).Load(unitIndexCategory, action); viewManager.ShowInDialog(view); }
public AbstractIndex UpdateUnitIndexCategory(UnitIndexCategoryDTO unitIndexCatDto) { var unitIndexCat = unitIndexService.UpdateUnitIndexCategory(new AbstractUnitIndexId(unitIndexCatDto.Id) , (unitIndexCatDto.ParentId.HasValue) ? new AbstractUnitIndexId(unitIndexCatDto.ParentId.Value) : null , unitIndexCatDto.Name, unitIndexCatDto.DictionaryName); return(unitIndexMapper.MapToModel(unitIndexCat)); }
public AbstractIndex AddUnitIndexCategory(UnitIndexCategoryDTO unitIndexCategoryDto) { var unitIndexCat = unitIndexService.AddUnitIndexCategory( (unitIndexCategoryDto.ParentId == null) ? null : new AbstractUnitIndexId(unitIndexCategoryDto.ParentId.Value), unitIndexCategoryDto.Name, unitIndexCategoryDto.DictionaryName); return(unitIndexMapper.MapToModel(unitIndexCat)); }
public void DoAction(UnitIndexTreeVM vm) { var unitIndexCategory = new UnitIndexCategoryDTO(); if (vm.SelectedUnitIndex != null) { unitIndexCategory.ParentId = vm.SelectedUnitIndex.Data.Id; } else { unitIndexCategory.ParentId = null; } basicInfoController.ShowUnitIndexCategoryView(unitIndexCategory, ActionType.AddUnitIndexCategory); }
public void Load(UnitIndexCategoryDTO unitIndexCategoryParam, ActionType actionTypeParam) { actionType = actionTypeParam; UnitIndexCategory = unitIndexCategoryParam; if (UnitIndexCategory != null && unitIndexCategory.ParentId.HasValue) { ShowBusyIndicator(); unitIndexCategoryService.GetUnitIndexCategory((res, exp) => appController.BeginInvokeOnDispatcher(() => { HideBusyIndicator(); ParentCategoryName = res.Name; }), unitIndexCategory.ParentId.Value); } }
public void ConvertUnitIndex(Period period) { var UnitIndexList = unitIndexDataProvider.GetUnitIndexList(); // Create Unit Index Category var PmsUnitIndexCategory = new UnitIndexCategoryDTO { Name = "گروه شاخص های سازمانی", DictionaryName = "UnitIndexCategoryDicName" }; unitIndexService.AddUnitIndexCategory((unitIndexCategoryResult, exp) => { if (exp != null) { throw new Exception("Error in Add UnitIndexCategory!"); } foreach (var UnitIndexItem in UnitIndexList) { var PmsUnitIndex = new UnitIndexDTO { Name = UnitIndexItem.Title, ParentId = unitIndexCategoryResult.Id, CustomFields = new List <CustomFieldDTO>(), DictionaryName = "CUI" + Guid.NewGuid() }; unitIndexService.AddUnitIndex((unitIndexResult, ueExp) => { if (ueExp != null) { throw new Exception("Error in Assignment Unit!"); } UnitIndexInPeriodDTO UnitIndexInPriodAssignment = new UnitIndexInPeriodDTO { }; //UnitInPriodAssignment = periodId; UnitIndexInPriodAssignment.Id = unitIndexCategoryResult.Id; UnitIndexInPriodAssignment.UnitIndexId = unitIndexCategoryResult.Id; //NewUnitID = unitResult.Id; }, PmsUnitIndex); } }, PmsUnitIndexCategory); }
public override AbstractIndex MapToModel(AbstractUnitIndex entity) { if (entity is UnitIndex) { var res = new UnitIndexDTO() { Id = entity.Id.Id, Name = entity.Name, DictionaryName = entity.DictionaryName, ParentId = ((UnitIndex)entity).Category.Id.Id, TransferId = entity.TransferId, //CustomFields = (entity as UnitIndex).CustomFieldTypeIdList.Select(c=>new CustomFieldDTO //{ // Id = c.Id, // Name = "Dont Use", // DictionaryName = "Dont Use", // EntityId = 1, // MaxValue = 10, // MinValue = 1, // TypeId = "Dont Use" //}).ToList() }; return(res); } else { var res = new UnitIndexCategoryDTO() { Id = entity.Id.Id, Name = entity.Name, DictionaryName = entity.DictionaryName, }; if (((UnitIndexCategory)entity).Parent != null) { res.ParentId = ((UnitIndexCategory)entity).Parent.Id.Id; } return(res); } }
public void UpdateUnitIndexCategory(Action <UnitIndexCategoryDTO, Exception> action, UnitIndexCategoryDTO unitIndexCategory) { var url = string.Format(apiAddress + "?Id=" + unitIndexCategory.Id); WebClientHelper.Put(new Uri(url, PMSClientConfig.UriKind), action, unitIndexCategory, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddUnitIndexCategory(Action <UnitIndexCategoryDTO, Exception> action, UnitIndexCategoryDTO unitIndexCategory) { var url = string.Format(apiAddress, UriKind.Absolute); WebClientHelper.Post(new Uri(url), action, unitIndexCategory, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public UnitIndexCategoryVM() { UnitIndexCategory = new UnitIndexCategoryDTO { Name = "شغل یک", DictionaryName = "UnitIndexCategory1" }; }