protected override void OnInit(EventArgs e) { base.OnInit(e); if (IsClientUser) { pnlWebParts.Visible = false; pnlClient.Visible = true; pnlSubCon.Visible = false; } else if (IsSubConUser) { pnlWebParts.Visible = false; pnlClient.Visible = false; pnlSubCon.Visible = true; } else { pnlWebParts.Visible = true; pnlClient.Visible = false; pnlSubCon.Visible = false; } if (pnlClient.Visible) { // remove all the contols in the normal view to prevent them running and therefore save time; pnlWebParts.Controls.Clear(); DateTime endDate = DateTime.Today.AddMonths(-1); endDate = new DateTime(endDate.Year, endDate.Month, System.Globalization.CultureInfo.CurrentCulture.Calendar.GetDaysInMonth(endDate.Year, endDate.Month)); lblUnbilledEndDate.Text = endDate.ToString("MMM yy"); Orchestrator.Facade.User facUser = new Orchestrator.Facade.User(); DataSet dsUser = facUser.GetOrganisationForUser(((Orchestrator.Entities.CustomPrincipal)Page.User).UserName); int clientIdentityID = (int)dsUser.Tables[0].Rows[0]["RelatedIdentityID"]; slOrdersForWeek.InitParameters = slOrdersForWeek.InitParameters + ",ClientIdentityID=" + clientIdentityID.ToString(); slInvoicedRevenue.InitParameters += ",ClientIdentityID=" + clientIdentityID.ToString(); slOutstandingPODs.InitParameters += ",ClientIdentityID=" + clientIdentityID.ToString(); slUninvoicedWork.InitParameters += ",ClientIdentityID=" + clientIdentityID.ToString(); } // check to see if the user has got FleetMetrk installed and active. if (!Orchestrator.Globals.Configuration.ShowFleetMetrik) { radTabs.Tabs[1].NavigateUrl = "nofleetmetrik.aspx"; } // If this is FleetMetrik then we do not want to show the first Tab at all if (Page.Theme == "FleetMetrik" || Orchestrator.Globals.Configuration.FleetMetrikInstance) { Server.Transfer("fmwebparts2.aspx"); } }
//---------------------------------------------------------------------------------------------------// private void PopulateUsers() { Facade.User user = new Orchestrator.Facade.User(); DataSet users = user.GetAllUsers(); this.cboUsers.Items.Clear(); this.cboSinglePageUser.Items.Clear(); this.cboUsers.Items.Add(new RadComboBoxItem("All Users")); this.cboSinglePageUser.Items.Add(new RadComboBoxItem("All Users")); foreach (DataRow row in users.Tables[0].Rows) { this.cboUsers.Items.Add(new RadComboBoxItem(row["UserName"].ToString())); this.cboSinglePageUser.Items.Add(new RadComboBoxItem(row["UserName"].ToString())); } }
public void cboPoint_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) { DataSet ds = null; Orchestrator.Facade.Point facPoint = new Orchestrator.Facade.Point(); int noOfRowsToReturn = 20; // The search text entered by the user ("e.Text") can be split into two regions delimited by a backslash. // Any text to the left of the first backslash (or when there is no backslash) should be used to filter the organisation name. // Any text to the right of a backslash should be used to filter the point description. char filterChar = (char)92; // Backslash character "\" string[] filterString = e.Text.Split(filterChar.ToString().ToCharArray()); bool isClient = false; Orchestrator.Entities.CustomPrincipal cp = Page.User as Orchestrator.Entities.CustomPrincipal; isClient = cp.IsInRole(((int)eUserRole.ClientUser).ToString()); int clientIdentityId = 0; if (isClient) { // Get the clients related organisation identityId. //Get the user's Identity row Orchestrator.Facade.IUser facUser = new Orchestrator.Facade.User(); SqlDataReader reader = facUser.GetRelatedIdentity(((Orchestrator.Entities.CustomPrincipal)Page.User).UserName); reader.Read(); //Is the User a Client User if ((eRelationshipType)reader["RelationshipTypeId"] == eRelationshipType.IsClient) { clientIdentityId = (int)reader["RelatedIdentityId"]; } reader.Close(); // If clientIdentityId = 0 then throw error? if (string.IsNullOrEmpty(e.Text)) { ds = facPoint.GetAllWithAddressForClientFiltered(clientIdentityId, ePointType.Any, "", noOfRowsToReturn); } else { ds = facPoint.GetAllWithAddressForClientFiltered(clientIdentityId, ePointType.Any, e.Text, noOfRowsToReturn); } } else { if (string.IsNullOrEmpty(e.Text)) { // Do not filter the point type for the time being - just display 'Any'. ds = facPoint.GetAllWithAddress(ePointType.Any, "", "", noOfRowsToReturn); } else if (filterString.Length == 1) { // Do not filter the point type for the time being - just display 'Any'. ds = facPoint.GetAllWithAddress(ePointType.Any, filterString[0], "", noOfRowsToReturn); } else if (filterString.Length > 1) { // Do not filter the point type for the time being - just display 'Any'. ds = facPoint.GetAllWithAddress(ePointType.Any, filterString[0], filterString[1], noOfRowsToReturn); } } DataTable dt = ds.Tables[0]; RadComboBoxItem rcItem = null; foreach (DataRow row in dt.Rows) { rcItem = new RadComboBoxItem(); PointComboItem comboItem = new PointComboItem(row); rcItem.DataItem = comboItem; rcItem.Text = comboItem.SingleLineText; rcItem.Value = row["IdentityId"].ToString() + "," + row["PointId"]; cboPoint.Items.Add(rcItem); } }