Esempio n. 1
0
 public CompanyDTO(DocumentTypeDTO documentType, long document, DateTime periodFrom, DateTime periodTo, int zipCode, string businessName, string activity, string address)
 {
     this.Id = null;
     this.DocumentType = documentType;
     this.Document = document;
     this.PeriodFrom = periodFrom;
     this.PeriodTo = periodTo;
     this.ZipCode = zipCode;
     this.BusinessName = businessName;
     this.Activity = activity;
     this.Address = address;
 }
 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;
 }
Esempio n. 3
0
        public List<DocumentTypeDTO> getDocumentTypes()
        {
            StringBuilder query = new StringBuilder();
            query.AppendLine("SELECT Id, Type FROM DocumentType");
            query.AppendLine("ORDER BY Id;");

            SqlCommand command = new SqlCommand(query.ToString(), this.conection);
            command.CommandType = System.Data.CommandType.Text;

            List<DocumentTypeDTO> documents = new List<DocumentTypeDTO>();
            try
            {
                this.conection.Open();
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            DocumentTypeDTO document = new DocumentTypeDTO(
                                (int)reader["Id"], reader["Type"].ToString());
                            documents.Add(document);
                        }
                    }
                }
            }
            finally
            {
                if (this.conection.State == ConnectionState.Open)
                    this.conection.Close();
            }

            return documents;
        }