public JuridicPersonDTO(string businessName, JuridicPersonTypeDTO type, DocumentTypeDTO documentType, long document, int companyId, LocationDTO location, ConditionRegardingVatDTO conditionRegardingVat, string phone, int zipCode, AccountDTO account, string address) { this.Id = null; this.BusinessName = businessName; this.Type = type; this.DocumentType = (DocumentTypeDTO)documentType; this.Document = document; this.CompanyId = companyId; this.Location = (LocationDTO)location; this.ConditionRegardingVat = (ConditionRegardingVatDTO)conditionRegardingVat; this.Phone = phone; this.ZipCode = zipCode; this.Account = account; this.Address = address; }
public List<JuridicPersonTypeDTO> getJuridicPersonTypes() { StringBuilder query = new StringBuilder(); query.AppendLine("SELECT Id, Type FROM JuridicPersonType"); query.AppendLine("ORDER BY Id;"); SqlCommand command = new SqlCommand(query.ToString(), this.conection); command.CommandType = System.Data.CommandType.Text; List<JuridicPersonTypeDTO> types = new List<JuridicPersonTypeDTO>(); try { this.conection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { JuridicPersonTypeDTO type = new JuridicPersonTypeDTO((int)reader["Id"], reader["Type"].ToString()); types.Add(type); } } } } finally { if (this.conection.State == ConnectionState.Open) this.conection.Close(); } return types; }