Exemplo n.º 1
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.Exception">project not found</exception>
        /// <exception cref="System.ApplicationException">Permission denied for this project </exception>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["projectid"] != null)
                {
                    ProjectID = Convert.ToInt32(Request.QueryString["projectid"].ToString());
                    ucProjectEvents.ProjectID = ProjectID;
                }

                StageBitz.Data.Project project = (from p in DataContext.Projects
                                                  where p.ProjectId == ProjectID
                                                  select p).FirstOrDefault();
                if (project == null)
                {
                    throw new Exception("project not found");
                }

                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 ");
                }

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

                //Set last updated date for concurrency handling
                OriginalLastUpdatedDate = project.LastUpdatedDate.Value;
                btnCancel.PostBackUrl   = string.Format("~/Project/ProjectDashboard.aspx?projectid={0}", ProjectID);
                DisplayTitle            = "Manage Schedule";//string.Format("{0}'s Dashboard", Support.TruncateString(project.ProjectName, 32));

                bool isReadOnlyRightsForProject = Support.IsReadOnlyRightsForProject(ProjectID);
                btnCancel.Visible = !isReadOnlyRightsForProject;

                #region SET LINKS

                lnkCompanyInventory.HRef = string.Format("~/Inventory/CompanyInventory.aspx?companyid={0}&relatedtable={1}&relatedid={2}", project.CompanyId, (int)BookingTypes.Project, ProjectID);
                lnkBookings.HRef         = string.Format("~/Project/ProjectBookingDetails.aspx?projectid={0}", ProjectID);
                linkTaskManager.HRef     = 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);
                projectUpdatesLink.ProjectID = ProjectID;
                projectUpdatesLink.LoadData();

                #endregion SET LINKS

                LoadBreadCrumbs(project);
            }

            ucProjectEvents.SetEventsGridLength(900);//to fix the events grid issue in chrome set the lengh of the grid manually.
        }
Exemplo n.º 2
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.Exception">project not found</exception>
        /// <exception cref="System.ApplicationException">
        /// Permission denied for this project
        /// or
        /// Invalid request.
        /// </exception>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["projectid"] != null)
                {
                    ProjectID = Convert.ToInt32(Request.QueryString["projectid"].ToString());
                    projectWarningPopup.ProjectId = ProjectID;

                    StageBitz.Data.Project project = (from p in DataContext.Projects
                                                      where p.ProjectId == ProjectID && p.IsActive == true
                                                      select p).FirstOrDefault();
                    if (project == null)
                    {
                        throw new Exception("project not found");
                    }

                    this.CompanyId = project.CompanyId;
                    DisplayTitle   = string.Format("{0}'s Updates Report", Support.TruncateString(project.ProjectName, 32));

                    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 ");
                    }

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

                    LoadConfigurationSettings();

                    #region SET LINKS

                    lnkCompanyInventory.HRef = string.Format("~/Inventory/CompanyInventory.aspx?companyid={0}&relatedtable={1}&relatedid={2}", project.CompanyId, (int)BookingTypes.Project, ProjectID);
                    lnkBookings.HRef         = string.Format("~/Project/ProjectBookingDetails.aspx?projectid={0}", ProjectID);
                    linkTaskManager.HRef     = ResolveUrl(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);
                    projectUpdatesLink.ProjectID = ProjectID;
                    projectUpdatesLink.LoadData(false);

                    #endregion SET LINKS

                    LoadBreadCrumbs(project);
                }
                else //UNCOMMENT this
                {
                    throw new ApplicationException("Invalid request.");
                }
            }
        }
Exemplo n.º 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>
        /// <exception cref="System.Exception">project not found</exception>
        /// <exception cref="System.ApplicationException">
        /// Permission denied for this project
        /// or
        /// Permission denied to this page
        /// </exception>
        protected void Page_Load(object sender, EventArgs e)
        {
            //IsLargeContentArea = true;
            if (!IsPostBack)
            {
                StageBitz.Data.Project project = (from p in DataContext.Projects
                                                  where p.ProjectId == ProjectId && p.IsActive == true
                                                  select p).FirstOrDefault();
                if (project == null)
                {
                    throw new Exception("project not found");
                }

                if (!Support.CanAccessProject(project))
                {
                    if (GetBL <ProjectBL>().IsProjectClosed(ProjectId))
                    {
                        StageBitzException.ThrowException(new StageBitzException(ExceptionOrigin.ProjectClose, project.ProjectId, "Permission denied for this project."));
                    }

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

                if (Support.IsReadOnlyRightsForProject(ProjectId, UserID, false))
                {
                    if (GetBL <ProjectBL>().IsProjectClosed(project.ProjectId))
                    {
                        StageBitzException.ThrowException(new StageBitzException(ExceptionOrigin.ProjectClose, project.ProjectId, "Permission denied for this page."));
                    }

                    throw new ApplicationException("Permission denied to this page ");
                }

                Data.Booking booking = this.GetBL <InventoryBL>().GetBooking(ProjectId, GlobalConstants.RelatedTables.Bookings.Project);
                editBookingDetails.ItemTypeId         = ItemTypeId;
                editBookingDetails.IsToDateChange     = IsToDateChange;
                editBookingDetails.BookingId          = booking.BookingId;
                editBookingDetails.IsInventoryManager = false;
                editBookingDetails.CallBackURL        = string.Format("~/Project/ProjectBookingDetails.aspx?projectid={0}", ProjectId);

                DisplayTitle = "Bookings";
                LoadBreadCrumbs(project);
                lnkCompanyInventory.HRef = string.Format("~/Inventory/CompanyInventory.aspx?companyid={0}&relatedtable={1}&relatedid={2}", project.CompanyId, (int)BookingTypes.Project, ProjectId);
                lnkBookings.HRef         = string.Format("~/Project/ProjectBookingDetails.aspx?projectid={0}", ProjectId);
                linkTaskManager.HRef     = 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);
                projectUpdatesLink.ProjectID = ProjectId;
                projectUpdatesLink.LoadData();
            }
        }
