Пример #1
0
 public void IsValid()
 {
     var item = new TagDto(TagCategory.Appointment)
     {
         Name = Guid.NewGuid().ToString(),
     };
     Assert.IsTrue(item.IsValid());
 }
Пример #2
0
        public AddFolderViewModel()
            : base()
        {
            PluginContext.Host.UserConnected += (sender, e) => this.component = PluginContext.ComponentFactory.GetInstance<IMedicalRecordComponent>();

            this.tagToAdd = new TagDto(TagCategory.MedicalRecord);
            this.AddFolderCommand = new RelayCommand(() => this.AddFolder(), () => this.CanAddFolder());
        }
Пример #3
0
 public void IsInvalid()
 {
     var item = new TagDto(TagCategory.Appointment)
     {
         Name = string.Empty,
     };
     Assert.IsFalse(item.IsValid());
 }
Пример #4
0
        private void Add()
        {
            try
            {
                var tag = new TagDto(TagCategory.Appointment) { Name = this.Value, };

                Component.Create(tag);

                this.Close();
                PluginContext.Host.WriteStatus(StatusType.Info, Messages.Msg_CategoryAdded);
            }
            catch (Exception ex) { this.Handle.Error(ex); }
        }
        private void Add()
        {
            try
            {
                this.component.Create(this.Tag);

                this.Tag = new TagDto(TagCategory.Doctor);
                PluginContext.Host.WriteStatus(StatusType.Info, Messages.Msg_DataSaved);
            }
            catch (ExistingItemException ex) { this.Handle.Warning(ex, ex.Message); }
            catch (Exception ex) { this.Handle.Error(ex, Messages.Msg_ErrorOccured); }
            finally { this.Close(); }
        }
        private void Add()
        {
            try
            {
                var tag = new TagDto(TagCategory.Pathology) { Name = this.CategoryName };

                Component.Create(tag);

                this.Close();
                PluginContext.Host.WriteStatus(StatusType.Info, Messages.Msg_CategoryAdded);
                this.Close();
            }
            catch (ExistingItemException ex) { this.Handle.Warning(ex, ex.Message); }
            catch (Exception ex)
            {
                this.Handle.Error(ex);
                this.Close();
            }
        }
Пример #7
0
 public static void SetStamp(DependencyObject target, TagDto value)
 {
     target.SetValue(StampProperty, value);
 }
Пример #8
0
 public TagViewModel()
 {
     Tag   = new TagDto();
     IsNew = true;
 }
Пример #9
0
 /// <summary>
 /// Gets the pictures for the specified patient and with the specified tag.
 /// If the specified tag is null, it'll select all the picture of the specified
 /// patient
 /// </summary>
 /// <param name="patient">The patient.</param>
 /// <param name="tag">The criteria of the search. If null, it'll take all the picture for the specified patient</param>
 /// <returns>
 /// A list of pictures
 /// </returns>
 public IList<PictureDto> GetPictures(LightPatientDto patient, TagDto tag)
 {
     IList<Picture> pictures = this.GetEntityPictures(patient, tag);
     return Mapper.Map<IList<Picture>, IList<PictureDto>>(pictures);
 }
Пример #10
0
        public async Task <JsonResult> UpdateTag([FromBody] TagDto vm)
        {
            await _tagService.UpdateTagAsync(vm);

            return(Json(OkReturnString));
        }
Пример #11
0
 public TagViewModel(TagDto tag)
 {
     Tag = tag;
     IsNew = false;
 }
Пример #12
0
 public long Create(TagDto tag)
 {
     return new Creator(this.Session).Create(tag);
 }
Пример #13
0
 public TagDto Tag(TagDto tagModel)
 {
     return(this.tagService.CreateTag(tagModel));
 }
Пример #14
0
 public void UpdateTag(TagDto tag, int customerID)
 {
     TagServices.UpdateTag(tag, customerID);
 }
Пример #15
0
 public static void SetSpecialisation(DependencyObject target, TagDto value)
 {
     target.SetValue(SpecialisationProperty, value);
 }
Пример #16
0
 public void CreateTag(int customerID, TagDto tag)
 {
     TagServices.CreateTag(customerID, tag);
 }
