Exemple #1
0
        /// <summary>
        /// Initialisation
        /// </summary>
        public void InitialiseData(TFrmPetraReportingUtils APetraUtilsObject)
        {
            FPetraUtilsObject = APetraUtilsObject;

            rbtAllAttendees.Checked          = true;
            txtExtract.Enabled               = false;
            FShowSelectOutreachOptionsDialog = true;

            // Get selected conference key
            long SelectedConferenceKey = TUserDefaults.GetInt64Default("LASTCONFERENCEWORKEDWITH");

            if (SelectedConferenceKey != 0)
            {
                txtConference.Text = SelectedConferenceKey.ToString();
            }
        }
        private void InitializeManualCode()
        {
            string        CurrencyCode;
            string        CurrencyName;
            string        ConferenceName;
            TPartnerClass PartnerClass;

            FPartnerKey = TUserDefaults.GetInt64Default("LASTCONFERENCEWORKEDWITH");

            // display the conference name in the title bar and in a text box at the top of the screen
            TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetPartnerShortName(FPartnerKey, out ConferenceName, out PartnerClass);
            this.Text = this.Text + " [" + ConferenceName + "]";
            txtConferenceName.Text = ConferenceName;

            // display the conference dates in a text box at the top of the screen
            txtConferenceDates.Text = FStartDate.ToShortDateString() + " to " + FEndDate.ToShortDateString();

            // display the conference currency in a text box at the top of the screen and in pnlDetails
            TRemote.MConference.Conference.WebConnectors.GetCurrency(FPartnerKey, out CurrencyCode, out CurrencyName);
            txtDetailAmount.CurrencyCode = CurrencyCode;
        }
