Example #1
0
        /// <summary>
        /// Performs business logic actions specified for this task handler.
        /// </summary>
        protected override void PerformActions()
        {
            ClearTemporaryDocumentMedia();

            DateTime dateToConsider = Utils.Today.Date;
            TimeSpan ts;

            if (TimeSpan.TryParse(Utils.GetSystemValue("AgentExecutionTime"), out ts))
            {
                if (Utils.Now < (Utils.Today + ts))
                {
                    dateToConsider = dateToConsider.AddDays(-1);
                }
            }
            ProjectUsageHandler.CreatePaymentSummaries(dateToConsider);
            //Monthly retry process with in the Graceperiod
            ProjectFinanceHandler.ProcessInvoicesAndPayments(0, dateToConsider, false, 0);

            // Run CompanyStatusHandler and  ProjectStatusHandler in same datacontext
            using (StageBitzDB dataContext = new StageBitzDB())
            {
                ProjectStatusHandler.UpdateProjectExpirations(dateToConsider, dataContext);
                CompanyStatusHandler.UpdateCompanyExpirations(dateToConsider, dataContext);

                dataContext.SaveChanges();
            }

            CompanyStatusHandler.SuspendNoPaymentOptionCompanies(dateToConsider);

            SendUserEmailNotifications(dateToConsider);
            SendBookingNotifications();
            SendBookingOverdueAndDelayedEmails(dateToConsider.AddDays(1));
            DeleteOldExportedZipFiles();
        }
Example #2
0
        /// <summary>
        /// Updates the user opt in.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void UpdateUserOptIn(object sender, EventArgs e)
        {
            if (!StopProcessing)
            {
                Data.Project project = DataContext.Projects.Where(p => p.ProjectId == UserOptInProjectId).SingleOrDefault();
                if (project != null)
                {
                    project.ProjectTypeCodeId   = Utils.GetCodeByValue("ProjectType", "FREETRIALOPTIN").CodeId;//This is a safeside. If d project is in Free trial, we show this message.
                    project.LastUpdatedByUserId = UserID;
                    int statusCodeId = ProjectStatusHandler.GetPreviuosProjectStatusFromHistory(project.ProjectId);

                    //If today is greater than Project Free trial expired day then activate the project.
                    if (project.ExpirationDate != null && (project.ExpirationDate > Today || project.ExpirationDate == Today && !Support.HasConsideringDayEnded(Now)))
                    {
                        project.ProjectStatusCodeId = ProjectStatusHandler.GetPreviuosProjectStatusFromHistory(project.ProjectId);
                    }
                    else
                    {
                        project.ProjectStatusCodeId = Utils.GetCodeByValue("ProjectStatus", "ACTIVE").CodeId;
                        project.ExpirationDate      = null;
                    }

                    //ProjectUsageHandler.UpdateFutureDailyUsageProjectState(project, true, UserID, statusCodeId, Today);
                    project.LastUpdatedDate = Now;
                    DataContext.SaveChanges();
                    SetUISettings(this.GetBL <FinanceBL>().GetCreditCardToken(CompanyId));
                    RefreshProjectList();
                }
            }
        }
Example #3
0
        /// <summary>
        /// Handles the ItemCommand event of the gvProjects control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridCommandEventArgs"/> instance containing the event data.</param>
        protected void gvProjects_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (!StopProcessing)
            {
                if (e.Item is GridDataItem)
                {
                    //Pay now for this project
                    GridDataItem dataItem  = (GridDataItem)e.Item;
                    int          projectId = (int)dataItem.GetDataKeyValue("ProjectId");
                    Data.Project project   = DataContext.Projects.Where(p => p.ProjectId == projectId).SingleOrDefault();

                    switch (e.CommandName)
                    {
                    case "Suspend":
                        popupSuspendReActivate.Title      = "Confirm Suspend";
                        divMsgSuspendReActivate.InnerText = "When you suspend a Project, it will become read-only for all users. " +
                                                            "This means you will not be able to add or edit any information, but you will still be able to view all " +
                                                            "elements of your Project. Suspended Projects are not included in your active Project count.";
                        popupSuspendReActivate.ShowPopup();
                        btnSuspendReActivate.CommandArgument = projectId.ToString();
                        break;

                    case "ReActivate":
                        sbPackageLimitsValidation.ProjectId = projectId;
                        if (sbPackageLimitsValidation.Validate())
                        {
                            //When ReActiving, we need to consider Free trial projects.
                            int prevoiusStatusCodeId = ProjectStatusHandler.GetPreviuosProjectStatusFromHistory(projectId);

                            popupSuspendReActivate.Title      = "Confirm Reactivate";
                            divMsgSuspendReActivate.InnerText = "When you reactivate a Project, all users will have the same access to the Project " +
                                                                "that they had before it was suspended. The Project will also be included in the active Project count.";
                            popupSuspendReActivate.ShowPopup();
                            btnSuspendReActivate.CommandArgument = projectId.ToString();

                            if (prevoiusStatusCodeId == Utils.GetCodeByValue("ProjectStatus", "FREETRIAL").CodeId)
                            {
                                freeTrialCodeId    = Support.GetCodeByValue("ProjectStatus", "FREETRIAL").CodeId;
                                UserOptInProjectId = projectId;
                            }
                        }
                        break;
                    }
                }
            }
        }
