Beispiel #1
0
        private UnitIndexDTO createDestinationUnitIndex(UnitIndexIntegrationDTO sourceUnitIndex)
        {
            var res = new UnitIndexDTO
            {
                Name         = sourceUnitIndex.Title,
                ParentId     = PMSCostantData.UnitIndexCategoryId,
                CustomFields = new List <CustomFieldDTO>
                {
                    new CustomFieldDTO
                    {
                        Id             = PMSCostantData.UnitIndexFieldId,
                        Name           = "UnitIndexCustomField",
                        DictionaryName = "UnitIndexCustomFieldDicName",
                        EntityId       = 1,
                        MaxValue       = 10,
                        MinValue       = 1,
                        TypeId         = "string",
                    }
                },
                DictionaryName = sourceUnitIndex.ID.ToString(),
                TransferId     = sourceUnitIndex.TransferId
            };

            return(res);
        }
Beispiel #2
0
        public void ShowUnitIndexCustomFieldManageView(UnitIndexDTO unitIndex, ActionType action)
        {
            var view = ServiceLocator.Current.GetInstance <IUnitIndexCustomFieldManageView>();

            ((UnitIndexCustomFieldManageVM)view.ViewModel).Load(unitIndex, action);
            viewManager.ShowInDialog(view);
        }
 public UnitIndexCustomFieldManageVM()
 {
     BasicInfoAppLocalizedResources = new BasicInfoAppLocalizedResources();
     init();
     UnitIndex = new UnitIndexDTO {
         Name = "شغل یک"
     };
 }
Beispiel #4
0
        public void DoAction(UnitIndexTreeVM vm)
        {
            var unitIndex = new UnitIndexDTO();

            if (vm.SelectedUnitIndex != null)
            {
                unitIndex.ParentId = vm.SelectedUnitIndex.Data.Id;
            }
            basicInfoController.ShowUnitIndexView(unitIndex, ActionType.AddUnitIndex);
        }
 public AbstractIndex UpdateUnitIndex(UnitIndexDTO unitIndexDto)
 {
     if (unitIndexDto.ParentId != null)
     {
         var unitIndex = unitIndexService.UpdateUnitIndex(new AbstractUnitIndexId(unitIndexDto.Id)
                                                          , new AbstractUnitIndexId(unitIndexDto.ParentId.Value), unitIndexDto.Name, unitIndexDto.DictionaryName
                                                          , unitIndexDto.CustomFields.Select(c => new CustomFieldTypeId(c.Id)).ToList()
                                                          );
         return(unitIndexMapper.MapToModel(unitIndex));
     }
     throw new Exception("UnitIndex ParentId is null");
 }
Beispiel #6
0
 public UnitIndexVM(IUnitIndexServiceWrapper unitIndexService,
                    ICustomFieldServiceWrapper customFieldService,
                    IPMSController appController,
                    IBasicInfoAppLocalizedResources basicInfoAppLocalizedResources)
 {
     this.unitIndexService          = unitIndexService;
     this.customFieldService        = customFieldService;
     this.appController             = appController;
     BasicInfoAppLocalizedResources = basicInfoAppLocalizedResources;
     UnitIndex   = new UnitIndexDTO();
     DisplayName = BasicInfoAppLocalizedResources.UnitIndexViewTitle;
 }
Beispiel #7
0
        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);
        }
Beispiel #8
0
 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);
     }
 }
Beispiel #9
0
        private UnitIndexInPeriodDTO createPeriodUnitIndexDTO(UnitIndexDTO unitIndex, Period period)
        {
            var res = new UnitIndexInPeriodDTO
            {
                ParentId         = PMSCostantData.UnitIndexGroup,
                CalculationLevel = 1,
                CalculationOrder = 1,
                IsInquireable    = true,
                Name             = unitIndex.Name,
                DictionaryName   = unitIndex.DictionaryName,
                UnitIndexId      = unitIndex.Id,
                PeriodId         = period.Id,
                CustomFields     = unitIndex.CustomFields.Select(c => new AbstractCustomFieldDescriptionDTO
                {
                    Id    = c.Id,
                    Name  = "fake",
                    Value = "1"
                }).ToList()
            };

            return(res);
        }
 public void Load(UnitIndexDTO unitIndexParam, ActionType actionTypeParam)
 {
     actionType = actionTypeParam;
     UnitIndex  = unitIndexParam;
     ShowBusyIndicator();
     customFieldService.GetAllCustomFieldsDescription((res, exp) => appController.BeginInvokeOnDispatcher(() =>
     {
         if (exp == null)
         {
             UnitIndexCustomFieldDescriptionList = res;
             if (actionType == ActionType.ManageUnitIndexCustomFields)
             {
                 setCurrentUnitCustomFields();
             }
             HideBusyIndicator();
         }
         else
         {
             HideBusyIndicator();
             appController.HandleException(exp);
         }
     }), "UnitIndex");
 }
Beispiel #11
0
 public UnitIndexDTO AddUnitIndex(UnitIndexDTO unitIndex)
 {
     return(IntegrationHttpClient.Post <UnitIndexDTO, UnitIndexDTO>(apiUri, endpoint, unitIndex));
     //var url = string.Format(apiAddress);
     //IntegrationWebClient.Post(new Uri(url, PMSClientConfig.UriKind), action, unitIndex, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
 }
 private void init()
 {
     UnitIndex   = new UnitIndexDTO();
     DisplayName = BasicInfoAppLocalizedResources.UnitIndexCustomFieldManageViewTitle;
 }
Beispiel #13
0
        public void UpdateUnitIndex(Action <UnitIndexDTO, Exception> action, UnitIndexDTO unitIndex)
        {
            var url = string.Format(apiAddress + "?Id=" + unitIndex.Id);

            WebClientHelper.Put(new Uri(url, UriKind.Absolute), action, unitIndex, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Beispiel #14
0
        public void AddUnitIndex(Action <UnitIndexDTO, Exception> action, UnitIndexDTO unitIndex)
        {
            var url = string.Format(apiAddress);

            WebClientHelper.Post(new Uri(url, PMSClientConfig.UriKind), action, unitIndex, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Beispiel #15
0
 public UnitIndexVM()
 {
     UnitIndex = new UnitIndexDTO {
         Name = "شاخص یک", DictionaryName = "UnitIndex1"
     };
 }
Beispiel #16
0
 public void Load(UnitIndexDTO unitIndexParam, ActionType actionTypeParam)
 {
     actionType = actionTypeParam;
     UnitIndex  = unitIndexParam;
 }