/// <summary> /// 新增一条支付类别 /// </summary> /// <param name="paymentMethod"> /// 支付类别 /// </param> /// <returns> /// 新增的Id /// </returns> public int Insert(Config_Payment_Type paymentMethod) { var paraList = new List<SqlParameter>() { this.SqlServer.CreateSqlParameter( "Name", SqlDbType.VarChar, paymentMethod.Name, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "CreateTime", SqlDbType.DateTime, DateTime.Now, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "ReferenceID", SqlDbType.Int, null, ParameterDirection.Output), this.SqlServer.CreateSqlParameter( "PaymentMethodID", SqlDbType.Int, paymentMethod.PaymentMethodID, ParameterDirection.Input) }; try { this.SqlServer.ExecuteNonQuery( CommandType.StoredProcedure, "sp_Config_Payment_Type_Insert", paraList, null); return (int)paraList.Find(p => p.ParameterName == "ReferenceID").Value; } catch (Exception exception) { throw new Exception("Exception - ConfigPaymentType - Insert", exception); } }
/// <summary> /// 更新一条支付类别 /// </summary> /// <param name="paymentMethod"> /// 支付类别 /// </param> /// <exception cref="Exception"> /// </exception> public void Update(Config_Payment_Type paymentMethod) { var paraList = new List<SqlParameter>() { this.SqlServer.CreateSqlParameter( "Name", SqlDbType.VarChar, paymentMethod.Name, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "CreateTime", SqlDbType.DateTime, DateTime.Now, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "ID", SqlDbType.Int, paymentMethod.ID, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "PaymentMethodID", SqlDbType.Int, paymentMethod.PaymentMethodID, ParameterDirection.Input) }; try { this.SqlServer.ExecuteNonQuery( CommandType.StoredProcedure, "sp_Config_Payment_Type_Update", paraList, null); } catch (Exception exception) { throw new Exception("Exception - ConfigPaymentType - Update", exception); } }