protected void btnToggleHeliconApe_Click(object sender, EventArgs e)
        {
            try
            {
                int result = 0;
                if (IsHeliconApeEnabled)
                {
                    // uninstall folders
                    result = ES.Services.WebServers.DisableHeliconApe(PanelRequest.ItemID);
                }
                else
                {
                    // install folders
                    result = ES.Services.WebServers.EnableHeliconApe(PanelRequest.ItemID);
                }

                if (result < 0)
                {
                    HostModule.ShowResultMessage(result);
                    return;
                }
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("WEB_INSTALL_HTACCESS", ex);
                return;
            }

            // change state
            IsHeliconApeEnabled = !IsHeliconApeEnabled;

            // bind items
            ToggleControls();
        }
Example #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                List <int> ids = new List <int>();
                foreach (ListItem item in listExternalAddresses.Items)
                {
                    if (item.Selected)
                    {
                        ids.Add(Utils.ParseInt(item.Value));
                    }
                }

                ResultObject res = ES.Services.Servers.AllocatePackageIPAddresses(PanelSecurity.PackageId,
                                                                                  0,
                                                                                  ResourceGroup, Pool,
                                                                                  radioExternalRandom.Checked,
                                                                                  Utils.ParseInt(txtExternalAddressesNumber.Text),
                                                                                  ids.ToArray());
                if (res.IsSuccess)
                {
                    // return back
                    Response.Redirect(HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), ListAddressesControl));
                }
                else
                {
                    // show message
                    messageBox.ShowMessage(res, "VPS_ALLOCATE_EXTERNAL_ADDRESSES_ERROR", "VPS");
                }
            }
            catch (Exception ex)
            {
                messageBox.ShowErrorMessage("VPS_ALLOCATE_EXTERNAL_ADDRESSES_ERROR", ex);
            }
        }
        public bool CreateNewAccount(int resellerId)
        {
            if (!Page.IsValid)
            {
                return(false);
            }

            try
            {
                GenericResult result = StorefrontHelper.AddContract(Account);
                // check result
                if (!result.Succeed)
                {
                    HostModule.ShowResultMessage(result.GetProperty <int>("ResultCode"));
                    return(false);
                }
                //
                contractId = result["ContractId"];
                //
                return(true);
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("CREATE_NEW_ACCOUNT", ex);
                return(false);
            }
        }
Example #4
0
        public bool LoadServiceInfo(int serviceId)
        {
            EnsureChildControls();

            try
            {
                // load hosting package svc
                HostingPackageSvc packageSvc = StorehouseHelper.GetHostingPackageService(serviceId);
                if (packageSvc == null)
                {
                    RedirectToBrowsePage();
                }
                //
                ecUtils.ToggleControls(PanelSecurity.LoggedUser.Role != UserRole.User, pnlUsername);
                //
                ltrServiceName.Text     = packageSvc.ServiceName;
                ltrUsername.Text        = packageSvc.Username;
                ltrServiceTypeName.Text = ecPanelFormatter.GetSvcItemTypeName(packageSvc.TypeId);
                ltrSvcCycleName.Text    = packageSvc.CycleName;
                ltrSvcCyclePeriod.Text  = String.Concat(packageSvc.PeriodLength, " ", packageSvc.BillingPeriod, "(s)");
                ltrSvcSetupFee.Text     = String.Concat(packageSvc.Currency, " ", packageSvc.SetupFee.ToString("C"));
                ltrSvcRecurringFee.Text = String.Concat(packageSvc.Currency, " ", packageSvc.RecurringFee.ToString("C"));
                ltrSvcCreated.Text      = packageSvc.Created.ToString();
                ltrServiceStatus.Text   = ecPanelFormatter.GetServiceStatusName(packageSvc.Status);
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("LOAD_HOSTING_PACKAGE_SVC", ex);
                return(false);
            }

            return(true);
        }
