/// <summary> /// 用户添加认证信息 /// </summary> /// <param name="model">认证信息</param> /// <returns></returns> 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; } } }
/// <summary> /// 用户修改认证信息 /// </summary> /// <param name="model">认证信息</param> /// <returns></returns> public int UpdateAuthentication(CustAuthenticationModel model) { var sqlStr = new StringBuilder("update `cust_authentication` set "); sqlStr.Append(Helper.CreateField(model).Trim().TrimEnd(',')); sqlStr.Append(" where innerid = @innerid"); const string sqlU = "update cust_info set authstatus=4 where innerid=@innerid;"; using (var conn = Helper.GetConnection()) { var tran = conn.BeginTransaction(); try { conn.Execute(sqlU, new { innerid = model.Custid }, tran); conn.Execute(sqlStr.ToString(), model, tran); tran.Commit(); return 1; } catch (Exception ex) { LoggerFactories.CreateLogger().Write("UpdateAuthentication Ex:" + ex.Message, TraceEventType.Error); tran.Rollback(); return 0; } } }
/// <summary> /// 审核认证信息 /// </summary> /// <param name="model">会员相关信息</param> /// <returns></returns> public int AuditAuthentication(CustAuthenticationModel model) { const string sql = "update cust_info set authstatus=@authstatus,type=1 where innerid=@innerid;"; const string sqlau = "update cust_authentication set auditper=@auditper,auditdesc=@auditdesc,audittime=@audittime where custid=@custid;"; //修改会员的车辆类型成为 1车商车源 const string sqlUCar = "update car_info set seller_type=1 where custid=@custid;"; using (var conn = Helper.GetConnection()) { var tran = conn.BeginTransaction(); try { conn.Execute(sql, new { authstatus = model.AuditResult == 1 ? 2 : 3, innerid = model.Custid }, tran); conn.Execute(sqlau, new { auditper = model.AuditPer, auditdesc = model.AuditDesc, audittime = model.AuditTime, custid = model.Custid }, tran); conn.Execute(sqlUCar, new { custid = model.Custid }, tran); tran.Commit(); return 1; } catch (Exception ex) { LoggerFactories.CreateLogger().Write("AuditAuthentication Ex:" + ex.Message, TraceEventType.Error); tran.Rollback(); return 0; } } }
/// <summary> /// 审核认证信息 /// </summary> /// <param name="model">会员相关信息</param> /// <returns></returns> public int AuditAuthentication(CustAuthenticationModel model) { const string sql = "update cust_info set authstatus=@authstatus where innerid=@innerid;"; const string sqlau = "update cust_authentication set auditper=@auditper,auditdesc=@auditdesc,audittime=@audittime where custid=@custid;"; using (var conn = Helper.GetConnection()) { var tran = conn.BeginTransaction(); try { conn.Execute(sql, new { authstatus = model.AuditResult, innerid = model.Custid }); conn.Execute(sqlau, new { auditper = model.AuditPer, auditdesc = model.AuditDesc, audittime = model.AuditTime, custid = model.Custid }); tran.Commit(); return 1; } catch (Exception ex) { tran.Rollback(); return 0; } } }