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
|
SqlFormView.UpdateCommandType = SqlDataSourceCommandType.Text;
if (affect == "1" || affect == "2") //Uniquement pour les ventilations sur les postes budgétaires dépense et recette
{
switch (dlVentil.SelectedValue)
{
case "Ventilation 1":
SqlFormView.UpdateCommand = "update dai.DAILCO set Ventilation1='" + postChoisi + "' , MontantV1=" + mt.ToString().Replace(",",".") + ", Affect1='" + affect + "', DateVentilation='" + dateModif.ToShortDateString() + "' where IDLCO='"+FormView1.DataKey.Value+"'";
break;
case "Ventilation 2":
SqlFormView.UpdateCommand = "update dai.DAILCO set Ventilation2='" + postChoisi + "' , MontantV2=" + mt.ToString().Replace(",", ".") + ", Affect2='" + affect + "', DateVentilation='" + dateModif.ToShortDateString() + "' where IDLCO='" + FormView1.DataKey.Value + "'";
break;
case "Ventilation 3":
SqlFormView.UpdateCommand = "update dai.DAILCO set Ventilation3='" + postChoisi + "' , MontantV3=" + mt.ToString().Replace(",", ".") + ", Affect3='" + affect + "', DateVentilation='" + dateModif.ToShortDateString() + "' where IDLCO='" + FormView1.DataKey.Value + "'";
break;
case "Ventilation 4":
SqlFormView.UpdateCommand = "update dai.DAILCO set Ventilation4='" + postChoisi + "' , MontantV4=" + mt.ToString().Replace(",", ".") + ", Affect4='" + affect + "', DateVentilation='" + dateModif.ToShortDateString() + "' where IDLCO='" + FormView1.DataKey.Value + "'";
break;
case "Ventilation 5":
SqlFormView.UpdateCommand = "update dai.DAILCO set Ventilation5='" + postChoisi + "' , MontantV5=" + mt.ToString().Replace(",", ".") + ", Affect5='" + affect + "', DateVentilation='" + dateModif.ToShortDateString() + "' where IDLCO='" + FormView1.DataKey.Value + "'";
break;
}
}
else //si ope ventilée sur retrait d'apport ou placement
{
switch (affect)
{
case "3":
SqlFormView.UpdateCommand = "update dai.DAILCO set Ventilation1='" + postChoisi + "' , MontantV1=" + mt.ToString().Replace(",", ".") + ", Affect1='" + affect + "', DateVentilation='" + dateModif.ToShortDateString() + "' where IDLCO='" + FormView1.DataKey.Value + "'";
break;
case "4":
SqlFormView.UpdateCommand = "update dai.DAILCO set Ventilation1='" + postChoisi + "', MontantV1=" + mt.ToString().Replace(",", ".") + ", Affect1='" + affect + "', DateVentilation='" + dateModif.ToShortDateString() + "', Placement=" + -1 + " where IDLCO='" + FormView1.DataKey.Value + "'";
break;
}
} |
Partager