EchoTex_Payroll/HRM.BO/Survey/QuestionAnswer.cs

266 lines
6.9 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00

using Ease.Core.Model;
using Payroll.BO;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Reflection;
namespace HRM.BO
{
public class QuestionAnswer: AuditTrailBase
{
#region Constructor
public QuestionAnswer()
{
_answerID = 0;
_questionID = 0;
_answerBody = string.Empty;
_image = string.Empty;
_isCorrect = false;
_displayOrder = 0;
_weight = 0;
}
#endregion
#region Properties
#region AnswerID : ID
private int _answerID;
public int AnswerID
{
get { return _answerID; }
set
{
_answerID = value;
}
}
#endregion
#region QuestionID : int
private int _questionID;
public int QuestionID
{
get { return _questionID; }
set
{
_questionID = value;
}
}
#endregion
#region AnswerBody : string
private string _answerBody;
public string AnswerBody
{
get { return _answerBody; }
set
{
_answerBody = value;
}
}
#endregion
#region Image : string
private string _image;
public string Image
{
get { return _image; }
set
{
_image = value;
}
}
#endregion
#region IsCorrect : bool
private bool _isCorrect;
public bool IsCorrect
{
get { return _isCorrect; }
set
{
_isCorrect = value;
}
}
#endregion
#region DisplayOrder : int
private int _displayOrder;
public int DisplayOrder
{
get { return _displayOrder; }
set
{
_displayOrder = value;
}
}
#endregion
#region Weight : double
private double _weight;
public double Weight
{
get { return _weight; }
set
{
_weight = value;
}
}
#endregion
public List<QuestionAnswerAttachment> QuestionAnswerAttachments { get; set; }
#region Service Factory IPFTransactionService : IPFTransactionService
internal static IQuestionAnswerService Service
{
get { return Services.Factory.CreateService<IQuestionAnswerService>(typeof(IQuestionAnswerService)); }
}
#endregion
#endregion
//#region Functions
//public QuestionAnswer Get(int nID)
//{
// QuestionAnswer oQuestionAnswer = null;
// #region Cache Header
// oQuestionAnswer = (QuestionAnswer)_cache["Get", ID];
// if (oQuestionAnswer != null)
// return oQuestionAnswer;
// #endregion
// oQuestionAnswer = QuestionAnswer.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oQuestionAnswer, "Get", ID);
// #endregion
// return oQuestionAnswer;
//}
//public static List<QuestionAnswer> Get()
//{
// #region cache header
// List<QuestionAnswer> QuestionAnswers = _cache["Get"] as List<QuestionAnswer>;
// if (QuestionAnswers != null)
// return QuestionAnswers;
// #endregion
// try
// {
// QuestionAnswers = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region cache footer
// _cache.Add(QuestionAnswers, "Get");
// #endregion
// return QuestionAnswers;
//}
//public static List<QuestionAnswer> GetByQuestionID(int questionId)
//{
// #region Cache Header
// List<QuestionAnswer> QuestionAnswers = _cache["Get", questionId] as List<QuestionAnswer>;
// if (QuestionAnswers != null)
// return QuestionAnswers;
// #endregion
// try
// {
// QuestionAnswers = Service.GetByQuestionID(questionId);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(QuestionAnswers, "Get", questionId);
// #endregion
// return QuestionAnswers;
//}
////#region Input validator
////public string[] InputValidator()
////{
//// string[] sErrorString = new string[2];
//// if (this.Code == "")
//// {
//// sErrorString[0] = "Code can not be empty";
//// sErrorString[1] = "Code";
//// return sErrorString;
//// }
//// if (this.Name == "")
//// {
//// sErrorString[0] = "Description can not be empty";
//// sErrorString[1] = "Description";
//// return sErrorString;
//// }
//// sErrorString = null;
//// return sErrorString;
////}
////#endregion
//public int Save()
//{
// base.SetAuditTrailProperties();
// return QuestionAnswer.Service.Save(this);
//}
//public void Delete(int id)
//{
// QuestionAnswer.Service.Delete(id);
//}
//#endregion
}
#region IQuestionAnswer Service
public interface IQuestionAnswerService
{
QuestionAnswer Get(int id);
List<QuestionAnswer> Get();
List<QuestionAnswer> GetByQuestionID(int questionId);
int Save(QuestionAnswer item);
void Delete(int id);
List<QuestionAnswerAttachment> GetQuestionFileAttachments(int questionID);
}
#endregion
}