Example #1
0
        /// <summary>
        /// Save the selected fuzzy lookup accounts to the accounts master table
        /// </summary>
        private void SaveFuzzyLookupAccountsToMasterTable()
        {
            //if (m_ExistingCompanies > 0)
            //    Message = "There are " + m_SelectedCompanies.ToString() + " selected companies." + Environment.NewLine + Environment.NewLine
            //            + m_ExistingCompanies.ToString() + " of these already exist on the master data. Please revoke those first." + Environment.NewLine + Environment.NewLine
            //            + "Be understood that the non-existing companies will be added to master data as non-validated companies." + Environment.NewLine + Environment.NewLine
            //            + "Contact matching list will be generated for the selected companies." + Environment.NewLine + Environment.NewLine
            //            + "You want to continue?";
            //else
            //    Message = "There are " + m_SelectedCompanies.ToString() + " selected companies." + Environment.NewLine + Environment.NewLine
            //            + "Be understood that the non-existing companies will be added to master data as non-validated companies." + Environment.NewLine + Environment.NewLine
            //            + "Contact matching list will be generated for the selected companies." + Environment.NewLine + Environment.NewLine
            //            + "You want to continue?";

            /**
             * get existing accounts with m_FuzzyLookupAccountIds
             */
            BrightPlatformEntities _efDbModel = new BrightPlatformEntities(UserSession.EntityConnection);
            int _iExistingAccounts = Convert.ToInt32(_efDbModel.FICheckExistingAccounts(string.Join(",", m_FuzzyLookupAccountIds.ToArray())).SingleOrDefault());
            string Message = string.Empty;
            if (_iExistingAccounts > 0)
                Message = "There are " + m_SelectedCompanies.ToString() + " selected companies." + Environment.NewLine + Environment.NewLine
                        + _iExistingAccounts.ToString() + " of these selected companies are already existing. Please check for validated/unvalidated records." + Environment.NewLine + Environment.NewLine
                        + "Be understood that the non-existing companies will be added to master data as non-validated companies." + Environment.NewLine + Environment.NewLine
                        + "You want to continue?";
            else
                Message = "There are " + m_SelectedCompanies.ToString() + " selected companies." + Environment.NewLine + Environment.NewLine
                        + "Be understood that the non-existing companies will be added to master data as non-validated companies." + Environment.NewLine + Environment.NewLine
                        + "You want to continue?";

            DialogResult objDialog = MessageBox.Show(Message, "Add Import File Companies", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (objDialog == DialogResult.No)
                return;

            WaitDialog.Show(ParentForm,"Saving import file...");

            DataImportUtility.SaveFuzzyLookupAccountToMasterTable(m_objImportList.customer_id, m_objImportList.import_list_name, m_objImportList.id, m_FuzzyLookupAccountIds, BrightVision.EventLog.Business.FacadeEventLog.Source_Bright_Manager_Import_List);

            // save import list as matched
            DataImportUtility.MatchedByAccount(m_objImportList.id);
            gvImportFile.SetRowCellValue(m_SelectedImportFileRowHandle, "matched_by_account", true);
            //this.PopulateImportListView();
            //this.SetContactMatchingModule(true);
            this.PopulateFuzzyLookupAccountList();

            //Message = "Selected companies has been successfully saved to master data." + Environment.NewLine + Environment.NewLine
            //        + "A new imported list has been created for " + m_objImportList.customer_name.ToUpper()
            //        + " -> " + m_objImportList.import_list_name.ToUpper() + ".";

            //MessageBox.Show(Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            WaitDialog.Close();
        }