Beispiel #1
0
        public ActionResult Index()
        {
            string domain = DbConvention.GetDomain();

            var approved  = new DomainSerializer("domains-approved.json");
            var installed = new DomainSerializer("domains-installed.json");

            if (!approved.Get().Contains(domain))
            {
                return(this.HttpNotFound());
            }

            if (installed.Get().Contains(domain))
            {
                return(this.Redirect("/"));
            }

            InstallationFactory.Setup(domain); //Background job
            return(this.Content("Installing frapid, please visit the site after a few minutes."));
        }
Beispiel #2
0
        public ActionResult Index()
        {
            string domain = DbConvention.GetDomain();

            var approved  = new DomainSerializer("DomainsApproved.json");
            var installed = new DomainSerializer("DomainsInstalled.json");

            if (!approved.GetTenantMembers().Any(x => x.Equals(domain)))
            {
                return(this.HttpNotFound());
            }

            if (installed.GetTenantMembers().Any(x => x.Equals(domain)))
            {
                return(this.Redirect("/"));
            }

            var setup = approved.Get().FirstOrDefault(x => x.GetSubtenants().Contains(domain.ToLowerInvariant()));

            InstallationFactory.Setup(setup); //Background job
            return(this.Content("Installing frapid, please visit the site after a few minutes."));
        }
