using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using TABS.MailCarrier.WebSDK;
using TABS.MailCarrier.WebSDK.Mail;

/// <summary>
/// MailApvDataSource의 요약 설명입니다.
/// </summary>
public class MailApvDataSource
{
    public MailApvDataSource()
    {
    }

    /// <summary>
    /// 승인권자가 승인할 메일을 반환한다.
    /// </summary>
    /// <param name="approverId">승인권자 ID</param>
    /// <param name="listMode">ListWait - 승인 대기 상태의 메일만 반환</param>
    /// <returns></returns>
    public DataSet GetMessages(string approverId, string listMode)
    {
        using (SqlConnection conn = new SqlConnection(GlobalConfig.ConnString))
        {
            Guid crId = new Guid(approverId);
            PermitSendEx ps = new PermitSendEx(WebUser.CurrentUser.DomainID);
            return ps.PsConfirmListSelectByConfirmer(conn, crId, listMode, "", "");
        }
    }

    public DataSet GetMessagesBySender(string listMode)
    {
        using (SqlConnection conn = new SqlConnection(GlobalConfig.ConnString))
        {
            PermitSendEx ps = new PermitSendEx(WebUser.CurrentUser.DomainID);
            return ps.PsConfirmListSelectBySender(conn, WebUser.CurrentUser.DomainUserID, "", "");
        }
    }

}