示例#1
0
		public PartnerForm(Partner partner)
		{
			isEditing = true;
			InitializeComponent();
			//populate the form
			IdField.Text = partner.ID;
			IdField.IsEnabled = false;
			VatNField.Text = partner.VAT_NUMBER;
			NameField.Text = partner.PARTNER_NAME;
			AddressField.Text = partner.ADDRESS;
			PostCodeField.Text = partner.POST_CODE.ToString();
			AdditionalInfoField.Text = partner.ADDITIONAL_INFO;
		}
示例#2
0
		public bool Persist()
		{
			FiltrateForm();
			if (ValidateForm())
			{
				Partner p = new Partner()
				{
	             	ID = IdField.Text,
	             	VAT_NUMBER = VatNField.Text,
	             	PARTNER_NAME = NameField.Text,
	             	ADDRESS = AddressField.Text,
	             	POST_CODE = Int32.Parse(PostCodeField.Text),
	             	ADDITIONAL_INFO = AdditionalInfoField.Text
				};
				if (isEditing) return PartnerController.Instance.Update(p);
				else return PartnerController.Instance.Create(p);
			}
			else
			{
				FocusFirstField();
				throw new ValidationException("Не сте попълнили валидно всички полета.");
			}
		}