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; } }
/// <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); } } }
public static DataSet GetUsers(int ownerId, bool recursive) { DataSet dsUsers = ES.Services.Users.GetRawUsers(ownerId, recursive); DataTable dtUsers = dsUsers.Tables[0]; // add "RoleName", "StatusName" columns dtUsers.Columns.Add("RoleName", typeof(string)); dtUsers.Columns.Add("StatusName", typeof(string)); foreach (DataRow dr in dtUsers.Rows) { dr["RoleName"] = PanelFormatter.GetUserRoleName((int)dr["RoleID"]); dr["StatusName"] = PanelFormatter.GetAccountStatusName((int)dr["StatusID"]); } return(dsUsers); }
private void BindService() { litGroup.Text = PanelFormatter.GetLocalizedResourceGroupName(resourceGroup.GroupName); if (ResourceGroups.VPS2012 == resourceGroup.GroupName || ResourceGroups.Os == resourceGroup.GroupName) { textProvider.Visible = false; ddlProviders.DataSource = ES.Services.Servers.GetProvidersByGroupId(provider.GroupId); ddlProviders.DataBind(); ddlProviders.SelectedValue = provider.ProviderId.ToString(); } else { selectProvider.Visible = false; litProvider.Text = provider.DisplayName; } txtServiceName.Text = service.ServiceName; txtQuotaValue.Text = service.ServiceQuotaValue.ToString(); Utils.SelectListItem(ddlClusters, service.ClusterId); txtComments.Text = service.Comments; }
private void BindGroup() { ResourceGroupInfo group = ES.Services.Servers.GetResourceGroup(PanelRequest.GroupID); litGroupName.Text = serviceName.Text = PanelFormatter.GetLocalizedResourceGroupName(group.GroupName); }
private void BindAccount() { // load user UserInfo user = UsersHelper.GetUser(PanelSecurity.SelectedUserId); if (user != null) { imgAdmin.Visible = (user.Role == UserRole.Administrator); imgReseller.Visible = (user.Role == UserRole.Reseller); imgUser.Visible = (user.Role == UserRole.User); // bind account details litUsername.Text = user.Username; litFullName.Text = Utils.EllipsisString(PortalAntiXSS.Encode(user.FirstName) + " " + PortalAntiXSS.Encode(user.LastName), 25); litSubscriberNumber.Text = PortalAntiXSS.Encode(user.SubscriberNumber); litRole.Text = PanelFormatter.GetUserRoleName(user.RoleId); litCreated.Text = user.Created.ToString(); litUpdated.Text = user.Changed.ToString(); lnkEmail.Text = Utils.EllipsisString(user.Email, 25); lnkEmail.NavigateUrl = "mailto:" + user.Email; // load owner account //UserInfo owner = UsersHelper.GetUser(user.OwnerId); //if(owner != null) //{ // litReseller.Text = owner.Username; //} // bind account status UserStatus status = user.Status; litStatus.Text = PanelFormatter.GetAccountStatusName((int)status); cmdActive.Visible = (status != UserStatus.Active); cmdSuspend.Visible = (status == UserStatus.Active); cmdCancel.Visible = (status != UserStatus.Cancelled); StatusBlock.Visible = (PanelSecurity.SelectedUserId != PanelSecurity.EffectiveUserId); // links lnkSummaryLetter.NavigateUrl = EditUrl("UserID", PanelSecurity.SelectedUserId.ToString(), "summary_letter"); lnkSummaryLetter.Visible = (PanelSecurity.SelectedUser.Role != UserRole.Administrator); lnkEditAccountDetails.NavigateUrl = EditUrl("UserID", PanelSecurity.SelectedUserId.ToString(), "edit_details"); lnkChangePassword.NavigateUrl = EditUrl("UserID", PanelSecurity.SelectedUserId.ToString(), "change_password"); lnkChangePassword.Visible = !((PanelSecurity.SelectedUserId == PanelSecurity.EffectiveUserId) && PanelSecurity.LoggedUser.IsPeer); lnkDelete.NavigateUrl = EditUrl("UserID", PanelSecurity.SelectedUserId.ToString(), "delete"); if (!((PanelSecurity.LoggedUser.Role == UserRole.Reseller) | (PanelSecurity.LoggedUser.Role == UserRole.Administrator))) { lnkDelete.Visible = false; } else { lnkDelete.Visible = (PanelSecurity.SelectedUserId != PanelSecurity.EffectiveUserId); } } }
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)); } } }