Пример #17
0
        private (string tagFilterJson, string tagIncludedLoginsJson, string tagExcludedLoginsJson) GetTagAsJson(TagDto dto)
        {
            var filter         = new TagFilterDto();//dto.TagFilter;
            var includedLogins = dto.TagFilter.IncludedLogins;
            var excludedLogins = dto.TagFilter.ExcludedLogins;

            filter.IncludedLogins        = new Dictionary <int, List <int> >();
            filter.ExcludedLogins        = new Dictionary <int, List <int> >();
            filter.TagIds                = dto.TagFilter.TagIds;
            filter.XIds                  = dto.TagFilter.XIds;
            filter.Groups                = dto.TagFilter.Groups;
            filter.OperatorByCalculation = dto.TagFilter.OperatorByCalculation;
            filter.RegulationId          = dto.TagFilter.RegulationId;
            filter.ServerIds             = dto.TagFilter.ServerIds;

            var jFilter = JsonConvert.SerializeObject(filter);

            var jIncludedLogins = string.Empty;
            var jExcludedLogins = string.Empty;

            if (includedLogins.Any())
            {
                jIncludedLogins = JsonConvert.SerializeObject(includedLogins);
            }

            if (excludedLogins.Any())
            {
                jExcludedLogins = JsonConvert.SerializeObject(excludedLogins);
            }

            return(jFilter, jIncludedLogins, jExcludedLogins);
        }
Пример #18
0
        private IList<Picture> GetEntityPictures(LightPatientDto patient, TagDto tag)
        {
            IList<Picture> pictures = new List<Picture>();

            // If there's a null criterium, select all the pictures;
            // otherwise, execute a search
            if (tag == null)
            {
                pictures = (from p in this.Session.Query<Picture>()
                            where p.Patient.Id == patient.Id
                            select p).ToList();
            }
            else
            {
                pictures = (from p in this.Session.Query<Picture>()
                            where p.Patient.Id == patient.Id
                            && p.Tag.Id == tag.Id
                            select p).ToList();
            }

            return pictures;
        }
Пример #19
0
        /// <summary>
        /// Create the specified item into the database
        /// </summary>
        /// <param name="item">The item to add in the database</param>
        public long Create(TagDto item)
        {
            Assert.IsNotNull(item, "item");
            Assert.IsNotNull(item.Name, "item.Name");

            var exist = (from p in this.Session.Query<Tag>()
                         where (p.Name.ToUpper() == item.Name.ToUpper()
                             && p.Category == item.Category)
                             || p.Id == item.Id
                         select p).ToList().Count() > 0;
            if (exist) throw new ExistingItemException();

            var entity = Mapper.Map<TagDto, Tag>(item);
            item.Id = (long)this.Session.Save(entity);
            return item.Id;
        }
Пример #20
0
 /// <summary>
 /// Gets the doubloons of the specified doctor.
 /// </summary>
 /// <param name="firstName">The first name of the doctor.</param>
 /// <param name="lastName">The last name of the doctor.</param>
 /// <param name="specialisation">The specialisation of the doctor.</param>
 /// <param name="query">preloaded query to help optimisation.</param>
 /// <returns>
 /// An enumeration of doctor that are doubloons with the specified doctor
 /// </returns>
 public IEnumerable<LightDoctorDto> GetDoubloonsOf(string firstName, string lastName, TagDto specialisation)
 {
     return this.GetDoubloonsOf(firstName, lastName, specialisation, null);
 }
Пример #21
0
        public void TagOperation(TagViewModel tag)
        {
            _newTag = tag.Tag;

            TagService.BeginTagOperation(Operation.Id, tag.Tag.Id,EndTagOperation,null);
        }
Пример #22
0
        /// <summary>
        /// Sets the specified tag to the list of patients.
        /// </summary>
        /// <param name="tag">The tag to set.</param>
        /// <param name="patients">The patients.</param>
        public void SetTag(TagDto tag, IEnumerable<LightPatientDto> patients)
        {
            var eTag = GetTag(tag);

            var ePatients = this.Load(patients);
            foreach (var patient in ePatients)
            {
                patient.Tag = eTag;
                this.Session.Update(patient);
            }
        }
Пример #23
0
 /// <summary>
 /// Updates the specified tag.
 /// </summary>
 /// <param name="tag">The tag.</param>
 public void Update(TagDto tag)
 {
     new Updator(this.Session).Update(tag);
 }
