예제 #1
0
 public JobIndexInPeriodDTO AddJobIndexInPeriod(JobIndexInPeriodDTO jobIndexInPeriod)
 {
     return(IntegrationHttpClient.Post <JobIndexInPeriodDTO, JobIndexInPeriodDTO>(apiUri,
                                                                                  makeEndPoint(jobIndexInPeriod.PeriodId), jobIndexInPeriod));
     //var url = string.Format(baseAddress + makeApiAdress(jobIndexInPeriod.PeriodId));
     //IntegrationWebClient.Post(new Uri(url, PMSClientConfig.UriKind), action, jobIndexInPeriod, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
 }
예제 #2
0
 public override AbstractIndexInPeriodDTO MapToModel(AbstractJobIndex entity)
 {
     if (entity is JobIndex)
     {
         var res = new JobIndexInPeriodDTO()
         {
             Id               = entity.Id.Id,
             PeriodId         = entity.PeriodId.Id,
             Name             = ((JobIndex)entity).Name,
             DictionaryName   = ((JobIndex)entity).DictionaryName,
             ParentId         = ((JobIndex)entity).Group.Id.Id,
             JobIndexId       = ((JobIndex)entity).SharedJobIndexId.Id,
             IsInquireable    = ((JobIndex)entity).IsInquireable,
             CalculationLevel = ((JobIndex)entity).CalculationLevel,
             CalculationOrder = ((JobIndex)entity).CalculationOrder
         };
         return(res);
     }
     else
     {
         var res = new JobIndexGroupInPeriodDTO()
         {
             Id             = entity.Id.Id,
             PeriodId       = entity.PeriodId.Id,
             Name           = ((JobIndexGroup)entity).Name,
             DictionaryName = ((JobIndexGroup)entity).DictionaryName,
         };
         if (((JobIndexGroup)entity).Parent != null)
         {
             res.ParentId = ((JobIndexGroup)entity).Parent.Id.Id;
         }
         return(res);
     }
 }
예제 #3
0
        public void ShowJobIndexInPeriodView(JobIndexInPeriodDTO jobIndexInPeriod, ActionType action)
        {
            var view = ServiceLocator.Current.GetInstance <IJobIndexInPeriodView>();

            ((JobIndexInPeriodVM)view.ViewModel).Load(jobIndexInPeriod, action);
            viewManager.ShowInDialog(view);
        }
예제 #4
0
        public void Load(JobIndexInPeriodDTO jobIndexInPeriodParam, ActionType actionTypeParam)
        {
            actionType       = actionTypeParam;
            JobIndexInPeriod = jobIndexInPeriodParam;

            if (actionType == ActionType.ModifyJobIndexInPeriod)
            {
                JobIndexIsReadOnly = false;
                ShowBusyIndicator("در حال دریافت اطلاعات...");
                jobIndexService.GetJobIndex((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp == null)
                    {
                        JobIndexList = new List <JobIndexDTO>()
                        {
                            res
                        };
                        SelectedJobIndex = res;
                    }
                    else
                    {
                        appController.HandleException(exp);
                    }
                }), JobIndexInPeriod.JobIndexId);
            }
            else
            {
                preLoad();
            }
        }
예제 #5
0
        public AbstractIndexInPeriodDTO UpdateJobIndex(JobIndexInPeriodDTO abstractIndex)
        {
            var jobIndex = jobIndexService.UpdateJobIndex(new AbstractJobIndexId(abstractIndex.Id)
                                                          , new AbstractJobIndexId(abstractIndex.ParentId.Value)
                                                          , abstractIndex.CustomFields.ToDictionary(itm => new SharedJobIndexCustomFieldId(itm.Id), itm => itm.Value),
                                                          abstractIndex.IsInquireable, abstractIndex.CalculationOrder, abstractIndex.CalculationLevel
                                                          );

            return(jobIndexMapper.MapToModel(jobIndex));
        }
예제 #6
0
        public void DoAction(JobIndexInPeriodTreeVM vm)
        {
            if (vm.SelectedAbstractIndexInPeriod == null)
            {
                return;
            }
            var jobIndexInPeriod = new JobIndexInPeriodDTO();

            jobIndexInPeriod.PeriodId = vm.Period.Id; //vm.PeriodAbstractIndexes.PeriodId;
            jobIndexInPeriod.ParentId = vm.SelectedAbstractIndexInPeriod.Data.Id;

            periodController.ShowJobIndexInPeriodView(jobIndexInPeriod, ActionType.AddJobIndexInPeriod);
        }
예제 #7
0
        private JobIndexInPeriodDTO createPeriodJobIndexDTO(JobIndexDTO jobIndex, Period period,
                                                            JobIndexIntegrationDTO sourceJobIndexDTO)
        {
            var res = new JobIndexInPeriodDTO
            {
                //todo: Kharabe

                CalculationOrder = 1,
                IsInquireable    = true,
                Name             = jobIndex.Name,
                DictionaryName   = jobIndex.DictionaryName,
                JobIndexId       = jobIndex.Id,
                PeriodId         = period.Id,
                CustomFields     = jobIndex.CustomFields.Select(c => new AbstractCustomFieldDescriptionDTO
                {
                    Id    = c.Id,
                    Name  = "fake",
                    Value = "1"
                }).ToList()
            };

            if (sourceJobIndexDTO.IndexType == PMSIntegrationCoreConstantData.IntegrationBehaviaralJobIndexId)
            {
                res.ParentId         = PMSCostantData.JobIndexGroupBehaviaral;
                res.CalculationLevel = 1;
            }
            else if (sourceJobIndexDTO.IndexType == PMSIntegrationCoreConstantData.IntegrationPerformanceJobIndexId)
            {
                res.ParentId         = PMSCostantData.JobIndexGroupPerformance;
                res.CalculationLevel = 2;
            }
            else
            {
                throw new Exception("Invalid index type in source job index (employee management system)");
            }
            return(res);
        }
예제 #8
0
        public void UpdateJobIndexInPeriod(Action <JobIndexInPeriodDTO, Exception> action, JobIndexInPeriodDTO jobIndexInPeriod)
        {
            //action(jobIndexInPeriod, null);
            //var url = string.Format(baseAddress + "?Id=" + jobIndexInPeriod.Id);
            //WebClientHelper.Put<JobIndexInPeriod, JobIndexInPeriod>(new Uri(url, UriKind.Absolute),
            //    (res, exp) => action(res, exp), jobIndexInPeriod,
            //    WebClientHelper.MessageFormat.Json);
            var url = string.Format(baseAddress + makeApiAdress(jobIndexInPeriod.PeriodId));

            WebClientHelper.Put(new Uri(url, PMSClientConfig.UriKind), action, jobIndexInPeriod, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
예제 #9
0
 private void init()
 {
     JobIndexInPeriod   = new JobIndexInPeriodDTO();
     DisplayName        = PeriodMgtAppLocalizedResources.JobIndexInPeriodViewTitle;
     JobIndexIsReadOnly = true;
 }