Exemple #1
0
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            if (
                TbFirstName.Text.Equals(String.Empty) ||
                TbLastName.Text.Equals(String.Empty) ||
                TbPassportID.Text.Equals(String.Empty) ||
                TbUsername.Text.Equals(String.Empty) ||
                CbPostion.SelectedItem == null ||
                PbPassword.Password.Equals(String.Empty)
                )
            {
                args.Cancel = true;
                return;
            }

            if (!CheckForm.IsPasspordId(TbPassportID.Text))
            {
                args.Cancel = true;
                return;
            }

            if (Employee == null)
            {
                Employee = new Employee();
            }
            Employee.FirstName  = TbFirstName.Text;
            Employee.LastName   = TbLastName.Text;
            Employee.Patronymic = TbPatronymic.Text;
            Employee.PassportID = TbPassportID.Text;
            Employee.Username   = TbUsername.Text;
            Employee.PositionId = ((Position)CbPostion.SelectedItem).Id;
            Employee.Position   = null;
            Employee.Password   = PbPassword.Password;
        }
Exemple #2
0
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            if ((PbPassword1.Password != PbPassword2.Password) || PbPassword1.Password.Equals(String.Empty) || (TbMail.Text.Equals(String.Empty) && TbPhoneNumber.Text.Equals(String.Empty)))
            {
                args.Cancel = true;
                return;
            }

            if (!TbMail.Text.Equals(String.Empty))
            {
                if (!CheckForm.IsMail(TbMail.Text))
                {
                    args.Cancel = true;
                    return;
                }
            }

            if (!CheckForm.IsPasspordId(TbPassportID.Text))
            {
                args.Cancel = true;
                return;
            }

            Client = new Client()
            {
                FirstName   = TbFirstName.Text,
                LastName    = TbLastName.Text,
                Patronymic  = TbPatronymic.Text,
                PassportID  = TbPassportID.Text,
                Mail        = TbMail.Text == String.Empty ? null : TbMail.Text,
                PhoneNumber = TbPhoneNumber.Text == String.Empty ? null : TbPhoneNumber.Text,
                Password    = PbPassword1.Password
            };
        }