Пример #24
0
        private void InitTestData()
        {
            _location = new LocationDto
            {
                Id     = Guid.NewGuid(),
                Cities = new List <CityDto>
                {
                    new CityDto
                    {
                        Id   = Guid.NewGuid(),
                        Name = "Minsk"
                    }
                },
                Country = "Belarus"
            };

            _vendor = new VendorDto
            {
                Id    = Guid.NewGuid(),
                Name  = "Vendor",
                Links = new List <LinkDto>
                {
                    new LinkDto
                    {
                        Type = LinkType.Website,
                        Url  = "v.com"
                    }
                },
                Addresses = new List <AddressDto>
                {
                    new AddressDto
                    {
                        Id        = 1,
                        CityId    = _location.Cities[0].Id,
                        CountryId = _location.Id,
                        Street    = "street"
                    }
                },
                Phones = new List <PhoneDto>
                {
                    new PhoneDto
                    {
                        Id     = 1,
                        Number = "+375441111111"
                    }
                }
            };

            _category = new CategoryDto
            {
                Id   = Guid.NewGuid(),
                Name = "Category"
            };

            _tag = new TagDto
            {
                Id         = Guid.NewGuid(),
                Name       = "Tag",
                CategoryId = _category.Id
            };

            _discount = new Discount
            {
                Id        = Guid.NewGuid(),
                PhonesIds = new List <int>
                {
                    _vendor.Phones.ElementAt(0).Id
                },
                CategoryId = _category.Id,
                Conditions = "Conditions",
                TagsIds    = new List <Guid> {
                    _tag.Id
                },
                VendorId   = _vendor.Id,
                VendorName = _vendor.Name,
                PromoCode  = "new promo code",
                StartDate  = DateTime.UtcNow.Date,
                EndDate    = DateTime.UtcNow.Date
            };

            _vendorSearch = new VendorSearch
            {
                Id         = _vendor.Id,
                Categories = new List <string> {
                    _category.Name
                },
                Tags = new List <string> {
                    _tag.Name
                },
                Discounts = new List <string> {
                    _discount.Conditions
                },
                Vendor = _vendor.Name,
                Cities = new List <string> {
                    _location.Cities[0].Name
                },
                Countries = new List <string> {
                    _location.Country
                },
                Streets = new List <string> {
                    _vendor.Addresses.ElementAt(0).Street
                }
            };

            _vendor.Discounts = new List <DiscountShortDto>
            {
                Mapper.Map <DiscountShortDto>(_discount)
            };
        }
 protected override void Insert()
 {
     this.component.Create(this.Tag);
     this.Tag = new TagDto(TagCategory.Doctor);
 }
Пример #26
0
 private void AssertJourneySpecificDataOnStandardTag(TagDto tagDto)
 {
     AssertEqualAndNotNull(_mode2.Title, tagDto.NextMode);
     AssertEqualAndNotNull(_responsible2.Code, tagDto.NextResponsibleCode);
     AssertEqualAndNotNull(_responsible2.Description, tagDto.NextResponsibleDescription);
 }
Пример #27
0
 public async Task <int> InsertTag([FromBody] TagDto vm)
 {
     return(await _tagService.InsertTagAsync(vm));
 }
Пример #28
0
        private IEnumerable<LightPatientDto> SetDefaultTagAsync()
        {
            var defaultName = "Patient";
            var defaultTag = this.Component.GetTag(defaultName);

            if (defaultTag == null) { defaultTag = new TagDto(TagCategory.Patient) { Name = defaultName }; }

            this.Component.SetTag(defaultTag, this.UntaggedPatients);
            return this.Component.GetUntaggedPatients();
        }
Пример #29
0
        private IEnumerable<LightDoctorDto> GetDoubloonsOf(string firstName, string lastName, TagDto specialisation, IQueryable<Doctor> query)
        {
            if (query == null) { query = this.Session.Query<Doctor>(); }

            var entities = (from doc in query
                            where doc.FirstName == firstName
                               && doc.LastName == lastName
                               && doc.Specialisation.Id == specialisation.Id
                            select doc).AsEnumerable();
            return Mapper.Map<IEnumerable<Doctor>, IEnumerable<LightDoctorDto>>(entities);
        }
