Ejemplo n.º 1
0
		private byte[] GetSummaryPdf(string managedItemId, string systemManagedItemName)
		{
			Business.ManagedItem managedItem = Business.ManagedItem.Get(new Guid(managedItemId), true);
			managedItem.ApplyTermDependencies(true,null);
            Guid itatSystemId = managedItem.SystemID;
            Business.ITATSystem itatSystem = Business.ITATSystem.Get(itatSystemId);
            Business.SecurityHelper securityHelper = new Kindred.Knect.ITAT.Business.SecurityHelper(itatSystem);
			Business.ManagedItemSummary miSummary = new Business.ManagedItemSummary(managedItem);
            string xml = miSummary.CreateXml(systemManagedItemName, securityHelper.UserRoles);	
			return Kindred.Common.WebServices.WebServiceFactory<PDFService.Service>.CreateService(Kindred.Common.WebServices.EnvironmentDetectionMode.Machine).GeneratePDF4(xml, managedItem.State.IsDraft ?? false, true, true);
		}
 protected virtual void GetManagedItem()
 {
     string qsValue = Request.QueryString[Common.Names._QS_MANAGED_ITEM_ID];
     bool loadComplexLists = false;
     _managedItem = Business.ManagedItem.Get(new Guid(qsValue), loadComplexLists);
     string qsTermGroup = Request.QueryString[Common.Names._QS_MANAGED_ITEM_TERMGROUP];
     if (_securityHelper == null)
         _securityHelper = new SecurityHelper(_itatSystem);
     if (string.IsNullOrEmpty(qsTermGroup))
     {
         bool isAdmin = Utility.ListHelper.HaveAMatch(_itatSystem.AllowedRoles(Business.XMLNames._AF_AdminViewer), _securityHelper.UserRoles);
         ActiveTermGroup = _managedItem.GetDefaultTermGroup(_securityHelper.UserRoles, isAdmin);
         try
         {
             Guid guid = ActiveTermGroup.ID;
         }
         catch (Exception)
         {
             UnauthorizedPageAccess();
         }
     }
     else
     {
         ActiveTermGroup = _managedItem.FindTermGroup(new Guid(qsTermGroup));
         if (ActiveTermGroup == null)
             throw new Exception(string.Format("Term Group ID {0} not found.", qsTermGroup));
         if (!_managedItem.CanAccessTermGroup(ActiveTermGroup, _securityHelper.UserRoles))
         {
             if (!Utility.ListHelper.HaveAMatch(_itatSystem.AllowedRoles(Business.XMLNames._AF_AdminViewer), _securityHelper.UserRoles))
                 UnauthorizedPageAccess();
         }
     }
 }
Ejemplo n.º 3
0
		private static Panel CreatePickListSearchControl(PickListTerm pickListTerm, bool canEditProfile, SecurityHelper securityHelper)
		{
			Panel pnl = new Panel();
			pnl.ID = ControlID(pickListTerm.Name);

			if (pickListTerm.PickListItems.Count == 1)    //1 picklist item: single check box
			{
				CheckBox chk = new CheckBox();
				chk.BorderStyle = BorderStyle.None;
				chk.ID = pnl.ID + "_lst";    // ????
				chk.CssClass = Common.Names._STYLE_CSSCLASS_EDIT;
				chk.Text = pickListTerm.PickListItems[0].Value;
				pnl.Controls.Add(chk);
			}
			else
			{
				if (pickListTerm.MultiSelect ?? false)  // multi-select picklist: MultiSelectGrid control
				{
					pnl.Height = Unit.Pixel(4 + 20 * Math.Min(4, pickListTerm.PickListItems.Count));
					pnl.Width = Unit.Percentage(100.0);

					MultiSelectGrid grd = new MultiSelectGrid();
					grd.ID = pnl.ID + "_lst";
					grd.CheckboxColumn = 0;
					grd.DataSource = pickListTerm.PickListItems;
					grd.BoundColumns = "Value";
					//grd.DataKeyNames = new string[] { "Value" };
					grd.Container = pnl.ID;
					grd.HeaderContainer = "";
					grd.AutoGenerateColumns = false;
					grd.RowHighlighting = false;
					grd.EnableClickEvent = false;
					grd.EnableDoubleClickEvent = false;
					grd.EnableHeaderClick = false;
					grd.ShowHeader = false;
					grd.ColumnWidths = "100%";
					grd.DataBind();
					pnl.Controls.Add(grd);
				}
				else
				{
					if (pickListTerm.PickListItems.Count == 2)   //2 item single-select picklist: RadioButtonList
					{
						RadioButtonList rdolst = new RadioButtonList();
						rdolst.ID = pnl.ID + "_lst";
						rdolst.CellPadding = 0;
						rdolst.CellSpacing = 0;
						rdolst.RepeatDirection = RepeatDirection.Vertical;
						AddListItems(rdolst, pickListTerm.PickListItems);
						pnl.Controls.Add(rdolst);
					}
					else          // 3 or more item single-select list: DropDrownList
					{
						DropDownList ddl = new DropDownList();
						ddl.ID = pnl.ID + "_lst";
						ddl.Width = Unit.Percentage(100.0);
						ddl.Items.Add(new ListItem("(Select One)", ""));
						AddListItems(ddl, pickListTerm.PickListItems);
						pnl.Controls.Add(ddl);
					}
				}
			}
			return pnl;
		}
Ejemplo n.º 4
0
        public bool UserIsInRole(string applicationFunctionName)
        {
            SecurityHelper securityHelper = new SecurityHelper(this);
            if (Utility.ListHelper.HaveAMatch(this.AllowedRoles(applicationFunctionName), securityHelper.UserRoles))
            {
                return true;
            }
            return false;

        }
