public JResult UpdateFinanceProgramme(FinanceProgrammeModel model) { return _carervice.UpdateFinanceProgramme(model); }
public JResult AddFinanceProgramme(FinanceProgrammeModel model) { return _carervice.AddFinanceProgramme(model); }
/// <summary> /// 金融方案修改 /// </summary> /// <param name="model"></param> /// <returns></returns> public int UpdateFinanceProgramme(FinanceProgrammeModel model) { var sql = new StringBuilder("update `finance_programme` set "); sql.Append(Helper.CreateField(model).Trim().TrimEnd(',')); sql.Append(" where innerid = @innerid"); int result; try { result = Helper.Execute(sql.ToString(), model); } catch (Exception ex) { LoggerFactories.CreateLogger().Write("金融方案修改:", TraceEventType.Error, ex); result = 0; } return result; }
/// <summary> /// 金融方案新增 /// </summary> /// <param name="model"></param> /// <returns></returns> public string AddFinanceProgramme(FinanceProgrammeModel model) { const string sql = @"INSERT INTO `finance_programme` (`innerid`, `amount`, `coty`, `mileage`, `loanterm`, `interestrate`, `customerpro`, `applicant`, `applytime`, `mobile`, `modifiedid`, `modifiedtime`, `createdid`, `createdtime`, `identitypic`, `driverspic`, `bankpic`,`drivinglicensepic`,`certificatepic`) VALUES (@innerid, @amount, @coty, @mileage, @loanterm, @interestrate, @customerpro, @applicant, @applytime, @mobile, @modifiedid, now(), @createdid, now(), @identitypic, @driverspic, @bankpic,@drivinglicensepic,@certificatepic);"; using (var conn = Helper.GetConnection()) { string result = string.Empty; try { if (conn.Execute(sql, model) == 1) { result = model.innerid; } else { result = "0"; } } catch (Exception ex) { LoggerFactories.CreateLogger().Write("金融方案新增:", TraceEventType.Information, ex); result = "0"; } return result; } }
/// <summary> /// 获取金融方案相关信息 /// </summary> /// <param name="query"></param> /// <returns></returns> public IEnumerable<FinanceProgrammeViewModel> GetFinanceProgramme(FinanceProgrammeModel query) { StringBuilder sql = new StringBuilder(@"select `innerid`, `amount`, `coty`, `mileage`, `loanterm`, `interestrate`, `customerpro`, `applicant`, `applytime`, `mobile`, `modifiedid`, `modifiedtime`, `createdid`, `createdtime`, `identitypic`, `driverspic`, `bankpic`,`drivinglicensepic`,`certificatepic` from finance_programme where 1=1 "); if (!string.IsNullOrWhiteSpace(query.innerid)) { sql.Append($" and innerid='{query.innerid}' "); } sql.Append($" order by applytime asc; "); try { var list = Helper.Query<FinanceProgrammeViewModel>(sql.ToString()); return list; } catch (Exception ex) { return null; } }