public void Initialize(Guid? id) { var isNew = id == null; if (isNew) { Organisation = new OrganisationDetails() { Name = "Организация" }; Organisation.UserUIDs.Add(ClientManager.CurrentUser.UID); } else { Organisation = OrganisationHelper.GetDetails(id.Value); } if (Organisation.Photo != null && Organisation.Photo.Data != null) { photoData = string.Format("data:image/gif;base64,{0}", Convert.ToBase64String(Organisation.Photo.Data)); Organisation.Photo.Data = null; } var filter = new EmployeeFilter { LogicalDeletationType = LogicalDeletationType.All, UIDs = new List<Guid> { Organisation.ChiefUID }, IsAllPersonTypes = true }; var chiefOperationResult = EmployeeHelper.Get(filter); SelectedChief = chiefOperationResult.Select(e => ShortEmployeeModel.CreateFromModel(e)).FirstOrDefault(); filter.UIDs = new List<Guid> {Organisation.HRChiefUID}; var hrChiefOperationResult = EmployeeHelper.Get(filter); SelectedHRChief = hrChiefOperationResult.Select(e => ShortEmployeeModel.CreateFromModel(e)).FirstOrDefault(); }
public PassCardViewModel(Guid employeeUID, SKDCard card) { Title = "Печать удостоверения " + card.Number; _card = card; PrintCommand = new RelayCommand(OnPrint, CanPrint); _employee = EmployeeHelper.GetDetails(employeeUID); if (_employee.DepartmentUID != Guid.Empty && !_employee.IsDepartmentDeleted) _department = DepartmentHelper.GetDetails(_employee.DepartmentUID); if (_employee.PositionUID != Guid.Empty && !_employee.IsPositionDeleted) _position = PositionHelper.GetDetails(_employee.PositionUID); _organisation = OrganisationHelper.GetDetails(_employee.OrganisationUID); _passCardCanvas = new PassCardCanvas(); PassCardTemplates = new ObservableCollection<ShortPassCardTemplate>(PassCardTemplateHelper.GetByOrganisation(_organisation.UID)); ServiceFactory.Events.GetEvent<PainterFactoryEvent>().Unsubscribe(OnPainterFactoryEvent); ServiceFactory.Events.GetEvent<PainterFactoryEvent>().Subscribe(OnPainterFactoryEvent); SelectedPassCardTemplate = PassCardTemplates.FirstOrDefault(); }
public OrganisationDetailsViewModel(OrganisationsViewModel organisationsViewModel, Organisation organisation = null) { OrganisationsViewModel = organisationsViewModel; if (organisation == null) { IsNew = true; Title = "Создание новой организации"; OrganisationDetails = new OrganisationDetails() { Name = "Организация", }; OrganisationDetails.UserUIDs.Add(ClientManager.CurrentUser.UID); } else { Title = string.Format("Свойства организации: {0}", organisation.Name); OrganisationDetails = OrganisationHelper.GetDetails(organisation.UID); } CopyProperties(); ChiefViewModel = new EmployeeSelectationViewModel(OrganisationDetails.ChiefUID, new EmployeeFilter { OrganisationUIDs = new List<Guid> { OrganisationDetails.UID } }); HRChiefViewModel = new EmployeeSelectationViewModel(OrganisationDetails.HRChiefUID, new EmployeeFilter { OrganisationUIDs = new List<Guid> { OrganisationDetails.UID } }); }
public OperationResult<bool> SaveOrganisation(Guid clientUID, OrganisationDetails item, bool isNew) { return SafeOperationCall(clientUID, () => RubezhService.SaveOrganisation(clientUID, item, isNew), "SaveOrganisation"); }
public OperationResult<bool> SaveOrganisation(OrganisationDetails item, bool isNew) { return SafeOperationCall(() => { var rubezhService = RubezhServiceFactory.Create(TimeSpan.FromMinutes(10)); using (rubezhService as IDisposable) return rubezhService.SaveOrganisation(RubezhServiceFactory.UID, item, isNew); }, "SaveOrganisation"); }
public static bool Save(OrganisationDetails organisation, bool isNew) { var result = ClientManager.RubezhService.SaveOrganisation(organisation, isNew); return Common.ThrowErrorIfExists(result); }
public OperationResult<bool> SaveOrganisation(Guid clientUID, OrganisationDetails item, bool isNew) { if (isNew) AddJournalMessage(JournalEventNameType.Редактирование_организации, item.Name, item.UID, clientUID, JournalEventDescriptionType.Добавление_организация, JournalObjectType.Organisation); else AddJournalMessage(JournalEventNameType.Редактирование_организации, item.Name, item.UID, clientUID, JournalEventDescriptionType.Редактирование_организация, JournalObjectType.Organisation); using (var databaseService = new RubezhDAL.DataClasses.DbService()) { return databaseService.OrganisationTranslator.Save(item); } }