private void Button_Click(object sender, RoutedEventArgs e) { DataTable crud = new DataTable(); crud = GetDates(); DataTable detalle = new DataTable(); detalle = GetDetalle(); //FUSIONAR LAS DOS TABLAS ANTERIOR Y ACTUAL // DataTable tablaMen = Gw var query = from table1 in crud.AsEnumerable() join table2 in detalle.AsEnumerable() on table1.Field <int>("Date") equals table2.Field <int>("Dia") select new { Dia = table1.Field <int>("Date"), Codigo_De_Sucursal = table2.Field <string>("Codigo_De_Sucursal"), Total = table2.Field <decimal>("Total"), Fecha = table2.Field <DateTime>("Fecha"), }; var lstLeftJoin = from fact in crud.AsEnumerable() join desc in detalle.AsEnumerable() on fact.Field <int>("Date") equals desc.Field <int>("Dia") into FactDesc from fd in FactDesc.DefaultIfEmpty() select new { Dia = fact.Field <int>("Date"), Total = (fd == null) ? 0 : fd.Field <decimal>("Total") } ; DataTable nueva = new DataTable(); nueva.Columns.Add("Date", typeof(int)); nueva.Columns.Add("Total", typeof(decimal)); foreach (var item in lstLeftJoin) { //un if de que si no hay registro se guarde cero :v nueva.Rows.Add(item.Dia, item.Total); } int osoKrasny = 1; //aqui manda al rpt }
public List <Course> AllCourses(int id) { return((from cursos in context.Course join asignadas in context.Assign.Where(x => x.Teacher == id) on cursos.IdCourse equals asignadas.CourseId into FactDesc from fd in FactDesc.DefaultIfEmpty() select cursos ).ToList()); }