private void BindDGMailIncidents() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("PendingMessageId", typeof(int))); // dt.Columns.Add(new DataColumn("From", typeof(string))); // dt.Columns.Add(new DataColumn("To", typeof(string))); dt.Columns.Add(new DataColumn("Subject", typeof(string))); dt.Columns.Add(new DataColumn("Created", typeof(DateTime))); DataRow dr; int[] pendList = EMailMessage.ListPendigEMailMessageIds(); foreach (int id in pendList) { dr = dt.NewRow(); dr["PendingMessageId"] = id; EMailMessageInfo emi = EMailMessageInfo.Load(id); // dr["From"] = GetAddress(emi.From); // dr["To"] = GetAddress(emi.To); dr["Subject"] = emi.Subject; dr["Created"] = emi.Created; dt.Rows.Add(dr); } DataView dv = dt.DefaultView; dv.Sort = "Created DESC"; dgMailIncidents.DataSource = dv; dgMailIncidents.DataBind(); int RowCount = dgMailIncidents.Items.Count; if (RowCount == 0) { Sep3.Visible = false; Pan3.Visible = false; } else { Sep3.Title = String.Format("{0} ({1})", LocRM.GetString("MI"), RowCount); } }
public bool IsEnable(object Sender, object Element) { bool isVisible = false; // Pending users if (Bus.Security.IsUserInGroup(Bus.InternalSecureGroups.Administrator)) { using (IDataReader reader = Bus.User.GetListPendingUsers()) { if (reader.Read()) { isVisible = true; } } } // Not assigned incidents if (!isVisible && (Bus.Security.IsUserInGroup(Bus.InternalSecureGroups.PowerProjectManager) || Bus.Security.IsUserInGroup(Bus.InternalSecureGroups.ProjectManager) || Bus.Security.IsUserInGroup(Bus.InternalSecureGroups.ExecutiveManager) || Bus.Security.IsUserInGroup(Bus.InternalSecureGroups.HelpDeskManager))) { using (IDataReader reader = Bus.Incident.GetListNotAssignedIncidents(0)) { if (reader.Read()) { isVisible = true; } } } // Mail incidents if (!isVisible) { int[] pendList = EMailMessage.ListPendigEMailMessageIds(); if (pendList.Length > 0) { isVisible = true; } } // Not Approved ToDo And Tasks if (!isVisible) { DataTable dt = Bus.ToDo.GetListNotApprovedToDoAndTasks(0); if (dt.Rows.Count > 0) { isVisible = true; } } // Pending ToDo And Tasks if (!isVisible) { DataTable dt = Bus.ToDo.GetListPendingToDoAndTasks(0); if (dt.Rows.Count > 0) { isVisible = true; } } // Pending Incidents if (!isVisible) { DataTable dt = Bus.Incident.GetListPendingIncidentsDataTable(0); if (dt.Rows.Count > 0) { isVisible = true; } } // Pending Events if (!isVisible) { DataTable dt = Bus.CalendarEntry.GetListPendingEventsDataTable(0); if (dt.Rows.Count > 0) { isVisible = true; } } // ToDo And Tasks without Resources if (!isVisible) { DataTable dt = Bus.ToDo.GetListToDoAndTasksWithoutResources(0); if (dt.Rows.Count > 0) { isVisible = true; } } // Not Assigned Documents if (!isVisible) { DataTable dt = Bus.Document.GetListNotAssignedDocumentsDataTable(0); if (dt.Rows.Count > 0) { isVisible = true; } } // Pending Documents if (!isVisible) { DataTable dt = Bus.Document.GetListPendingDocumentsDataTable(0); if (dt.Rows.Count > 0) { isVisible = true; } } // Declined Requests if (!isVisible) { using (IDataReader reader = Bus.Common.GetListDeclinedRequests(0)) { if (reader.Read()) { isVisible = true; } } } return(isVisible); }