/// <summary> /// 车辆劲爆成交 /// </summary> /// <param name="model">车辆model</param> /// <returns>1.操作成功</returns> public int DealMaddenCar(CarMaddenModel model) { try { const string sql = "update car_madden_info set status=2,dealprice=@dealprice,dealtime=@dealtime,dealdesc=@dealdesc where `innerid`=@innerid;"; Helper.Execute(sql, new { model.innerid, model.dealprice, model.dealtime, model.dealdesc }); } catch (Exception ex) { LoggerFactories.CreateLogger().Write("车辆劲爆成交异常:", TraceEventType.Error, ex); return 0; } return 1; }
/// <summary> /// 修改劲爆车源 /// </summary> /// <param name="model">车源信息</param> /// <returns></returns> public int UpdateMaddenCar(CarMaddenModel model) { var sql = new StringBuilder("update `car_madden_info` 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 int AddMaddenCar(CarMaddenModel model) { const string sql = @"INSERT INTO `car_madden_info` (innerid, supplierid, carno, pictures, provid, cityid, brand_id, series_id, model_id, colorid, programme, programmedesc, guideprice, price, dealprice, dealtime, dealdesc, deletedtime, deletedesc, estimateprice, status, isdeleted, createdtime, modifiedtime, refreshtime, remark, operatedid) VALUES (@innerid, @supplierid, @carno, @pictures, @provid, @cityid, @brand_id, @series_id, @model_id, @colorid, @programme, @programmedesc, @guideprice, @price, @dealprice, @dealtime, @dealdesc, @deletedtime, @deletedesc, @estimateprice, @status, @isdeleted, @createdtime, @modifiedtime, @refreshtime, @remark, @operatedid);"; using (var conn = Helper.GetConnection()) { int result; try { result = conn.Execute(sql, model); } catch (Exception ex) { LoggerFactories.CreateLogger().Write("添加劲爆车源异常:", TraceEventType.Error, ex); result = 0; } return result; } }
/// <summary> /// 回复劲爆车辆 /// </summary> /// <param name="model">回复model</param> /// <returns>1.操作成功</returns> public int RecoveryMaddenCar(CarMaddenModel model) { try { const string sql = "update car_madden_info set isdeleted=0,deletedesc=concat(ifnull(deletedesc,''),@deletedesc) where `innerid`=@innerid;"; model.deletedesc = string.Concat("\n@", model.deletedesc); Helper.Execute(sql, new {model.innerid, model.deletedesc}); } catch (Exception ex) { LoggerFactories.CreateLogger().Write("回复劲爆车辆异常:", TraceEventType.Error, ex); return 0; } return 1; }