using LHDN.CRM.BC.Repositories;
using LHDN.CRM.Models.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LHDN.CRM.BC.Services
{
    public class ErrorService : ServiceBase<ErrorLog>
    {
        private ErrorRepository errRepo = new ErrorRepository();
        public long LogError(string additionalInfo, string userId)
        {
            long errorLogID = 0;

            ErrorLog log = new ErrorLog()
            {
                System = "LHDN.CRM",
                AdditionalInfo = additionalInfo,
                UserID = userId,
                CreatedBy = "System",
                CreatedDateTime = DateTime.Now
            };

            errorLogID = errRepo.LogError(log);

            return errorLogID;
        }

        public long LogError(string additionalInfo, string userId, string system)
        {
            long errorLogID = 0;

            ErrorLog log = new ErrorLog()
            {
                System = system,
                AdditionalInfo = additionalInfo,
                UserID = userId,
                CreatedBy = "System",
                CreatedDateTime = DateTime.Now
            };

            errorLogID = errRepo.LogError(log);

            return errorLogID;
        }
    }
}
