Exemplo n.º 1
0
        protected void repeaterDomains_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Edit")
            {
                int domainID = 0;
                int.TryParse(e.CommandArgument.ToString(), out domainID);

                if (domainID > 0)
                {
                    ModifyDomain(domainID);
                }
            }
            else if (e.CommandName == "Delete")
            {
                // Delete domain
                DomainsViewModel viewModel = new DomainsViewModel();
                viewModel.ViewModelEvent += viewModel_ViewModelEvent;
                viewModel.DeleteDomain(e.CommandArgument.ToString(), WebSessionHandler.SelectedCompanyCode);

                // Audit
                AuditGlobal.AddAudit(WebSessionHandler.SelectedCompanyCode, HttpContext.Current.User.Identity.Name, ActionID.DeleteDomain, e.CommandArgument.ToString(), null);

                GetDomains();
            }
        }
Exemplo n.º 2
0
        private void DeleteUser(string userPrincipalName)
        {
            UsersViewModel viewModel = new UsersViewModel();

            viewModel.ViewModelEvent += viewModel_ViewModelEvent;

            // Create new user
            viewModel.DeleteUser(userPrincipalName);

            // Audit
            AuditGlobal.AddAudit(WebSessionHandler.SelectedCompanyCode, HttpContext.Current.User.Identity.Name, ActionID.DeleteUser, userPrincipalName);

            // Refresh
            PopulateUsersListView();
        }
Exemplo n.º 3
0
        protected void btnResetPwd_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtResetPwd1.Text) && !string.IsNullOrEmpty(txtResetPwd2.Text))
            {
                if (txtResetPwd1.Text != txtResetPwd2.Text)
                {
                    alertmessage.SetMessage(AlertID.WARNING, "Passwords did not match");
                }
                else
                {
                    UsersViewModel viewModel = new UsersViewModel();
                    viewModel.ViewModelEvent += viewModel_ViewModelEvent;
                    viewModel.ResetPassword(hfResetPwdHiddenField.Value, txtResetPwd2.Text, WebSessionHandler.SelectedCompanyCode);

                    AuditGlobal.AddAudit(WebSessionHandler.SelectedCompanyCode, WebSessionHandler.Username, ActionID.ResetPassword, hfResetPwdHiddenField.Value);
                }
            }
        }
Exemplo n.º 4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            // Edit an existing domain
            string domain    = txtDomainName.Text.Trim();
            bool   isDefault = cbIsDefaultDomain.Checked;

            DomainsViewModel viewModel = new DomainsViewModel();

            viewModel.ViewModelEvent += viewModel_ViewModelEvent;

            if (string.IsNullOrEmpty(hfDomainID.Value))
            {
                if (cbIsAcceptedDomain.Checked && divExchangeDomain.Visible)
                {
                    viewModel.AddDomain(domain, WebSessionHandler.SelectedCompanyCode, isDefault, true, GetAcceptedDomainType());
                }
                else
                {
                    viewModel.AddDomain(domain, WebSessionHandler.SelectedCompanyCode, isDefault, false, GetAcceptedDomainType());
                }

                // Audit
                AuditGlobal.AddAudit(WebSessionHandler.SelectedCompanyCode, HttpContext.Current.User.Identity.Name, ActionID.AddDomain, domain, null);
            }
            else
            {
                if (cbIsAcceptedDomain.Checked && divExchangeDomain.Visible)
                {
                    viewModel.UpdateDomain(domain, WebSessionHandler.SelectedCompanyCode, isDefault, cbIsAcceptedDomain.Checked, GetAcceptedDomainType());
                }
                else
                {
                    viewModel.UpdateDomain(domain, WebSessionHandler.SelectedCompanyCode, isDefault, false, GetAcceptedDomainType());
                }

                // Audit
                AuditGlobal.AddAudit(WebSessionHandler.SelectedCompanyCode, HttpContext.Current.User.Identity.Name, ActionID.UpdateDomain, domain, null);
            }

            // Refresh domain list
            GetDomains();
        }