Exemple #3
0
        /// delete the complete conference including all conference data
        public static void DeleteThisConference(Form AMainWindow)
        {
            // Get conference key
            long ConferenceKey = TUserDefaults.GetInt64Default("LASTCONFERENCEWORKEDWITH");

            if (ConferenceKey == 0)
            {
                MessageBox.Show(Catalog.GetString("There is no conference selected."),
                                Catalog.GetString("Delete Conference"),
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                // Get conference name
                string        ConferenceName;
                TPartnerClass PartnerClass;
                TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetPartnerShortName(ConferenceKey, out ConferenceName, out PartnerClass);

                DeleteConference(AMainWindow, ConferenceKey, ConferenceName);
            }
        }
Exemple #4
0
        /// delete the complete conference including all conference data
        public static void DeleteConference(Form AMainWindow, Int64 AConferenceKey, string AConferenceName)
        {
            if (MessageBox.Show(Catalog.GetString("Please save a backup of your database first!!!") + Environment.NewLine +
                                string.Format(Catalog.GetString("Do you REALLY want to delete conference '{0}'?"),
                                              AConferenceName),
                                Catalog.GetString("Delete Conference"),
                                MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2
                                ) == DialogResult.Yes)
            {
                Thread t = new Thread(() => ProcessDeletion(AMainWindow, AConferenceKey, AConferenceName));

                using (TProgressDialog dialog = new TProgressDialog(t))
                {
                    dialog.ShowDialog();
                }

                if (AConferenceKey == TUserDefaults.GetInt64Default("LASTCONFERENCEWORKEDWITH"))
                {
                    // update user defaults table
                    TUserDefaults.SetDefault(TUserDefaults.CONFERENCE_LASTCONFERENCEWORKEDWITH, 0);

                    // reload navigation
                    PropertyInfo CurrentConferenceProperty = AMainWindow.GetType().GetProperty("SelectedConferenceKey");
                    CurrentConferenceProperty.SetValue(AMainWindow, 0, null);

                    MethodInfo method = AMainWindow.GetType().GetMethod("LoadNavigationUI");

                    if (method != null)
                    {
                        method.Invoke(AMainWindow, new object[] { false });
                        method = AMainWindow.GetType().GetMethod("SelectConferenceFolder");
                        method.Invoke(AMainWindow, new object[] { });
                    }
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Opens the partner edit screen with the last partner worked on.
        /// Checks if the partner is merged.
        /// </summary>
        public static void OpenLastUsedPartnerEditScreenByContext(Form AParentForm, string AContext = null)
        {
            string ValidContexts;
            string Context;
            long   MergedPartnerKey = 0;
            long   LastPartnerKey;
            string NoPartnerAvailableStr = Catalog.GetString("You have not edited a Partner yet.");

            if (AContext != null)
            {
                ValidContexts = TUserDefaults.USERDEFAULT_LASTPARTNERMAILROOM + ";" + TUserDefaults.USERDEFAULT_LASTPERSONPERSONNEL + ";" +
                                TUserDefaults.USERDEFAULT_LASTUNITPERSONNEL + ";" + TUserDefaults.USERDEFAULT_LASTPERSONCONFERENCE + ";";

                if (!ValidContexts.Contains(AContext + ";"))
                {
                    throw new ArgumentException("AContext \"" + AContext + "\" is not a valid context. Valid contexts: " + ValidContexts);
                }
                else
                {
                    Context = AContext;
                }
            }
            else
            {
                Context = TUserDefaults.USERDEFAULT_LASTPARTNERMAILROOM;
            }

            LastPartnerKey = TUserDefaults.GetInt64Default(Context, 0);

            // we don't need to validate the partner key
            // because it's done in the mnuFile_Popup function.
            // If we don't have a valid partner key, this code can't be called from the file menu.

            // now that this function is called from the main menu, we need to check for LastPartnerKey != 0
            if (LastPartnerKey == 0)
            {
                if (Context == TUserDefaults.USERDEFAULT_LASTPERSONPERSONNEL)
                {
                    NoPartnerAvailableStr = Catalog.GetString("You have not yet worked with a Person in the Personnel Module.");
                }

                MessageBox.Show(Catalog.GetString(NoPartnerAvailableStr),
                                Catalog.GetString("No Last Partner"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }

            if (MergedPartnerHandling(LastPartnerKey, out MergedPartnerKey, AParentForm))
            {
                // work with the merged partner
                LastPartnerKey = MergedPartnerKey;
            }
            else if (MergedPartnerKey > 0)
            {
                // The partner is merged but user cancelled the action
                return;
            }

            // Open the Partner Edit screen
            TFrmPartnerEdit frmPEDS;

            AParentForm.Cursor = Cursors.WaitCursor;

            frmPEDS = new TFrmPartnerEdit(AParentForm);

            if (Context == TUserDefaults.USERDEFAULT_LASTPERSONPERSONNEL)
            {
                frmPEDS.SetParameters(TScreenMode.smEdit, LastPartnerKey, TPartnerEditTabPageEnum.petpPersonnelIndividualData);
            }
            else
            {
                frmPEDS.SetParameters(TScreenMode.smEdit, LastPartnerKey);
            }

            frmPEDS.Show();

            AParentForm.Cursor = Cursors.Default;
        }
        // displays information about the currently selected conference in the navigation panel
        private static void AddConferenceInformation(XmlNode AMenuNode)
        {
            FConferenceKey = TUserDefaults.GetInt64Default("LASTCONFERENCEWORKEDWITH");

            // Set PartnerKey in conference setup screens for selected conference
            Ict.Petra.Client.MConference.Gui.TConferenceMain.FPartnerKey = FConferenceKey;

            XmlNode      childNode = AMenuNode.FirstChild;
            XmlAttribute enabledAttribute;

            while (childNode != null)
            {
                if ((TXMLParser.GetAttribute(childNode, "DependsOnConference").ToLower() == "true") && (FConferenceKey != 0))
                {
                    FConferenceSelected = true; // node only displayed if this is true

                    // Create 'Select Conference' Node
                    XmlAttribute LabelAttributeConference = childNode.OwnerDocument.CreateAttribute("Label");
                    XmlElement   SelConferenceElmnt       = childNode.OwnerDocument.CreateElement("ConferenceInfo");
                    XmlNode      SelectConferenceNode     = childNode.AppendChild(SelConferenceElmnt);
                    SelectConferenceNode.Attributes.Append(LabelAttributeConference);
                    SelectConferenceNode.Attributes["Label"].Value = Catalog.GetString("Current Conference");

                    // Create conference details Node
                    XmlElement   SpecificConferenceElmnt = childNode.OwnerDocument.CreateElement("Conference" + FConferenceKey);
                    XmlNode      SpecificConferenceNode  = SelectConferenceNode.AppendChild(SpecificConferenceElmnt);
                    XmlAttribute AttributeConferenceName = childNode.OwnerDocument.CreateAttribute("Label");
                    SpecificConferenceNode.Attributes.Append(AttributeConferenceName);

                    // Disable clicking on node
                    enabledAttribute       = childNode.OwnerDocument.CreateAttribute("Enabled");
                    enabledAttribute.Value = "false";
                    SpecificConferenceNode.Attributes.Append(enabledAttribute);

                    // Get conference name
                    string        ConferenceName;
                    TPartnerClass PartnerClass;
                    TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetPartnerShortName(FConferenceKey, out ConferenceName, out PartnerClass);

                    if (ConferenceName != String.Empty)
                    {
                        const int BreakPoint = 28;
                        SpecificConferenceNode.Attributes["Label"].Value = "";

                        // splits the name over multiple lines if it too long
                        while (ConferenceName.Length > BreakPoint)
                        {
                            int IndexOfSpace     = ConferenceName.IndexOf(" ", 0);
                            int LastIndexOfSpace = 0;

                            // searches for the last breakpoint for a line
                            while (IndexOfSpace <= BreakPoint && IndexOfSpace != -1)
                            {
                                LastIndexOfSpace = IndexOfSpace;
                                IndexOfSpace     = ConferenceName.IndexOf(" ", LastIndexOfSpace + 1);
                            }

                            SpecificConferenceNode.Attributes["Label"].Value += ConferenceName.Substring(0, LastIndexOfSpace) + "\n";

                            ConferenceName = ConferenceName.Remove(0, LastIndexOfSpace + 1);
                        }

                        SpecificConferenceNode.Attributes["Label"].Value += ConferenceName + "\n";
                    }
                    else
                    {
                        SpecificConferenceNode.Attributes["Label"].Value = "Conference Key: " + FConferenceKey;
                    }

                    // Set node values
                    SpecificConferenceNode.Attributes["Label"].Value = SpecificConferenceNode.Attributes["Label"].Value;

                    // only dispay dates if they are valid
                    DateTime StartDate = TRemote.MConference.Conference.WebConnectors.GetStartDate(FConferenceKey);
                    DateTime EndDate   = TRemote.MConference.Conference.WebConnectors.GetEndDate(FConferenceKey);

                    if (StartDate != DateTime.MinValue)
                    {
                        SpecificConferenceNode.Attributes["Label"].Value = SpecificConferenceNode.Attributes["Label"].Value +
                                                                           "\nStart: " + StartDate.ToLongDateString();
                    }

                    if (EndDate != DateTime.MinValue)
                    {
                        SpecificConferenceNode.Attributes["Label"].Value = SpecificConferenceNode.Attributes["Label"].Value +
                                                                           "\nEnd: " + EndDate.ToLongDateString();
                    }

                    childNode = childNode.NextSibling;
                }
                else
                {
                    // Recurse into deeper levels!
                    AddConferenceInformation(childNode);

                    childNode = childNode.NextSibling;
                }
            }
        }