7
My system exists a class that is currently a common class for several situations, below some of the other models to exemplify
public class Servico
{
public int Id {get;set;}
public string Nome {get;set;}
public decimal? Valor {get;set;}
}
public class Coleta : Servico
{
//dados da colheita
}
public class Faturamento
{
public ICollection<Servico> Servicos {get;set;}
}
Then this Service may be registered as
var servico = new Servico("Coleta de sangue",5.00);
Service is a model
common, only for no repetition of records and for the user to choose in a select
or services, without the need to re-register
But the Collection is also a service, which may or may not be carried out in the company, if it is carried out within the company, it will have its other fields...
But how can I stop when I’m making multiple collections, my Service Records List doesn’t get huge? That is, the model
Servico
is just a simple reference, already the Coleta
, is a more complete model, that there may be actions within it
[Edit]
A step-by-step example of the process.
- Registration of the service (Blood collection)
- Referenced in a work order
- If done in the company, the TELA is its own, with other fields, etc, represented by the Coleta class
- Go to billing as a Service
What I’m doing, I leave in a constant
the name of the Blood Collection Service, I do not let the user edit, and when I submit a service order, I submit a class of Coleta.cs
if done in the company (has view
one checkbox
whether it is done there or by third parties)
Could also have inside the class Coleta.cs
, one ServicoId
, then select it, when doing the Collection, however it is boring and bad for the user, since it is the Blood Collection and not another service, also, if it has many services, it is bad to be looking for.
This seems to be Entity Framework code. If you put tags, I can try to answer.
– Leonel Sanches da Silva
@Ciganomorrisonmendez yes, can also be valid in the modeling of db same, already edited
– Rod