275 lines
7.5 KiB
C#
275 lines
7.5 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Text;
|
|||
|
using System.Net.Mail;
|
|||
|
using Ease.CoreV35;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
using Ease.CoreV35.Caching;
|
|||
|
using System.Data.Linq.Mapping;
|
|||
|
|
|||
|
namespace Payroll.BO
|
|||
|
{
|
|||
|
[Serializable]
|
|||
|
public class MailSenderErrorList : BasicBaseObject
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
|
|||
|
private static Cache _cache = new Cache(typeof(MailSenderErrorList));
|
|||
|
|
|||
|
#endregion
|
|||
|
#region Private Variable
|
|||
|
private ID _toEmpID;
|
|||
|
private ID _batchNo;
|
|||
|
private DateTime _receiveTime;
|
|||
|
private DateTime _sendTime;
|
|||
|
private bool _isSuccessfull;
|
|||
|
private string _reason;
|
|||
|
private string _from;
|
|||
|
private string _to;
|
|||
|
private string _cc;
|
|||
|
private string _subject;
|
|||
|
private Object _body;
|
|||
|
private string _attachments;
|
|||
|
|
|||
|
private Employee _toEmployee;
|
|||
|
|
|||
|
public Employee ToEmployee
|
|||
|
{
|
|||
|
get { return _toEmployee; }
|
|||
|
set { _toEmployee = value; }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constractor
|
|||
|
public MailSenderErrorList()
|
|||
|
{
|
|||
|
_from = "";
|
|||
|
_receiveTime = DateTime.Today;
|
|||
|
_sendTime = DateTime.Today;
|
|||
|
_isSuccessfull = false;
|
|||
|
_reason = "";
|
|||
|
_to = "";
|
|||
|
_cc = "";
|
|||
|
_subject = "";
|
|||
|
_body = "";
|
|||
|
_attachments = "";
|
|||
|
_batchNo = null;
|
|||
|
_toEmpID = null;
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Properties
|
|||
|
public ID ToEmpID
|
|||
|
{
|
|||
|
get { return _toEmpID; }
|
|||
|
set { _toEmpID = value; }
|
|||
|
}
|
|||
|
public ID BatchNo
|
|||
|
{
|
|||
|
get { return _batchNo; }
|
|||
|
set { _batchNo = value; }
|
|||
|
}
|
|||
|
|
|||
|
public string From
|
|||
|
{
|
|||
|
get { return _from; }
|
|||
|
set { _from = value; }
|
|||
|
}
|
|||
|
public DateTime ReceiveTime
|
|||
|
{
|
|||
|
get { return _receiveTime; }
|
|||
|
set { _receiveTime = value; }
|
|||
|
}
|
|||
|
public DateTime SendTime
|
|||
|
{
|
|||
|
get { return _sendTime; }
|
|||
|
set { _sendTime = value; }
|
|||
|
}
|
|||
|
public bool IsSuccessfull
|
|||
|
{
|
|||
|
get { return _isSuccessfull; }
|
|||
|
set { _isSuccessfull = value; }
|
|||
|
}
|
|||
|
public string Reason
|
|||
|
{
|
|||
|
get { return _reason; }
|
|||
|
set { _reason = value; }
|
|||
|
}
|
|||
|
public string To
|
|||
|
{
|
|||
|
get { return _to; }
|
|||
|
set { _to = value; }
|
|||
|
}
|
|||
|
public string CC
|
|||
|
{
|
|||
|
get { return _cc; }
|
|||
|
set { _cc = value; }
|
|||
|
}
|
|||
|
public string Subject
|
|||
|
{
|
|||
|
get { return _subject; }
|
|||
|
set { _subject = value; }
|
|||
|
}
|
|||
|
public Object Body
|
|||
|
{
|
|||
|
get { return _body; }
|
|||
|
set { _body = value; }
|
|||
|
}
|
|||
|
public string Attachments
|
|||
|
{
|
|||
|
get { return _attachments; }
|
|||
|
set { _attachments = value; }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory IMailSenderErrorListService : IMailSenderErrorListService
|
|||
|
|
|||
|
internal static IMailSenderErrorListService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<IMailSenderErrorListService>(typeof(IMailSenderErrorListService)); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
|
|||
|
public static MailSenderErrorList Get(ID nID)
|
|||
|
{
|
|||
|
MailSenderErrorList oMailSenderErrorList = null;
|
|||
|
#region Cache Header
|
|||
|
oMailSenderErrorList = (MailSenderErrorList)_cache["Get", nID];
|
|||
|
if (oMailSenderErrorList != null)
|
|||
|
return oMailSenderErrorList;
|
|||
|
#endregion
|
|||
|
|
|||
|
oMailSenderErrorList = MailSenderErrorList.Service.Get(nID);
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oMailSenderErrorList, "Get", nID);
|
|||
|
#endregion
|
|||
|
return oMailSenderErrorList;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<MailSenderErrorList> Get()
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<MailSenderErrorList> MailSenderErrorLists = _cache["Get"] as ObjectsTemplate<MailSenderErrorList>;
|
|||
|
if (MailSenderErrorLists != null)
|
|||
|
return MailSenderErrorLists;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
MailSenderErrorLists = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(MailSenderErrorLists, "Get");
|
|||
|
#endregion
|
|||
|
return MailSenderErrorLists;
|
|||
|
}
|
|||
|
public MailSenderErrorList GetWithBody(ID id)
|
|||
|
{
|
|||
|
MailSenderErrorList mailSenderErrorList = null;
|
|||
|
|
|||
|
mailSenderErrorList = Service.GetWithBody(id);
|
|||
|
|
|||
|
return mailSenderErrorList;
|
|||
|
}
|
|||
|
public ID Save(byte[] body)
|
|||
|
{
|
|||
|
this.SetAuditTrailProperties();
|
|||
|
return MailSenderErrorList.Service.Save(this, body);
|
|||
|
}
|
|||
|
public void Delete(ID id)
|
|||
|
{
|
|||
|
MailSenderErrorList.Service.Delete(id);
|
|||
|
}
|
|||
|
public static ID GetNewBatchNo()
|
|||
|
{
|
|||
|
ID id = ID.FromInteger(0);
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
id = MailSenderErrorList.Service.GetNewBatchNo();
|
|||
|
}
|
|||
|
catch (Exception exception)
|
|||
|
{
|
|||
|
|
|||
|
throw exception;
|
|||
|
}
|
|||
|
|
|||
|
return id;
|
|||
|
}
|
|||
|
public static DataTable GetBatchNoWiseErrorList()
|
|||
|
{
|
|||
|
DataTable dataTable = new DataTable();
|
|||
|
try
|
|||
|
{
|
|||
|
dataTable = MailSenderErrorList.Service.GetBatchNoWiseErrorList();
|
|||
|
}
|
|||
|
catch (Exception exception)
|
|||
|
{
|
|||
|
|
|||
|
throw exception;
|
|||
|
}
|
|||
|
return dataTable;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<MailSenderErrorList> GetErrorListByBatchNo(int batchNo)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
ObjectsTemplate<MailSenderErrorList> MailSenderErrorLists = _cache["Get", Ease.CoreV35.Model.ID.FromInteger(batchNo)] as ObjectsTemplate<MailSenderErrorList>;
|
|||
|
if (MailSenderErrorLists != null)
|
|||
|
return MailSenderErrorLists;
|
|||
|
#endregion
|
|||
|
try
|
|||
|
{
|
|||
|
MailSenderErrorLists = MailSenderErrorList.Service.GetErrorListByBatchNo(batchNo);
|
|||
|
}
|
|||
|
catch (Exception exception)
|
|||
|
{
|
|||
|
|
|||
|
throw exception;
|
|||
|
}
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(MailSenderErrorLists, "Get", ID.FromInteger(batchNo));
|
|||
|
#endregion
|
|||
|
return MailSenderErrorLists;
|
|||
|
}
|
|||
|
|
|||
|
public static void UpdateSendStatus(int nID, bool bStatus)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
MailSenderErrorList.Service.UpdateSendStatus(nID, bStatus);
|
|||
|
}
|
|||
|
catch (Exception exception)
|
|||
|
{
|
|||
|
throw exception;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
#region IMailSenderErrorList Service
|
|||
|
public interface IMailSenderErrorListService
|
|||
|
{
|
|||
|
MailSenderErrorList Get(ID id);
|
|||
|
ObjectsTemplate<MailSenderErrorList> Get();
|
|||
|
ID Save(MailSenderErrorList item, byte[] body);
|
|||
|
void Delete(ID id);
|
|||
|
ID GetNewBatchNo();
|
|||
|
DataTable GetBatchNoWiseErrorList();
|
|||
|
ObjectsTemplate<MailSenderErrorList> GetErrorListByBatchNo(int batchNo);
|
|||
|
MailSenderErrorList GetWithBody(ID id);
|
|||
|
void UpdateSendStatus(int nID, bool bStatus);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
}
|