Exemplo n.º 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 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);
            taskList.SetTasksGridWidth(930);
            if (!IsPostBack)
            {
                StageBitz.Data.Project project = GetBL <Logic.Business.Project.ProjectBL>().GetProject(ProjectId);

                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.");
                }

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

                bool isReadOnly = Support.IsReadOnlyRightsForProject(ProjectId);

                LoadList();
                if (ProjectId > 0)
                {
                    LoadBreadCrumbs();
                    //For observers, do not allow delete list
                    if (isReadOnly)
                    {
                        btnDeleteList.Enabled = false;
                    }
                }

                //Set links
                lnkCompanyInventory.HRef         = string.Format("~/Inventory/CompanyInventory.aspx?companyid={0}&relatedtable={1}&relatedid={2}&ItemTypeId={3}", project.CompanyId, (int)BookingTypes.Project, ProjectId, ItemTypeId);
                lnkBookings.HRef                 = string.Format("~/Project/ProjectBookingDetails.aspx?projectid={0}", ProjectId);
                hyperLinkTaskManager.NavigateUrl = string.Format("~/ItemBrief/TaskManager.aspx?projectid={0}&ItemTypeId={1}", ProjectId, ItemTypeId);
                reportList.ShowReportLinks(string.Format("~/ItemBrief/ItemisedPurchaseReport.aspx?projectid={0}", ProjectId), string.Format("~/ItemBrief/BudgetSummaryReport.aspx?projectid={0}", ProjectId), ProjectId);
                projectUpdatesLink.ProjectID = ProjectId;
                projectUpdatesLink.LoadData();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Handles the ItemDataBound event of the gvClosedProjects control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridItemEventArgs"/> instance containing the event data.</param>
        protected void gvClosedProjects_ItemDataBound(object sender, GridItemEventArgs e)
        {
            //Set company name, set project name, and set those links
            if (e.Item is GridDataItem)
            {
                ProjectListInfo project = e.Item.DataItem as ProjectListInfo;

                HtmlAnchor lnkProject = (HtmlAnchor)e.Item.FindControl("lnkProject");
                HtmlAnchor lnkCompany = (HtmlAnchor)e.Item.FindControl("lnkCompany");
                Literal    litCompany = (Literal)e.Item.FindControl("litCompany");
                Label      lblProject = (Label)e.Item.FindControl("lblProject");
                //INITIALIZATION
                string projectName = (project.ProjectName != null) ? Support.TruncateString(project.ProjectName, 20) : string.Empty;
                string companyName = (project.CompanyName != null) ? Support.TruncateString(project.CompanyName, 20) : string.Empty;

                if (lnkProject != null)
                {
                    lnkProject.HRef      = string.Format("~/Project/ProjectDashboard.aspx?projectid={0}", project.ProjectId);
                    lnkProject.InnerText = lblProject.Text = projectName;

                    if (project.IsCompanyAdmin || Support.CanAccessProject(project.ProjectId))
                    {
                        lblProject.Visible = false;
                        lnkProject.Visible = true;
                    }
                    else
                    {
                        lblProject.Visible = true;
                        lnkProject.Visible = false;
                    }
                }

                if (lnkCompany != null && litCompany != null)
                {
                    lnkCompany.HRef      = string.Format("~/Company/CompanyDashboard.aspx?companyid={0}", project.CompanyId);
                    lnkCompany.InnerText = companyName;
                    litCompany.Text      = companyName;
                }

                if (!project.IsCompanyAdmin)
                {
                    lnkCompany.Visible = false;
                    litCompany.Visible = true;
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Handles the OnRowDataBound event of the gvEvents control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridViewRowEventArgs"/> instance containing the event data.</param>
        protected void gvEvents_OnRowDataBound(Object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                dynamic projectEvent = e.Row.DataItem as dynamic;

                LinkButton lnkProject   = (LinkButton)e.Row.FindControl("lnkProjectName");
                Label      lblProject   = (Label)e.Row.FindControl("lblProjectName");
                Label      lblEventName = (Label)e.Row.FindControl("lblEventName");
                Literal    litDate      = (Literal)e.Row.FindControl("litDate");

                litDate.Text = Support.FormatDate(projectEvent.EventDate);

                if (lblProject != null && lblProject != null)
                {
                    string truncatedProjectName = Support.TruncateString(projectEvent.Project.ProjectName, 18);
                    if (Support.CanAccessProject(projectEvent.ProjectId))
                    {
                        lnkProject.Text        = truncatedProjectName;
                        lnkProject.PostBackUrl = string.Format("~/Project/ProjectDashboard.aspx?projectid={0}", projectEvent.ProjectId);
                        lblProject.Visible     = false;
                        lnkProject.Visible     = true;
                    }
                    else
                    {
                        lblProject.Text    = truncatedProjectName;
                        lblProject.Visible = true;
                        lnkProject.Visible = false;
                    }
                }

                lnkProject.Text        = Support.TruncateString(projectEvent.Project.ProjectName, 18);
                lnkProject.PostBackUrl = string.Format("~/Project/ProjectDashboard.aspx?projectid={0}", projectEvent.ProjectId);
                if (projectEvent.Project.ProjectName.Length > 18)
                {
                    lnkProject.ToolTip = projectEvent.Project.ProjectName;
                }

                lblEventName.Text = Support.TruncateString(projectEvent.EventName, 18);
                if (projectEvent.EventName.Length > 18)
                {
                    lblEventName.ToolTip = projectEvent.EventName;
                }
            }
        }
Exemplo n.º 7
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.Exception">project not found</exception>
        /// <exception cref="System.ApplicationException">Permission denied for this project </exception>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StageBitz.Data.Project project = (from p in DataContext.Projects
                                                  where p.ProjectId == ProjectId && p.IsActive == true
                                                  select p).FirstOrDefault();
                if (project == null)
                {
                    throw new Exception("project not found");
                }

                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 ");
                }
                bookingDetails.CanEditBookingDates = !GetBL <ProjectBL>().IsReadOnlyRightsForProject(ProjectId, UserID, false);
                //bookingDetails.RelatedId = ProjectId;
                //bookingDetails.RelatedTableName = "Project";
                bookingDetails.BookingId          = GetBL <InventoryBL>().GetBooking(ProjectId, "Project").BookingId;
                bookingDetails.DisplayMode        = UserWeb.Controls.Inventory.BookingDetails.ViewMode.Project;
                bookingDetails.OnlyShowMyBookings = this.OnlyShowMyBookings;
                DisplayTitle = "Bookings";
                LoadBreadCrumbs(project);
                lnkCompanyInventory.HRef = string.Format("~/Inventory/CompanyInventory.aspx?companyid={0}&relatedtable={1}&relatedid={2}", project.CompanyId, (int)BookingTypes.Project, ProjectId);
                lnkBookings.HRef         = string.Format("~/Project/ProjectBookingDetails.aspx?projectid={0}", ProjectId);
                linkTaskManager.HRef     = 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);
                projectUpdatesLink.ProjectID = ProjectId;
                projectUpdatesLink.LoadData();
            }
        }
