Untitled diff

Created Diff never expires
using System;
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
using Agathos.FlexAnswer.BL.BusinessClasses;
using Agathos.FlexAnswer.BL.BusinessClasses;
using Agathos.FlexAnswer.BL.BusinessClasses.Collections;
using Agathos.FlexAnswer.BL.BusinessClasses.Collections;
using Agathos.FlexAnswer.BL.Interfaces;
using Agathos.FlexAnswer.BL.Interfaces;
using Agathos.FlexAnswer.BL.Logic.Exceptions;
using Agathos.FlexAnswer.BL.Logic.Exceptions;
using Agathos.FlexAnswer.BL.Logic.Utils;
using Agathos.FlexAnswer.BL.Logic.Utils;
namespace Agathos.FlexAnswer.BL.Logic
namespace Agathos.FlexAnswer.BL.Logic
{
{
public class FrequentMessageGroups : IFrequentMessageGroups
    public class FrequentMessageGroups : IFrequentMessageGroups
{
    {
// Class: Frequent Message Groups (FMG) - Wraps the logical entity of Frequent
        // Class: Frequent Message Groups (FMG) - Wraps the logical entity of Frequent
// Message Groups
        // Message Groups
// The Frequent Message Groups are groups of messages which are logically
        // The Frequent Message Groups are groups of messages which are logically
// similar, and therefore have the same response
        // similar, and therefore have the same response
// An FMG consists of:
        // An FMG consists of:
// MessageText - a typical message summarising all the messages within the group
        // MessageText - a typical message summarising all the messages within the group
// ResponseTag - a convient reference to a response
        // ResponseTag - a convient reference to a response
// ResponseText - the full text of a response
        // ResponseText - the full text of a response
// Folder - an FMG sits somewhere inside a folder hierarchy
        // Folder - an FMG sits somewhere inside a folder hierarchy
       
// Internals:
        // Internals:
// Internally an FMG is split across a number of tables: MesGroups being the
        // Internally an FMG is split across a number of tables: MesGroups being the
// primary one, but also MesGroupInstances, Messages and Responses
        // primary one, but also MesGroupInstances, Messages and Responses
       
public int AddFrequentMessageGroup(int SessionId, int ProjectId, string MessageText, string ResponseTag, string ResponseText, int ResponseType, int FolderId, bool AddInstance, int ApprovalId)
        public int AddFrequentMessageGroup(int SessionId, int ProjectId, string MessageText, string ResponseTag, string ResponseText, int ResponseType, int FolderId, bool AddInstance, int ApprovalId)
{
        {
int functionReturnValue = 0;
            int functionReturnValue = 0;
// Adds a new FMG to the project optionally places it in a folder specified by
            // Adds a new FMG to the project optionally places it in a folder specified by
// FolderId (defaults to top level folder, and will also put it in the top level
            // FolderId (defaults to top level folder, and will also put it in the top level
// folder if the FolderId is not valid)
            // folder if the FolderId is not valid)
// Returns a Long, which is the MesGroupId of the new FMG
            // Returns a Long, which is the MesGroupId of the new FMG
// Also adds an instance with text of MessageText and trains the response
            // Also adds an instance with text of MessageText and trains the response
// server on this new instance
            // server on this new instance
// Declaration
            // Declaration
           
Messages objMess = default(Messages);
            Messages objMess = default(Messages);
int lngMesId = 0;
            int lngMesId = 0;
Responses objResp = default(Responses);
            Responses objResp = default(Responses);
MesGroups objMesGroup = new MesGroups();
            MesGroups objMesGroup = new MesGroups();
MesGroupInstances objMGI = default(MesGroupInstances);
            MesGroupInstances objMGI = default(MesGroupInstances);
bool blnCreatingOk = false;
            bool blnCreatingOk = false;
int lngRespId = 0;
            int lngRespId = 0;
           
// Error trapping begins
            // Error trapping begins
try
            try
{
{
// Log entry
                // Log entry
Logging.log.Info("FrequentMessageGroups:" + "AddFrequentMessageGroup");
                Logging.log.Info("FrequentMessageGroups:" + "AddFrequentMessageGroup");
Logging.log.Info("SessionId:" + SessionId.ToString());
                Logging.log.Info("SessionId:" + SessionId.ToString());
Logging.log.Info("ProjectId:" + ProjectId.ToString());
                Logging.log.Info("ProjectId:" + ProjectId.ToString());
Logging.log.Info("MessageText:" + MessageText.ToString());
                Logging.log.Info("MessageText:" + MessageText.ToString());
Logging.log.Info("ResponseTag:" + ResponseTag.ToString());
                Logging.log.Info("ResponseTag:" + ResponseTag.ToString());
Logging.log.Info("ResponseText:" + ResponseText.ToString());
                Logging.log.Info("ResponseText:" + ResponseText.ToString());
Logging.log.Info("ResponseType:" + ResponseType.ToString());
                Logging.log.Info("ResponseType:" + ResponseType.ToString());
Logging.log.Info("FolderId:" + FolderId.ToString());
                Logging.log.Info("FolderId:" + FolderId.ToString());
Logging.log.Info("AddInstance:" + AddInstance.ToString());
                Logging.log.Info("AddInstance:" + AddInstance.ToString());
               
// Main code
                // Main code
blnCreatingOk = true;
                blnCreatingOk = true;
//' Check that the folder exists
                //' Check that the folder exists
objResp = new Responses();
                objResp = new Responses();
               
if (!objResp.FolderExists(SessionId, ProjectId, FolderId))
if (!objResp.FolderExists(SessionId, ProjectId, FolderId))
{
{
FolderId = 0;
                    FolderId = 0;
}
                }
               
functionReturnValue = objResp.LookForSameAnswerName(ProjectId, ResponseTag, 0, ApprovalId);
                functionReturnValue = objResp.LookForSameAnswerName(ProjectId, ResponseTag, 0, ApprovalId);
               
if (functionReturnValue == 0)
                if (functionReturnValue == 0)
{
{
functionReturnValue = objResp.LookForSameQuestionText(ProjectId, MessageText, 0, ApprovalId);
                    functionReturnValue = objResp.LookForSameQuestionText(ProjectId, MessageText, 0, ApprovalId);
}
                }
               
if (functionReturnValue > 0)
                if (functionReturnValue > 0)
{
{
functionReturnValue = 0;
                    functionReturnValue = 0;
return functionReturnValue;
return functionReturnValue;
}
                }
               
//' Add the message to the messages table
                //' Add the message to the messages table
objMess = new Messages();
                objMess = new Messages();
lngMesId = objMess.AddMessage(SessionId, ProjectId, MessageText, "FMG", 0);
                lngMesId = objMess.AddMessage(SessionId, ProjectId, MessageText, "FMG", 0);
functionReturnValue = lngMesId;
                functionReturnValue = lngMesId;
Logging.log.Info("Added message");
                Logging.log.Info("Added message");
               
//' Add the response to the responses table
                //' Add the response to the responses table
lngRespId = objResp.AddResponse(SessionId, ProjectId, ResponseTag, ResponseText, false, FolderId, ResponseType);
                lngRespId = objResp.AddResponse(SessionId, ProjectId, ResponseTag, ResponseText, false, FolderId, ResponseType);
if (lngRespId == 0) blnCreatingOk = false;
                if (lngRespId == 0) blnCreatingOk = false;
objResp = null;
                objResp = null;
Logging.log.Info("Added response");
                Logging.log.Info("Added response");
               
if (blnCreatingOk) {
                if (blnCreatingOk) {
//' Update TopMesGroupId and TopRespId
                    //' Update TopMesGroupId and TopRespId
objMess.UpdateMessageTopMesGroupAndResp(SessionId, ProjectId, lngMesId, lngMesId, lngRespId);
                    objMess.UpdateMessageTopMesGroupAndResp(SessionId, ProjectId, lngMesId, lngMesId, lngRespId);
objMess = null;
                    objMess = null;
Logging.log.Info("Updated TopMesGroupId and TopRespId");
                    Logging.log.Info("Updated TopMesGroupId and TopRespId");
}
                }
               
if (blnCreatingOk)
                if (blnCreatingOk)
{
{
//' Add to the message groups table
                    //' Add to the message groups table
objMesGroup = new MesGroups();
                    objMesGroup = new MesGroups();
objMesGroup.AddMessageGroup(SessionId, ProjectId, lngMesId, lngRespId);
                    objMesGroup.AddMessageGroup(SessionId, ProjectId, lngMesId, lngRespId);
Logging.log.Info("Added message group");
                    Logging.log.Info("Added message group");
}
                }
               
if (blnCreatingOk)
                if (blnCreatingOk)
{
{
//' Add to the message group instances table
                    //' Add to the message group instances table
objMGI = new MesGroupInstances();
                    objMGI = new MesGroupInstances();
if (!objMGI.AddMessageGroupInstance(SessionId, ProjectId, lngMesId, lngMesId, true))
                    if (!objMGI.AddMessageGroupInstance(SessionId, ProjectId, lngMesId, lngMesId, true))
{
{
blnCreatingOk = false;
                        blnCreatingOk = false;
}
                    }
Logging.log.Info("Added message group instance");
                    Logging.log.Info("Added message group instance");
objMGI = null;
                    objMGI = null;
}
                }
               
if (blnCreatingOk & AddInstance)
                if (blnCreatingOk & AddInstance)
{
{
//' Add a matching user message
                    //' Add a matching user message
objMesGroup.AddUserMessageToGroup(SessionId, ProjectId, MessageText, lngMesId);
                    objMesGroup.AddUserMessageToGroup(SessionId, ProjectId, MessageText, lngMesId);
Logging.log.Info("Added matching user message");
                    Logging.log.Info("Added matching user message");
objMesGroup = null;
                    objMesGroup = null;
}
                }
               
// Commit transaction and release context object reference
                // Commit transaction and release context object reference
if (blnCreatingOk)
                if (blnCreatingOk)
{
{
Logging.log.Info("Transaction Complete");
                    Logging.log.Info("Transaction Complete");
}
                }
else
                else
{
{
functionReturnValue = 0;
                    functionReturnValue = 0;
Logging.log.Info("Transaction Aborted");
                    Logging.log.Info("Transaction Aborted");
}
                }
}
            }
catch (Exception ex)
            catch (Exception ex)
{
{
HandleException("App Layer Error:", ex);
                HandleException("App Layer Error:", ex);
}
            }
return functionReturnValue;
            return functionReturnValue;
}
        }
public bool GetFrequentMessageGroupFromID(int SessionId, int ProjectId, int MesGroupId, ref string MessageText, ref string ResponseTag, ref string ResponseText, ref string FolderTag, ref int FolderId, ref int ResponseType, ref string CreatedBy,
        public bool GetFrequentMessageGroupFromID(int SessionId, int ProjectId, int MesGroupId, ref string MessageText, ref string ResponseTag, ref string ResponseText, ref string FolderTag, ref int FolderId, ref int ResponseType, ref string CreatedBy,
ref int CreatedByUserId, ref string DateCreated, ref string EditedBy, ref string DateEdited, ref string ApprovedBy, ref string DateApproved)
        ref int CreatedByUserId, ref string DateCreated, ref string EditedBy, ref string DateEdited, ref string ApprovedBy, ref string DateApproved)
{
        {
// Returns the details of an FMG specified by MesGroupId
            // Returns the details of an FMG specified by MesGroupId
// MessageText (String)
            // MessageText (String)
// ResponseTag (String)
            // ResponseTag (String)
// ResponseText (String)
            // ResponseText (String)
// FolderTag (String)
            // FolderTag (String)
// FolderId (Long)
            // FolderId (Long)
// Return value - false if the group could not be found
            // Return value - false if the group could not be found
// Declaration
            // Declaration
                       
// Error trapping begins
            // Error trapping begins
try
            try
{
{
// Log entry
                // Log entry
Logging.log.Info("FrequentMessageGroups:" + "GetFrequentMessageGroupFromID");
Logging.log.Info("FrequentMessageGroups:" + "GetFrequentMessageGroupFromID");
Logging.log.Info("SessionId:" + SessionId.ToString());
                Logging.log.Info("SessionId:" + SessionId.ToString());
Logging.log.Info("ProjectId:" + ProjectId.ToString());
                Logging.log.Info("ProjectId:" + ProjectId.ToString());
Logging.log.Info("MesGroupId:" + MesGroupId.ToString());
                Logging.log.Info("MesGroupId:" + MesGroupId.ToString());
               
DataAccess.FrequentMessageGroups helper = new DataAccess.FrequentMessageGroups();
                DataAccess.FrequentMessageGroups helper = new DataAccess.FrequentMessageGroups();
return helper.GetFrequentMessageGroupFromID(SessionId, ProjectId, MesGroupId, ref MessageText, ref ResponseTag,
return helper.GetFrequentMessageGroupFromID(SessionId, ProjectId, MesGroupId, ref MessageText, ref ResponseTag,
ref ResponseText, ref FolderTag, ref FolderId, ref ResponseType, ref CreatedBy, ref CreatedByUserId,
ref ResponseText, ref FolderTag, ref FolderId, ref ResponseType, ref CreatedBy, ref CreatedByUserId,
ref DateCreated, ref EditedBy, ref DateEdited, ref ApprovedBy, ref DateApproved);
ref DateCreated, ref EditedBy, ref DateEdited, ref ApprovedBy, ref DateApproved);
}
            }
catch (Exception ex)
            catch (Exception ex)
{
{
// Main code
                // Main code
//' Get message group information given a message id
                //' Get message group information given a message id
HandleException("App Layer Error:", ex);
                HandleException("App Layer Error:", ex);
}
            }
return false;
return false;
}
        }
public bool UpdateFrequentMessageGroup(int SessionId, int ProjectId, int MesGroupId, string MessageText, string ResponseTag, string ResponseText, int ResponseType)
        public bool UpdateFrequentMessageGroup(int SessionId, int ProjectId, int MesGroupId, string MessageText, string ResponseTag, string ResponseText, int ResponseType)
{
        {
bool functionReturnValue = false;
            bool functionReturnValue = false;
// Updates all of the fields of an FMG identified by MesGroupId
            // Updates all of the fields of an FMG identified by MesGroupId
// all values must be specified and valid
            // all values must be specified and valid
// Returns false if the FMG doesn't exist
            // Returns false if the FMG doesn't exist
// Declaration
            // Declaration
           
Messages objMess = default(Messages);
            Messages objMess = default(Messages);
Responses objResp = default(Responses);
            Responses objResp = default(Responses);
int lngRespId = 0;
            int lngRespId = 0;
MesGroups objMesGrp = default(MesGroups);
            MesGroups objMesGrp = default(MesGroups);
// Error trapping begins
            // Error trapping begins
try
            try
{
{
// Log entry
                // Log entry
Logging.log.Info("FrequentMessageGroups:" + "UpdateFrequentMessageGroup");
                Logging.log.Info("FrequentMessageGroups:" + "UpdateFrequentMessageGroup");
Logging.log.Info("SessionId:" + SessionId.ToString());
                Logging.log.Info("SessionId:" + SessionId.ToString());
Logging.log.Info("ProjectId:" + ProjectId.ToString());
                Logging.log.Info("ProjectId:" + ProjectId.ToString());
Logging.log.Info("MesGroupId:" + MesGroupId.ToString());
                Logging.log.Info("MesGroupId:" + MesGroupId.ToString());
Logging.log.Info("MessageText:" + MessageText.ToString());
                Logging.log.Info("MessageText:" + MessageText.ToString());
Logging.log.Info("ResponseTag:" + ResponseTag.ToString());
                Logging.log.Info("ResponseTag:" + ResponseTag.ToString());
Logging.log.Info("ResponseText:" + ResponseText.ToString());
                Logging.log.Info("ResponseText:" + ResponseText.ToString());
Logging.log.Info("ResponseType:" + ResponseType.ToString());
                Logging.log.Info("ResponseType:" + ResponseType.ToString());
               
// Main code
                // Main code
// Could check that this is a FMG and the response is actually response
                // Could check that this is a FMG and the response is actually response
// for this group
                // for this group
//' Find the RespId
                //' Find the RespId
int SimilarText = 0;
                int SimilarText = 0;
SimilarText = 0;
                SimilarText = 0;
               
objResp = new Responses();
                objResp = new Responses();
SimilarText = objResp.LookForSameAnswerName(ProjectId, ResponseTag, MesGroupId, 0);
                SimilarText = objResp.LookForSameAnswerName(ProjectId, ResponseTag, MesGroupId, 0);
               
if (SimilarText == 0)
                if (SimilarText == 0)
{
{
SimilarText = objResp.LookForSameQuestionText(ProjectId, MessageText, MesGroupId, 0);
                    SimilarText = objResp.LookForSameQuestionText(ProjectId, MessageText, MesGroupId, 0);
}
                }
               
if (SimilarText > 0)
                if (SimilarText > 0)
{
{
functionReturnValue = false;
                    functionReturnValue = false;
return false;
                    return false;
}
                }
               
functionReturnValue = true;
                functionReturnValue = true;
lngRespId = GetRespID(MesGroupId);
                lngRespId = GetRespID(MesGroupId);
Logging.log.Info("Got response id (" + lngRespId + ")");
                Logging.log.Info("Got response id (" + lngRespId + ")");
               
if (lngRespId != 0)
                if (lngRespId != 0)
{
{
//' Try to update responses table
                    //' Try to update responses table
                   
functionReturnValue = objResp.UpdateResponse(SessionId, ProjectId, lngRespId, ResponseTag, ResponseText, ResponseType);
                    functionReturnValue = objResp.UpdateResponse(SessionId, ProjectId, lngRespId, ResponseTag, ResponseText, ResponseType);
objResp = null;
                    objResp = null;
if (!functionReturnValue)
                    if (!functionReturnValue)
{
{
Logging.log.Info("Unable to update response");
                        Logging.log.Info("Unable to update response");
}
                    }
else
                    else
{
{
Logging.log.Info("Updated responses table");
                        Logging.log.Info("Updated responses table");
//' Update data in messages table
                        //' Update data in messages table
objMess = new Messages();
                        objMess = new Messages();
objMess.UpdateMessageText(SessionId, ProjectId, MesGroupId, MessageText);
                        objMess.UpdateMessageText(SessionId, ProjectId, MesGroupId, MessageText);
objMess = null;
                        objMess = null;
Logging.log.Info("Updated messages table");
                        Logging.log.Info("Updated messages table");
//'Update Message Group Table
                        //'Update Message Group Table
objMesGrp = new MesGroups();
                        objMesGrp = new MesGroups();
objMesGrp.UpdateEditInformation(SessionId, ProjectId, MesGroupId);
                        objMesGrp.UpdateEditInformation(SessionId, ProjectId, MesGroupId);
objMesGrp = null;
                        objMesGrp = null;
Logging.log.Info("Updated messages groups table");
                        Logging.log.Info("Updated messages groups table");
}
                    }
}
                }
               
Csr objCsr = default(Csr);
                Csr objCsr = default(Csr);
objCsr = new Csr();
                objCsr = new Csr();
               
bool IsApproveMQA = false;
                bool IsApproveMQA = false;
IsApproveMQA = objCsr.GetCsrApproveMqa(SessionId, ProjectId);
                IsApproveMQA = objCsr.GetCsrApproveMqa(SessionId, ProjectId);
               
//string strSQL = "";
                //string strSQL = "";
bool FMGExist = false;
                bool FMGExist = false;
string FolderTag = "";
                string FolderTag = "";
int FolderId = 0;
                int FolderId = 0;
string CreatedBy = "";
                string CreatedBy = "";
int CreatedByUserId = 0;
                int CreatedByUserId = 0;
string DateCreated = "";
                string DateCreated = "";
string EditedBy = "";
                string EditedBy = "";
string DateEdited = "";
                string DateEdited = "";
string ApprovedBy = "";
                string ApprovedBy = "";
string DateApproved = "";
                string DateApproved = "";
               
if (!IsApproveMQA)
if (!IsApproveMQA)
{
{
FMGExist = GetFrequentMessageGroupFromID(SessionId, ProjectId, MesGroupId, ref MessageText, ref ResponseTag,
                    FMGExist = GetFrequentMessageGroupFromID(SessionId, ProjectId, MesGroupId, ref MessageText, ref ResponseTag,
ref ResponseText, ref FolderTag, ref FolderId, ref ResponseType, ref CreatedBy, ref CreatedByUserId,
ref ResponseText, ref FolderTag, ref FolderId, ref ResponseType, ref CreatedBy, ref CreatedByUserId,
ref DateCreated, ref EditedBy, ref DateEdited, ref ApprovedBy, ref DateApproved);
ref DateCreated, ref EditedBy, ref DateEdited, ref ApprovedBy, ref DateApproved);
                   
if (FMGExist == true) //commented for test on 31 Aug 12 //uncommented on 3 Sep 12 //commented again
if (FMGExist == true) //commented for test on 31 Aug 12 //uncommented on 3 Sep 12 //commented again
{
{
DataAccess.FrequentMessageGroups helper = new DataAccess.FrequentMessageGroups();
                        DataAccess.FrequentMessageGroups helper = new DataAccess.FrequentMessageGroups();
helper.UpdateFrequentMessageGroup(SessionId, ProjectId, MesGroupId, MessageText, ResponseTag, ResponseText, ResponseType, FolderId, lngRespId);
                        helper.UpdateFrequentMessageGroup(SessionId, ProjectId, MesGroupId, MessageText, ResponseTag, ResponseText, ResponseType, FolderId, lngRespId);
}
}
}
                }
}
            }
catch (Exception ex)
            catch (Exception ex)
{
{
HandleException("App Layer Error:", ex);
                HandleException("App Layer Error:", ex);
}
            }
return functionReturnValue;
            return functionReturnValue;
}
        }
       
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
        public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs)
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs)
{
{
int publishStatus = 0;
int publishStatus = 0;
int folderId = 0;
int folderId = 0;
string dateCondition = "";
string dateCondition = "";
int createdBy = 0;
int createdBy = 0;
int editedBy = 0;
int editedBy = 0;
int approvedBy = 0;
int approvedBy = 0;
ViewType currentViewType = ViewType.LiveMqa;
ViewType currentViewType = ViewType.LiveMqa;
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
}
}
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int publishStatus)
int publishStatus)
{
{
int folderId = 0;
int folderId = 0;
string dateCondition = "";
string dateCondition = "";
int createdBy = 0;
int createdBy = 0;
int editedBy = 0;
int editedBy = 0;
int approvedBy = 0;
int approvedBy = 0;
ViewType currentViewType = ViewType.LiveMqa;
ViewType currentViewType = ViewType.LiveMqa;
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
}
}
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int publishStatus, int folderId)
int publishStatus, int folderId)
{
{
string dateCondition = "";
string dateCondition = "";
int createdBy = 0;
int createdBy = 0;
int editedBy = 0;
int editedBy = 0;
int approvedBy = 0;
int approvedBy = 0;
ViewType currentViewType = ViewType.LiveMqa;
ViewType currentViewType = ViewType.LiveMqa;
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
}
}
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int publishStatus, int folderId, string dateCondition)
int publishStatus, int folderId, string dateCondition)
{
{
int createdBy = 0;
int createdBy = 0;
int editedBy = 0;
int editedBy = 0;
int approvedBy = 0;
int approvedBy = 0;
ViewType currentViewType = ViewType.LiveMqa;
ViewType currentViewType = ViewType.LiveMqa;
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
}
}
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int publishStatus, int folderId, string dateCondition, int createdBy)
int publishStatus, int folderId, string dateCondition, int createdBy)
{
{
int editedBy = 0;
int editedBy = 0;
int approvedBy = 0;
int approvedBy = 0;
ViewType currentViewType = ViewType.LiveMqa;
ViewType currentViewType = ViewType.LiveMqa;
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
}
}
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int publishStatus, int folderId, string dateCondition, int createdBy, int editedBy)
int publishStatus, int folderId, string dateCondition, int createdBy, int editedBy)
{
{
int approvedBy = 0;
int approvedBy = 0;
ViewType currentViewType = ViewType.LiveMqa;
ViewType currentViewType = ViewType.LiveMqa;
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
}
}
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int publishStatus, int folderId, string dateCondition, int createdBy, int editedBy, int approvedBy)
int publishStatus, int folderId, string dateCondition, int createdBy, int editedBy, int approvedBy)
{
{
ViewType currentViewType = ViewType.LiveMqa;
ViewType currentViewType = ViewType.LiveMqa;
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
return GetFrequentMessageGroups(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs, publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
}
}
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
public Collection<FrequentMessage> GetFrequentMessageGroups(int sessionId, int projectId, string filter_Renamed,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int order, int dir_Renamed, int dispTag, int dispAnswer, int intPage, int intPageSize, ref int totalRecs,
int publishStatus, int folderId, string dateCondition, int createdBy, int editedBy, int approvedBy, ViewType currentViewType)
int publishStatus, int folderId, string dateCondition, int createdBy, int editedBy, int approvedBy, ViewType currentViewType)
{
{
// Returns a StdResults structure which is a count of the total number of
// Returns a StdResults structure which is a count of the total number of
// FMGs in the project and a recordset which represents the current
// FMGs in the project and a recordset which represents the current
// view of the total set given the view settings
// view of the total set given the view settings
// Recordset consists of columns:
// Recordset consists of columns:
// Freq - Number of instances in the group
// Freq - Number of instances in the group
// MesGroupId - The MesGroupId of the group
// MesGroupId - The MesGroupId of the group
// also MessageText
// also MessageText
// and, if the following boolean inputs are true then the specified field
// and, if the following boolean inputs are true then the specified field
// will also be returned
// will also be returned
// DispAnswer Then ResponseText
// DispAnswer Then ResponseText
// DispTag Then AnswerTag
// DispTag Then AnswerTag
// Declaration
// Declaration
// Error trapping begins
// Error trapping begins
try
try
{
{
// Log entry
// Log entry
//Logging.log.Info("FrequentMessageGroups:" + "GetFrequentMessageGroups");
//Logging.log.Info("FrequentMessageGroups:" + "GetFrequentMessageGroups");
//Logging.log.Info("SessionId:" + sessionId.ToString());
//Logging.log.Info("SessionId:" + sessionId.ToString());
//Logging.log.Info("ProjectId:" + projectId.ToString());
//Logging.log.Info("ProjectId:" + projectId.ToString());
////Logging.log.Info("UserId:" + userId.ToString())
////Logging.log.Info("UserId:" + userId.ToString())
//Logging.log.Info("Filter:" + filter_Renamed.ToString());
//Logging.log.Info("Filter:" + filter_Renamed.ToString());
//Logging.log.Info("Order:" + order.ToString());
//Logging.log.Info("Order:" + order.ToString());
//Logging.log.Info("Dir:" + dir_Renamed.ToString());
//Logging.log.Info("Dir:" + dir_Renamed.ToString());
//Logging.log.Info("DispTag:" + dispTag.ToString());
//Logging.log.Info("DispTag:" + dispTag.ToString());
//Logging.log.Info("DispAnswer:" + dispAnswer.ToString());
//Logging.log.Info("DispAnswer:" + dispAnswer.ToString());
//Logging.log.Info("Page:" + intPage.ToString());
//Logging.log.Info("Page:" + intPage.ToString());
//Logging.log.Info("PageSize:" + intPageSize.ToString());
//Logging.log.Info("PageSize:" + intPageSize.ToString());
//Logging.log.Info("PublishStatus:" + publishStatus.ToString());
//Logging.log.Info("PublishStatus:" + publishStatus.ToString());
//Logging.log.Info("FolderId:" + folderId.ToString());
//Logging.log.Info("FolderId:" + folderId.ToString());
//Logging.log.Info("DateCondition:" + dateCondition.ToString());
//Logging.log.Info("DateCondition:" + dateCondition.ToString());
//Logging.log.Info("CreatedBy:" + createdBy.ToString());
//Logging.log.Info("CreatedBy:" + createdBy.ToString());
//Logging.log.Info("EditedBy:" + editedBy.ToString());
//Logging.log.Info("EditedBy:" + editedBy.ToString());
//Logging.log.Info("ApprovedBy:" + approvedBy.ToString());
//Logging.log.Info("ApprovedBy:" + approvedBy.ToString());
//Logging.log.Info("Special:" + currentViewType.ToString());
//Logging.log.Info("Special:" + currentViewType.ToString());
// Main code
// Main code
//' Get count and recordset and build StdResults with it
//' Get count and recordset and build StdResults with it
// Remarked by CP on 2008-06-16 as it should be properly prased at the very Front-End
// Remarked by CP on 2008-06-16 as it should be properly prased at the very Front-End
// Since it is more flexible.
// Since it is more flexible.
//dateCondition = Trim(dateCondition)
//dateCondition = Trim(dateCondition)
//If dateCondition <> "" Then
//If dateCondition <> "" Then
//dateCondition = Right(dateCondition, Len(dateCondition) - 4)
//dateCondition = Right(dateCondition, Len(dateCondition) - 4)
//dateCondition = Replace(dateCondition, "'", "''")
//dateCondition = Replace(dateCondition, "'", "''")
//End If
//End If
// End of remarked by CP on 2008-06-16
// End of remarked by CP on 2008-06-16
//If page = 0 Then
//If page = 0 Then
//page = 1
//page = 1
//End If
//End If
// Count = GetFrequentMessagesInFolderCount(SessionId, ProjectId, Filter_Renamed, DispTag, DispAnswer, PublishStatus, FolderId, DateCondition)
// Count = GetFrequentMessagesInFolderCount(SessionId, ProjectId, Filter_Renamed, DispTag, DispAnswer, PublishStatus, FolderId, DateCondition)
//Dim helper As New Folders
//Dim helper As New Folders
//Dim strFolderList As String = helper.ChkFolder_RetrieveAllFoldersForUser(projectId, userId)
//Dim strFolderList As String = helper.ChkFolder_RetrieveAllFoldersForUser(projectId, userId)
//helper = Nothing
//helper = Nothing
// Get User Type
// Get User Type
//Dim userHelper As New DataAccess.User
//Dim userHelper As New DataAccess.User
//Dim userTypeText As String = userHelper.GetUserType(userId)
//Dim userTypeText As String = userHelper.GetUserType(userId)
//Dim currentUserType As Integer = GetUserLevelFromTypeText(userTypeText)
//Dim currentUserType As Integer = GetUserLevelFromTypeText(userTypeText)
//Dim strFolders As String = ""
//Dim strFolders As String = ""
//If strFolderList <> "" And currentUserType < 3 Then
//If strFolderList <> "" And currentUserType < 3 Then
//strFolders = Mid(strFolderList, 2)
//strFolders = Mid(strFolderList, 2)
//End If
//End If
Logging.log.Info("Built std results");
Logging.log.Info("Built std results");
return GetFrequentMessagesInFolderRecordset(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs,
return GetFrequentMessagesInFolderRecordset(sessionId, projectId, filter_Renamed, order, dir_Renamed, dispTag, dispAnswer, intPage, intPageSize, ref totalRecs,
publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
publishStatus, folderId, dateCondition, createdBy, editedBy, approvedBy, currentViewType);
}
}
catch (Exception ex)
catch (Exception ex)
{
{
HandleException("App Layer Error:", ex);
HandleException("App Layer Error:", ex);
}
}
return new Collection<FrequentMessage>();
return new Collection<FrequentMessage>();
}
}
//Added by Priya on Sep 29, 2011
//Added by Priya on Sep 29, 2011
public int GetFrequentMessageGroupsMQA(int sessionId, int projectId, string filter,
public int GetFrequentMessageGroupsMQA(int sessionId, int projectId, string filter,
int order, int dir, int page, int pageSize, int dispTag, int dispAnswer, int publishStatus,
int order, int dir, int page, int pageSize, int dispTag, int dispAnswer, int publishStatus,
int folderId = -1, string dateCondition = "", int createdBy = 0, int editedBy = 0, int approvedBy = 0, ViewType special = ViewType.LiveMqa, string strFolderList = "")
int folderId = -1, string dateCondition = "", int createdBy = 0, int editedBy = 0, int approvedBy = 0, ViewType special = ViewType.LiveMqa, string strFolderList = "")
{
{
// Error trapping begins
// Error trapping begins
int fmgCount = 0;
int fmgCount = 0;
Collection<FrequentMessage> fmgCnt = new Collection<FrequentMessage>();
Collection<FrequentMessage> fmgCnt = new Collection<FrequentMessage>();
try {
            try {
// Log entry
                // Log entry
//Logging.log.Info("FrequentMessageGroups:" + "GetFrequentMessageGroups for Status: Knowledge Report");
//Logging.log.Info("FrequentMessageGroups:" + "GetFrequentMessageGroups for Status: Knowledge Report");
//Logging.log.Info("SessionId:" + sessionId.ToString());
//Logging.log.Info("SessionId:" + sessionId.ToString());
//L
//L