Guest User

Untitled

a guest
Oct 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. Modelo:
  2. {
  3. [Table("Pessoa")]
  4.  
  5. }
  6.  
  7.  
  8.  
  9.  
  10. [DisplayName(displayName: "nome")]
  11. [DataObjectField(primaryKey: false, isIdentity: false, isNullable: true)]
  12. [StringLength(maximumLength: 80)]
  13. public string nome { get; set; }
  14.  
  15. [DisplayName(displayName: "NomeFantasia")]
  16. [DataObjectField(primaryKey: false, isIdentity: false, isNullable: true)]
  17. [StringLength(maximumLength: 80)]
  18. public string nomeFantasia { get; set; }
  19.  
  20.  
  21. [DisplayName(displayName: "Tipo")]
  22. [DataObjectField(primaryKey: false, isIdentity: false, isNullable: false)]
  23. public int tipoPessoa { get; set; }
  24.  
  25.  
  26.  
  27.  
  28. }
  29.  
  30. [Table("Fornecedor")]
  31. public class Fornecedor : Pessoa
  32. {
  33.  
  34. public Fornecedor()
  35. {
  36.  
  37. // this.pessoa = new Pessoa();
  38. }
  39.  
  40.  
  41. [Browsable(false)]
  42. [DataObjectField(false, true, false)]
  43.  
  44. [ForeignKey("pessoa")]
  45. [Index(IsUnique = true)]
  46. public int IdPessoa { get; set; }
  47. public virtual Pessoa pessoa { get; set; }
  48.  
  49. [DisplayName(displayName: "CNPJ/CPF")]
  50. [DataObjectField(primaryKey: false, isIdentity: false, isNullable: true)]
  51. [StringLength(maximumLength: 14)]
  52. public string inscricaoFed { get; set; }
  53.  
  54. [DisplayName(displayName: "Inscricão estadual")]
  55. [DataObjectField(primaryKey: false, isIdentity: false, isNullable: true)]
  56. [StringLength(maximumLength: 14)]
  57. public string inscricaoEst { get; set; }
  58.  
  59. public void AdicionaFornecedor(Fornecedor fornecedor, int idPessoa)
  60. {
  61.  
  62. fornecedor.IdPessoa = idPessoa;
  63. Db.Fornecedor.Add(fornecedor);
  64. SalvarBd();
  65. }
Add Comment
Please, Sign In to add comment