Beispiel #3
0
        public ActionResult Index()
        {
            string domain = TenantConvention.GetDomain();

            var approved  = new ApprovedDomainSerializer();
            var installed = new InstalledDomainSerializer();

            if (!approved.GetMemberSites().Any(x => x.Equals(domain)))
            {
                return(this.HttpNotFound());
            }

            if (installed.GetMemberSites().Any(x => x.Equals(domain)))
            {
                return(this.Redirect("/"));
            }

            var setup = approved.Get().FirstOrDefault(x => x.GetSubtenants().Contains(domain.ToLowerInvariant()));

            InstallationFactory.Setup(setup); //Background job
            return(this.Content(Resources.FrapidInstallationMessage));
        }
        private void InstallButton_Click(object sender, EventArgs e)
        {
            this.CreateOffice();
            this._office.Validate();

            if (!this._office.IsValid)
            {
                Program.warn("Cannot install. Office information was not provided.");
                return;
            }

            string destination = this.InstallationDirectoryTextBox.Text;

            bool isEmpty = this.IsEmpty(destination);

            if (!isEmpty)
            {
                string message = string.Format(CultureInfo.InvariantCulture,
                                               "The destination directory {0} is not empty. Would you like to empty it now?", destination);
                DialogResult result = MessageBox.Show(message, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    Directory.Delete(destination, true);
                }
                else
                {
                    Program.error("Cannot install MixERP.");
                    return;
                }
            }


            this.InstallButton.Enabled      = false;
            this.CloseButton.Enabled        = false;
            this.GroupBox.Enabled           = false;
            this.OfficeInfoGroupBox.Enabled = false;

            InstallationFactory factory = new InstallationFactory
            {
                DatabaseName       = this.DatabaseNameTextBox.Text,
                InstallSample      = this.InstallSampleCheckBox.Checked,
                Office             = this._office,
                Password           = this.PostgresPassword.Text,
                MixERPPassword     = this.MixERPPassword.Text,
                ReportUserPassword = this.ReportUserPassword.Text,
                SiteDirectory      = this.InstallationDirectoryTextBox.Text,
                SiteAppPoolName    = this.ApplicationPoolNameTextBox.Text,
                SiteHostName       = this.HostNameTextBox.Text,
                SiteName           = this.SiteNameTextBox.Text,
                SitePortNumber     = Conversion.TryCastInteger(this.PortNumberTextBox.Text)
            };

            factory.Initialize();
            IEnumerable <IInstaller> installers = factory.Installers;

            ActivityProgressBar.Style = ProgressBarStyle.Marquee;

            this.StatusLabel.Visible         = true;
            this.StatusProgressLabel.Visible = true;

            try
            {
                this.StatusProgressLabel.Text = string.Format("0/{0} tasks completed.", installers.Count());

                Task.Run(() =>
                {
                    int count   = installers.Count();
                    int counter = 0;
                    foreach (IInstaller installer in installers)
                    {
                        counter++;
                        IInstaller installer1 = installer;
                        int counter1          = counter;

                        this.Invoke(
                            (MethodInvoker)
                            delegate { this.StatusLabel.Text = string.Format("Installing {0}.", installer1.Name); });

                        installer.Install();

                        this.Invoke((MethodInvoker) delegate
                        {
                            this.ActivityProgressBar.Style = ProgressBarStyle.Marquee;
                            this.StatusProgressBar.Style   = ProgressBarStyle.Blocks;

                            this.StatusProgressBar.Value  = (int)100.00 * counter1 / count;
                            this.StatusProgressLabel.Text = string.Format("{0}/{1} task completed.", counter1, count);

                            if (counter1.Equals(count))
                            {
                                this.ActivityProgressBar.Style = ProgressBarStyle.Blocks;
                                this.ActivityProgressBar.Value = 100;
                                this.CloseButton.Enabled       = true;
                                Program.success("MixERP Installation was successful.");

                                this.BrowseMixERP();
                            }
                        });
                    }
                });
            }
            catch (Exception ex)
            {
                Program.error(ex.Message);
            }
        }
        private void InstallButton_Click(object sender, EventArgs e)
        {
            this.CreateOffice();
            this._office.Validate();

            if (!this._office.IsValid)
            {
                Program.warn("Cannot install. Office information was not provided.");
                return;
            }

            this.InstallButton.Enabled      = false;
            this.CloseButton.Enabled        = false;
            this.GroupBox.Enabled           = false;
            this.OfficeInfoGroupBox.Enabled = false;

            InstallationFactory factory = new InstallationFactory
            {
                DatabaseName       = this.DatabaseNameTextBox.Text,
                Office             = this._office,
                Password           = this.PostgresPassword.Text,
                MixERPPassword     = this.MixERPPassword.Text,
                ReportUserPassword = this.ReportUserPassword.Text,
                SiteDirectory      = this.InstallationDirectoryTextBox.Text,
                SiteAppPoolName    = this.ApplicationPoolNameTextBox.Text,
                SiteHostName       = this.HostNameTextBox.Text,
                SiteName           = this.SiteNameTextBox.Text,
                SitePortNumber     = Conversion.TryCastInteger(this.PortNumberTextBox.Text)
            };

            factory.Initialize();
            IEnumerable <IInstaller> installers = factory.Installers;

            ActivityProgressBar.Style = ProgressBarStyle.Marquee;

            this.StatusLabel.Visible         = true;
            this.StatusProgressLabel.Visible = true;

            try
            {
                this.StatusProgressLabel.Text = string.Format("0/{0} task completed.", installers.Count());

                Task.Run(() =>
                {
                    int count   = installers.Count();
                    int counter = 0;
                    foreach (IInstaller installer in installers)
                    {
                        counter++;
                        IInstaller installer1 = installer;
                        int counter1          = counter;

                        this.Invoke(
                            (MethodInvoker)
                            delegate { this.StatusLabel.Text = string.Format("Installing {0}.", installer1.Name); });

                        installer.Install();

                        this.Invoke((MethodInvoker) delegate
                        {
                            this.ActivityProgressBar.Style = ProgressBarStyle.Marquee;
                            this.StatusProgressBar.Style   = ProgressBarStyle.Blocks;

                            this.StatusProgressBar.Value  = (int)100.00 * counter1 / count;
                            this.StatusProgressLabel.Text = string.Format("{0}/{1} task completed.", counter1, count);

                            if (counter1.Equals(count))
                            {
                                this.ActivityProgressBar.Style = ProgressBarStyle.Blocks;
                                this.ActivityProgressBar.Value = 100;
                                this.CloseButton.Enabled       = true;
                                Program.success("MixERP Installation was successful.");

                                this.BrowseMixERP();
                            }
                        });
                    }
                });
            }
            catch (Exception ex)
            {
                Program.error(ex.Message);
            }
        }