Exemplo n.º 8
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">
        /// Item type not found
        /// or
        /// Project not found
        /// or
        /// Permission denied for this project
        /// </exception>
        /// <exception cref="System.Exception">Item Type not found</exception>
        protected void Page_Load(object sender, EventArgs e)
        {
            projectItemTypes.ProjectID = ProjectId;
            if (!IsPostBack)
            {
                LoadItemBriefSorting();
                StageBitz.Data.Project project = GetBL <ProjectBL>().GetProject(ProjectId);

                #region concurrentScenarios

                projectWarningPopup.ProjectId = ProjectId;

                if (isItemRmoved())
                {
                    throw new ApplicationException("Item type not found");
                }

                #endregion concurrentScenarios

                #region Check access security

                if (project == null)
                {
                    throw new ApplicationException("Project not found");
                }

                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 ");
                }

                //Check the validity of the ItemType
                if (Utils.GetItemTypeById(ItemTypeId) == null)
                {
                    throw new Exception("Item Type not found");
                }

                #endregion Check access security

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

                //Set the page read only status if the user is project "Observer"
                IsReadOnly         = Support.IsReadOnlyRightsForProject(ProjectId);
                pnlAddItem.Visible = !IsReadOnly;

                displaySettings.Module = ListViewDisplaySettings.ViewSettingModule.ProjectItemBriefList;
                displaySettings.LoadControl();

                txtName.Focus();

                #region SET LINKS

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

                #endregion SET LINKS

                var    itemType          = Utils.GetItemTypeById(ItemTypeId);
                string searchDefaultText = string.Concat("Find ", itemType.Name, " Briefs...");
                wmeFindName.WatermarkText = searchDefaultText;
                DisplayTitle = string.Format("{0} Brief List", string.Concat(Utils.GetItemTypeById(ItemTypeId).Name));
                LoadBreadCrumbs(project);
                ImportbulkItemsControl.ProjectID  = ProjectId;
                ImportbulkItemsControl.ItemTypeId = ItemTypeId;
                ImportbulkItemsControl.IsReadOnly = IsReadOnly;

                //Security - Hide editing deleting for Observers
                if (IsReadOnly)
                {
                    foreach (GridColumn col in gvItemList.MasterTableView.RenderColumns)
                    {
                        if (col.UniqueName == "EditCommandColumn")
                        {
                            col.Visible = false;
                        }
                    }
                }
            }

            projectItemTypes.InformParentToReload += delegate()
            {
                //Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
                ReloadByItemType();
            };

            ImportbulkItemsControl.InformItemListToLoad += delegate()//Subscribe to the Informparent to get updated
            {
                displaySettings.LoadControl();
            };
        }
