1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| private void AddDecsToLV(HHH.DataAbstractionLayer.BObject.Entity.DECLARARION dc)
{
HHH.DataAbstractionLayer.BObject.Table.CVTs cvts = new HHH.DataAbstractionLayer.BObject.Table.CVTs();
HHH.DataAbstractionLayer.BObject.Entity.CVT cvt = new HHH.DataAbstractionLayer.BObject.Entity.CVT();
HHH.DataAbstractionLayer.BObject.Table.BVs bvs = new HHH.DataAbstractionLayer.BObject.Table.BVs();
cvts.LoadCVTs();
cvt = cvts.FindCVTbyAgrement(dc.AgrCVT);
bvs.LoadBVS();
#region mois non payés
HHH.DataAbstractionLayer.BObject.Table.DECLARATIONs decs = new HHH.DataAbstractionLayer.BObject.Table.DECLARATIONs();
decs.LoadDeclarationsByAgrement(dc.AgrCVT, Convert.ToInt16(combAnnee.SelectedItem.ToString()));
var Mois = new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
var MoisDeclare = new short[11];
string chMoisDec = "|";
string chMoisNonDec = "|";
for (int i = 0; i < decs.Count; i++)
foreach (HHH.DataAbstractionLayer.BObject.Entity.DECLARARION oDec in decs)
{
MoisDeclare[i] = oDec.MoisDec;
chMoisDec += MoisDeclare[i] + "|";
i++;
}
List<short> MoisNonDeclares = new List<short>();
foreach (short m in Mois) // Parcours des mois
{
bool found = false;
foreach (short md in MoisDeclare) // Parcours des mois déclarés
{
if (m == md)
{
found = true; // Ce mois est déclaré
break; // Utile uniquement pour gagner en perf, sur un tableau de mois tu gagneras rien
}
}
if (!found)
{
MoisNonDeclares.Add(m); // Mois non trouvé parmis ceux déclarés
chMoisNonDec += m + "|";
}
}
#endregion
if (MoisNonDeclares.Count >= Convert.ToInt16(cmbMois.SelectedItem.ToString()))
{
ListViewItem item = new ListViewItem(new string[] { dc.AgrCVT.ToString(), cvt.Name, cvt.City, chMoisDec, chMoisNonDec, "Voir Detail" });
item.ImageIndex = 0;
if ((this.lvListeTypes.Items.Count % 2) == 0)
{
item.BackColor = ColorTranslator.FromHtml("#C0D9F8");
}
else
{
item.BackColor = ColorTranslator.FromHtml("#EAEEF1");
}
this.lvListeTypes.Items.Add(item);
}
} |
Partager