Example #4
0
        /// <summary>
        /// Loads the data.
        /// </summary>
        public void LoadData()
        {
            StageBitz.Data.Project project = DataContext.Projects.Where(p => p.ProjectId == ProjectID).FirstOrDefault();
            bool paymentsSpecified         = (FinanceSupport.GetCreditCardToken("Company", project.CompanyId) != null);

            ProjectStatusHandler.ProjectWarningInfo warningInfo = ProjectStatusHandler.GetProjectWarningStatus(project.ProjectStatusCodeId, project.ProjectTypeCodeId == Support.GetCodeByValue("ProjectType", "FREETRIALOPTIN").CodeId, project.ExpirationDate);
            StageBitz.Data.User companyAdmin = this.GetBL <CompanyBL>().GetCompanyPrimaryAdministrator(project.CompanyId);

            ProjectName       = Support.TruncateString(project.ProjectName, 30);
            RemainingDays     = string.Format("{0} day{1}", warningInfo.DaysToExpiration < 0 ? 0 : warningInfo.DaysToExpiration, warningInfo.DaysToExpiration == 1 ? string.Empty : "s");
            CompanyAdminName  = Support.TruncateString((companyAdmin.FirstName + " " + companyAdmin.LastName).Trim(), 30);
            CompanyAdminEmail = companyAdmin.Email1;
            PaymentFailedDate = null;

            CompanyFinancialUrl = ResolveUrl(string.Format("~/Company/CompanyFinancialDetails.aspx?companyid={0}", project.CompanyId));

            if (warningInfo.WarningStatus == ProjectStatusHandler.ProjectWarningStatus.NoWarning)
            {
                noticesMultiView.Visible = false;
                return;
            }
            else
            {
                noticesMultiView.Visible = true;
            }

            #region Determine User Permission Type

            ProjectPermission userType = ProjectPermission.Staff;
            if (Support.IsCompanyAdministrator(project.CompanyId))
            {
                userType = ProjectPermission.CompanyAdministrator;
            }
            else if (Support.IsProjectAdministrator(ProjectID))
            {
                userType = ProjectPermission.ProjectAdministrator;
            }
            else
            {
                userType = ProjectPermission.Staff;
            }

            #endregion Determine User Permission Type

            switch (warningInfo.WarningStatus)
            {
            case ProjectStatusHandler.ProjectWarningStatus.FreeTrialGrace:
                if (userType == ProjectPermission.CompanyAdministrator)
                {
                    noticesMultiView.ActiveViewIndex = (int)NoticeType.FreeTrialGraceCompanyAdmin;
                }
                break;

            case ProjectStatusHandler.ProjectWarningStatus.GracePeriod:
                if (userType == ProjectPermission.CompanyAdministrator)
                {
                    noticesMultiView.ActiveViewIndex = (int)NoticeType.GracePeriodCompanyAdmin;
                    ucCompanyPaymentFailedWarningGracePeriodCompanyAdmin.CompanyID = project.CompanyId;
                    ucCompanyPaymentFailedWarningGracePeriodCompanyAdmin.LoadData(CompanyPaymentFailedWarning.PermissionLevel.CompanyAdministrator,
                                                                                  CompanyPaymentFailedWarning.DisplayMode.PaymentFailedGracePeriod);
                }
                else if (userType == ProjectPermission.ProjectAdministrator)
                {
                    noticesMultiView.ActiveViewIndex = (int)NoticeType.GracePeriodProjectAdmin;
                    ucCompanyPaymentFailedWarningGracePeriodNonCompanyAdmin.CompanyID = project.CompanyId;
                    ucCompanyPaymentFailedWarningGracePeriodNonCompanyAdmin.LoadData(CompanyPaymentFailedWarning.PermissionLevel.NonCompanyAdministrator,
                                                                                     CompanyPaymentFailedWarning.DisplayMode.PaymentFailedGracePeriod);
                }
                PaymentFailedDate = project.ExpirationDate.Value.AddDays(-7);
                break;

            case ProjectStatusHandler.ProjectWarningStatus.PaymentFailed:
                if (userType == ProjectPermission.CompanyAdministrator)
                {
                    noticesMultiView.ActiveViewIndex = (int)NoticeType.PaymentFailedCompanyAdmin;
                    ucCompanyPaymentFailedWarningPaymentFailedCompanyAdmin.CompanyID = project.CompanyId;
                    ucCompanyPaymentFailedWarningPaymentFailedCompanyAdmin.LoadData(CompanyPaymentFailedWarning.PermissionLevel.CompanyAdministrator,
                                                                                    CompanyPaymentFailedWarning.DisplayMode.PaymentFailed);
                }
                else if (userType == ProjectPermission.ProjectAdministrator || userType == ProjectPermission.Staff)
                {
                    noticesMultiView.ActiveViewIndex = (int)NoticeType.PaymentFailedProjectStaff;
                    ucCompanyPaymentFailedWarningPaymentFailedNonCompanyAdmin.CompanyID = project.CompanyId;
                    ucCompanyPaymentFailedWarningPaymentFailedNonCompanyAdmin.LoadData(CompanyPaymentFailedWarning.PermissionLevel.NonCompanyAdministrator,
                                                                                       CompanyPaymentFailedWarning.DisplayMode.PaymentFailed);
                }

                break;

            case ProjectStatusHandler.ProjectWarningStatus.Suspended:
                if (userType == ProjectPermission.CompanyAdministrator)
                {
                    noticesMultiView.ActiveViewIndex = (int)NoticeType.SuspendedCompanyAdmin;
                }
                else if (userType == ProjectPermission.ProjectAdministrator || userType == ProjectPermission.Staff)
                {
                    noticesMultiView.ActiveViewIndex = (int)NoticeType.SuspendedProjectStaff;
                }
                break;

            case ProjectStatusHandler.ProjectWarningStatus.Closed:
                if (userType == ProjectPermission.CompanyAdministrator)
                {
                    noticesMultiView.ActiveViewIndex = (int)NoticeType.ClosedProjectCompanyAdmin;
                }
                break;
            }

            //If the project's payment has failed, calculate the number of days the payment is due.
            if (PaymentFailedDate != null)
            {
                int paymentOverdueDays = (int)(Today - PaymentFailedDate.Value).TotalDays;
                PaymentOverdueDays = string.Format("{0} day{1}", paymentOverdueDays, paymentOverdueDays == 1 ? string.Empty : "s");
            }

            upnlProjectWarningDisplay.Update();
        }