Example #5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtComments.Text.Trim() == "")
            {
                return;
            }

            try
            {
                int result = ES.Services.Comments.AddComment(ItemTypeId, ItemId, Server.HtmlEncode(txtComments.Text), 2);
                if (result < 0)
                {
                    HostModule.ShowResultMessage(result);
                    return;
                }
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("COMMENT_ADD", ex);
                return;
            }

            // clear fields
            txtComments.Text = "";

            // rebind list
            BindComments();
        }
        public bool SaveContractAccount()
        {
            ContractAccount account = null;

            //
            if (!Page.User.Identity.IsAuthenticated)
            {
                //
                string username = txtUsername.Text.Trim();
                //
                if (StorefrontHelper.UsernameExists(username))
                {
                    HostModule.ShowResultMessage(BusinessErrorCodes.ERROR_USER_ALREADY_EXISTS);
                    return(false);
                }
                //
                string state = (txtCountryState.Visible) ? txtCountryState.Text.Trim() : ddlCountryStates.SelectedValue;
                //
                account = ecUtils.GetContractAccountFromInput(username, txtPassword.Text, txtFirstName.Text.Trim(),
                                                              txtLastName.Text.Trim(), txtEmail.Text.Trim(), txtCompany.Text.Trim(), txtAddress.Text.Trim(),
                                                              txtCity.Text.Trim(), ddlCountry.SelectedValue, state, txtPostalCode.Text.Trim(), txtPhoneNumber.Text.Trim(),
                                                              txtFaxNumber.Text.Trim(), txtInstantMsngr.Text.Trim(), ddlMailFormat.SelectedValue);
            }
            else
            {
                account = ecUtils.GetContractAccountFromUserInfo(WSP.PanelSecurity.EffectiveUser);
            }
            //
            ViewState[VIEWSTATE_KEY] = account;
            //
            return(true);
        }
Example #7
0
 private Tab CreateTab(string id, string text)
 {
     return(new Tab(id, GetLocalizedString(text),
                    HostModule.EditUrl("AccountID", PanelRequest.AccountID.ToString(), id,
                                       "SpaceID=" + PanelSecurity.PackageId.ToString(),
                                       "ItemID=" + PanelRequest.ItemID.ToString(), "CollectionID=" + PanelRequest.CollectionID)));
 }
        protected void btnToggleSecuredFolders_Click(object sender, EventArgs e)
        {
            try
            {
                int result = 0;
                if (IsSecuredFoldersInstalled)
                {
                    // uninstall folders
                    result = ES.Services.WebServers.UninstallSecuredFolders(PanelRequest.ItemID);
                }
                else
                {
                    // install folders
                    result = ES.Services.WebServers.InstallSecuredFolders(PanelRequest.ItemID);
                }

                if (result < 0)
                {
                    HostModule.ShowResultMessage(result);
                    return;
                }
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("WEB_INSTALL_FOLDERS", ex);
                return;
            }

            // change state
            IsSecuredFoldersInstalled = !IsSecuredFoldersInstalled;

            // bind items
            ToggleControls();
        }
        private void BindDnsRecord(int recordId)
        {
            try
            {
                ViewState["RecordID"] = recordId;

                GlobalDnsRecord record = ES.Services.Servers.GetDnsRecord(recordId);
                if (record != null)
                {
                    ddlRecordType.SelectedValue = record.RecordType;
                    txtRecordName.Text          = record.RecordName;
                    txtRecordData.Text          = record.RecordData;
                    txtMXPriority.Text          = record.MxPriority.ToString();
                    txtSRVPriority.Text         = record.SrvPriority.ToString();
                    txtSRVWeight.Text           = record.SrvWeight.ToString();
                    txtSRVPort.Text             = record.SrvPort.ToString();
                    ipAddress.AddressId         = record.IpAddressId;
                }

                ToggleRecordControls();
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("GDNS_GET_RECORD", ex);
                return;
            }
        }
Example #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // home element
            lnkHome.NavigateUrl = HostModule.NavigateURL(PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString());

            // organization element
            bool orgVisible = (PanelRequest.ItemID > 0);

            spanOrg.Visible = orgVisible;
            if (orgVisible)
            {
                // load organization details
                Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID);

                lnkOrg.NavigateUrl = HostModule.EditUrl(
                    "ItemID", PanelRequest.ItemID.ToString(), "organization_home",
                    "SpaceID=" + PanelSecurity.PackageId.ToString());
                lnkOrg.Text = org.Name;
            }

            // page name
            string localizedPageName = HostModule.GetLocalizedString(pageName);

            litPage.Text = localizedPageName != null ? localizedPageName : pageName;
        }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ClientScriptManager cs = Page.ClientScript;

            cs.RegisterClientScriptInclude("jquery", ResolveUrl("~/JavaScript/jquery-1.4.4.min.js"));

            if (HeliconApeStatus.IsInstalled)
            {
                if (!IsPostBack)
                {
                    WebSite site = null;
                    try
                    {
                        site = ES.Services.WebServers.GetWebSite(PanelRequest.ItemID);
                    }
                    catch (Exception ex)
                    {
                        HostModule.ShowErrorMessage("WEB_GET_SITE", ex);
                        return;
                    }

                    if (site == null)
                    {
                        RedirectToBrowsePage();
                    }

                    BindHeliconApe(site);
                }
            }
        }
