public ItemBriefDetails GetItemBriefDetails(ItemBriefRequestDetails itemBriefRequestDetails)
        {
            ItemBriefDetails itemBriefDetails = new Data.DataTypes.ItemBriefDetails();

            using (StageBitzDB dataContext = new StageBitzDB())
            {
                try
                {
                    ItemBriefBL itemBriefBL = new ItemBriefBL(dataContext);
                    ItemTypesBL itemTypesBL = new ItemTypesBL(dataContext);

                    Data.ItemBrief itemBrief = itemBriefBL.GetItemBrief(itemBriefRequestDetails.ItemBriefId);

                    int projectId = 0;
                    if (itemBrief != null)
                    {
                        projectId = itemBrief.ProjectId;
                    }

                    itemBriefDetails.CountryId = itemBriefBL.GetCountryIdByItemBriefId(itemBrief.ItemBriefId);

                    itemBriefDetails.ItemBriefInfo       = itemBriefBL.GetItemBriefInfoByItemBrief(itemBrief);
                    itemBriefDetails.IsReadOnly          = Support.IsReadOnlyRightsForProject(projectId, itemBriefRequestDetails.UserId);
                    itemBriefDetails.CanSeeBudgetSummary = Support.CanSeeBudgetSummary(itemBriefRequestDetails.UserId, projectId);
                    int itemTypeId = itemBriefRequestDetails.ItemTypeId.HasValue ?
                                     itemBriefRequestDetails.ItemTypeId.Value : itemBriefBL.GetItemBriefType(itemBriefRequestDetails.ItemBriefId).ItemTypeId;
                    itemBriefDetails.DisplayMarkUp   = itemTypesBL.GetItemTypeHTML(itemTypeId);
                    itemBriefDetails.ItemBriefValues = itemTypesBL.GetItemBriefFieldValues(itemBriefRequestDetails.ItemBriefId).Select(ibfv =>
                                                                                                                                       new ValuesInfo
                    {
                        Id            = ibfv.ItemBriefValueId,
                        FieldId       = ibfv.FieldId,
                        FieldOptionId = ibfv.FieldOptionId,
                        Value         = ibfv.Value
                    }).ToList();

                    int itemId = 0;
                    int userId = 0;

                    ItemBooking itemBooking = itemBriefBL.GetInUseItemBooking(itemBriefRequestDetails.ItemBriefId);
                    if (itemBooking != null)
                    {
                        itemId = itemBooking.ItemId;
                    }

                    userId = itemBriefRequestDetails.UserId;
                    ItemDetails itemDetails = itemTypesBL.GetItemDetails(itemId, itemBriefRequestDetails.ItemBriefId, userId, null, null, null);
                    if (itemDetails != null)
                    {
                        itemBriefDetails.ItemDetails = itemDetails;
                    }
                }
                catch (Exception ex)
                {
                    AgentErrorLog.HandleException(ex);
                }
                return(itemBriefDetails);
            }
        }
Example #2
0
 /// <summary>
 /// Shows the report links.
 /// </summary>
 /// <param name="itemisedPurchaseReportUrl">The itemised purchase report URL.</param>
 /// <param name="budgetSummaryReportUrl">The budget summary report URL.</param>
 /// <param name="projectId">The project identifier.</param>
 public void ShowReportLinks(string itemisedPurchaseReportUrl, string budgetSummaryReportUrl, int projectId)
 {
     if (Support.CanSeeBudgetSummary(UserID, projectId))
     {
         divReportList.Visible = true;
         hyperLinkItemisedPurchaseReport.NavigateUrl = itemisedPurchaseReportUrl;
         hyperLinkBudgetSummary.NavigateUrl          = budgetSummaryReportUrl;
     }
     else
     {
         divReportList.Visible = false;
     }
 }
