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
//' 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