protected void scdTaskSchedule_OnDataBound(object sender, Telerik.Web.UI.SchedulerEventArgs e)
        {
            try
            {
                e.Appointment.AllowDelete = false;
                e.Appointment.AllowEdit   = true;
                e.Appointment.Description = StringHtmlExtensions.TruncateHtml(e.Appointment.Description, 10000, "...");
                e.Appointment.Description = WebSiteCommon.StripHTML(e.Appointment.Description);

                if (e.Appointment.End.Date >= e.Appointment.Start.Date && e.Appointment.Start.Date < SessionManager.UserContext.LocalTime.Date)
                {
                    // past due active link
                    e.Appointment.BackColor = System.Drawing.ColorTranslator.FromHtml("#ffe6e6");  // light pink
                }
                else if (string.IsNullOrEmpty(e.Appointment.ID.ToString()))
                {
                    // inactive link
                    e.Appointment.BackColor = System.Drawing.ColorTranslator.FromHtml("#F0FFFF");   // azure
                }
                else
                {
                    // active link
                    e.Appointment.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFE0");   // yellow
                }

                e.Appointment.End = e.Appointment.Start.AddHours(2);
            }
            catch
            {
                ;
            }
        }
        protected void scdTaskSchedule_OnDataBound(object sender, Telerik.Web.UI.SchedulerEventArgs e)
        {
            e.Appointment.AllowDelete = false;
            e.Appointment.AllowEdit   = true;
            e.Appointment.Description = StringHtmlExtensions.TruncateHtml(e.Appointment.Description, 1000, "...");
            e.Appointment.Description = WebSiteCommon.StripHTML(e.Appointment.Description);

            if (e.Appointment.End.Date > e.Appointment.Start.Date && e.Appointment.Start.Date < DateTime.Now.Date)
            {
                e.Appointment.BackColor = System.Drawing.ColorTranslator.FromHtml("#ffe6e6");  // light yellow  #ffd413  #ffc013
            }
            e.Appointment.End = e.Appointment.Start.AddHours(2);
        }
Example #3
0
 protected void rptTaskStrip_OnItemCreate(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         try
         {
             TaskItem item = (TaskItem)e.Item.DataItem;
             item.Description = StringHtmlExtensions.TruncateHtml(item.Description, 1000, "...");
             item.Description = WebSiteCommon.StripHTML(item.Description);
         }
         catch
         { }
     }
 }
 protected void rptTaskStrip_OnItemCreate(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         try
         {
             TaskItem item = (TaskItem)e.Item.DataItem;
             if (item.Person != null && (item.NotifyType == TaskNotification.Escalation || item.NotifyType == TaskNotification.Delegate))
             {
                 item.Description += " (" + SQMModelMgr.FormatPersonListItem(item.Person) + ")";
             }
             item.Description = StringHtmlExtensions.TruncateHtml(item.Description, 1000, "...");
             item.Description = WebSiteCommon.StripHTML(item.Description);
         }
         catch
         { }
     }
 }
        protected void rgPreventativeList_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                HiddenField hf;
                Label       lbl;
                string      val = "";

                EHSIncidentData data = (EHSIncidentData)e.Item.DataItem;

                lbl      = (Label)e.Item.FindControl("lblIncidentId");
                lbl.Text = WebSiteCommon.FormatID(data.Incident.INCIDENT_ID, 6);

                lbl      = (Label)e.Item.FindControl("lblDescription");
                lbl.Text = StringHtmlExtensions.TruncateHtml(data.Incident.DESCRIPTION, 100, "...");
                lbl.Text = lbl.Text.Replace("<a href", "<a target=\"blank\" href");

                if (data.Person != null)
                {
                    lbl      = (Label)e.Item.FindControl("lblReportedBy");
                    lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person);
                }

                lbl      = (Label)e.Item.FindControl("lblCategory");
                lbl.Text = EHSIncidentMgr.SelectIncidentAnswer(data.Incident, (decimal)EHSQuestionId.InspectionCategory) + "<br/>" +
                           EHSIncidentMgr.SelectIncidentAnswer(data.Incident, (decimal)EHSQuestionId.RecommendationType);

                lbl = (Label)e.Item.FindControl("lblIncStatus");
                try
                {
                    if (data.Status == "U")
                    {
                        lbl.Text = "Audited " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE_DATA_COMPLETE, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")";
                    }
                    else if (data.Status == "F")
                    {
                        lbl.Text = "Awaiting Funding " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE_DATA_COMPLETE, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")";
                    }
                    else if (data.Status == "C")
                    {
                        lbl.Text = "Closed  " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE, "d", false) + "<br/><strong>Not Audited</strong>";
                    }
                    else
                    {
                        lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", data.Status) + "<br/>(" + data.DaysOpen + ")";
                    }
                }
                catch
                {
                    ;
                }

                LinkButton lbEditReport = (LinkButton)e.Item.FindControl("lbEditReport");
                lbEditReport.Visible = true;

                try
                {
                    lbl      = (Label)e.Item.FindControl("lblIncidentDT");
                    lbl.Text = SQMBasePage.FormatDate(data.Incident.INCIDENT_DT, "d", false);
                    if ((val = data.EntryList.Where(l => l.INCIDENT_QUESTION_ID == 80).Select(l => l.ANSWER_VALUE).FirstOrDefault()) != null && !string.IsNullOrEmpty(val))
                    {
                        val = val.Substring(0, val.IndexOf(' '));
                        DateTime parseDate;
                        if (DateTime.TryParse(val, CultureInfo.GetCultureInfo("en-US"), DateTimeStyles.AssumeLocal, out parseDate))
                        {
                            lbl.Text = parseDate.ToShortDateString();
                        }
                    }
                }
                catch {}
                try {
                    if ((val = data.EntryList.Where(l => l.INCIDENT_QUESTION_ID == 92).Select(l => l.ANSWER_VALUE).FirstOrDefault()) != null && !string.IsNullOrEmpty(val))
                    {
                        val = val.Substring(0, val.IndexOf(' '));
                        DateTime parseDate;
                        if (DateTime.TryParse(val, CultureInfo.GetCultureInfo("en-US"), DateTimeStyles.AssumeLocal, out parseDate))
                        {
                            lbl      = (Label)e.Item.FindControl("lblDueDT");
                            lbl.Text = parseDate.ToShortDateString();
                        }
                    }
                }
                catch  {; }

                if (data.RespPerson != null)
                {
                    lbl      = (Label)e.Item.FindControl("lblAssignedTo");
                    lbl.Text = SQMModelMgr.FormatPersonListItem(data.RespPerson);
                }

                if (rgPreventativeList.MasterTableView.GetColumn("Attach").Visible&&  data.AttachList != null)
                {
                    lbl = (Label)e.Item.FindControl("lblAttach");
                    Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx");
                    lbl.Parent.Controls.AddAt(lbl.Parent.Controls.IndexOf(lbl), attch);
                    attch.BindListAttachment(data.AttachList, "1", 1);
                }
            }
        }