public int AddAuthentication(CustAuthenticationModel model)
{
//添加认证 自动升级成车商
const string sqlU = "update cust_info set authstatus=1 where innerid=@innerid;";
const string sqlI = @"INSERT INTO `cust_authentication`
(innerid, custid, realname, idcard, enterprisename, licencecode, licencearea, organizationcode, taxcode, relevantpicture, createdtime)
VALUES
(uuid(), @custid, @realname, @idcard, @enterprisename, @licencecode, @licencearea, @organizationcode, @taxcode, @relevantpicture, @createdtime);";
using (var conn = Helper.GetConnection())
{
var tran = conn.BeginTransaction();
try
{
conn.Execute(sqlU, new { innerid = model.Custid }, tran);
conn.Execute(sqlI, model, tran);
tran.Commit();
return 1;
}
catch (Exception ex)
{
LoggerFactories.CreateLogger().Write("AddAuthentication Ex:" + ex.Message, TraceEventType.Error);
tran.Rollback();
return 0;
}
}
}