Ejemplo n.º 5
0
		private static Panel CreateFacilitySearchControl(FacilityTerm facilityTerm, bool canEditProfile, SecurityHelper securityHelper)
		{
			bool canEdit = canEditProfile;
			if (facilityTerm.SystemTerm && facilityTerm.OwningFacilityIDs.Count > 0)
				canEdit = false;

			Panel pnl = new Panel();
			pnl.ID = ControlID(facilityTerm.Name);
			pnl.CssClass = "NoBorder";

			if (canEdit)
			{

				FacilityCollection facilities;
				if (facilityTerm.UseUserSecurity ?? false)
					if (facilityTerm.IncludeChildren ?? false)
						facilities = FacilityCollection.FilteredFacilityList(securityHelper.AllUserFacilities, facilityTerm);
					else
						facilities = FacilityCollection.FilteredFacilityList(securityHelper.UserFacilities, facilityTerm);
				else
					facilities = FacilityCollection.FilteredFacilityList(FacilityCollection.FacilityList(Data.Facility.CorporateFacilityId, facilityTerm.IncludeChildren ?? false), facilityTerm);
				List<Data.FacilityDataRow> sortedFacilities = facilities.SortedList(facilityTerm.SortField);

				if (facilityTerm.MultiSelect ?? false)
				{
					pnl.Height = Unit.Pixel(4 + 20 * Math.Min(4, facilities.Count));
					pnl.Width = Unit.Percentage(100.0);

					MultiSelectGrid grd = new MultiSelectGrid();
					grd.CssClass = "MSG";
					grd.ID = pnl.ID + "_lst";
					grd.CheckboxColumn = 0;
					grd.BoundColumns = "FacilityId SapFacilityId FacilityName";
					grd.ColumnWidths = "0px 60px 100%";
					//grd.DataKeyNames = new string[] { "FacilityId" };
					grd.Container = pnl.ID;
					grd.HeaderContainer = "";
					grd.AutoGenerateColumns = false;
					grd.EnableClickEvent = false;
					grd.RowHighlighting = false;
					grd.EnableDoubleClickEvent = false;
					grd.EnableHeaderClick = false;
					grd.ShowHeader = false;
					grd.DataSource = sortedFacilities;
					grd.DataBind();
					pnl.Controls.Add(grd);
				}
				else
				{
					DropDownList ddl = new DropDownList();
					ddl.ID = pnl.ID + "_lst";
					ddl.Width = Unit.Parse("100%");
					Helper.LoadListControl(ddl, sortedFacilities, "SapIdPlusName", "FacilityId", "", true, "(Select a Facility)", "0");
					pnl.Controls.Add(ddl);
				}
			}
			else
			{
				Label lbl = new Label();
				lbl.Text = string.Format("{0} - {1}", facilityTerm.DisplayValue(XMLNames._TPS_SAPID), facilityTerm.DisplayValue(XMLNames._TPS_FacilityName));
				pnl.Controls.Add(lbl);
			}
			return pnl;
		}
Ejemplo n.º 6
0
		private static Panel CreateMSOSearchControl(MSOTerm msoTerm, bool canEditProfile, SecurityHelper securityHelper)
		{
			Panel pnl = new Panel();
			pnl.ID = ControlID(msoTerm.Name);
			TextBox txtMso = new TextBox();
			txtMso.ID = pnl.ID + "_lst";
			txtMso.Width = Unit.Percentage(100.0);
			pnl.Controls.Add(txtMso);
			return pnl;
		}
Ejemplo n.º 7
0
		private static Panel CreateRenewalSearchControl(RenewalTerm renewalTerm, bool canEditProfile, SecurityHelper securityHelper)
		{
			Panel pnl = new Panel();
			pnl.ID = ControlID(renewalTerm.Name);
			pnl.Controls.Add(DateRangeControl(renewalTerm.Name));
			return pnl;
		}
Ejemplo n.º 8
0
		private static Panel CreateDateSearchControl(DateTerm dateTerm, bool canEditProfile, SecurityHelper securityHelper)
		{
			Panel pnl = new Panel();

			//if current page is the Profile page, then display the MSO Control.  Otherwise (e.g. Search), show a text box.
			BaseManagedItemPage p = HttpContext.Current.CurrentHandler as BaseManagedItemPage;
			if (p == null)
			{
				pnl.Controls.Add(DateRangeControl(dateTerm.Name));
			}
			else
			{
				//Profile page
				pnl.Controls.Add(CreateDateControl(dateTerm.Name));
			}
			return pnl;
		}
Ejemplo n.º 9
0
		private static TextBox CreateTextSearchControl(TextTerm textTerm, bool canEditProfile, SecurityHelper securityHelper)
		{
			TextBox txt = new TextBox();
			txt.ID = ControlID(textTerm.Name);
			switch (textTerm.Format)
			{
				case TextTermFormat.Plain:
					txt.Width = Unit.Percentage(100.0);
					break;
				case TextTermFormat.Number:
					txt.Width = Unit.Pixel(120);
					break;
				case TextTermFormat.Currency:
					txt.Width = Unit.Pixel(120);
					break;
				case TextTermFormat.SSN:
					txt.Width = Unit.Pixel(120);
					break;
				case TextTermFormat.Phone:
					txt.Width = Unit.Pixel(120);
					break;
				case TextTermFormat.PhonePlusExtension:
					txt.Width = Unit.Pixel(200);
					break;
				default:
					break;
			}
			return txt;
		}