Example #3
0
 /// <summary>
 /// Handles the Load event of the Page 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 Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (ProjectID > 0)
         {
             LoadProjectLocations();
             LoadProjectTeam();
             budgetList.ProjectID = ProjectID;
             if (Support.CanSeeBudgetSummary(UserID, ProjectID))
             {
                 budgetList.BudgetListViewMode = ItemBrief.BudgetList.ViewMode.ProjectDashboard;
             }
             else
             {
                 divBudgetPanel.Visible = false;
             }
         }
     }
 }
Example #4
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        /// <exception cref="System.ApplicationException">
        /// Permission denied for Itemised Purchase Report.
        /// or
        /// You don't have permission to view data in this project.
        /// </exception>
        protected void Page_Load(object sender, EventArgs e)
        {
            this.ExportData1.PDFExportClick   += new EventHandler(ExportData1_PDFExportClick);
            this.ExportData1.ExcelExportClick += new EventHandler(ExportData1_ExcelExportClick);
            projectItemTypes.ProjectID         = ProjectId;
            projectWarningPopup.ProjectId      = ProjectId;
            if (!IsPostBack)
            {
                var project = GetBL <ProjectBL>().GetProject(ProjectId);

                if (Support.CanAccessProject(project))
                {
                    if (!Support.CanSeeBudgetSummary(UserID, ProjectId))
                    {
                        throw new ApplicationException("Permission denied for Itemised Purchase Report.");
                    }

                    this.CompanyId           = project.CompanyId;
                    warningDisplay.ProjectID = ProjectId;
                    warningDisplay.LoadData();

                    CultureName = Support.GetCultureName(project.Country.CountryCode);

                    //Set links
                    lnkCompanyInventory.HRef = string.Format("~/Inventory/CompanyInventory.aspx?companyid={0}&relatedtable={1}&relatedid={2}&ItemTypeId={3}",
                                                             project.CompanyId, (int)BookingTypes.Project, ProjectId, projectItemTypes.SelectedItemTypeId);
                    lnkBookings.HRef = string.Format("~/Project/ProjectBookingDetails.aspx?projectid={0}", ProjectId);
                    hyperLinkTaskManager.NavigateUrl = string.Format("~/ItemBrief/TaskManager.aspx?projectid={0}", ProjectId);
                    reportList.ShowReportLinks(string.Format("~/ItemBrief/ItemisedPurchaseReport.aspx?projectid={0}", ProjectId), string.Format("~/ItemBrief/BudgetSummaryReport.aspx?projectid={0}", ProjectId), ProjectId);
                    reportList.ApplyReportLinkStyle("ItemisedPurchaseReport");
                    projectUpdatesLink.ProjectID = ProjectId;
                    projectUpdatesLink.LoadData();

                    LoadBreadCrumbs();
                    LoadData();
                    if (projectItemTypes.SelectedItemTypeId != 0)
                    {
                        DisplayTitle = "Itemised Purchase Report - " + Utils.GetItemTypeById(projectItemTypes.SelectedItemTypeId).Name;
                    }
                    else
                    {
                        DisplayTitle = "Itemised Purchase Report";
                    }
                }
                else
                {
                    if (GetBL <ProjectBL>().IsProjectClosed(project.ProjectId))
                    {
                        StageBitzException.ThrowException(new StageBitzException(ExceptionOrigin.ProjectClose, project.ProjectId, "This Project Is Closed."));
                    }

                    throw new ApplicationException("You don't have permission to view data in this project.");
                }
            }

            projectItemTypes.InformParentToReload += delegate()
            {
                //Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
                ReloadByItemType();
            };
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        /// <exception cref="System.ApplicationException">
        /// Permission denied for this project.
        /// or
        /// Permission denied for Budget Summary Page.
        /// </exception>
        protected void Page_Load(object sender, EventArgs e)
        {
            this.ExportData1.PDFExportClick           += new EventHandler(ExportData1_PDFExportClick);
            this.ExportData1.ExcelExportClick         += new EventHandler(ExportData1_ExcelExportClick);
            projectItemTypes.ProjectID                 = ProjectId;
            projectItemTypes.ShouldShowAllItemTypeText = true;
            if (!IsPostBack)
            {
                StageBitz.Data.Project project = GetBL <Logic.Business.Project.ProjectBL>().GetProject(ProjectId);
                this.CompanyId = project.CompanyId;

                if (!Support.CanAccessProject(project))
                {
                    if (GetBL <ProjectBL>().IsProjectClosed(project.ProjectId))
                    {
                        StageBitzException.ThrowException(new StageBitzException(ExceptionOrigin.ProjectClose, project.ProjectId, "This Project Is Closed."));
                    }

                    throw new ApplicationException("Permission denied for this project.");
                }

                if (!Support.CanSeeBudgetSummary(UserID, ProjectId))
                {
                    throw new ApplicationException("Permission denied for Budget Summary Page.");
                }

                if (project != null)
                {
                    CultureName = Support.GetCultureName(project.Country.CountryCode);
                }

                warningDisplay.ProjectID = ProjectId;
                warningDisplay.LoadData();

                //Set links
                lnkCompanyInventory.HRef = string.Format("~/Inventory/CompanyInventory.aspx?companyid={0}&relatedtable={1}&relatedid={2}&ItemTypeId={3}",
                                                         project.CompanyId, (int)BookingTypes.Project, ProjectId, projectItemTypes.SelectedItemTypeId);
                lnkBookings.HRef = string.Format("~/Project/ProjectBookingDetails.aspx?projectid={0}", ProjectId);
                hyperLinkTaskManager.NavigateUrl = string.Format("~/ItemBrief/TaskManager.aspx?projectid={0}", ProjectId);
                reportList.ShowReportLinks(string.Format("~/ItemBrief/ItemisedPurchaseReport.aspx?projectid={0}", ProjectId), string.Format("~/ItemBrief/BudgetSummaryReport.aspx?projectid={0}", ProjectId), ProjectId);
                reportList.ApplyReportLinkStyle("BudgetSummaryReport");
                projectUpdatesLink.ProjectID = ProjectId;
                projectUpdatesLink.LoadData();

                LoadData();

                projectWarningPopup.ProjectId = ProjectId;
                budgetList.ProjectID          = ProjectId;
                budgetList.ItemTypeID         = projectItemTypes.SelectedItemTypeId;
                budgetList.BudgetListViewMode = UserWeb.Controls.ItemBrief.BudgetList.ViewMode.BudgetSummary;
                LoadBreadCrumbs();

                if (projectItemTypes.SelectedItemTypeId > 0)
                {
                    DisplayTitle = "Budget Summary Report - " + Utils.GetItemTypeById(projectItemTypes.SelectedItemTypeId).Name;
                }
                else
                {
                    DisplayTitle = "Budget Summary Report";
                }
            }
            projectItemTypes.InformParentToReload += delegate()
            {
                //Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
                ReloadByItemType();
            };

            bool IsItemTypeColVisible = true;

            foreach (GridColumn col in gvItems.MasterTableView.RenderColumns)
            {
                if (col.UniqueName == "ItemType" && projectItemTypes.SelectedItemTypeId != -1)
                {
                    col.Visible          = false;
                    IsItemTypeColVisible = false;
                }
                else if (IsItemTypeColVisible)
                {
                    switch (col.UniqueName)
                    {
                    case "Budget":
                    {
                        col.HeaderStyle.Width = 110;
                        break;
                    }

                    case "Expended":
                    {
                        col.HeaderStyle.Width = 110;
                        break;
                    }

                    case "Remaining":
                    {
                        col.HeaderStyle.Width = 110;
                        break;
                    }

                    case "Balance":
                    {
                        col.HeaderStyle.Width = 110;
                        break;
                    }
                    }
                }
            }
        }