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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
| public partial class SuiviBudgetReconstitutionVT : UserControl
{
private ObservableCollection<VTSuiviBudgetMois> _suiviBudgetAnneSelection;
private ObservableCollection<VTSuiviBudgetMois> _suiviBudgetAnnePrec;
public SuiviBudgetReconstitutionVT()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(SuiviBudget_Loaded);
}
/// <summary>
/// Chargement de la page
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void SuiviBudget_Loaded(object sender, RoutedEventArgs e)
{
try
{
// Tab VT perçu
string annee = DateTime.Now.Year.ToString();
_suiviBudgetAnnePrec = new ObservableCollection<VTSuiviBudgetMois>();
_suiviBudgetAnneSelection = new ObservableCollection<VTSuiviBudgetMois>();
AfficherListeAnnee(annee);
}
catch (Exception erreur)
{
throw new Exception("Impossible de charger les données " + erreur.Message);
}
}
private void treeViewVersementItem_Expanded(object sender, RoutedEventArgs e)
{
}
private void treeViewVersementItem_Collapsed(object sender, RoutedEventArgs e)
{
}
private void listViewAnneeVersement_SelectionChanged(object sender, RoutedEventArgs e)
{
treeViewVersement1.Items.Clear();
treeViewVersement2.Items.Clear();
CME_VT_MontantVerse selectAnne = (CME_VT_MontantVerse)listViewAnneeVersement.SelectedValue;
string annee = selectAnne.annee.ToString();
string annePrec = (Convert.ToInt32(annee) - 1).ToString();
DataTable listeMontantMois = CAD_VT_MontantVerse_ORACLE.MontantVerseParMois(annePrec, "");
foreach (DataRow ligne in listeMontantMois.Rows)
{
VTSuiviBudgetMois montantMois = new VTSuiviBudgetMois();
montantMois.Mois = ligne["mois"].ToString();
montantMois.MontantMoisPercu = Convert.ToDouble(ligne["MontantVerse"]);
montantMois.MoisLong = ConversionMois(montantMois.Mois);
montantMois.ListeMontantVerse = new ObservableCollection<CME_VT_MontantVerse>();
montantMois.ListeMontantVerse = CME_VT_MontantVerse.ListeMontantsVerses(0, annePrec, ligne["mois"].ToString(), "");
/* if (ligne["signeDifferenceReconstitue"].ToString() != "")
{
if (ligne["signeDifferenceReconstitue"].ToString() == "-")
{
montantMois.MontantMoisReconstitue = montantMois.MontantMoisPercu - Convert.ToDouble(ligne["montantDifferenceReconstitue"]);
}
else
{
montantMois.MontantMoisReconstitue = montantMois.MontantMoisPercu + Convert.ToDouble(ligne["montantDifferenceReconstitue"]);
}
}*/
_suiviBudgetAnnePrec.Add(montantMois);
}
treeViewVersement2.DataContext = _suiviBudgetAnnePrec;
listeMontantMois = CAD_VT_MontantVerse_ORACLE.MontantVerseParMois(annee, "");
foreach (DataRow ligne in listeMontantMois.Rows)
{
VTSuiviBudgetMois montantMois = new VTSuiviBudgetMois();
montantMois.Mois = ligne["mois"].ToString();
montantMois.MontantMoisPercu = Convert.ToDouble(ligne["MontantVerse"]);
montantMois.MoisLong = ConversionMois(montantMois.Mois);
montantMois.ListeMontantVerse = new ObservableCollection<CME_VT_MontantVerse>();
montantMois.ListeMontantVerse = CME_VT_MontantVerse.ListeMontantsVerses(0, annee, ligne["mois"].ToString(), "");
/* if (ligne["signeDifferenceReconstitue"].ToString() != "")
{
if (ligne["signeDifferenceReconstitue"].ToString() == "-")
{
montantMois.MontantMoisReconstitue = montantMois.MontantMoisPercu - Convert.ToDouble(ligne["montantDifferenceReconstitue"]);
}
else
{
montantMois.MontantMoisReconstitue = montantMois.MontantMoisPercu + Convert.ToDouble(ligne["montantDifferenceReconstitue"]);
}
}*/
_suiviBudgetAnneSelection.Add(montantMois);
}
treeViewVersement1.DataContext = _suiviBudgetAnneSelection;
}
#region Methode
private void AfficherListeAnnee(string pAnnee)
{
ObservableCollection<CME_VT_MontantVerse> listeVersementParOCAnneeMois = new ObservableCollection<CME_VT_MontantVerse>();
for (int i = Convert.ToInt32(pAnnee); i > 2005; i--)
{
listeVersementParOCAnneeMois.Add(new CME_VT_MontantVerse(1, i.ToString(), "1"));
}
listViewAnneeVersement.DataContext = listeVersementParOCAnneeMois;
} |
Partager