Exemplo n.º 5
0
        private void SaveNewUser()
        {
            UsersObject newUser = new UsersObject();

            newUser.CompanyCode          = WebSessionHandler.SelectedCompanyCode;
            newUser.Firstname            = txtFirstName.Text;
            newUser.Middlename           = txtMiddleName.Text;
            newUser.Lastname             = txtLastname.Text;
            newUser.DisplayName          = txtDisplayName.Text;
            newUser.Department           = txtDepartment.Text;
            newUser.UserPrincipalName    = string.Format("{0}@{1}", txtLoginName.Text, ddlLoginDomain.SelectedItem.Text);
            newUser.Password             = txtPassword1.Text;
            newUser.PasswordNeverExpires = cbPasswordNeverExpires.Checked;
            newUser.IsCompanyAdmin       = cbCompanyAdmin.Checked;
            newUser.IsResellerAdmin      = cbResellerAdmin.Checked;

            if (newUser.IsCompanyAdmin)
            {
                newUser.EnableExchangePerm        = cbEnableExchange.Checked;
                newUser.DisableExchangePerm       = cbDisableExchange.Checked;
                newUser.AddDomainPerm             = cbAddDomain.Checked;
                newUser.DeleteDomainPerm          = cbDeleteDomain.Checked;
                newUser.EnableAcceptedDomainPerm  = cbEnableAcceptedDomain.Checked;
                newUser.DisableAcceptedDomainPerm = cbDisableAcceptedDomain.Checked;
            }

            UsersViewModel viewModel = new UsersViewModel();

            viewModel.ViewModelEvent += viewModel_ViewModelEvent;

            // Create new user
            viewModel.CreateUser(newUser);

            // Audit
            AuditGlobal.AddAudit(WebSessionHandler.SelectedCompanyCode, HttpContext.Current.User.Identity.Name, ActionID.CreateUser, newUser.UserPrincipalName, null);

            // Refresh
            PopulateUsersListView();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Saves the new settings to the database
        /// </summary>
        private void SaveSettings()
        {
            try
            {
                #region General

                StaticSettings.HostersName      = txtCompanyName.Text;
                StaticSettings.ResellersEnabled = cbEnableResellers.Checked;

                #endregion

                #region Active Directory

                StaticSettings.HostingOU = txtHostingOU.Text;
                StaticSettings.UsersOU   = txtUsersOU.Text;
                StaticSettings.PrimaryDC = txtDomainController.Text;
                StaticSettings.Username  = txtUsername.Text;
                StaticSettings.Password  = DataProtection.Encrypt(txtPassword.Text, ConfigurationManager.AppSettings["Key"]);

                #endregion

                #region Security Groups

                StaticSettings.SuperAdmins   = txtSuperAdmins.Text;
                StaticSettings.BillingAdmins = txtBillingAdmins.Text;

                #endregion

                #region Billing


                #endregion

                #region Exchange

                StaticSettings.ExchangeConnectionType     = ddlExchConnectionType.SelectedValue;
                StaticSettings.ExchangeVersion            = int.Parse(ddlExchVersion.SelectedValue);
                StaticSettings.ExchangeServer             = txtExchServer.Text;
                StaticSettings.ExchangePublicFolderServer = txtExchPFServer.Text;
                StaticSettings.ExchangeDatabases          = txtExchDatabases.Text;
                StaticSettings.PublicFoldersEnabled       = cbExchPFEnabled.Checked;
                StaticSettings.ExchangeSSLEnabled         = cbExchSSLEnabled.Checked;

                #endregion

                #region Modules

                StaticSettings.CitrixEnabled = cbEnableCitrix.Checked;
                StaticSettings.LyncEnabled   = cbEnableLync.Checked;

                #endregion

                // Commit changes
                StaticSettings.CommitSettings(ConfigurationManager.AppSettings["Key"]);

                // Audit
                AuditGlobal.AddAudit(WebSessionHandler.SelectedCompanyCode, WebSessionHandler.Username, Modules.Base.Enumerations.ActionID.SaveSettings, "", "");

                // Show Success
                alertmessage.SetMessage(Modules.Base.Enumerations.AlertID.SUCCESS, "Successfully saved settings");
            }
            catch (Exception ex)
            {
                alertmessage.SetMessage(Modules.Base.Enumerations.AlertID.FAILED, ex.Message);
            }
        }