protected string GetTitle(int itemId, string title, int itemTypeId, object groupName, int stateId, bool isOverdue, string itemCode) { string result = string.Empty; if (itemId == 0) { result = string.Format("<b>{0}</b>", groupName); } else { string link = null; string icon = null; string iconCompleted = null; string iconOverdue = null; switch (itemTypeId) { case (int)ObjectTypes.Project: link = "~/Projects/ProjectView.aspx?ProjectId="; icon = "project.gif"; iconCompleted = "project_completed.gif"; iconOverdue = "project.gif"; title += CHelper.GetProjectNumPostfix(itemId, itemCode); break; case (int)ObjectTypes.Task: link = "~/Tasks/TaskView.aspx?TaskId="; icon = "task1.gif"; iconCompleted = "task1_completed.gif"; iconOverdue = "task1_overdue.gif"; title += " (#" + itemId + ")"; break; case (int)ObjectTypes.ToDo: link = "~/ToDo/ToDoView.aspx?ToDoId="; icon = "task.gif"; iconCompleted = "task_completed.gif"; iconOverdue = "task_overdue.gif"; title += " (#" + itemId + ")"; break; case (int)ObjectTypes.Document: link = "~/Documents/DocumentView.aspx?DocumentId="; icon = "document.gif"; iconCompleted = "document_completed.gif"; iconOverdue = "document.gif"; title += " (#" + itemId + ")"; break; case (int)ObjectTypes.Issue: link = "~/Incidents/IncidentView.aspx?IncidentId="; icon = "incident.gif"; iconCompleted = "incident_closed.gif"; iconOverdue = "incident.gif"; title += " (#" + itemId + ")"; break; case (int)ObjectTypes.CalendarEntry: link = "~/Events/EventView.aspx?EventId="; icon = "event.gif"; iconCompleted = "event_completed.gif"; iconOverdue = "event.gif"; break; } if (!string.IsNullOrEmpty(link)) { link = Page.ResolveUrl(link + itemId); if (!string.IsNullOrEmpty(icon)) { icon = Page.ResolveUrl("~/Layouts/Images/icons/" + icon); } if (!string.IsNullOrEmpty(iconCompleted)) { iconCompleted = Page.ResolveUrl("~/Layouts/Images/icons/" + iconCompleted); } if (!string.IsNullOrEmpty(iconOverdue)) { iconOverdue = Page.ResolveUrl("~/Layouts/Images/icons/" + iconOverdue); } if (stateId == (int)ObjectStates.Completed) { result = string.Format("<span style='color:#999999;text-decoration:line-through'><a href='{0}'><span><img alt='' src='{1}' /></span> <span>{2}</span></a></span>", link, iconCompleted, title); } else if (stateId == (int)ObjectStates.Overdue || isOverdue) { result = string.Format("<a href='{0}'><span style='color:red'><span><img alt='' src='{1}' /></span> <span>{2}</span></span></a>", link, iconOverdue, title); } else { result = string.Format("<a href='{0}'><span><img alt='' src='{1}' /></span> <span>{2}</span></a>", link, icon, title); } } } return(result); }
private void BindValues() { if (IncidentId != 0) { try { using (IDataReader reader = Incident.GetIncident(IncidentId)) { if (reader.Read()) { string sTitle = ""; if (Configuration.ProjectManagementEnabled && reader["ProjectId"] != DBNull.Value) { string projectPostfix = CHelper.GetProjectNumPostfix((int)reader["ProjectId"], (string)reader["ProjectCode"]); if (Project.CanRead((int)reader["ProjectId"])) { sTitle += String.Format(CultureInfo.InvariantCulture, "<a href='../Projects/ProjectView.aspx?ProjectId={0}' title='{1}'>{2}{3}</a> \\ ", reader["ProjectId"].ToString(), LocRM.GetString("Project"), reader["ProjectTitle"].ToString(), projectPostfix ); } else { sTitle += String.Format(CultureInfo.InvariantCulture, "<span title='{0}'>{1}{2}</span> \\ ", LocRM.GetString("Project"), reader["ProjectTitle"].ToString(), LocRM.GetString("Project")); } } sTitle += reader["Title"].ToString() + " (#" + reader["IncidentId"].ToString() + ") "; string sIdentifier = ""; if (reader["Identifier"] != DBNull.Value) { sIdentifier = reader["Identifier"].ToString(); } if (reader["IncidentBoxId"] != DBNull.Value) { IncidentBox box = IncidentBox.Load((int)reader["IncidentBoxId"]); sTitle += "(" + ((sIdentifier == "") ? TicketUidUtil.Create(box.IdentifierMask, IncidentId) : sIdentifier) + ")"; } lblTitle.Text = sTitle; lblType.Text = reader["TypeName"].ToString(); lblSeverity.Text = reader["SeverityName"].ToString(); lblState.ForeColor = Util.CommonHelper.GetStateColor((int)reader["StateId"]); lblState.Text = reader["StateName"].ToString(); if ((bool)reader["IsOverdue"]) { lblState.ForeColor = Util.CommonHelper.GetStateColor((int)ObjectStates.Overdue); lblState.Text = String.Format(CultureInfo.InvariantCulture, "{0}, {1}", reader["StateName"].ToString(), GetGlobalResourceObject("IbnFramework.Incident", "Overdue")); } lblPriority.Text = reader["PriorityName"].ToString() + " " + LocRM.GetString("Priority").ToLower(); lblPriority.ForeColor = Util.CommonHelper.GetPriorityColor((int)reader["PriorityId"]); if (reader["Description"] != DBNull.Value) { string txt = CommonHelper.parsetext(reader["Description"].ToString(), false); if (PortalConfig.ShortInfoDescriptionLength > 0 && txt.Length > PortalConfig.ShortInfoDescriptionLength) { txt = txt.Substring(0, PortalConfig.ShortInfoDescriptionLength) + "..."; } lblDescription.Text = txt; } // lblExpRespDate.Text = ((DateTime)reader["ExpectedResponseDate"]).ToString("g"); // lblExpResDur.Text = ((DateTime)reader["ExpectedResolveDate"]).ToString("g"); } else { Response.Redirect("../Common/NotExistingID.aspx?IncidentID=1"); } } } catch (AccessDeniedException) { Response.Redirect("~/Common/NotExistingID.aspx?AD=1"); } divType.Visible = lblType.Visible = PortalConfig.IncidentAllowViewTypeField; divSeverity.Visible = lblSeverity.Visible = PortalConfig.IncidentAllowViewSeverityField; lblPriority.Visible = PortalConfig.CommonIncidentAllowViewPriorityField; trAdd.Visible = divType.Visible || divSeverity.Visible || lblPriority.Visible; } }
private void BindData() { /// TaskId, TaskNum, ProjectId, ProjectTitle, ManagerId, CreatorId, CompletedBy, Title, /// Description, CreationDate, StartDate, FinishDate, Duration, /// ActualFinishDate, PriorityId, PriorityName, PercentCompleted, OutlineNumber, /// OutlineLevel, IsSummary, IsMilestone, ConstraintTypeId, ConstraintTypeName, /// ConstraintDate, CompletionTypeId, CompletionTypeName, IsCompleted, /// MustBeConfirmed, ReasonId, ProjectCode try { using (IDataReader rdr = Task.GetTask(_taskId)) { if (rdr.Read()) { lblTimeline.Text = String.Format("{0} {1} - {2} {3}", ((DateTime)rdr["StartDate"]).ToShortDateString(), ((DateTime)rdr["StartDate"]).ToShortTimeString(), ((DateTime)rdr["FinishDate"]).ToShortDateString(), ((DateTime)rdr["FinishDate"]).ToShortTimeString()); string projectPostfix = CHelper.GetProjectNumPostfix((int)rdr["ProjectId"], (string)rdr["ProjectCode"]); if (Project.CanRead((int)rdr["ProjectId"])) { lblTitle.Text = String.Format(CultureInfo.InvariantCulture, "<a href='../Projects/ProjectView.aspx?ProjectId={0}' title='{1}'>{2}{3}</a> \\ ", rdr["ProjectId"].ToString(), LocRM2.GetString("Project"), rdr["ProjectTitle"].ToString(), projectPostfix); } else { lblTitle.Text = String.Format(CultureInfo.InvariantCulture, "<span title='{0}'>{1}{2}</span> \\ ", LocRM2.GetString("Project"), rdr["ProjectTitle"].ToString(), projectPostfix); } lblTitle.Text += String.Format("{0} (#{1})", rdr["Title"].ToString(), _taskId); if ((bool)rdr["IsSummary"] || (bool)rdr["IsMileStone"]) { lblSummaryMilestone.Visible = true; if ((bool)rdr["IsSummary"]) { lblSummaryMilestone.Text = "(" + LocRM.GetString("SummaryTask") + ")"; } if ((bool)rdr["IsMileStone"]) { lblSummaryMilestone.Text = "(" + LocRM.GetString("Milestone") + ")"; } } lblState.ForeColor = Util.CommonHelper.GetStateColor((int)rdr["StateId"]); lblState.Text = rdr["StateName"].ToString(); if (((int)rdr["StateId"] == (int)ObjectStates.Active || (int)rdr["StateId"] == (int)ObjectStates.Overdue) && !(bool)rdr["IsMileStone"]) { lblState.Text += String.Format(" ({0} %)", rdr["PercentCompleted"].ToString()); } lblPriority.Text = rdr["PriorityName"].ToString() + " " + LocRM.GetString("Priority").ToLower(); lblPriority.ForeColor = Util.CommonHelper.GetPriorityColor((int)rdr["PriorityId"]); lblPriority.Visible = PortalConfig.CommonTaskAllowViewPriorityField; if (rdr["Description"] != DBNull.Value) { string txt = CommonHelper.parsetext(rdr["Description"].ToString(), false); if (PortalConfig.ShortInfoDescriptionLength > 0 && txt.Length > PortalConfig.ShortInfoDescriptionLength) { txt = txt.Substring(0, PortalConfig.ShortInfoDescriptionLength) + "..."; } lblDescription.Text = txt; } } else { Response.Redirect("../Common/NotExistingId.aspx?TaskId=" + _taskId); } } } catch (AccessDeniedException) { Response.Redirect("../Common/NotExistingId.aspx?AD=1"); } }
private void BindValues() { if (DocumentId != 0) { using (IDataReader rdr = Document.GetDocument(DocumentId)) { /// DocumentId, ProjectId, ProjectTitle, CreatorId, ManagerId, /// Title, Description, CreationDate, PriorityId, PriorityName, /// StatusId, StatusName, IsCompleted, ReasonId, StateId, ProjectCode if (rdr.Read()) { string sTitle = ""; if (rdr["ProjectId"] != DBNull.Value) { string projectPostfix = CHelper.GetProjectNumPostfix((int)rdr["ProjectId"], (string)rdr["ProjectCode"]); if (Project.CanRead((int)rdr["ProjectId"])) { sTitle += String.Format("<a href='../Projects/ProjectView.aspx?ProjectId={0}' title='{1}'>{2}{3}</a> \\ ", (int)rdr["ProjectId"], LocRM.GetString("Project"), rdr["ProjectTitle"].ToString(), projectPostfix ); } else { sTitle += String.Format("<span title='{0}'>{1}{2}</span>\\ ", LocRM.GetString("Project"), rdr["ProjectTitle"].ToString(), projectPostfix); } } sTitle += String.Format("{0} (#{1})", rdr["Title"].ToString(), rdr["DocumentId"].ToString()); lblTitle.Text = sTitle; lblState.ForeColor = Util.CommonHelper.GetStateColor((int)rdr["StateId"]); lblState.Text = rdr["StateName"].ToString(); if ((int)rdr["StateId"] == (int)ObjectStates.Active || (int)rdr["StateId"] == (int)ObjectStates.Overdue) { lblState.Text += String.Format(": {0}", rdr["StatusName"].ToString()); } lblPriority.Text = rdr["PriorityName"].ToString() + " " + LocRM.GetString("Priority").ToLower(); lblPriority.ForeColor = Util.CommonHelper.GetPriorityColor((int)rdr["PriorityId"]); lblPriority.Visible = PortalConfig.CommonDocumentAllowViewPriorityField; if (rdr["ManagerId"] != DBNull.Value) { lblManager.Text = CommonHelper.GetUserStatus((int)rdr["ManagerId"]); } if (rdr["Description"] != DBNull.Value) { string txt = CommonHelper.parsetext(rdr["Description"].ToString(), false); if (PortalConfig.ShortInfoDescriptionLength > 0 && txt.Length > PortalConfig.ShortInfoDescriptionLength) { txt = txt.Substring(0, PortalConfig.ShortInfoDescriptionLength) + "..."; } lblDescription.Text = txt; } } } } }
private void BindValues() { using (IDataReader rdr = ToDo.GetToDo(ToDoID)) { /// ToDoId, ProjectId, ProjectTitle, IncidentId, IncidentTitle, StatusId, /// DocumentId, DocumentTitle, CompleteDocument, CreatorId, ManagerId, CompletedBy, /// Title, Description, CreationDate, StartDate, FinishDate, /// ActualFinishDate, PriorityId, PriorityName, PercentCompleted, IsActual, /// CompletionTypeId, IsCompleted, CompletionTypeName, MustBeConfirmed, /// ReasonId, TaskId, CompleteTask, TaskTitle, ProjectCode if (rdr.Read()) { lblTitle.Text = ""; string timeline = ""; if (rdr["StartDate"] != DBNull.Value) { timeline += ((DateTime)rdr["StartDate"]).ToShortDateString() + " " + ((DateTime)rdr["StartDate"]).ToShortTimeString(); } else { timeline += LocRM.GetString("NotSet"); } timeline += " - "; if (rdr["FinishDate"] != DBNull.Value) { timeline += ((DateTime)rdr["FinishDate"]).ToShortDateString() + " " + ((DateTime)rdr["FinishDate"]).ToShortTimeString(); } else { timeline += LocRM.GetString("NotSet"); } lblTimeline.Text = timeline; if (Configuration.ProjectManagementEnabled && rdr["ProjectId"] != DBNull.Value) { string projectPostfix = CHelper.GetProjectNumPostfix((int)rdr["ProjectId"], (string)rdr["ProjectCode"]); if (Project.CanRead((int)rdr["ProjectId"]) && !Security.CurrentUser.IsExternal) { lblTitle.Text = String.Format(CultureInfo.InvariantCulture, "<a href='../Projects/ProjectView.aspx?ProjectId={0}' title='{1}'>{2}{3}</a> \\ ", rdr["ProjectId"].ToString(), LocRM.GetString("Project"), rdr["ProjectTitle"].ToString(), projectPostfix); } else { lblTitle.Text = String.Format(CultureInfo.InvariantCulture, "<span title='{0}'>{1}{2}<span> \\ ", LocRM.GetString("Project"), rdr["ProjectTitle"].ToString(), projectPostfix); } } if (rdr["IncidentId"] != DBNull.Value) { if (Incident.CanRead((int)rdr["IncidentId"]) && !Security.CurrentUser.IsExternal) { lblTitle.Text += String.Format("<a href='../Incidents/IncidentView.aspx?IncidentId={0}' title='{2}'>{1} (#{0})</a> \\ ", rdr["IncidentId"].ToString(), rdr["IncidentTitle"].ToString(), LocRM.GetString("Issue")); } else { lblTitle.Text += String.Format("<span title='{1}'>{0} (#{2})<span> \\ ", rdr["IncidentTitle"].ToString(), LocRM.GetString("Issue"), rdr["IncidentId"].ToString()); } } else if (rdr["TaskId"] != DBNull.Value) { if (Task.CanRead((int)rdr["TaskId"]) && !Security.CurrentUser.IsExternal) { lblTitle.Text += String.Format("<a href='../Tasks/TaskView.aspx?TaskId={0}' title='{2}'>{1} (#{0})</a> \\ ", rdr["TaskId"].ToString(), rdr["TaskTitle"].ToString(), LocRM.GetString("Task")); } else { lblTitle.Text += String.Format("<span title='{1}'>{0} (#{2})</span> \\ ", rdr["TaskTitle"].ToString(), LocRM.GetString("Task"), rdr["TaskId"].ToString()); } } else if (rdr["DocumentId"] != DBNull.Value) { if (Document.CanRead((int)rdr["DocumentId"]) && !Security.CurrentUser.IsExternal) { lblTitle.Text += String.Format("<a href='../Documents/DocumentView.aspx?DocumentId={0}' title='{2}'>{1}</a> \\ ", rdr["DocumentId"].ToString(), rdr["DocumentTitle"].ToString(), LocRM.GetString("Document")); } else { lblTitle.Text += String.Format("<span title='{1}'>{0}</span> \\ ", rdr["DocumentTitle"].ToString(), LocRM.GetString("Document")); } } lblTitle.Text += String.Format("{0} (#{1})", rdr["Title"].ToString(), ToDoID); lblState.ForeColor = Util.CommonHelper.GetStateColor((int)rdr["StateId"]); lblState.Text = rdr["StateName"].ToString(); if ((int)rdr["StateId"] == (int)ObjectStates.Active || (int)rdr["StateId"] == (int)ObjectStates.Overdue) { lblState.Text += String.Format(" ({0} %)", rdr["PercentCompleted"].ToString()); } lblPriority.Text = rdr["PriorityName"].ToString() + " " + LocRM.GetString("Priority").ToLower(); lblPriority.ForeColor = Util.CommonHelper.GetPriorityColor((int)rdr["PriorityId"]); lblPriority.Visible = PortalConfig.CommonToDoAllowViewPriorityField; if (rdr["Description"] != DBNull.Value) { string txt = CommonHelper.parsetext(rdr["Description"].ToString(), false); if (PortalConfig.ShortInfoDescriptionLength > 0 && txt.Length > PortalConfig.ShortInfoDescriptionLength) { txt = txt.Substring(0, PortalConfig.ShortInfoDescriptionLength) + "..."; } lblDescription.Text = txt; } } } }