public string GetBuildTypeNameByID(int id) { BuildTypesTableAdapter buildTypesAdapter = new BuildTypesTableAdapter(); phxbuild.BuildTypesDataTable buildTypeTable = buildTypesAdapter.GetBuildTypeByID(id); string buildTypeName = ""; if (buildTypeTable.Count > 0) { buildTypeName = buildTypeTable[0].Name; // Strip out "Build" from the end if (buildTypeName.LastIndexOf("Build") != -1) { buildTypeName = buildTypeName.Substring(0, buildTypeName.LastIndexOf("Build")); } buildTypeName = buildTypeName.Trim(); } else { buildTypeName = "unknow (" + id + ")"; } return(buildTypeName); }
protected void Page_Load(object sender, EventArgs e) { // Get current user WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent(); int lastSlash = currentIdentity.Name.LastIndexOf('\\') + 1; mUserName = currentIdentity.Name.Substring(lastSlash, currentIdentity.Name.Length - lastSlash).ToLower(); // Get user access level mAccessLevel = s_phxBuildDB.GetAccessByUserID(mUserName); // Get builds lockdown mBuildsLockedDown = s_phxBuildDB.GetStatusLockdown(); if (!Page.IsPostBack) { // Populate controls // // BuildTypes radio buttons phxbuild.BuildTypesDataTable buildTypesTable = s_phxBuildDB.GetBuildTypesSorted(); buildTypeRadioButtonList.Items.Clear(); for (int i = 0; i < buildTypesTable.Count; i++) { bool bIsItemEnabled = false; if (mAccessLevel >= buildTypesTable[i].Perms) { bIsItemEnabled = true; } string typeName = null; if (!buildTypesTable[i].IsNameNull()) { typeName = buildTypesTable[i].Name; } else { typeName = "Unkown"; } string typeDescription = null; if (!buildTypesTable[i].IsDescriptionNull()) { typeDescription = buildTypesTable[i].Description; } string name; if ((typeName != null) && (typeDescription != null)) { name = typeName.Trim() + ": " + typeDescription.Trim(); } else { name = typeName.Trim(); } string value = buildTypesTable[i].Id.ToString(); buildTypeRadioButtonList.Items.Add(new ListItem(name, value, bIsItemEnabled)); if ((buildTypeRadioButtonList.SelectedIndex == -1) && bIsItemEnabled) { buildTypeRadioButtonList.SelectedIndex = i; } } } else { buildQueueGridView.DataBind(); } if (mBuildsLockedDown == true) { lockdownStateLabel.Text = lockdownLabelLockStr; } else { lockdownStateLabel.Text = lockdownLabelUnlockStr; } if (mBuildsLockedDown && (mAccessLevel < 6)) { typeLabel.Enabled = false; buildTypeRadioButtonList.Enabled = false; commentsLabel.Enabled = false; buildCommentTextBox.Enabled = false; buildButton.Enabled = false; } else { typeLabel.Enabled = true; buildTypeRadioButtonList.Enabled = true; commentsLabel.Enabled = true; buildCommentTextBox.Enabled = true; buildButton.Enabled = true; } // Refresh grid view colors refreshHighLight(); }