Exemplo n.º 9
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.Exception">project not found</exception>
        /// <exception cref="System.ApplicationException">Permission denied for this project.</exception>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["projectid"] != null)
                {
                    ProjectID              = Convert.ToInt32(Request.QueryString["projectid"].ToString());
                    ucLocation.ProjectID   = ProjectID;
                    attachments.RelatedId  = ProjectID;
                    attachments.ProjectId  = ProjectID;
                    attachments.Mode       = ItemAttachments.DisplayMode.Project;
                    attachments.IsReadOnly = Support.IsReadOnlyRightsForProject(ProjectID);
                }

                string tabId = Request.QueryString["tabId"];
                if (tabId != null)
                {
                    int tabIndex = Convert.ToInt16(tabId);
                    projectDetailsTabs.SelectedIndex  = tabIndex;
                    projectDetailsPages.SelectedIndex = tabIndex;
                }

                projectWarningPopup.ProjectId = ProjectID;

                var project = GetBL <ProjectBL>().GetProject(ProjectID);

                if (project == null)
                {
                    throw new Exception("project not found");
                }

                CompanyID    = project.CompanyId;
                ProjectName  = project.ProjectName;
                DisplayTitle = string.Format("{0}'s Details", Support.TruncateString(project.ProjectName, 32));
                txtName.Text = project.ProjectName;

                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.");
                }

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

                bool isReadOnlyRightsForProject = Support.IsReadOnlyRightsForProject(ProjectID);

                //Set last updated date for concurrency handling
                OriginalLastUpdatedDate = project.LastUpdatedDate.Value;
                btnCancel.PostBackUrl   = String.Format("~/Project/ProjectDashboard.aspx?projectid={0}&companyid={1}", ProjectID, CompanyID);
                btnCancel.Visible       = !isReadOnlyRightsForProject;
                txtName.ReadOnly        = isReadOnlyRightsForProject;

                #region SET LINKS

                lnkCompanyInventory.HRef = string.Format("~/Inventory/CompanyInventory.aspx?companyid={0}&relatedtable={1}&relatedid={2}", CompanyID, (int)BookingTypes.Project, ProjectID);
                lnkBookings.HRef         = string.Format("~/Project/ProjectBookingDetails.aspx?projectid={0}", ProjectID);
                linkTaskManager.HRef     = ResolveUrl(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);
                projectUpdatesLink.ProjectID = ProjectID;
                projectUpdatesLink.LoadData();

                #endregion SET LINKS

                LoadBreadCrumbs(project);
                LoadProjectWarpupTab();
            }

            ucLocation.SetLocationsGridLength(880);//to fix the grid issue in chrome set the lengh of the grid manually.

            ucLocation.UpdateLocationTabCount += delegate(int count)
            {
                UpdateLocationsTabCount(count);
            };
            attachments.UpdateAttachmentsCount += delegate(int count)
            {
                UpdateAttachmentsTabCount(count);
            };
        }
