Beispiel #1
0
        /// <summary>
        /// Open Dialog to find extracts to be added list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddExtractToList(System.Object sender, EventArgs e)
        {
            TFrmExtractFindDialog ExtractFindDialog  = new TFrmExtractFindDialog(this.ParentForm);
            MExtractMasterTable   ExtractMasterTable = new MExtractMasterTable();
            MExtractMasterRow     NewRow;

            // let the user select base extract
            ExtractFindDialog.AllowMultipleSelect = true;
            ExtractFindDialog.ShowDialog(true);

            // get data for selected base extract
            ExtractFindDialog.GetResult(ref ExtractMasterTable);
            ExtractFindDialog.Dispose();

            // only continue if an extract was selected
            foreach (MExtractMasterRow Row in ExtractMasterTable.Rows)
            {
                if (!FExtractMasterTable.Rows.Contains(new object[] { Row.ExtractId }))
                {
                    NewRow             = FExtractMasterTable.NewRowTyped();
                    NewRow.ExtractId   = Row.ExtractId;
                    NewRow.ExtractName = Row.ExtractName;
                    NewRow.ExtractDesc = Row.ExtractDesc;
                    NewRow.KeyCount    = Row.KeyCount;
                    NewRow.CreatedBy   = Row.CreatedBy;
                    NewRow.DateCreated = Row.DateCreated;

                    FExtractMasterTable.Rows.Add(NewRow);

                    btnRemove.Enabled = true;
                }
            }
        }
        /// <summary>
        /// Opens a Modal instance of the Extract Find screen.
        /// </summary>
        /// <param name="AExtractId">Id of extract found</param>
        /// <param name="AExtractName">Name of the extract found</param>
        /// <param name="AExtractDesc">Description of the extract found</param>
        /// <param name="AParentForm"></param>
        /// <returns>True if an extrac was found and accepted by the user,
        /// otherwise false.</returns>
        public static bool OpenModalForm(out int AExtractId,
                                         out String AExtractName,
                                         out String AExtractDesc,
                                         Form AParentForm)
        {
            AExtractId   = -1;
            AExtractName = String.Empty;
            AExtractDesc = String.Empty;

            TFrmExtractFindDialog SelectExtract = new TFrmExtractFindDialog(AParentForm);

            if (SelectExtract.ShowDialog(true))
            {
                SelectExtract.GetResult(out AExtractId, out AExtractName, out AExtractDesc);
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Guide user through process to create extract which contains all family records of
        /// Persons in a base extract.
        /// </summary>
        /// <param name="AParentForm"></param>
        /// <param name="AExtractMasterRow"></param>
        public static void CreateFamilyExtractForPersons(Form AParentForm, MExtractMasterRow AExtractMasterRow)
        {
            TFrmExtractFindDialog ExtractFindDialog = new TFrmExtractFindDialog(AParentForm);
            TFrmExtractNamingDialog ExtractNameDialog = new TFrmExtractNamingDialog(AParentForm);
            int BaseExtractId = 0;
            string BaseExtractName;
            string BaseExtractDescription;
            int ExtractId = 0;
            string ExtractName;
            string ExtractDescription;

            if (AExtractMasterRow != null)
            {
                BaseExtractId = AExtractMasterRow.ExtractId;

                // inform user what this extract is about and what will happen
                if (MessageBox.Show(Catalog.GetString("A new Extract will be created that will contain all Families of the Persons" +
                            " that exist in the Extract '" + AExtractMasterRow.ExtractName + "'."),
                        Catalog.GetString("Generate Family Extract for Persons"),
                        MessageBoxButtons.OKCancel,
                        MessageBoxIcon.Information) == DialogResult.Cancel)
                {
                    return;
                }
            }
            else
            {
                // inform user what this extract is about and what will happen
                MessageBox.Show(Catalog.GetString("Please select an existing Extract with the Find Screen that follows.\r\n\r\n" +
                        "A new Extract will be created that will contain all Families of the Persons" +
                        " that exist in the selected Extract."),
                    Catalog.GetString("Generate Family Extract for Persons"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);

                // let the user select base extract
                ExtractFindDialog.ShowDialog(true);

                // get data for selected base extract
                ExtractFindDialog.GetResult(out BaseExtractId, out BaseExtractName, out BaseExtractDescription);
                ExtractFindDialog.Dispose();
            }

            // only continue if a base extract was selected
            if (BaseExtractId >= 0)
            {
                ExtractNameDialog.ShowDialog();

                if (ExtractNameDialog.DialogResult != System.Windows.Forms.DialogResult.Cancel)
                {
                    /* Get values from the Dialog */
                    ExtractNameDialog.GetReturnedParameters(out ExtractName, out ExtractDescription);
                    ExtractNameDialog.Dispose();
                }
                else
                {
                    // dialog was cancelled, do not continue with extract generation
                    ExtractNameDialog.Dispose();
                    return;
                }

                // create extract with given name and description and store it in db
                if (TRemote.MPartner.Partner.WebConnectors.CreateFamilyExtractForPersons(BaseExtractId,
                        ref ExtractId, ExtractName, ExtractDescription))
                {
                    NewExtractCreated(ExtractName, ExtractId, AParentForm);
                }
                else
                {
                    MessageBox.Show(Catalog.GetString("Creation of extract failed"),
                        Catalog.GetString("Generate Family Extract for Persons"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Stop);
                    return;
                }
            }
        }
        /// <summary>
        /// Guide user through process to create extract which contains all family records of
        /// Persons in a base extract.
        /// </summary>
        /// <param name="AParentForm"></param>
        /// <param name="AExtractMasterRow"></param>
        public static void CreateFamilyExtractForPersons(Form AParentForm, MExtractMasterRow AExtractMasterRow)
        {
            TFrmExtractFindDialog   ExtractFindDialog = new TFrmExtractFindDialog(AParentForm);
            TFrmExtractNamingDialog ExtractNameDialog = new TFrmExtractNamingDialog(AParentForm);
            int    BaseExtractId = 0;
            string BaseExtractName;
            string BaseExtractDescription;
            int    ExtractId = 0;
            string ExtractName;
            string ExtractDescription;

            if (AExtractMasterRow != null)
            {
                BaseExtractId = AExtractMasterRow.ExtractId;

                // inform user what this extract is about and what will happen
                if (MessageBox.Show(Catalog.GetString("A new Extract will be created that will contain all Families of the Persons" +
                                                      " that exist in the Extract '" + AExtractMasterRow.ExtractName + "'."),
                                    Catalog.GetString("Generate Family Extract for Persons"),
                                    MessageBoxButtons.OKCancel,
                                    MessageBoxIcon.Information) == DialogResult.Cancel)
                {
                    return;
                }
            }
            else
            {
                // inform user what this extract is about and what will happen
                MessageBox.Show(Catalog.GetString("Please select an existing Extract with the Find Screen that follows.\r\n\r\n" +
                                                  "A new Extract will be created that will contain all Families of the Persons" +
                                                  " that exist in the selected Extract."),
                                Catalog.GetString("Generate Family Extract for Persons"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);

                // let the user select base extract
                ExtractFindDialog.ShowDialog(true);

                // get data for selected base extract
                ExtractFindDialog.GetResult(out BaseExtractId, out BaseExtractName, out BaseExtractDescription);
                ExtractFindDialog.Dispose();
            }

            // only continue if a base extract was selected
            if (BaseExtractId >= 0)
            {
                ExtractNameDialog.ShowDialog();

                if (ExtractNameDialog.DialogResult != System.Windows.Forms.DialogResult.Cancel)
                {
                    /* Get values from the Dialog */
                    ExtractNameDialog.GetReturnedParameters(out ExtractName, out ExtractDescription);
                    ExtractNameDialog.Dispose();
                }
                else
                {
                    // dialog was cancelled, do not continue with extract generation
                    ExtractNameDialog.Dispose();
                    return;
                }

                // create extract with given name and description and store it in db
                if (TRemote.MPartner.Partner.WebConnectors.CreateFamilyExtractForPersons(BaseExtractId,
                                                                                         ref ExtractId, ExtractName, ExtractDescription))
                {
                    NewExtractCreated(ExtractName, ExtractId, AParentForm);
                }
                else
                {
                    MessageBox.Show(Catalog.GetString("Creation of extract failed"),
                                    Catalog.GetString("Generate Family Extract for Persons"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Stop);
                    return;
                }
            }
        }
        /// <summary>
        /// Open Dialog to find extracts to be added list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddExtractToList(System.Object sender, EventArgs e)
        {
            TFrmExtractFindDialog ExtractFindDialog = new TFrmExtractFindDialog(this.ParentForm);
            MExtractMasterTable ExtractMasterTable = new MExtractMasterTable();
            MExtractMasterRow NewRow;

            // let the user select base extract
            ExtractFindDialog.AllowMultipleSelect = true;
            ExtractFindDialog.ShowDialog(true);

            // get data for selected base extract
            ExtractFindDialog.GetResult(ref ExtractMasterTable);
            ExtractFindDialog.Dispose();

            // only continue if an extract was selected
            foreach (MExtractMasterRow Row in ExtractMasterTable.Rows)
            {
                if (!FExtractMasterTable.Rows.Contains(new object[] { Row.ExtractId }))
                {
                    NewRow = FExtractMasterTable.NewRowTyped();
                    NewRow.ExtractId = Row.ExtractId;
                    NewRow.ExtractName = Row.ExtractName;
                    NewRow.ExtractDesc = Row.ExtractDesc;
                    NewRow.KeyCount = Row.KeyCount;
                    NewRow.CreatedBy = Row.CreatedBy;
                    NewRow.DateCreated = Row.DateCreated;

                    FExtractMasterTable.Rows.Add(NewRow);

                    grdExtracts.SelectRowInGrid(1);
                    btnOK.Select();
                    btnRemove.Enabled = true;
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Guide user through process to create extract which contains all family member records (Persons)
        /// of families and persons in a base extract.
        /// </summary>
        /// <param name="AParentForm"></param>
        public static void FamilyMembersExtract(Form AParentForm)
        {
            TFrmExtractFindDialog   ExtractFindDialog = new TFrmExtractFindDialog(AParentForm);
            TFrmExtractNamingDialog ExtractNameDialog = new TFrmExtractNamingDialog(AParentForm);
            int    BaseExtractId = 0;
            string BaseExtractName;
            string BaseExtractDescription;
            int    ExtractId = 0;
            string ExtractName;
            string ExtractDescription;

            // inform user what this extract is about and what will happen
            MessageBox.Show(Catalog.GetString("Please select an existing Extract with the Find Screen that follows.\r\n\r\n" +
                                              "The new Extract will contain all Family Members (Persons) of the Families" +
                                              " that exist in the selected Extract."),
                            Catalog.GetString("Generate Family Members Extract"),
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Information);

            // let the user select base extract
            ExtractFindDialog.ShowDialog(true);

            // get data for selected base extract
            ExtractFindDialog.GetResult(out BaseExtractId, out BaseExtractName, out BaseExtractDescription);
            ExtractFindDialog.Dispose();

            // only continue if a base extract was selected
            if (BaseExtractId >= 0)
            {
                ExtractNameDialog.ShowDialog();

                if (ExtractNameDialog.DialogResult != System.Windows.Forms.DialogResult.Cancel)
                {
                    /* Get values from the Dialog */
                    ExtractNameDialog.GetReturnedParameters(out ExtractName, out ExtractDescription);
                    ExtractNameDialog.Dispose();
                }
                else
                {
                    // dialog was cancelled, do not continue with extract generation
                    ExtractNameDialog.Dispose();
                    return;
                }

                // create extract with given name and description and store it in db
                if (TRemote.MPartner.Partner.WebConnectors.CreateFamilyMembersExtract(BaseExtractId,
                                                                                      ref ExtractId, ExtractName, ExtractDescription))
                {
                    // now open Screen for new extract so user can see the result
                    TFrmExtractMaintain frm = new TFrmExtractMaintain(AParentForm);
                    frm.ExtractId   = ExtractId;
                    frm.ExtractName = ExtractName;
                    frm.Show();
                }
                else
                {
                    MessageBox.Show(Catalog.GetString("Creation of extract failed"),
                                    Catalog.GetString("Generate Family Members Extract"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Stop);
                    return;
                }
            }
        }
        /// <summary>
        /// Guide user through process to create extract which contains all family member records (Persons)
        /// of families and persons in a base extract.
        /// </summary>
        /// <param name="AParentForm"></param>
        public static void FamilyMembersExtract(Form AParentForm)
        {
            TFrmExtractFindDialog ExtractFindDialog = new TFrmExtractFindDialog(AParentForm);
            TFrmExtractNamingDialog ExtractNameDialog = new TFrmExtractNamingDialog(AParentForm);
            int BaseExtractId = 0;
            string BaseExtractName;
            string BaseExtractDescription;
            int ExtractId = 0;
            string ExtractName;
            string ExtractDescription;

            // inform user what this extract is about and what will happen
            MessageBox.Show(Catalog.GetString("Please select an existing Extract with the Find Screen that follows.\r\n\r\n" +
                    "The new Extract will contain all Family Members (Persons) of the Families" +
                    " that exist in the selected Extract."),
                Catalog.GetString("Generate Family Members Extract"),
                MessageBoxButtons.OK,
                MessageBoxIcon.Information);

            // let the user select base extract
            ExtractFindDialog.ShowDialog(true);

            // get data for selected base extract
            ExtractFindDialog.GetResult(out BaseExtractId, out BaseExtractName, out BaseExtractDescription);
            ExtractFindDialog.Dispose();

            // only continue if a base extract was selected
            if (BaseExtractId >= 0)
            {
                ExtractNameDialog.ShowDialog();

                if (ExtractNameDialog.DialogResult != System.Windows.Forms.DialogResult.Cancel)
                {
                    /* Get values from the Dialog */
                    ExtractNameDialog.GetReturnedParameters(out ExtractName, out ExtractDescription);
                    ExtractNameDialog.Dispose();
                }
                else
                {
                    // dialog was cancelled, do not continue with extract generation
                    ExtractNameDialog.Dispose();
                    return;
                }

                // create extract with given name and description and store it in db
                if (TRemote.MPartner.Partner.WebConnectors.CreateFamilyMembersExtract(BaseExtractId,
                        ref ExtractId, ExtractName, ExtractDescription))
                {
                    // now open Screen for new extract so user can see the result
                    TFrmExtractMaintain frm = new TFrmExtractMaintain(AParentForm);
                    frm.ExtractId = ExtractId;
                    frm.ExtractName = ExtractName;
                    frm.Show();
                }
                else
                {
                    MessageBox.Show(Catalog.GetString("Creation of extract failed"),
                        Catalog.GetString("Generate Family Members Extract"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Stop);
                    return;
                }
            }
        }
        /// <summary>
        /// Opens a Modal instance of the Extract Find screen.
        /// </summary>
        /// <param name="AExtractId">Id of extract found</param>
        /// <param name="AExtractName">Name of the extract found</param>
        /// <param name="AExtractDesc">Description of the extract found</param>
        /// <param name="AParentForm"></param>
        /// <returns>True if an extrac was found and accepted by the user,
        /// otherwise false.</returns>
        public static bool OpenModalForm(out int AExtractId,
            out String AExtractName,
            out String AExtractDesc,
            Form AParentForm)
        {
            AExtractId = -1;
            AExtractName = String.Empty;
            AExtractDesc = String.Empty;

            TFrmExtractFindDialog SelectExtract = new TFrmExtractFindDialog(AParentForm);

            if (SelectExtract.ShowDialog(true))
            {
                SelectExtract.GetResult(out AExtractId, out AExtractName, out AExtractDesc);
                return true;
            }

            return false;
        }