Esempio n. 1
0
        private void BindPackage()
        {
            PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId);

            if (package == null)
            {
                return;
            }

            rowSpaceServer.Visible = (PanelSecurity.LoggedUser.Role == UserRole.Administrator);

            spaceUser.UserId     = package.UserId;
            litPackageName.Text  = package.PackageName;
            litPurchaseDate.Text = package.PurchaseDate.ToString("d");

            serverDetails.ServerId = package.ServerId;
            litStatus.Text         = PanelFormatter.GetPackageStatusName(package.StatusId);

            // load hosting plan
            HostingPlanInfo plan = ES.Services.Packages.GetHostingPlan(package.PlanId);

            if (plan != null)
            {
                litHostingPlan.Text = plan.PlanName;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// For each row in the table translates status from Id to Value. For example from 1 to Active and so on.
 /// It uses <see cref="PanelFormatter"/>s GetPackageStatusName method for translation purposes.
 /// </summary>
 /// <param name="dt">Table containing rows with Hosting Space information.</param>
 protected void TranslateStatusField(DataTable dt)
 {
     foreach (DataRow row in dt.Rows)
     {
         int statusId = 0;
         if (int.TryParse(row["Status"].ToString(), out statusId))
         {
             row["Status"] = PanelFormatter.GetPackageStatusName(statusId);
         }
     }
 }
Esempio n. 3
0
        private void BindSpace()
        {
            // load space
            PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId);

            if (package != null)
            {
                litSpaceName.Text  = PortalAntiXSS.EncodeOld(package.PackageName);
                chkDefault.Checked = package.DefaultTopPackage;

                // bind space status
                PackageStatus status = (PackageStatus)package.StatusId;
                litStatus.Text = PanelFormatter.GetPackageStatusName(package.StatusId);

                cmdActive.Visible  = (status != PackageStatus.Active);
                cmdSuspend.Visible = (status == PackageStatus.Active);
                cmdCancel.Visible  = (status != PackageStatus.Cancelled);

                StatusBlock.Visible = (PanelSecurity.SelectedUserId != PanelSecurity.EffectiveUserId);

                // bind account details
                litCreated.Text = package.PurchaseDate.ToString();
                bool isNotUser = ((PanelSecurity.LoggedUser.Role != UserRole.User));
                lblSuspendedDate.Visible = litSuspendedDate.Visible = false;
                if (status != PackageStatus.Active)
                {
                    lblSuspendedDate.Visible = litSuspendedDate.Visible = isNotUser;
                    litSuspendedDate.Text    = package.StatusIDchangeDate.ToString();
                }
                serverDetails.ServerId = package.ServerId;

                // load plan
                HostingPlanInfo plan = ES.Services.Packages.GetHostingPlan(package.PlanId);
                if (plan != null)
                {
                    litHostingPlan.Text = plan.PlanName;
                }

                // links
                lnkSummaryLetter.NavigateUrl = EditUrl(PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString(), "summary_letter");
                lnkSummaryLetter.Visible     = (PanelSecurity.PackageId > 1);

                lnkOverusageReport.NavigateUrl = NavigatePageURL("OverusageReport", PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString());
                OverusageReport.Visible        = (PanelSecurity.SelectedUser.Role != UserRole.User);

                lnkEditSpaceDetails.NavigateUrl = EditUrl(PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString(), "edit_details");

                bool ownSpace = (package.UserId == PanelSecurity.EffectiveUserId);
                lnkEditSpaceDetails.Visible = (PanelSecurity.PackageId > 1 && !ownSpace);

                lnkDelete.NavigateUrl = EditUrl(PortalUtils.SPACE_ID_PARAM, PanelSecurity.PackageId.ToString(), "delete");
                if (!((PanelSecurity.LoggedUser.Role == UserRole.Reseller) | (PanelSecurity.LoggedUser.Role == UserRole.Administrator)))
                {
                    lnkDelete.Visible = false;
                }
                else
                {
                    lnkDelete.Visible = ((PanelSecurity.SelectedUserId != PanelSecurity.EffectiveUserId) && (PanelSecurity.PackageId > 1));
                }
            }
        }