Beispiel #1
0
 public void SetWorkTypes(List <KVPBase> data)
 {
     data = data.OrderBy(p => p.Name).ToList();
     WorkTypes.Clear();
     data.ForEach(o => WorkTypes.Add(o));
     if (LoadWorkTypesComplete != null)
     {
         LoadWorkTypesComplete(this, new EventArgs());
     }
 }
        private void OnAddWorkType()
        {
            if (WorkTypes == null)
            {
                WorkTypes = new ObservableCollection <WorkTypeTileViewModel>();
            }
            var newWorkType = new WorkTypeTileViewModel(this);

            WorkTypes.Add(newWorkType);
            newWorkType.OnEdit();
            Parent.WasChanged = true;
        }
        public JobMarketViewModel(int countryID, IEnumerable <Entities.Country> countries, CountryBestJobOffers bestJobs)
        {
            CountryID = countryID;

            foreach (var country in countries)
            {
                Countries.Add(new SelectListItem()
                {
                    Value = country.ID.ToString(),
                    Text  = country.Entity.Name
                });

                if (country.ID == CountryID)
                {
                    MinMax = new JobMarketBestViewModel(country, bestJobs);
                }
            }
            foreach (WorkTypeEnum workType in Enum.GetValues(typeof(WorkTypeEnum)))
            {
                WorkTypes.Add(new SelectListItem()
                {
                    Value    = ((int)workType).ToString(),
                    Text     = workType.ToString(),
                    Selected = (workType == WorkTypeEnum.Any)
                });
            }

            foreach (JobOfferTypeEnum offerType in Enum.GetValues(typeof(JobOfferTypeEnum)))
            {
                OfferTypes.Add(new SelectListItem()
                {
                    Text  = offerType.ToString(),
                    Value = ((int)offerType).ToString()
                });
            }
        }
Beispiel #4
0
        /// <summary>
        /// Create or set the Out Of Office of current user
        /// </summary>
        /// <param name="wrapper">The Out Of Office criteria</param>
        /// <returns>Success(true) or Fail(False)</returns>
        public bool SetOutOfOffice(OOFWrapper wrapper)
        {
            if (wrapper.WorkType == null)
            {
                _connection.SetUserStatus(Convert.ToBoolean(wrapper.Status) ? UserStatuses.Available : UserStatuses.OOF);
                return(false);
            }


            bool           isNew          = false;
            WorklistShares worklistShares = new WorklistShares();

            worklistShares = _connection.GetCurrentSharingSettings(ShareType.OOF);
            WorklistShare worklistShare = null;

            if (worklistShares.Count > 0)
            {
                worklistShare           = worklistShares[0];
                worklistShare.ShareType = ShareType.OOF;
            }
            else
            {
                isNew = true;
            }

            if (worklistShare == null)
            {
                worklistShare           = new WorklistShare();
                worklistShare.ShareType = ShareType.OOF;
                isNew = true;
            }


            worklistShare.StartDate = wrapper.StartDate;
            worklistShare.EndDate   = wrapper.EndDate;

            WorkTypes workTypes = worklistShare.WorkTypes;
            WorkType  workType  = new WorkType();

            if (workTypes.Count > 0)
            {
                workType = workTypes[0];
            }
            else
            {
                workType = new WorkType();
                workTypes.Add(workType);
            }
            workType.Name = Guid.NewGuid().ToString();
            Destinations destinations = new Destinations();

            foreach (DestinationDto dest in wrapper.WorkType.Destinations)
            {
                var destination = new Destination(dest.LoginName.FQNWithK2Label(), DestinationType.User);
                destinations.Add(destination);
            }

            workType.Destinations       = destinations;
            workType.WorkTypeExceptions = GetWorkTypeExceptions(wrapper.WorkType.WorkTypeExceptions);
            worklistShare.WorkTypes     = workTypes;

            if (isNew)
            {
                _connection.ShareWorkList(worklistShare);
            }
            _connection.UpdateWorkType(worklistShare.WorkTypes[0]);
            _connection.SetUserStatus(Convert.ToBoolean(wrapper.Status) ? UserStatuses.Available : UserStatuses.OOF);


            return(true);
        }
