/// <summary> /// 添加供应商 /// </summary> /// <param name="model">供应商信息</param> /// <returns></returns> public int AddSupplier(CarSupplierModel model) { const string sql = @"INSERT INTO `car_supplier` (innerid, suppliername, address, introduction, contacts, contactsphone, remark, extend, isenabled, createrid, createdtime, modifierid, modifiedtime) VALUES (@innerid, @suppliername, @address, @introduction, @contacts, @contactsphone, @remark, @extend, @isenabled, @createrid, @createdtime, @modifierid, @modifiedtime);"; using (var conn = Helper.GetConnection()) { int result; try { result = conn.Execute(sql, model); } catch (Exception ex) { LoggerFactories.CreateLogger().Write("添加供应商异常:", TraceEventType.Information, ex); result = 0; } return result; } }
/// <summary> /// 修改供应商 /// </summary> /// <param name="model">供应商信息</param> /// <returns></returns> public int UpdateSupplier(CarSupplierModel model) { var sql = new StringBuilder("update `car_supplier` 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; }