Exemplo n.º 10
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.Exception">User does not have permission to access the project team</exception>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StageBitz.Data.Project project = DataContext.Projects.Where(p => p.ProjectId == ProjectId && p.IsActive == true).SingleOrDefault();
                if (!Support.CanAccessProject(project))
                {
                    if (IsProjectClosed)
                    {
                        StageBitzException.ThrowException(new StageBitzException(ExceptionOrigin.ProjectClose, project.ProjectId, "This Project Is Closed."));
                    }

                    throw new Exception("User does not have permission to access the project team");
                }

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

                sbPackageLimitsValidation.CompanyId   = CompanyId;
                sbPackageLimitsValidation.DisplayMode = UserWeb.Controls.Company.PackageLimitsValidation.ViewMode.UserLimit;
                sbPackageLimitsValidation.LoadData();

                LoadBreadCrumbs();

                SetReadOnlyMode(project);

                if (!IsReadOnly)
                {
                    searchUsers.DisplayMode = SearchUsers.ViewMode.ProjectTeam;
                    searchUsers.ProjectId   = ProjectId;
                    searchUsers.LoadControl();
                }
                else
                {
                    searchUsers.Visible = false;
                }

                LoadProjectTeam();

                #region SET LINKS

                lnkCompanyInventory.HRef = string.Format("~/Inventory/CompanyInventory.aspx?companyid={0}&relatedtable={1}&relatedid={2}", project.CompanyId, (int)BookingTypes.Project, ProjectId);
                lnkBookings.HRef         = string.Format("~/Project/ProjectBookingDetails.aspx?projectid={0}", ProjectId);
                linkTaskManager.HRef     = ResolveUrl(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);
                projectUpdatesLink.ProjectID = ProjectId;
                projectUpdatesLink.LoadData();

                #endregion SET LINKS

                #region SetValidationGroup

                string validationGroup = string.Concat(ucUserInvitationPopup.ClientID, "ValidationGroup");
                btnApplyUserPermission.ValidationGroup = validationGroup;
                ucUserInvitationPopup.InitializeValidationGroup(validationGroup);

                #endregion SetValidationGroup
            }
        }
Exemplo n.º 11
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();
            };
        }
