private void editChecklists(EmployerForm source, EmployerUser dest) { foreach (var vacancy in source.Vacancies.OrderBy(x => x.CreationDate)) { var checklist = DataAccessLayer.GetById<Checklist>(vacancy.Id); if (checklist == null) { #if DEBUG throw new HttpException(404, "Checklist not found"); #endif #if RELEASE return; #endif } DataAccessLayer.ClearChecklist(checklist); foreach (var attribute in DataAccessLayer.GetAttributes(DataAccessLayer.Constants.EmployerChecklistType.Id)) { var attributeValue = new AttribValue { AttribId = attribute.Id, ChecklistId = checklist.Id }; switch (attribute.Code) { case Constants.SalaryCode: attributeValue.Value = vacancy.Salary; break; case Constants.WorkCode: attributeValue.Value = vacancy.Work; break; case Constants.AboutCode: attributeValue.Value = vacancy.FullDescription; break; case Constants.StartWorkCode: attributeValue.Value = vacancy.StartTime.ToPandaString(); break; case Constants.EndWorkCode: attributeValue.Value = vacancy.EndTime.ToPandaString(); break; case Constants.CityCode: attributeValue.Value = vacancy.City; break; case Constants.GenderCode: attributeValue.Value = vacancy.Gender; break; } checklist.AttrbuteValues.Add(attributeValue); } } }
public override bool Compare(AttribValue storedValue, object value) { var castedValue = (IEnumerable<DictValue>)value; if (storedValue != null) { var entityListId = Guid.Parse(storedValue.Value); var storedDesiredWork = DataAccessLayer.GetById<EntityList>(entityListId).DesiredWork.Select(x => x.Work); return castedValue.All(x => storedDesiredWork.Contains(x)); } else { return castedValue == null; } }
private void editMainParam(EmployerForm source, EmployerUser dest) { dest.Email = source.Email; dest.IsAdmin = source.IsAdmin; var checklist = dest.MainChecklist; if (checklist == null) { #if DEBUG throw new HttpException(404, "Checklist not found"); #endif #if RELEASE return; #endif } var mainAlbum = dest.Albums.First(); if (source.NewPhotos != null) { foreach (var photo in source.NewPhotos) { DataAccessLayer.Create(new Photo { Album = DataAccessLayer.GetById<Album>(mainAlbum.Id), SourceUrl = ImageCreator.SavePhoto(photo) }); } } DataAccessLayer.ClearChecklist(checklist); foreach (var attribute in DataAccessLayer.GetAttributes(DataAccessLayer.Constants.EmployerMainChecklistType.Id)) { var attributeValue = new AttribValue { AttribId = attribute.Id, ChecklistId = checklist.Id }; #region Big switch [TODO by code field] switch (attribute.Code) { case Constants.AboutCode: attributeValue.Value = source.About; break; case Constants.EmployerNameCode: attributeValue.Value = source.EmployerName; break; case Constants.AddressCode: attributeValue.Value = source.Address; break; case Constants.MobilePhoneCode: attributeValue.Value = source.MobilePhone; break; case Constants.CityCode: attributeValue.Value = source.City; break; } #endregion checklist.AttrbuteValues.Add(attributeValue); } }
public void Edit(Promouter source, PromouterUser dest) { //source.Email = dest.Email; var checklist = dest.Checklists.FirstOrDefault(); if (checklist == null) { #if DEBUG throw new HttpException(404, "Checklist not found"); #endif #if RELEASE return; #endif } checklist.AttrbuteValues.Clear(); foreach (var attribute in Attributes) { var attributeValue = new AttribValue { AttribId = attribute.Id, ChecklistId = checklist.Id }; #region Big switch [TODO by code field] switch (attribute.Name) { case "Фамилия": //TODO break; case "Имя": attributeValue.Value = source.Name; break; case "Отчество": //TODO break; case "Пол": //TODO break; case "Дата рождения": attributeValue.Value = source.BirthDate.ToPandaString(); break; case "Медицинская книжка": attributeValue.Value = source.MedicalBook.ToPandaString(); break; case "Автомобиль": attributeValue.Value = source.Car.ToPandaString(); break; case "Готов работать сейчас": //TODO break; case "Мобильный телефон": attributeValue.Value = source.MobilePhone; break; case "Цена работы за час": attributeValue.Value = source.CostForHour.ToPandaString(); break; case "Город": attributeValue.Value = source.City; break; case "Образование": attributeValue.Value = source.Education; break; case "Опыт работы": //TODO break; case "Рост": attributeValue.Value = source.Height.ToPandaString(); break; case "Телосложение": attributeValue.Value = source.Build; break; case "Вес": attributeValue.Value = source.Weight.ToPandaString(); break; case "Тип кожи": attributeValue.Value = source.SkinType; break; case "Цвет глаз": attributeValue.Value = source.EyeColor; break; case "Цвет волос": attributeValue.Value = source.HairColor; break; case "Длина волос": attributeValue.Value = source.HairLength; break; case "Размер одежды": attributeValue.Value = source.SizeClothes; break; case "Размер обуви": attributeValue.Value = source.SizeShoes; break; case "Размер груди": attributeValue.Value = source.SizeChest; break; case "Роликовые коньки": attributeValue.Value = source.RollerSkates.ToPandaString(); break; case "Зимние коньки": attributeValue.Value = source.WinterSkates.ToPandaString(); break; } #endregion checklist.AttrbuteValues.Add(attributeValue); } }
public override bool Compare(AttribValue storedValue, object value) { var castedValue = (IEnumerable<DictValue>)value; if (storedValue != null) { return castedValue.Any(x => x.Code == storedValue.Value); } else { return castedValue == null; } }
public abstract bool Compare(AttribValue storedValue, object value);
public override bool Compare(AttribValue storedValue, object value) { if (storedValue != null) { dynamic tmp = value; return storedValue.Value == tmp.ToPandaString(); } else { return value != null; } }
public override bool Compare(AttribValue storedValue, object value) { if (storedValue != null) { return value.ToString() == storedValue.Value; } else { return value == null; } }
public void Edit(PromouterForm source, PromouterUser dest) { dest.Email = source.Email; dest.IsAdmin = source.IsAdmin; var checklist = dest.MainChecklist; if (checklist == null) { #if DEBUG throw new HttpException(404, "Checklist not found"); #endif #if RELEASE return; #endif } var mainAlbum = dest.Albums.First(); if (source.NewPhotos != null) { foreach (var photo in source.NewPhotos) { DataAccessLayer.Create(new Photo { Album = DataAccessLayer.GetById<Album>(mainAlbum.Id), SourceUrl = ImageCreator.SavePhoto(photo) }); } } DataAccessLayer.ClearChecklist(checklist); foreach (var attribute in DataAccessLayer.GetAttributes(DataAccessLayer.Constants.PromouterChecklistType.Id)) { var attributeValue = new AttribValue { AttribId = attribute.Id, ChecklistId = checklist.Id }; #region Big switch [TODO by code field] switch (attribute.Code) { case Constants.LastNameCode: attributeValue.Value = source.LastName; break; case Constants.FirstNameCode: attributeValue.Value = source.FirstName; break; case Constants.MiddleNameCode: attributeValue.Value = source.MiddleName; break; case Constants.GenderCode: attributeValue.Value = source.Gender; break; case Constants.DateOfBirthCode: attributeValue.Value = source.BirthDate.ToPandaString(); break; case Constants.MedicalBookCode: attributeValue.Value = source.MedicalBook.ToString(); break; case Constants.CarCode: attributeValue.Value = source.Car.ToString(); break; case Constants.ReadyForWorkCode: attributeValue.Value = source.ReadyForWork.ToString(); break; case Constants.MobilePhoneCode: attributeValue.Value = source.MobilePhone; break; case Constants.SalaryCode: attributeValue.Value = source.Salary; break; case Constants.CityCode: attributeValue.Value = source.City; break; case Constants.EducationCode: attributeValue.Value = source.Education; break; case Constants.WorkExperienceCode: attributeValue.Value = editWorkExperience(source); break; case Constants.HeightCode: attributeValue.Value = source.Height.ToPandaString(); break; case Constants.BuildCode: attributeValue.Value = source.Build; break; case Constants.WeightCode: attributeValue.Value = source.Weight.ToString(CultureInfo.InvariantCulture); break; case Constants.SkinTypeCode: attributeValue.Value = source.SkinType; break; case Constants.EyeColorCode: attributeValue.Value = source.EyeColor; break; case Constants.HairColorCode: attributeValue.Value = source.HairColor; break; case Constants.HairLengthCode: attributeValue.Value = source.HairLength; break; case Constants.SizeClothesCode: attributeValue.Value = source.SizeClothes; break; case Constants.SizeShoesCode: attributeValue.Value = source.SizeShoes; break; case Constants.SizeChestCode: attributeValue.Value = source.SizeChest; break; case Constants.RollerSkatesCode: attributeValue.Value = source.RollerSkates.ToString(); break; case Constants.WinterSkatesCode: attributeValue.Value = source.WinterSkates.ToString(); break; case Constants.AboutCode: attributeValue.Value = source.About; break; case Constants.HobbiesCode: attributeValue.Value = source.Hobbies; break; case Constants.DesiredWorkTimeCode: attributeValue.Value = editDesiredWorkTime(source); break; case Constants.DesiredWorkCode: attributeValue.Value = editDesiredWork(source); break; } #endregion checklist.AttrbuteValues.Add(attributeValue); } }