/// <summary> /// Handles the ItemDataBound event of the rptItemBriefTypes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterItemEventArgs"/> instance containing the event data.</param> protected void rptItemBriefTypes_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { if (e.Item.DataItem != null) { ItemTypeSummary itemTypeSummary = (ItemTypeSummary)e.Item.DataItem; Label lblItemTypeName = (Label)e.Item.FindControl("lblItemTypeName"); Label lblItemTypeSummary = (Label)e.Item.FindControl("lblItemTypeSummary"); if (lblItemTypeName != null && lblItemTypeSummary != null) { lblItemTypeName.Text = itemTypeSummary.ItemTypeName; lblItemTypeSummary.Text = GetItemTypeSummaryText(itemTypeSummary); } } }
/// <summary> /// Handles the Clicked event of the btnRemoveItemType control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnRemoveItemType_Clicked(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; int itemTypeId = int.Parse(btn.CommandArgument); ItemTypeSummary itemBriefTypes = GetBL <ItemBriefBL>().GetItemBriefCountByItemTypeId(itemTypeId, ProjectID); int itemCount = (itemBriefTypes != null) ? itemBriefTypes.ItemCount : 0; if (itemCount > 0) { ScriptManager.RegisterStartupScript(UpdatePanelItemTypesDropDown, GetType(), "slideUpItemTypes", "slideUpItemTypes();", true); popupItemAlreadyHasBrief.ShowPopup(); } else { bool alreadyRemoved = CheckForConcurrency(itemTypeId); if (!alreadyRemoved) { ScriptManager.RegisterStartupScript(UpdatePanelItemTypesDropDown, GetType(), "slideUpItemTypes", "slideUpItemTypes();", true); btnItemDeleteConfirmation.CommandArgument = btn.CommandArgument; popupItemDeleteConfirmation.ShowPopup(); } } }
/// <summary> /// Gets the item type summary text. /// </summary> /// <param name="itemTypeSummary">The item type summary.</param> /// <returns></returns> private string GetItemTypeSummaryText(ItemTypeSummary itemTypeSummary) { return(string.Format("{0} Completed, {1} In Progress, {2} Not Started", itemTypeSummary.CompletedItemCount, itemTypeSummary.InProgressItemCount, itemTypeSummary.NotStartedItemCount)); }