Exemplo n.º 12
0
        /// <summary>
        /// Handles the ItemDataBound event of the gvProjects control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void gvProjects_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                dynamic      projData = (dynamic)e.Item.DataItem;

                #region Project

                HyperLink lnkProject = (HyperLink)dataItem.FindControl("lnkProject");

                if (Support.CanAccessProject(projData.Project))
                {
                    lnkProject.Visible = true;
                    lnkProject.Text    = Support.TruncateString(projData.Project.ProjectName, 20);
                    if (projData.Project.ProjectName.Length > 20)
                    {
                        lnkProject.ToolTip = projData.Project.ProjectName;
                    }

                    lnkProject.NavigateUrl = "~/Project/ProjectDashboard.aspx?projectId=" + projData.Project.ProjectId;
                }
                else
                {
                    dataItem["Project"].Text = Support.TruncateString(projData.Project.ProjectName, 20);
                    if (projData.Project.ProjectName.Length > 20)
                    {
                        dataItem["Project"].ToolTip = projData.Project.ProjectName;
                    }
                }

                #endregion Project

                #region Company

                HyperLink lnkCompany = (HyperLink)dataItem.FindControl("lnkCompany");

                if (Support.IsCompanyAdministrator(projData.Company.CompanyId))
                {
                    lnkCompany.Visible = true;
                    lnkCompany.Text    = Support.TruncateString(projData.Company.CompanyName, 20);
                    if (projData.Company.CompanyName.Length > 20)
                    {
                        lnkCompany.ToolTip = projData.Company.CompanyName;
                    }

                    lnkCompany.NavigateUrl = "~/Company/CompanyDashboard.aspx?companyId=" + projData.Company.CompanyId;
                }
                else
                {
                    dataItem["Company"].Text = Support.TruncateString(projData.Company.CompanyName, 20);
                    if (projData.Company.CompanyName.Length > 20)
                    {
                        dataItem["Company"].ToolTip = projData.Company.CompanyName;
                    }
                }

                #endregion Company

                #region Permission Type

                dataItem["Permission"].Text = projData.PermissionType.Description;

                #endregion Permission Type

                #region Role

                if (!string.IsNullOrEmpty(projData.ProjectRole))
                {
                    dataItem["ProjectRole"].Text = Support.TruncateString(projData.ProjectRole, 20);
                    if (projData.ProjectRole.Length > 20)
                    {
                        dataItem["ProjectRole"].ToolTip = projData.ProjectRole;
                    }
                }

                #endregion Role
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Handles the ItemDataBound event of the gvProjects control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridItemEventArgs"/> instance containing the event data.</param>
        protected void gvProjects_ItemDataBound(object sender, GridItemEventArgs e)
        {
            //Set company name, set project name, and set those links
            if (e.Item is GridDataItem)
            {
                ProjectListInfo project = e.Item.DataItem as ProjectListInfo;

                HtmlAnchor lnkProject = (HtmlAnchor)e.Item.FindControl("lnkProject");
                HtmlAnchor lnkCompany = (HtmlAnchor)e.Item.FindControl("lnkCompany");
                Literal    litCompany = (Literal)e.Item.FindControl("litCompany");
                Label      lblProject = (Label)e.Item.FindControl("lblProject");
                //INITIALIZATION
                string projectName = (project.ProjectName != null) ? Support.TruncateString(project.ProjectName, 20) : string.Empty;
                string companyName = (project.CompanyName != null) ? Support.TruncateString(project.CompanyName, 20) : string.Empty;

                if (lnkProject != null)
                {
                    lnkProject.HRef      = string.Format("~/Project/ProjectDashboard.aspx?projectid={0}", project.ProjectId);
                    lnkProject.InnerText = lblProject.Text = projectName;

                    if (project.IsCompanyAdmin || Support.CanAccessProject(project.ProjectId))
                    {
                        lblProject.Visible = false;
                        lnkProject.Visible = true;
                    }
                    else
                    {
                        lblProject.Visible = true;
                        lnkProject.Visible = false;
                    }
                }

                if (lnkCompany != null && litCompany != null)
                {
                    lnkCompany.HRef      = string.Format("~/Company/CompanyDashboard.aspx?companyid={0}", project.CompanyId);
                    lnkCompany.InnerText = companyName;
                    litCompany.Text      = companyName;
                }

                if (!project.IsCompanyAdmin)
                {
                    lnkCompany.Visible = false;
                    litCompany.Visible = true;
                }

                #region Notifications

                HtmlAnchor lnkNotificationCount = (HtmlAnchor)e.Item.FindControl("lnkNotificationCount");

                if (project.NotificationCount > 0 && DisplayMode == ViewMode.UserDashboard)
                {
                    lnkNotificationCount.Visible   = true;
                    lnkNotificationCount.InnerText = project.NotificationCount.ToString();
                    lnkNotificationCount.HRef      = string.Format("~/Project/ProjectNotifications.aspx?projectid={0}", project.ProjectId);
                }
                else
                {
                    lnkNotificationCount.Visible = false;
                }

                #endregion Notifications

                #region Warning Icon

                if (DisplayMode == ViewMode.CompanyDashboard && project.IsCompanyAdmin)
                {
                    HtmlGenericControl divProjectWarning = (HtmlGenericControl)e.Item.FindControl("divProjectWarning");
                    ProjectStatusHandler.ProjectWarningInfo warningInfo = ProjectStatusHandler.GetProjectWarningStatus(project.ProjectStatusCodeId, project.ProjectTypeCodeId == Support.GetCodeByValue("ProjectType", "FREETRIALOPTIN").CodeId, project.ExpirationDate);
                    if (warningInfo.WarningStatus == ProjectStatusHandler.ProjectWarningStatus.NoWarning)
                    {
                        divProjectWarning.Visible = false;
                    }
                    else
                    {
                        divProjectWarning.Visible = true;
                    }
                }

                #endregion Warning Icon

                #region Project Suspention Icon

                HtmlGenericControl divProjectSuspended = (HtmlGenericControl)e.Item.FindControl("divProjectSuspended");
                divProjectSuspended.Visible = (project.ProjectStatusCodeId == Support.GetCodeByValue("ProjectStatus", "SUSPENDED").CodeId);

                #endregion Project Suspention Icon
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Handles the ItemDataBound event of the lvProjects control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ListViewItemEventArgs"/> instance containing the event data.</param>
        protected void lvProjects_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ProjectListInfo project   = e.Item.DataItem as ProjectListInfo;
                ProjectBL       projectBL = GetBL <ProjectBL>();

                //INITIALIZATION
                string projectName = (project.ProjectName != null) ? Support.TruncateString(project.ProjectName, 20) : string.Empty;
                string companyName = (project.CompanyName != null) ? Support.TruncateString(project.CompanyName, 20) : string.Empty;

                PlaceHolder plcProjectMemberView  = (PlaceHolder)e.Item.FindControl("plcProjectMemberView");
                PlaceHolder plcInvitationView     = (PlaceHolder)e.Item.FindControl("plcInvitationView");
                PlaceHolder plcClosedProjectsView = (PlaceHolder)e.Item.FindControl("plcClosedProjectsView");
                if (projectBL.IsProjectClosed(project.ProjectId))
                {
                    plcProjectMemberView.Visible  = false;
                    plcInvitationView.Visible     = false;
                    plcClosedProjectsView.Visible = true;

                    HyperLink lnkProjectClosed = (HyperLink)e.Item.FindControl("lnkProjectClosed");
                    Label     lblProjectClosed = (Label)e.Item.FindControl("lblProjectClosed");
                    Label     lblClosedDate    = (Label)e.Item.FindControl("lblClosedDate");
                    Label     lblClosedBy      = (Label)e.Item.FindControl("lblClosedBy");

                    if (lnkProjectClosed != null && lblProjectClosed != null)
                    {
                        lnkProjectClosed.Text = lblProjectClosed.Text = projectName;
                        int projectId = project.ProjectId;
                        if (project.IsCompanyAdmin || Support.CanAccessProject(projectId))
                        {
                            lnkProjectClosed.NavigateUrl = string.Format("~/Project/ProjectDashboard.aspx?projectid={0}", project.ProjectId);
                            lblProjectClosed.Visible     = false;
                            lnkProjectClosed.Visible     = true;
                        }
                        else
                        {
                            lblProjectClosed.Visible = true;
                            lnkProjectClosed.Visible = false;
                        }
                    }

                    if (lblClosedDate != null)
                    {
                        lblClosedDate.Text = project.ClosedOn.HasValue ? Utils.FormatDatetime(project.ClosedOn.Value, false) : string.Empty;
                    }

                    if (lblClosedBy != null)
                    {
                        lblClosedBy.Text    = Support.TruncateString(project.ClosedByName, 10);
                        lblClosedBy.ToolTip = project.ClosedByName;
                    }
                }
                else
                {
                    plcClosedProjectsView.Visible = false;

                    if (project.InvitationId == 0)
                    {
                        #region Project that this user is a member of

                        plcProjectMemberView.Visible = true;
                        plcInvitationView.Visible    = false;

                        HyperLink lnkProject = (HyperLink)e.Item.FindControl("lnkBtnProject");
                        HyperLink lnkCompany = (HyperLink)e.Item.FindControl("lnkBtnCompany");
                        Label     lblProject = (Label)e.Item.FindControl("lblProject");

                        //Set Links
                        if (lnkProject != null && lblProject != null)
                        {
                            lnkProject.Text = lblProject.Text = projectName;
                            int projectId = project.ProjectId;
                            if (project.IsCompanyAdmin || Support.CanAccessProject(projectId))
                            {
                                lnkProject.NavigateUrl = string.Format("~/Project/ProjectDashboard.aspx?projectid={0}", project.ProjectId);
                                lblProject.Visible     = false;
                                lnkProject.Visible     = true;
                            }
                            else
                            {
                                lblProject.Visible = true;
                                lnkProject.Visible = false;
                            }
                        }

                        #region Company link

                        if (lnkCompany != null)
                        {
                            //If it is in Userdashboard and if not a Company Admin, show the Literal.
                            if (DisplayMode == ViewMode.UserDashboard)
                            {
                                HtmlGenericControl spnCompany = (HtmlGenericControl)e.Item.FindControl("spnCompany");
                                //check if it is a company admin.
                                if (project.IsCompanyAdmin)
                                {
                                    lnkCompany.Text        = string.Format("({0})", companyName);
                                    lnkCompany.NavigateUrl = string.Format("~/Company/CompanyDashboard.aspx?companyid={0}", project.CompanyId);
                                    spnCompany.Visible     = false;
                                }
                                else
                                {
                                    spnCompany.InnerText = string.Format("({0})", companyName);
                                    lnkCompany.Visible   = false;
                                }
                            }
                            else if (DisplayMode == ViewMode.CompanyDashboard)
                            {
                                lnkCompany.Text        = string.Format("({0})", companyName);
                                lnkCompany.NavigateUrl = string.Format("~/Company/CompanyDashboard.aspx?companyid={0}", project.CompanyId);
                            }
                        }

                        #endregion Company link

                        #region Item counts

                        Literal litItems      = (Literal)e.Item.FindControl("litItems");
                        Literal litCompleted  = (Literal)e.Item.FindControl("litCompleted");
                        Literal litInProgress = (Literal)e.Item.FindControl("litInProgress");
                        Literal litNotstarted = (Literal)e.Item.FindControl("litNotstarted");

                        //Validate data before assigning
                        int itemCount           = (project.ItemCount != null) ? project.ItemCount : 0;
                        int completeItemCount   = (project.CompletedItemCount != null) ? project.CompletedItemCount : 0;
                        int inProgressItemCount = (project.InProgressItemCount != null) ? project.InProgressItemCount : 0;
                        int notStartedItemCount = (project.NotStartedItemCount != null) ? project.NotStartedItemCount : 0;

                        //Set literals
                        if (itemCount == 1)
                        {
                            litItems.Text = string.Format("{0} Item Brief", itemCount);
                        }
                        else
                        {
                            litItems.Text = string.Format("{0} Item Briefs", itemCount);
                        }

                        litCompleted.Text  = (litCompleted != null) ? string.Format("{0} Completed", completeItemCount) : string.Empty;
                        litInProgress.Text = (litInProgress != null) ? string.Format("{0} In Progress", inProgressItemCount) : string.Empty;
                        litNotstarted.Text = (litNotstarted != null) ? string.Format("{0} Not Started", notStartedItemCount) : string.Empty;

                        #endregion Item counts

                        #region Notifications

                        HtmlGenericControl divNotificationArea  = (HtmlGenericControl)e.Item.FindControl("divNotificationArea");
                        HtmlAnchor         lnkNotificationCount = (HtmlAnchor)e.Item.FindControl("lnkNotificationCount");

                        if (project.NotificationCount > 0 && DisplayMode == ViewMode.UserDashboard)
                        {
                            lnkNotificationCount.Visible   = true;
                            lnkNotificationCount.InnerText = project.NotificationCount.ToString();
                            lnkNotificationCount.HRef      = string.Format("~/Project/ProjectNotifications.aspx?projectid={0}", project.ProjectId);
                        }
                        else
                        {
                            lnkNotificationCount.Visible = false;
                        }

                        #endregion Notifications

                        #region Warning Icon

                        if (project.IsCompanyAdmin)
                        {
                            HtmlGenericControl divProjectWarning = (HtmlGenericControl)e.Item.FindControl("divProjectWarning");
                            ProjectStatusHandler.ProjectWarningInfo warningInfo = ProjectStatusHandler.GetProjectWarningStatus(project.ProjectStatusCodeId, project.ProjectTypeCodeId == Support.GetCodeByValue("ProjectType", "FREETRIALOPTIN").CodeId, project.ExpirationDate);
                            if (warningInfo.WarningStatus == ProjectStatusHandler.ProjectWarningStatus.NoWarning)
                            {
                                divProjectWarning.Visible = false;
                            }
                            else
                            {
                                divProjectWarning.Visible = true;
                            }
                        }

                        #endregion Warning Icon

                        #region Project Suspention Icon

                        HtmlGenericControl divProjectSuspended = (HtmlGenericControl)e.Item.FindControl("divProjectSuspended");
                        divProjectSuspended.Visible = (project.ProjectStatusCodeId == Support.GetCodeByValue("ProjectStatus", "SUSPENDED").CodeId);

                        #endregion Project Suspention Icon

                        #endregion Project that this user is a member of
                    }
                    else
                    {
                        //This only occurs in user dashboard for invited projects

                        #region Invited project

                        plcProjectMemberView.Visible = false;
                        plcInvitationView.Visible    = true;

                        HyperLink lnkProject     = (HyperLink)e.Item.FindControl("lnkBtnProjectInvt");
                        HyperLink lnkCompany     = (HyperLink)e.Item.FindControl("lnkBtnCompanyInvt");
                        Literal   litProjectName = (Literal)e.Item.FindControl("litProjectName");
                        Literal   litCompanyName = (Literal)e.Item.FindControl("litCompanyName");

                        #region Project/Company links

                        //check if it is a company admin.
                        if (project.IsCompanyAdmin)
                        {
                            lnkProject.Text        = string.Format("({0})", projectName);
                            lnkProject.NavigateUrl = string.Format("~/Project/ProjectDashboard.aspx?projectid={0}", project.ProjectId);
                            litProjectName.Visible = false;
                        }
                        else //If not a Company Admin, show the Literal.
                        {
                            litProjectName.Visible = true;
                            litProjectName.Text    = projectName;
                            lnkProject.Visible     = false;
                        }

                        if (project.IsCompanyAdmin)
                        {
                            lnkCompany.Text        = string.Format("({0})", companyName);
                            lnkCompany.NavigateUrl = string.Format("~/Company/CompanyDashboard.aspx?companyid={0}", project.CompanyId);
                            litCompanyName.Visible = false;
                        }
                        else
                        {
                            litCompanyName.Visible = true;
                            litCompanyName.Text    = companyName;
                            lnkCompany.Visible     = false;
                        }

                        #endregion Project/Company links

                        LinkButton lnkbtnViewInvite = (LinkButton)e.Item.FindControl("lnkbtnViewInvite");
                        lnkbtnViewInvite.CommandArgument = project.InvitationId.ToString();

                        #endregion Invited project
                    }
                }
            }
        }
