EchoTex_Payroll/HRM.BO/Survey/Question.cs

319 lines
6.9 KiB
C#
Raw Permalink 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
{
#region Question
public class Question : AuditTrailBase
{
#region Constructor
public Question()
{
_questionID = 0;
_questionNo = string.Empty;
_categoryID = 0;
_questionBody = string.Empty;
_image = string.Empty;
_isMultiple = false;
_isPublished = false;
_creationDate = DateTime.MinValue;
_userID = 0;
_questionType = 0;
}
#endregion
#region Properties
#region QuestionID : ID
private int _questionID;
public int QuestionID
{
get { return _questionID; }
set
{
_questionID = value;
}
}
#endregion
#region QuestionNo : string
private string _questionNo;
public string QuestionNo
{
get { return _questionNo; }
set
{
_questionNo = value;
}
}
#endregion
#region CategoryID : int
private int _categoryID;
public int CategoryID
{
get { return _categoryID; }
set
{
_categoryID = value;
}
}
#endregion
#region QuestionBody : string
private string _questionBody;
public string QuestionBody
{
get { return _questionBody; }
set
{
_questionBody = value;
}
}
#endregion
#region Image : string
private string _image;
public string Image
{
get { return _image; }
set
{
_image = value;
}
}
#endregion
#region IsMultiple : bool
private bool _isMultiple;
public bool IsMultiple
{
get { return _isMultiple; }
set
{
_isMultiple = value;
}
}
#endregion
#region IsPublished : bool
private bool _isPublished;
public bool IsPublished
{
get { return _isPublished; }
set
{
_isPublished = value;
}
}
#endregion
#region CreationDate : DateTime
private DateTime _creationDate;
public DateTime CreationDate
{
get { return _creationDate; }
set
{
_creationDate = value;
}
}
#endregion
#region UserID : int
private int _userID;
public int UserID
{
get { return _userID; }
set
{
_userID = value;
}
}
#endregion
#region QuestionType : EnumSurveyQuestionType
private EnumSurveyQuestionType _questionType;
public EnumSurveyQuestionType QuestionType
{
get { return _questionType; }
set
{
_questionType = value;
}
}
#endregion
public List<QuestionAnswer> QuestionAnswers { get; set; }
public List<QuestionAnswerAttachment> QuestionAnswerAttachments { get; set; }
public QuestionCategory Category { get; set; }
public string CategoryString { get; set; }
public string ConnectionString { get; set; }
public int NoOfOptions { get; set; }
public double? EstimatedTime { get; set; }
#region Category
public string QuestionCategoryDes
{
get
{
if (this.Category == null)
return "";
return this.Category.Description;
}
}
#endregion
//#region Functions
//public Question Get(int nID)
//{
// Question oQuestion = null;
// #region Cache Header
// oQuestion = (Question)_cache["Get", ID];
// if (oQuestion != null)
// return oQuestion;
// #endregion
// oQuestion = Question.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oQuestion, "Get", ID);
// #endregion
// return oQuestion;
//}
//public static List<Question> Get()
//{
// #region cache header
// List<Question> Questions = _cache["Get"] as List<Question>;
// if (Questions != null)
// return Questions;
// #endregion
// try
// {
// Questions = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region cache footer
// _cache.Add(Questions, "Get");
// #endregion
// return Questions;
//}
//public static List<Question> GetByCategory(int categoryID)
//{
// #region Cache Header
// List<Question> Questions = _cache["Get", categoryID] as List<Question>;
// if (Questions != null)
// return Questions;
// #endregion
// try
// {
// Questions = Service.GetByCategory(categoryID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(Questions, "Get", categoryID);
// #endregion
// return Questions;
//}
//public bool IsTagged()
//{
// if (this.IsNew || this.ID.IsUnassigned)
// return false;
// return Service.IsTagged(this.ID);
//}
//public int Save()
//{
// base.SetAuditTrailProperties();
// return Question.Service.Save(this);
//}
//public void Delete(int id)
//{
// Question.Service.Delete(id);
//}
//#endregion
}
#endregion
#region IQuestion Service
public interface IQuestionService
{
Question Get(int id);
List<Question> Get();
List<Question> GetByCategory(int categoryID);
int Save(Question item);
void Delete(int id);
bool IsTagged(int id);
Question GetWithChild(int id);
QuestionAnswerAttachment GetAnswerByAttchmentId(int questionId, int answerId);
}
#endregion
}
#endregion