示例#1
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            FirstName.Focus();
            if (!Globals.MyPermissions.Allow("ActivateClientStaff"))
            {
                ActiveCheckBox.IsEnabled = false;
                ActiveCheckBox.ToolTip   = ActiveLabel.ToolTip = "Your current permissions do not allow activating or disabling contacts";
            }
            try
            {
                pageMode          = PageFunctions.pageParameter(this, "Mode");
                selectedContactID = Int32.Parse(PageFunctions.pageParameter(this, "ContactID"));
                //selectedClientID = Int32.Parse(PageFunctions.pageParameter(this, "ClientID"));
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                ClientFunctions.ReturnToTilesPage();
            }

            //Clients thisClient = ClientFunctions.GetClientByID(selectedClientID, true);
            ClientCode.Text = Globals.SelectedClient.ClientCode;
            ClientName.Text = Globals.SelectedClient.ClientName;

            if (pageMode == PageFunctions.New)
            {
                PageHeader.Content = "Create New Contact";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "AddIcon");
                Instructions.Content = "Fill in the details as required and then click 'Save' to create the record.";
            }
            else if (pageMode == PageFunctions.Amend)
            {
                if (selectedContactID > 0)
                {
                    try
                    {
                        thisContact              = ClientFunctions.GetContact(selectedContactID);
                        FirstName.Text           = thisContact.FirstName;
                        Surname.Text             = thisContact.Surname;
                        JobTitle.Text            = thisContact.JobTitle;
                        ActiveCheckBox.IsChecked = thisContact.Active;
                        PhoneNumber.Text         = thisContact.PhoneNumber;
                        Email.Text = thisContact.Email;
                    }

                    catch (Exception generalException)
                    {
                        MessageFunctions.Error("Error populating contact data", generalException);
                        ClientFunctions.ReturnToContactPage(selectedContactID);
                    }
                }
                else
                {
                    MessageFunctions.Error("Load error: no contact loaded.", null);
                    ClientFunctions.ReturnToContactPage(selectedContactID);
                }
            }
        }
示例#2
0
 private void goBack()
 {
     ClientFunctions.ReturnToContactPage(selectedContactID);
 }