Beispiel #5
0
        async void CheckMaterialFiles()
        {
            var client = new RestClient(HOST_URL);
            //var client = new RestClient("http://sbl-crm-project-pafik13.c9users.io:8080/");
            var request = new RestRequest("/MaterialFile?type=for_hospital&populate=false&limit=50", Method.GET);

            var response = await client.ExecuteGetTaskAsync <List <MaterialFile> >(request);

            if (!CancelToken.IsCancellationRequested)
            {
                switch (response.StatusCode)
                {
                case HttpStatusCode.OK:
                case HttpStatusCode.Created:
                    SDiag.Debug.WriteLine("MaterialFile: {0}", response.Data.Count);
                    MaterialFiles.Clear();
                    foreach (var item in response.Data)
                    {
                        if (!MainDatabase.IsSavedBefore <MaterialFile>(item.uuid))
                        {
                            if (!string.IsNullOrEmpty(item.s3Location))
                            {
                                MaterialFiles.Add(item);
                            }
                        }
                    }

                    RunOnUiThread(() => {
                        int count = MaterialFiles.Count + WorkTypes.Count + LibraryFiles.Count;
                        FindViewById <TextView>(Resource.Id.saUpdateEntitiesCount).Text = string.Format("Необходимо обновить {0} объектов", count);
                    });
                    break;
                }
                SDiag.Debug.WriteLine(response.StatusDescription);
            }

            request = new RestRequest("/WorkType?populate=false", Method.GET);

            var responseWTs = await client.ExecuteGetTaskAsync <List <WorkType> >(request);

            if (!CancelToken.IsCancellationRequested)
            {
                switch (responseWTs.StatusCode)
                {
                case HttpStatusCode.OK:
                case HttpStatusCode.Created:
                    SDiag.Debug.WriteLine("WorkType: {0}", responseWTs.Data.Count);
                    WorkTypes.Clear();
                    foreach (var item in responseWTs.Data)
                    {
                        if (!MainDatabase.IsSavedBefore <WorkType>(item.uuid))
                        {
                            if (!string.IsNullOrEmpty(item.name))
                            {
                                WorkTypes.Add(item);
                            }
                        }
                    }

                    RunOnUiThread(() => {
                        int count = MaterialFiles.Count + WorkTypes.Count + LibraryFiles.Count;
                        FindViewById <TextView>(Resource.Id.saUpdateEntitiesCount).Text = string.Format("Необходимо обновить {0} объектов", count);
                    });
                    break;
                }
                SDiag.Debug.WriteLine(response.StatusDescription);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Create or set the Out Of Office of current user
        /// </summary>
        /// <param name="wrapper">The Out Of Office criteria</param>
        /// <returns>Success(true) or Fail(False)</returns>
        public bool SetOutOfOffice(OOFWrapper wrapper)
        {
            if (wrapper.WorkType == null)
            {
                using (Connection workflowClient = this.GetWorkflowClient()) {
                    workflowClient.SetUserStatus(Convert.ToBoolean(wrapper.Status) ? UserStatuses.Available : UserStatuses.OOF);
                }

                return(false);
            }

            using (Connection workflowClient = this.GetWorkflowClient()) {
                bool           isNew          = false;
                WorklistShares worklistShares = new WorklistShares();
                worklistShares = workflowClient.GetCurrentSharingSettings(ShareType.OOF);
                WorklistShare worklistShare = null;
                if (worklistShares.Count > 0)
                {
                    worklistShare           = worklistShares[0];
                    worklistShare.ShareType = ShareType.OOF;
                }
                else
                {
                    isNew = true;
                }

                if (worklistShare == null)
                {
                    worklistShare           = new WorklistShare();
                    worklistShare.ShareType = ShareType.OOF;
                    isNew = true;
                }


                worklistShare.StartDate = wrapper.StartDate;
                worklistShare.EndDate   = wrapper.EndDate;

                WorkTypes workTypes = worklistShare.WorkTypes;
                WorkType  workType  = new WorkType();

                if (workTypes.Count > 0)
                {
                    workType = workTypes[0];
                }
                else
                {
                    workType = new WorkType();
                    workTypes.Add(workType);
                }
                workType.Name = Guid.NewGuid().ToString();
                Destinations destinations = new Destinations();

                foreach (DestinationDto dest in wrapper.WorkType.Destinations)
                {
                    if (SecurityLabelUtils.IsCorrectUserName(dest.LoginName))
                    {
                        var destination = new K2.Destination(SecurityLabelUtils.GetNameWithLabel(dest.LoginName), DestinationType.User);
                        destinations.Add(destination);
                    }
                }

                workType.Destinations       = destinations;
                workType.WorkTypeExceptions = GetWorkTypeExceptions(wrapper.WorkType.WorkTypeExceptions);
                worklistShare.WorkTypes     = workTypes;

                if (isNew)
                {
                    workflowClient.ShareWorkList(worklistShare);
                }
                workflowClient.UpdateWorkType(worklistShare.WorkTypes[0]);
                workflowClient.SetUserStatus(Convert.ToBoolean(wrapper.Status) ? UserStatuses.Available : UserStatuses.OOF);
            }

            return(true);
        }