Example #12
0
 /// <summary>
 /// Registers the given <see cref="HostModule"/> with the script
 /// manager.
 /// </summary>
 /// <param name="hostModule">Host module to register.</param>
 public void RegisterHostModule(HostModule hostModule)
 {
     foreach (HostFunctionPrototype hostFunctionPrototype
              in hostModule.HostFunctionPrototypes)
     {
         RegisterHostFunction(hostFunctionPrototype, hostModule);
     }
 }
 protected void odsItemsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         HostModule.ProcessException(e.Exception);
         e.ExceptionHandled = true;
     }
 }
Example #14
0
 public string GetHttpdEditControlUrl(string ctrlKey, string name)
 {
     return(HostModule.EditUrl("ItemID", PanelRequest.ItemID.ToString(), ctrlKey,
                               "Name=" + name,
                               PortalUtils.SPACE_ID_PARAM + "=" + int.Parse(Request.QueryString["ServiceID"]),
                               "ReturnUrlBase64=" + EncodeTo64(Server.UrlEncode(Request.Url.PathAndQuery))
                               ));
 }
Example #15
0
        private MenuItem CreateMenuItem(string text, string key)
        {
            MenuItem item = new MenuItem();

            item.Key  = key;
            item.Text = GetLocalizedString("Text." + text);
            item.Url  = HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), key);
            return(item);
        }
Example #16
0
        protected override void OnOpen(object arg = null)
        {
            base.OnOpen(arg);
            txtRoomIPPort.text = "";
            m_module           = ModuleManager.Instance.GetModule(ModuleDef.HostModule) as HostModule;

            ClearRoomInfo();
            UpdateRoomInfo();
        }
 protected void odsLog_Selected(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         //ShowError(e.Exception.ToString());
         HostModule.ProcessException(e.Exception);
         //this.DisableControls = true;
         e.ExceptionHandled = true;
     }
 }
Example #18
0
    public override void Hide()
    {
        EventManager.Instance.UnregisterEvent("OnHostChanged", UpdateHost);

        hostModule = null;

        lab_roomIP.text = "";

        base.Hide();
    }
Example #19
0
    public override void Show(object args)
    {
        base.Show(args);

        EventManager.Instance.RegisterEvent("OnHostChanged", UpdateHost);

        hostModule = ModuleManager.Instance.EnsureModule <HostModule>();

        UpdateHost();
    }
Example #20
0
 private void BindComments()
 {
     try
     {
         gvComments.DataSource = ES.Services.Comments.GetComments(PanelSecurity.EffectiveUserId, ItemTypeId, ItemId);
         gvComments.DataBind();
     }
     catch (Exception ex)
     {
         HostModule.ShowErrorMessage("COMMENT_GET", ex);
         return;
     }
 }
        protected void gvItems_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            HyperLink lnkView = (HyperLink)e.Row.FindControl("lnkView");

            if (lnkView == null)
            {
                return;
            }

            string localizedLinkText = HostModule.GetLocalizedString(ViewLinkText + ".Text");

            lnkView.Text = localizedLinkText != null ? localizedLinkText : ViewLinkText;
        }
 public void LoadCustomerInvoiceTemplate(int invoiceId)
 {
     try
     {
         //
         string invoiceTemplate = StorehouseHelper.GetCustomerInvoiceFormatted(invoiceId);
         //
         ShowCustomerInvoice(invoiceTemplate);
     }
     catch (Exception ex)
     {
         HostModule.ShowErrorMessage("LOAD_CUSTOMER_INVOICE", ex);
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            //modalTaskDetailsProperties.Hide();

            // set display preferences
            gvLog.PageSize = UsersHelper.GetDisplayItemsPerPage();

            // grid columns
            gvLog.Columns[4].Visible = String.IsNullOrEmpty(logSource);
            gvLog.Columns[6].Visible = PanelRequest.ItemID == 0;


            if (!IsPostBack)
            {
                try
                {
                    btnClearLog.Visible
                        = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);

                    // bind
                    BindPeriod();
                    BindSources();

                    // hide source if required
                    if (!String.IsNullOrEmpty(logSource))
                    {
                        ddlSource.SelectedValue = logSource;
                        SourceRow.Visible       = false;
                    }

                    // tasks
                    BindSourceTasks();

                    // hide item name if required
                    if (PanelRequest.ItemID > 0)
                    {
                        ItemNameRow.Visible      = false;
                        FilterButtonsRow.Visible = false;
                    }
                }
                catch (Exception ex)
                {
                    //ShowErrorMessage("AUDIT_INIT_FORM", ex);
                    HostModule.ProcessException(ex);
                    //this.DisableControls = true;
                    return;
                }
            }
        }