Exemplo n.º 15
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 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;
                    }
                    }
                }
            }
        }
Exemplo n.º 16
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 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;
            if (!IsPostBack)
            {
                StageBitz.Data.Project project = this.GetBL <ProjectBL>().GetProject(ProjectId);

                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.");
                }

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

                if (Support.IsReadOnlyRightsForProject(ProjectId) || projectItemTypes.SelectedItemTypeId == 0)
                {
                    IsReadOnly = true;
                    //Can not create lists, can not add tasks to lists, can view lists
                    //Set visibility and enabling
                    txtListName.Enabled      = false;
                    btnAddList.Enabled       = false;
                    gridviewTaskList.Enabled = false;
                }

                #region 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);
                projectUpdatesLink.ProjectID = ProjectId;
                projectUpdatesLink.LoadData();

                #endregion SET Links

                LoadData();
                if (projectItemTypes.SelectedItemTypeId != 0)
                {
                    string itemTypename = Utils.GetItemTypeById(projectItemTypes.SelectedItemTypeId).Name;
                    litTitleAT.Text   = string.Concat("All Active " + itemTypename + " Tasks");
                    litItemtype1.Text = litItemtype2.Text = itemTypename;
                    DisplayTitle      = "Task Manager - " + Utils.GetItemTypeById(projectItemTypes.SelectedItemTypeId).Name;
                }
                else
                {
                    litTitleAT.Text = "All Active Tasks";
                    DisplayTitle    = "Task Manager";
                }
            }

            projectItemTypes.InformParentToReload += delegate()
            {
                //Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
                ReloadByItemType();
            };
        }