CCN.Modules.Car.DataAccess.CarDataAccess.UpdateCar C# (CSharp) Method

UpdateCar() public method

修改车辆
public UpdateCar ( CarInfoModel model ) : int
model CCN.Modules.Car.BusinessEntity.CarInfoModel 车辆信息
return int
        public int UpdateCar(CarInfoModel model)
        {
            var sql = new StringBuilder("update `car_info` set ");
            sql.Append(Helper.CreateField(model).Trim().TrimEnd(','));

            //非必填字段的修改
            if (!model.buytime.HasValue)
            {
                sql.Append(",buytime=null");
            }
            if (!model.buyprice.HasValue)
            {
                sql.Append(",buyprice=null");
            }
            if (!model.ckyear_date.HasValue)
            {
                sql.Append(",ckyear_date=null");
            }
            if (!model.tlci_date.HasValue)
            {
                sql.Append(",tlci_date=null");
            }
            if (!model.audit_date.HasValue)
            {
                sql.Append(",audit_date=null");
            }

            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;
        }
CarDataAccess