private void CreateUpdatePaymentTerm(PaymentTerm p)
 {
     SqlService sql = new SqlService(_sqlConnection);
     if (p.Id != null)
         sql.AddParameter("@pId", System.Data.SqlDbType.UniqueIdentifier, p.Id);
     sql.AddParameter("@pCode", System.Data.SqlDbType.VarChar, p.Code);
     sql.AddParameter("@pDescription", System.Data.SqlDbType.VarChar, p.Description);
     sql.ExecuteSP("ICMS_spCreateUpdatePaymentTerm");
 }
 public PaymentTerm GetPaymentTerm(Guid id)
 {
     PaymentTerm p = new PaymentTerm();
     SqlService sql = new SqlService(_sqlConnection);
     sql.AddParameter("@pId", System.Data.SqlDbType.UniqueIdentifier, id);
     using (SqlDataReader reader = sql.ExecuteSPReader("ICMS_spGetPaymentTerms"))
     {
         if (reader.HasRows)
         {
             while (reader.Read())
             {
                 SetupPaymentTerm(p, reader);
             }
         }
     }
     return p;
 }
 private void SetupPaymentTerm(PaymentTerm p, SqlDataReader reader)
 {
     p.Id = reader.SafeGetGuid(reader.GetOrdinal("Id"));
     p.Code = reader.SafeGetInt(reader.GetOrdinal("Code")).Value;
     p.Description = reader.SafeGetString(reader.GetOrdinal("Description"));
 }
 public void UpdatePaymentTerm(PaymentTerm p)
 {
     CreateUpdatePaymentTerm(p);
 }