/// <summary> /// Thread Constructor /// </summary> /// <param name="peer">entry peer</param> /// <param name="data">data text</param> public MChatEntry(MChatEntry peer, String data) : this(peer.GetCtx(), 0, peer.Get_TrxName()) { //set chat in MChatEntry SetCM_Chat_ID(peer.GetCM_Chat_ID()); //parent chat entry SetCM_ChatEntryParent_ID(peer.GetCM_ChatEntryParent_ID()); // Set GrandParent int id = peer.GetCM_ChatEntryGrandParent_ID(); //if no chat if (id == 0) { id = peer.GetCM_ChatEntryParent_ID(); } //set M_ChatEntryGrandParent_ID SetCM_ChatEntryGrandParent_ID(id); //confidential chat type SetConfidentialType(peer.GetConfidentialType()); //chat text SetCharacterData(data); //chat entry SetChatEntryType(CHATENTRYTYPE_ForumThreaded); }
/// <summary> /// Get History as text from data base using Html display formate /// </summary> /// <param name="ConfidentialType">confidential type</param> /// <returns>text from control</returns> public string GetHistory(String confidentialType) { GetEntries(true);//array list status Boolean first = true; //text to show in browser StringBuilder strbChatText = new StringBuilder("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>" + "<html xmlns='http://www.w3.org/1999/xhtml'>" + "<head>" + "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />" + "<title>Untitled Document</title>" + "<style type='text/css'>" + "<!--" + "body {" + "margin-left: 0px;" + "margin-top: 0px;" + "margin-right: 0px;" + "margin-bottom: 0px;" + "font-family:Arial;" + "font-size:12px;" + "}" + ".grey" + "{" + "color:#969292;" + "}" + ".grey-1" + "{" + "font-size:10px;" + "color:#969292;" + "}" + "-->" + "</style></head>" + "<body>" + "<table width='100%' style='background-color:#F6F6F6' border='0' align='left' cellpadding='4' cellspacing='0'>"); //loop for each Chat record in Array for (int i = 0; i < _chatEntries.Length; i++) { MChatEntry entry = _chatEntries[i]; //get the created date of a perticular chat from PO _createdDate = entry.GetCreated(); _format = new DateTime(_createdDate.Year, _createdDate.Month, _createdDate.Day, _createdDate.Hour, _createdDate.Minute, _createdDate.Second); _createdDate = _format; //check for valid value if (!entry.IsActive() || !entry.IsConfidentialTypeValid(confidentialType)) { continue; } //status for first chat if (first) { first = false; } //only show those records where Character data is not empty if (entry.GetCharacterData() != null) { //set table strbChatText.Append("<tr>" + "<td><table width='100%' border='0' align='left' cellpadding='0' cellspacing='0'>" + "<tr>" + "<td class='grey'></td>" + "<td> </td>" + "</tr>" + "<tr>" + "<td width='76px' class='grey'>" + GetCtx().GetAD_User_Name() + " :</td>" +//Show the Login User Name "<td width='100%' Style='text-align:left' ><hr /></td>" + "</tr>" + "<tr>" + "<td> </td>" + "<td align='right' class='grey-1'>" + _createdDate + "</td>" +//show the chat created date "</tr>" + "<tr>" + "<td colspan='2' width='100%'>" + entry.GetCharacterData() + "</td>" +//Show the chat "</tr>" + "<tr>" + "<td colspan='2'> </td>" + "</tr>" + "</table></td>" + "</tr>" + "<tr>" + "<td class='grey'> </td>" + "</tr>"); //if (i == 0) //{ // //_createdDate // data += ctx.GetAD_User_Name() + ":__________\n " + _createdDate.Date+"\n\n" + entry.GetCharacterData(); //} //else //{ // data1 += "\n\n" + ctx.GetAD_User_Name() + ":_____________________\n " + _createdDate.Date + "\n\n" + entry.GetCharacterData(); //} } } strbChatText.Append("</table></body></html>");//close table //data += data1; //return data; //return string text with HTML return(strbChatText.ToString()); }