Example #24
0
        public bool Authenticate()
        {
            // status
            int loginStatus = WSP.PortalUtils.AuthenticateUser(txtUsername.Text.Trim(), txtPassword.Text, Request.UserHostAddress,
                                                               false, null, null);

            //
            if (loginStatus < 0)
            {
                HostModule.ShowResultMessage(loginStatus);
                return(false);
            }
            //
            return(true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ShowPanels(false);

                try
                {
                    BindDnsRecords();
                }
                catch (Exception ex)
                {
                    HostModule.ShowErrorMessage("GDNS_GET_RECORD", ex);
                    return;
                }
            }
        }
        protected void btnTruncate_Click(object sender, EventArgs e)
        {
            // truncate
            try {
                int result = ES.Services.DatabaseServers.TruncateSqlDatabase(PanelRequest.ItemID);
                if (result < 0)
                {
                    HostModule.ShowResultMessage(result);
                    return;
                }
            } catch (Exception ex) {
                HostModule.ShowErrorMessage("SQL_TRUNCATE_DATABASE", ex);
                return;
            }

            HostModule.ShowSuccessMessage("SQL_TRUNCATE_DATABASE");
        }
Example #27
0
        private void BindDatabases(int packageId, string groupName)
        {
            try
            {
                SqlDatabase[] databases = ES.Services.DatabaseServers.GetSqlDatabases(packageId,
                                                                                      groupName, false);

                ddlDefaultDatabase.DataSource = databases;
                ddlDefaultDatabase.DataBind();
                ddlDefaultDatabase.Items.Insert(0, new ListItem(GetLocalizedString("Text.SelectDatabase"), ""));
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("SQL_GET_DATABASE", ex);
                return;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ClientScriptManager cs = Page.ClientScript;

            cs.RegisterClientScriptInclude("jquery", ResolveUrl("~/JavaScript/jquery-1.4.4.min.js"));

            //HideServiceColumns(gvWebSites);

            // set display preferences
            gvItems.PageSize = UsersHelper.GetDisplayItemsPerPage();

            itemsQuota.QuotaName = QuotaName;
            lblQuotaName.Text    = GetSharedLocalizedString("Quota." + QuotaName) + ":";

            // edit button
            string localizedButtonText = HostModule.GetLocalizedString(btnAddItem.Text + ".Text");

            if (localizedButtonText != null)
            {
                btnAddItem.Text = localizedButtonText;
            }

            // visibility
            chkRecursive.Visible       = (PanelSecurity.SelectedUser.Role != UserRole.User);
            gvItems.Columns[2].Visible = !String.IsNullOrEmpty(ViewLinkText);
            gvItems.Columns[3].Visible = gvItems.Columns[4].Visible =
                (PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked;
            gvItems.Columns[5].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator);
            gvItems.Columns[6].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);

            ShowActionList();

            if (!IsPostBack)
            {
                // toggle controls
                btnAddItem.Enabled = PackagesHelper.CheckGroupQuotaEnabled(
                    PanelSecurity.PackageId, GroupName, QuotaName);

                searchBox.AddCriteria("ItemName", GetLocalizedString("SearchField.ItemName"));
                searchBox.AddCriteria("Username", GetLocalizedString("SearchField.Username"));
                searchBox.AddCriteria("FullName", GetLocalizedString("SearchField.FullName"));
                searchBox.AddCriteria("Email", GetLocalizedString("SearchField.EMail"));
            }
            searchBox.AjaxData = this.GetSearchBoxAjaxData();
        }
 private bool DeleteGroup(string name)
 {
     try
     {
         int result = ES.Services.WebServers.DeleteSecuredGroup(PanelRequest.ItemID, name);
         if (result < 0)
         {
             HostModule.ShowResultMessage(result);
             return(false);
         }
     }
     catch (Exception ex)
     {
         HostModule.ShowErrorMessage("WEB_DELETE_SECURED_GROUP", ex);
         return(false);
     }
     return(true);
 }
        protected void gvItems_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Detach")
            {
                // remove item from meta base
                int itemId = Utils.ParseInt(e.CommandArgument.ToString(), 0);

                int result = ES.Services.Packages.DetachPackageItem(itemId);
                if (result < 0)
                {
                    HostModule.ShowResultMessage(result);
                    return;
                }

                // refresh the list
                gvItems.DataBind();
            }
        }
 public virtual void SetUp()
 {
     _containerMock = new Mock<IUnityContainer>();
     _hostModule = new HostModule(_containerMock.Object);
 }