Пример #1
0
        private static bool CanSave(Contact contact)
        {
            OperationResult operationResult;

            operationResult = null;

            if (string.IsNullOrEmpty(contact.FirstName))
            {
                operationResult = new OperationResult("First name not set.");
            }

            if (string.IsNullOrEmpty(contact.LastName))
            {
                if (operationResult == null)
                {
                    operationResult = new OperationResult("Last name not set.");
                }
                else
                {
                    operationResult.Errors.Add("Last name not set;");
                }
            }

            return operationResult ?? new OperationResult();
        }
Пример #2
0
 // Helper methods
 private void DisplayContact(Contact contact)
 {
     SuspendLayout();
     LoadContactIntoUi(contact);
     ResumeLayout();
     Refresh();
 }
Пример #3
0
 private void LoadContactIntoUi(Contact contact)
 {
     this.firstNameTextBox.Text = contact.FirstName;
     this.middleNameTextBox.Text = contact.MiddleName;
     this.lastNameTextBox.Text = contact.LastName;
     this.phoneNumberTextBox.Text = contact.PhoneNumber;
 }
Пример #4
0
        private static OperationResult Save(Contact contact)
        {
            // NOTE: (TJ) success would be the real result in a real implementation.
            // bool success;

            // TODO: (TJ) Execute Save operation to DB, file, registry, remote call etc.
            return new OperationResult();

            // NOTE: (TJ) success would be the real result in a real implementation.
            // return success;
        }