using MercatorUi;
using MercatorApi;
using System.Linq;
// <CompileWithRoslyn />
namespace Main
{
public class Customizer : MercatorUi.ICustomizers.IExec
{
public void Main(MercatorUi.ICustomizers.ExecAction action)
{
if (action == MercatorUi.ICustomizers.ExecAction.UserLogin)
{
MercatorOutlook.OutlookStatic.Office365GraphParams = null;
if (!string.IsNullOrEmpty(Globals.CurrentUserRecord.CRM_MAIL))
{
var l = Api.Zselect<(string id, string secret)>(Globals.RepData, "select id,secret from FREE_TABLE_SECRETS where id in ('Off365ClId','Off365ClSe','Off365Tena')");
if (l != null)
{
MercatorOutlook.OutlookStatic.Office365GraphParams = new IneoSmtp.Smtp.SendMailOffice365GraphParameters(
l.FirstOrDefault(p => p.id == "Off365ClId").secret,
l.FirstOrDefault(p => p.id == "Off365ClSe").secret,
l.FirstOrDefault(p => p.id == "Off365Tena").secret,
Globals.CurrentUserRecord.CRM_MAIL);
}
}
}
else if (action == MercatorUi.ICustomizers.ExecAction.DossierClose)
{
MercatorOutlook.OutlookStatic.Office365GraphParams = null;
}
}
}
}