Пример #30
0
 public IList<LightPictureDto> GetLightPictures(LightPatientDto patient, TagDto tag)
 {
     var pictures = GetEntityPictures(patient, tag);
     var result = Mapper.Map<IList<Picture>, IList<LightPictureDto>>(pictures);
     return result;
 }
        /// <summary>
        /// 取关
        /// </summary>
        /// <param name="groupName"></param>
        /// <param name="count"></param>
        public void UnfollowBatched(string groupName, int count)
        {
            _logger.LogInformation("【分组名】{group}", groupName);

            //根据分组名称获取tag
            TagDto tag   = GetTag(groupName);
            int?   tagId = tag?.Tagid;
            int    total = tag?.Count ?? 0;

            if (!tagId.HasValue)
            {
                _logger.LogWarning("分组名称不存在");
                return;
            }

            if (total == 0)
            {
                _logger.LogWarning("分组下不存在up");
                return;
            }

            if (count == -1)
            {
                count = total;
            }

            _logger.LogInformation("【分组下共有】{count}人", total);
            _logger.LogInformation("【目标取关】{count}人" + Environment.NewLine, count);

            //计算共几页
            int totalPage = (int)Math.Ceiling(total / (double)20);

            //从最后一页开始获取
            var req = new GetSpecialFollowingsRequest(long.Parse(_cookie.UserId), tagId.Value)
            {
                Pn = totalPage
            };
            List <UpInfo> followings = _relationApi.GetFollowingsByTag(req)
                                       .GetAwaiter().GetResult()
                                       .Data;

            followings.Reverse();

            var targetList = new List <UpInfo>();

            if (count <= followings.Count)
            {
                targetList = followings.Take(count).ToList();
            }
            else
            {
                int pn = totalPage;
                while (targetList.Count < count)
                {
                    targetList.AddRange(followings);

                    //获取前一页
                    pn -= 1;
                    if (pn <= 0)
                    {
                        break;
                    }
                    req.Pn     = pn;
                    followings = _relationApi.GetFollowingsByTag(req)
                                 .GetAwaiter().GetResult()
                                 .Data;
                    followings.Reverse();
                }
            }

            _logger.LogInformation("开始取关..." + Environment.NewLine);
            int success = 0;

            for (int i = 1; i <= targetList.Count && i <= count; i++)
            {
                UpInfo info = targetList[i - 1];

                _logger.LogInformation("【序号】{num}", i);
                _logger.LogInformation("【UP】{up}", info.Uname);

                string modifyReferer = string.Format(RelationApiConstant.ModifyReferer, _cookie.UserId, tagId);
                var    modifyReq     = new ModifyRelationRequest(info.Mid, _cookie.BiliJct);
                var    re            = _relationApi.ModifyRelation(modifyReq, modifyReferer)
                                       .GetAwaiter().GetResult();

                if (re.Code == 0)
                {
                    _logger.LogInformation("【取关结果】成功" + Environment.NewLine);
                    success++;
                }
                else
                {
                    _logger.LogInformation("【取关结果】失败");
                    _logger.LogInformation("【原因】{msg}" + Environment.NewLine, re.Message);
                }
            }

            _logger.LogInformation("【本次共取关】{count}人", success);

            //计算剩余
            tag = GetTag(groupName);
            _logger.LogInformation("【分组下剩余】{count}人", tag?.Count ?? 0);
        }
Пример #32
0
 private Tag GetTag(TagDto tag)
 {
     var eTag = (from t in this.Session.Query<Tag>()
                 where t.Id == tag.Id
                 select t).FirstOrDefault();
     if (eTag == null)
     {
         eTag = Mapper.Map<TagDto, Tag>(tag);
         var id = this.Session.Save(eTag);
         eTag = this.Session.Get<Tag>(id);
     }
     return eTag;
 }
Пример #33
0
 // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local
 private void AssertJourneySpecificDataOnSiteTag(TagDto tagDto)
 {
     Assert.IsNull(tagDto.NextMode);
     Assert.IsNull(tagDto.NextResponsibleCode);
     Assert.IsNull(tagDto.NextResponsibleDescription);
 }
Пример #34
0
 public string Insert([FromBody] TagDto doc)
 {
     return(_tagsDbService.InsertTag(doc));
 }
Пример #35
0
 /// <summary>
 /// Create the specified item into the database
 /// </summary>
 /// <param name="item">The item to add in the database</param>
 /// <returns>
 /// The id of the just created item
 /// </returns>
 public long Create(TagDto item)
 {
     return(new Creator(this.Session).Create(item));
 }
Пример #36
0
 public void Update([FromRoute] string docId, [FromBody] TagDto doc)
 {
     _tagsDbService.UpdateTag(new ObjectId(docId), doc);
 }
