Example #1
0
        private void GetCallDataByDate(DateTime startDate, DateTime endDate)
        {
            var listContactCall = _masterDal.GetCallForCalendar(FranchiseeId,
                                                                SalesRepId,
                                                                HostName,
                                                                startDate.ToShortDateString(), endDate.ToShortDateString(), 0);

            EContactCall[] eContactCalls = null;
            if (listContactCall != null)
            {
                eContactCalls = listContactCall.ToArray();
            }
            if (eContactCalls != null && eContactCalls.Length > 0)
            {
                for (int counter = 0; counter < eContactCalls.Length; counter++)
                {
                    string callSubject = "\"" + eContactCalls[counter].Subject + " \"";

                    string callStartDate = "";
                    if (eContactCalls[counter].StartDate.Trim().Length > 0)
                    {
                        callStartDate = "\"" + Convert.ToDateTime(eContactCalls[counter].StartDate).ToLongDateString() +
                                        " \"";
                    }

                    string callStartTime = "\"\"";
                    if (eContactCalls[counter].StartTime.Trim().Length > 0)
                    {
                        callStartTime = "\"" + Convert.ToDateTime(eContactCalls[counter].StartTime).ToShortTimeString() +
                                        " \"";
                    }

                    string callContact     = "\"" + eContactCalls[counter].Contact.Title + " " + eContactCalls[counter].Contact.FirstName + " " + eContactCalls[counter].Contact.LastName + " \"";
                    string callDuration    = "\"" + (Convert.ToInt32(eContactCalls[counter].Duration) / 60) + " hrs. & " + Convert.ToInt32(eContactCalls[counter].Duration % 60) + " min. \"";
                    string callStatus      = "\"" + eContactCalls[counter].CallStatus.Status + " \"";
                    string callDescription = "\"" + eContactCalls[counter].Notes + " \"";
                    string controlId       = "\"Call" + eContactCalls[counter].ContactCallID + "\"";


                    string callDescriptions = callSubject + "," + callContact + "," + callStartDate + "," + callStartTime + "," + callDuration + "," + callStatus + "," + callDescription + "," + controlId;
                    string strCallView;

                    if (eContactCalls[counter].CallStatus.Status == "Completed")
                    {
                        strCallView = "onclick = 'alert(\"You cannot edit Call already completed\")' ";
                    }

                    else
                    {
                        strCallView = "onclick = 'window.location=\"../../App/Franchisor/AddCall.aspx?ContactCallID=" + eContactCalls[counter].ContactCallID + "&Referrer=Calendar\"'";
                    }

                    var jTipData =
                        "<p class=\"jtprowtop\"><span class=\"lbljtip\"> Subject</span>" +
                        "<span class=\"left\"><b>:</b>&nbsp;</span><span class=\"dtlsjtip\">" +
                        callSubject.Replace("\"", string.Empty) +
                        "</span></p><p class=\"jtprow\"><span class=\"lbljtip\"> Contact to </span>" +
                        "<span class=\"left\"><b>:</b>&nbsp;</span><span class=\"dtlsjtip\">" +
                        callContact.Replace("\"", string.Empty) +
                        "</span></p><p class=\"jtprow\"><span class=\"lbljtip\"> Start on </span>" +
                        "<span class=\"left\"><b>:</b>&nbsp;</span><span class=\"dtlsjtip\">" +
                        callStartDate.Replace("\"", string.Empty) + " at " + callStartTime.Replace("\"", string.Empty) +
                        "</span></p><p class=\"jtprow\"><span class=\"lbljtip\">Duration</span>" +
                        "<span class=\"left\"><b>:</b>&nbsp;</span><span class=\"dtlsjtip\">" +
                        callDuration.Replace("\"", string.Empty) +
                        "</span></p><p class=\"jtprow\"><span class=\"lbljtip\"> Status</span>" +
                        "<span class=\"left\"><b>:</b>&nbsp;</span><span class=\"dtlsjtip\">" +
                        callStatus.Replace("\"", string.Empty) +
                        "</span></p><p class=\"jtprow\"><span class=\"lbljtip\">Description</span> " +
                        "<span class=\"left\"><b>:</b>&nbsp;</span><span class=\"dtlsjtip\">" +
                        callDescription.Replace("\"", string.Empty) + "</span></p>";


                    string strCallName = "<a  class='jtip' title='CallDetails|" + jTipData + "'" + strCallView + " > <img src='../Images/reminders-square.gif' /> " + eContactCalls[counter].Subject + "</a>";

                    _tblAppointments.Rows.Add(new object[] { "Call" + eContactCalls[counter].ContactCallID.ToString(), "Calls", strCallName, eContactCalls[counter].StartDate, callDescriptions });
                }
            }
        }