Мне нужно построить очень сложный вид и запрос, возможно. У меня есть 3 таблицы в моей базе данных: Lote, Carga и RegistosForno. Моя модель имеет все эти 3 класса:Очень сложный вид с asp.net MVC
Класс "Carga"
public partial class carga
{
public string cga_numero { get; set; }
public string cem_numero { get; set; }
public string lot_numero { get; set; }
public string tpe_numero { get; set; }
public string buj_numero { get; set; }
public string ope_numero { get; set; }
public Nullable<decimal> for_numero { get; set; }
public string ret_numero { get; set; }
public Nullable<decimal> cga_carga { get; set; }
public Nullable<int> cga_parte_lote { get; set; }
public Nullable<decimal> cga_data_in_forno { get; set; }
public Nullable<decimal> cga_hora_in_forno { get; set; }
public string cga_tmp_in_forno { get; set; }
public Nullable<decimal> cga_data_out_forno { get; set; }
public Nullable<decimal> cga_hora_out_forno { get; set; }
public string cga_tmp_out_forno { get; set; }
public Nullable<int> cga_estado { get; set; }
public Nullable<int> cga_cem_num_utilizacoes { get; set; }
public Nullable<int> cga_ret_total_utilizacoes { get; set; }
public Nullable<int> cga_ret_num_utilizacoes { get; set; }
public Nullable<int> cga_ret_lim_utilizacoes { get; set; }
public Nullable<int> cga_buj_total_utilizacoes { get; set; }
public Nullable<int> cga_buj_num_utilizacoes { get; set; }
public Nullable<int> cga_buj_lim_utilizacoes { get; set; }
public string cga_lot_tmp_out_forno { get; set; }
public string cga_lot_tmp_in_forno { get; set; }
public Nullable<int> cga_lot_cem_num_utilizacoes { get; set; }
public string cga_datahora { get; set; }
}
Класс "Лот"
public partial class lote
{
public string lot_numero { get; set; }
public string ope_numero { get; set; }
public string tpe_nome { get; set; }
public Nullable<int> lot_peso_total { get; set; }
public Nullable<int> lot_total_cargas { get; set; }
public Nullable<int> lot_cargas { get; set; }
public Nullable<int> lot_estado { get; set; }
public Nullable<decimal> lot_data { get; set; }
public Nullable<decimal> lot_hora { get; set; }
public Nullable<decimal> lot_peso_prp { get; set; }
public Nullable<decimal> lot_peso_total_cargas { get; set; }
public Nullable<int> lot_cem_num_utilizacoes { get; set; }
public Nullable<int> lot_cem_tipo { get; set; }
public string lot_datahora { get; set; }
}
Класс "RegForno"
public partial class regforno
{
public int reg_id { get; set; }
public string cga_numero { get; set; }
public Nullable<decimal> for_numero { get; set; }
public string ope_numero { get; set; }
public Nullable<int> reg_id_plc { get; set; }
public Nullable<decimal> reg_hora { get; set; }
public Nullable<decimal> reg_data { get; set; }
public Nullable<int> reg_temperatura { get; set; }
public Nullable<int> reg_estado { get; set; }
public Nullable<int> reg_cga_tmp_forno { get; set; }
public string reg_datahora { get; set; }
}
My vi РЭБ должен выглядеть следующим образом:
Lote 1
>Carga 1
>Registo 1 forno Carga 1
>Registo 2 forno Carga 1
>Carga 2
>Registo 1 forno Carga 2
>Registo 2 forno Carga 2
>Carga 3
>Registo 1 forno Carga 3
>Registo 2 forno Carga 3
>Carga 4
>Registo 1 forno Carga 4
>Registo 2 forno Carga 4
Лоте N
>Carga 1
>Registo 1 forno Carga 1
>Registo 2 forno Carga 1
>Carga 2
>Registo 1 forno Carga 2
>Registo 2 forno Carga 2
>Carga 3
>Registo 1 forno Carga 3
>Registo 2 forno Carga 3
>Carga 4
>Registo 1 forno Carga 4
>Registo 2 forno Carga 4
В основном нужно: Для каждого Лоте получить все записи из Carga связанные с этим лотом, и получить все записи из regForno, связанные с этим Carga.
Мой опыт работы с asp.net не много, но я смог реализовать несколько вещей, в основном основанных на учебниках и примерах. Однако я не смог найти пример для этого или любого учебника, делающего такие вещи. Я считаю, что это очень специфично для моих пользовательских запросов.
Привет и спасибо за ваш ответ. Воспользовавшись своими идеями и с некоторыми более намеками от более опытных людей, я в конечном итоге получил это. Я создал отношения между классами, и я создал модель View в контроллере, которая стала более сложной, чем ваша линия. Он работает сейчас, спасибо за вашу помощь. – aganju82
рад услышать друг. затем подтвердите свой ответ. все счастливы –