Пример #37
0
 public TagViewModel(TagDto tag)
 {
     Tag   = tag;
     IsNew = false;
 }
Пример #38
0
 public async Task CreateOrEditTag(TagDto input)
 {
     await _unitOfWork.Tags.CreateOrEditTag(input);
 }
Пример #39
0
 public async Task CreateTagAsync(TagDto tag)
 {
     await _bus.SendAsync(new StartTagCommand(tag.BlogId, tag.Url, tag.Title));
 }
Пример #40
0
 public async Task GetTagForEdit(TagDto input)
 {
     await _unitOfWork.Tags.GetTagForEdit(input);
 }
Пример #41
0
 public static void SetSpecialisation(DependencyObject target, TagDto value)
 {
     target.SetValue(SpecialisationProperty, value);
 }
Пример #42
0
 public List <TagDto> GetAllTag(TagDto input)
 {
     return(_unitOfWork.Tags.GetAllTag(input));
 }
Пример #43
0
 /// <summary>
 /// Determines whether this instance can remove the specified item.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>
 ///   <c>true</c> if this instance can remove the specified item; otherwise, <c>false</c>.
 /// </returns>
 public bool CanRemove(TagDto item)
 {
     return new Remover(this.Session).CanRemove(item);
 }
Пример #44
0
        /// <summary>
        /// Updates the specified tag.
        /// </summary>
        /// <param name="tag">The tag.</param>
        public void Update(TagDto tag)
        {
            var entity = Mapper.Map <TagDto, Tag>(tag);

            this.Session.Update(entity);
        }
Пример #45
0
 /// <summary>
 /// Removes item with the specified id.
 /// </summary>
 /// <param name="item"></param>
 public void Remove(TagDto item)
 {
     new Remover(this.Session).Remove(item);
 }
Пример #46
0
        private async Task CreateTagInPost(HttpClient httpClient, TagDto newTag)
        {
            var tagResult = await httpClient.PostAsJsonAsync(createTagUri, newTag);

            Assert.AreEqual(HttpStatusCode.NoContent, tagResult.StatusCode, "POST API method failed (for tag)");
        }
Пример #47
0
 public static void SetStamp(DependencyObject target, TagDto value)
 {
     target.SetValue(StampProperty, value);
 }
Пример #48
0
        private async Task EnsurePostHasTagDeleted(HttpClient httpClient, int newPostId, HttpResponseMessage getResult, TagDto newTag)
        {
            var getResult2 = await httpClient.GetAsync(getPostUri(newPostId));

            Assert.AreEqual(HttpStatusCode.OK, getResult.StatusCode, "GET API method failed (for post)");

            var postLoaded2 = new JavaScriptSerializer().Deserialize <PostDetailsModel>(getResult2.Content.ReadAsStringAsync().Result);

            Assert.IsFalse(postLoaded2.Tags.Contains(newTag.Tag));
        }
Пример #49
0
        private async Task DeleteTagFromPost(HttpClient httpClient, int newPostId, TagDto newTag)
        {
            var untagResult = await httpClient.DeleteAsync(createTagInPostUri(newPostId, newTag.Tag));

            Assert.AreEqual(HttpStatusCode.NoContent, untagResult.StatusCode, "DELETE API method failed (for tag)");
        }
Пример #50
0
        private async Task <HttpResponseMessage> GetPostWithTag(HttpClient httpClient, int newPostId, TagDto newTag)
        {
            var getResult = await httpClient.GetAsync(getPostUri(newPostId));

            Assert.AreEqual(HttpStatusCode.OK, getResult.StatusCode, "GET API method failed (for post)");

            var postLoaded = new JavaScriptSerializer().Deserialize <PostDetailsModel>(getResult.Content.ReadAsStringAsync().Result);

            Assert.IsTrue(postLoaded.Tags.Contains(newTag.Tag));
            return(getResult);
        }
Пример #51
0
 /// <summary>
 /// Create the specified item into the database
 /// </summary>
 /// <param name="item">The item to add in the database</param>
 /// <returns>
 /// The id of the just created item
 /// </returns>
 public long Create(TagDto item)
 {
     return new Creator(this.Session).Create(item);
 }
Пример #52
0
 public TagViewModel()
 {
     Tag = new TagDto();
     IsNew = true;
 }