protected override ElementBaseRectangle CreateElement(double left, double top)
		{
			var element = new ElementPassCardTextProperty() { Left = left, Top = top };
			element.OrganisationUID = _organisationUID;
			var propertiesViewModel = new PassCardTextPropertyViewModel(element, DesignerCanvas);
			return DialogService.ShowModalWindow(propertiesViewModel) ? element : null;
		}
		public PassCardTextPropertyViewModel(ElementPassCardTextProperty element, CommonDesignerCanvas designerCanvas)
			: base(element, designerCanvas)
		{
			Title = "Свойства фигуры: Текстовое свойство";
			PropertyTypes = new ObservableCollection<PassCardTextPropertyType>(Enum.GetValues(typeof(PassCardTextPropertyType)).Cast<PassCardTextPropertyType>());
			_organisationUID = element.OrganisationUID;
		}
Exemplo n.º 3
0
		void ResolveTextProperty(ElementPassCardTextProperty elementTextProperty)
		{
			elementTextProperty.PresentationName = GetEnumDescription(elementTextProperty.PropertyType);
			switch (elementTextProperty.PropertyType)
			{
				case PassCardTextPropertyType.Birthday:
					elementTextProperty.Text = _employee.BirthDate.ToShortDateString();
					break;
				case PassCardTextPropertyType.Department:
					elementTextProperty.Text = _department != null ? _department.Name : "";
					break;
				case PassCardTextPropertyType.EndDate:
					elementTextProperty.Text = _card.EndDate.ToShortDateString();
					break;
				case PassCardTextPropertyType.FirstName:
					elementTextProperty.Text = _employee.FirstName;
					break;
				case PassCardTextPropertyType.LastName:
					elementTextProperty.Text = _employee.LastName;
					break;
				case PassCardTextPropertyType.Organisation:
					elementTextProperty.Text = _organisation.Name;
					break;
				case PassCardTextPropertyType.Position:
					elementTextProperty.Text = _position != null ? _position.Name : "";
					break;
				case PassCardTextPropertyType.SecondName:
					elementTextProperty.Text = _employee.SecondName;
					break;
				case PassCardTextPropertyType.CardNumber:
					elementTextProperty.Text = _card.Number.ToString();
					break;
				case PassCardTextPropertyType.Additional:
					var columnValue = _employee.AdditionalColumns.FirstOrDefault(x => x.AdditionalColumnTypeUID == elementTextProperty.AdditionalColumnUID);
					elementTextProperty.Text = columnValue == null || columnValue.TextData == null ? string.Empty : columnValue.TextData;
					break;
				default:
					elementTextProperty.Text = string.Empty;
					break;
			}
		}