title: Silverlight C# show data from SQL Server
body: <p>I have some mistakes with my data show in datagridview. I used C# and WCF Ssilverlight and when I use the query in SQL I can see all data but in C# I can't see all. Can anyone help me?</p>
  <p><a href="https://i.stack.imgur.com/sV0S7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sV0S7.png" alt="enter image description here" /></a></p>
  <pre><code>    public IQueryable&lt;MandehMorakhasi&gt; GetMandeMorakhasiList(int IDLanguage, int IDShobe, string Tarikh)
      {
          string RozKari = GetOption(&quot;TanzimHogohDastmozd_Other_RozKari&quot;, IDShobe).ParamValue;
          List&lt;DateTime&gt; DateList = new List&lt;DateTime&gt;();
          if (!string.IsNullOrEmpty(Tarikh))
          {
              DateList = Helper.GetDatesOfYear(Tarikh, IDLanguage);
          }
  
          var TblEstMohasebe = (from s in this.ObjectContext.TblEstMohasebes where s.IDSHobe == IDShobe orderby s.TaTarikh descending select new { s.AzTarikh, s.IDEstKargozini }).ToList();
  
          var TblEstMandeMorakhasi = (from s in this.ObjectContext.TblEstMandes
                                      join c in this.ObjectContext.TblEstMandeSubs
                                      on s.IDEstMande equals c.IDEstMande
                                      orderby c.IDEstMandeSub descending
                                      where s.IDSHobe == IDShobe &amp;&amp; c.Type == 3
                                      select new
                                      {
                                          s.IDEstMande,
                                          c.Mande,
                                          c.Mabna,
                                          c.MorakhasiEstefadeshode,
                                          c.MandePayanMah,
                                          s.IDEstKargozini,
                                          s.AzTarikh,
                                          s.TaTarikh
                                      }).ToList();
  
          List&lt;int&gt; IDEstKargoziniList = TblEstMandeMorakhasi.Select(x =&gt; x.IDEstKargozini).ToList();
          List&lt;MandehMorakhasi&gt; MandehMorakhasiList = new List&lt;MandehMorakhasi&gt;();
  
          int Count = 0;
          foreach (var i in IDEstKargoziniList.Distinct())
          {
              MandehMorakhasi Mandeh = new MandehMorakhasi();
  
              Mandeh.IDEstKargozini = i;
              Mandeh.IDSHobe = IDShobe;
              Mandeh.CodePersenel = (from s in this.ObjectContext.TblEstKargozinis where s.IDEstKargozini == i select s.IDMostakhdem).FirstOrDefault();
              Mandeh.NamePersenel = (from s in this.ObjectContext.TblEstPersenel_T
                                     join c in this.ObjectContext.TblEstKargozinis on s.IDPersenelEst equals c.IDPersenelEst
                                     where c.IDEstKargozini == i
                                     select s.Name).FirstOrDefault() + &quot; &quot; +
                                     (from s in this.ObjectContext.TblEstPersenel_T
                                      join c in this.ObjectContext.TblEstKargozinis on s.IDPersenelEst equals c.IDPersenelEst
                                      where c.IDEstKargozini == i
                                      select s.Family).FirstOrDefault();
              Mandeh.Date = Tarikh;
              Mandeh.IDLanguage = IDLanguage;
  
              if (IDLanguage == 1)
              {
                  Mandeh.EnabledField = Convert.ToInt32((Helper.MiladiToShamsi(TblEstMohasebe.FirstOrDefault(x =&gt; x.IDEstKargozini == i).AzTarikh)).Substring(5, 2));
              }
              else
              {
                  Mandeh.EnabledField = TblEstMohasebe.FirstOrDefault(x =&gt; x.IDEstKargozini == i).AzTarikh.Month;
              }
  
              /////////////the first month of year in hijri**strong text**
              var Mande_1 = TblEstMandeMorakhasi.FirstOrDefault(x =&gt; x.IDEstKargozini == i &amp;&amp; (x.AzTarikh.Date &gt;= DateList[0] &amp;&amp; x.AzTarikh.Date &lt;= DateList[1] &amp;&amp;
                  x.TaTarikh.Date &gt;= DateList[0] &amp;&amp; x.TaTarikh.Date &lt;= DateList[1]));
  
              TimeSpan MandeMorakhasiAval_1_T = new TimeSpan();
              TimeSpan MabnaMorakhasiPayanMah_1_T = new TimeSpan();
              if (Mande_1 != null)
              {
                  MandeMorakhasiAval_1_T = (TimeSpan.FromTicks(Mande_1.Mande));
                  Mandeh.MandeMorakhasiAval_1 = Helper.GetTimeSpanConverter(MandeMorakhasiAval_1_T, TimeSpan.Parse(RozKari).TotalMinutes).ToString(@&quot;dd\.hh\:mm&quot;);
  
                  MabnaMorakhasiPayanMah_1_T = (TimeSpan.FromTicks(Mande_1.MandePayanMah));
                  Mandeh.MabnaMorakhasiPayanMah_1 = Helper.GetTimeSpanConverter(MabnaMorakhasiPayanMah_1_T, TimeSpan.Parse(RozKari).TotalMinutes).ToString(@&quot;dd\.hh\:mm&quot;);
              }
  </code></pre>