Exemplo n.º 1
0
        private void ConstruiesteRanduriDGV()
        {
            this.dgvLista.IncepeContructieRanduri();

            BColectieClienti listaElem      = BClienti.GetListaClientiNoiPerioada(this.ctrlPerioada.DataInceput, this.ctrlPerioada.DataSfarsit, null);
            List <int>       listaIdClinici = listaElem.GetListaId();

            BColectieClientiComenzi listaUltimelorLucrari = BClientiComenzi.GetUltimeleLucrariPerClinica(listaIdClinici, null);
            BColectieClientiFacturi listaUltimelorFacturi = BClientiFacturi.GetUltimeleFacturiPerClinica(listaIdClinici, null);

            Dictionary <int, double> dictIdClinicaTotalFacturi  = BClientiFacturi.GetDictIdClinicaTotalFacturi(listaIdClinici, null);
            Dictionary <int, double> dictIdClinicaTotalIncasari = BClientiPlati.GetDictIdClinicaTotalIncasari(listaIdClinici, null);

            Dictionary <int, int> dictIdClinicaNrLucrari = BClientiComenzi.GetDictIdClinicaNrLucrari(listaIdClinici, null);

            int    idTemp    = 0;
            double totalFact = 0;
            double totalInc  = 0;

            foreach (var elem in listaElem)
            {
                idTemp = elem.Id;

                if (dictIdClinicaTotalFacturi.ContainsKey(idTemp))
                {
                    totalFact = dictIdClinicaTotalFacturi[idTemp];
                }
                else
                {
                    totalFact = 0;
                }

                if (dictIdClinicaTotalIncasari.ContainsKey(idTemp))
                {
                    totalInc = dictIdClinicaTotalIncasari[idTemp];
                }
                else
                {
                    totalInc = 0;
                }

                incarcaRand(this.dgvLista.AdaugaRandNou(), elem, listaUltimelorLucrari.GetUltimaByIdClient(elem.Id), listaUltimelorFacturi.GetUltimaByIdClient(elem.Id), dictIdClinicaNrLucrari.ContainsKey(elem.Id) ? dictIdClinicaNrLucrari[elem.Id] : 0, totalFact, totalInc);
            }

            this.dgvLista.FinalizeazaContructieRanduri();

            this.lblTotal.Text = string.Format("{0}: {1}", BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ClientiNoi), this.dgvLista.RowCount.ToString());
        }