Пример #1
0
        public void Initialize(Guid? organisationId, Guid? id, Guid? parentDepartmentId)
        {
            if (id.HasValue)
            {
                var departmentDetailsResult = DepartmentHelper.GetDetails(id.Value);
                Department = departmentDetailsResult;
            }
            else
            {
                Department = new Department
                {
                    Name = "Новое подразделение",
                    ParentDepartmentUID = parentDepartmentId ?? Guid.Empty,
                    OrganisationUID = organisationId.Value
                };
            }

            var filter = new DepartmentFilter();
            filter.UIDs.Add(Department.ParentDepartmentUID);
            var departmentListResult = DepartmentHelper.Get(filter);
            SelectedDepartment = departmentListResult.FirstOrDefault();

            var employeeFilter = new EmployeeFilter { LogicalDeletationType = LogicalDeletationType.All, UIDs = new List<Guid> { Department.ChiefUID }, IsAllPersonTypes = true };
            var chiefResult = EmployeeHelper.Get(employeeFilter);
            SelectedChief = chiefResult.Select(e => ShortEmployeeModel.CreateFromModel(e)).FirstOrDefault();

            if (Department.Photo != null && Department.Photo.Data != null)
            {
                photoData = string.Format("data:image/gif;base64,{0}", Convert.ToBase64String(Department.Photo.Data));
                Department.Photo.Data = null;
            }
        }
Пример #2
0
		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();
		}
Пример #3
0
		public static bool Save(Department department, bool isNew)
		{
			var result = ClientManager.RubezhService.SaveDepartment(department, isNew);
			return Common.ThrowErrorIfExists(result);
		}
Пример #4
0
		public OperationResult<bool> SaveDepartment(Guid clientUID, Department item, bool isNew)
		{
			return SafeOperationCall(clientUID, () => RubezhService.SaveDepartment(clientUID, item, isNew), "SaveDepartment");
		}
Пример #5
0
		public OperationResult<bool> SaveDepartment(Department item, bool isNew)
		{
			return SafeOperationCall(() =>
			{
				var rubezhService = RubezhServiceFactory.Create(TimeSpan.FromMinutes(10));
				using (rubezhService as IDisposable)
					return rubezhService.SaveDepartment(RubezhServiceFactory.UID, item, isNew);
			}, "SaveDepartment");
		}
Пример #6
0
		public OperationResult<bool> SaveDepartment(Guid clientUID, Department item, bool isNew)
		{
			if (isNew)
				AddJournalMessage(JournalEventNameType.Редактирование_отдела, item.Name, item.UID, clientUID, JournalEventDescriptionType.Добавление_отдел, JournalObjectType.Department);
			else
				AddJournalMessage(JournalEventNameType.Редактирование_отдела, item.Name, item.UID, clientUID, JournalEventDescriptionType.Редактирование_отдел, JournalObjectType.Department);
			using (var databaseService = new RubezhDAL.DataClasses.DbService())
			{
				return databaseService.DepartmentTranslator.Save(item);
			}
		}