Example #5
0
        /// <summary>
        /// Suspends the re activate.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="CommandEventArgs"/> instance containing the event data.</param>
        protected void SuspendReActivate(object sender, CommandEventArgs e)
        {
            if (!StopProcessing)
            {
                popupSuspendReActivate.HidePopup();
                int projectId;
                int.TryParse(e.CommandArgument.ToString(), out projectId);
                Data.Project project = GetBL <ProjectBL>().GetProject(projectId);
                suspendCodeId     = Support.GetCodeByValue("ProjectStatus", "SUSPENDED").CodeId;
                freeTrialCodeId   = Support.GetCodeByValue("ProjectStatus", "FREETRIAL").CodeId;
                gracePeriodCodeId = Support.GetCodeByValue("ProjectStatus", "GRACEPERIOD").CodeId;
                bool isReActivation = project.ProjectStatusCodeId == suspendCodeId;
                int  statusToConsider;

                activeCodeId = Support.GetCodeByValue("ProjectStatus", "ACTIVE").CodeId;
                int          compnayGracePeriodCodeId = Support.GetCodeByValue("CompanyStatus", "GRACEPERIOD").CodeId;
                Data.Company company = GetBL <CompanyBL>().GetCompany(this.CompanyId);

                if (project != null)
                {
                    //This is a Reactivation.
                    if (isReActivation)
                    {
                        int previousStatusCodeId = ProjectStatusHandler.GetPreviuosProjectStatusFromHistory(projectId);
                        //We have to move the current status to where it was(Active or FreeTrial).
                        //Make sure whether Free trial period has expired.
                        if ((previousStatusCodeId == freeTrialCodeId || previousStatusCodeId == gracePeriodCodeId) && project.ExpirationDate != null && (project.ExpirationDate > Today || project.ExpirationDate == Today && !Support.HasConsideringDayEnded(Now)))
                        {
                            //Still on the Free Trial
                            project.ProjectStatusCodeId = previousStatusCodeId;
                        }
                        else if (company.CompanyStatusCodeId == compnayGracePeriodCodeId && (previousStatusCodeId == activeCodeId || previousStatusCodeId == freeTrialCodeId))
                        {
                            project.ProjectStatusCodeId = gracePeriodCodeId;
                            project.ExpirationDate      = company.ExpirationDate;
                        }
                        else if (!this.GetBL <CompanyBL>().HasCompanySuspendedbySBAdmin(CompanyId))//This checks for safeside.
                        {
                            //Just an Activation.
                            previousStatusCodeId        = activeCodeId;
                            project.ProjectStatusCodeId = previousStatusCodeId;
                            project.ExpirationDate      = null;
                        }
                        else
                        {
                            //Just a safe action.
                            gvProjects.Rebind();
                            return;
                        }
                        statusToConsider = previousStatusCodeId;
                    }
                    else
                    {
                        statusToConsider            = suspendCodeId;
                        project.ProjectStatusCodeId = suspendCodeId;
                    }

                    //ProjectUsageHandler.UpdateFutureDailyUsageProjectState(project, isReActivation, UserID, statusToConsider, Today);
                    project.LastUpdatedByUserId = UserID;
                    project.LastUpdatedDate     = Now;
                    DataContext.SaveChanges();
                }

                gvProjects.Rebind();
                planMonitor.LoadData();
                upnlPlanMonitor.Update();
            }
        }
Example #6
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
            }
        }
Example #7
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
                    }
                }
            }
        }