private void retour_Click(object sender, EventArgs e) { Etap1Panel.BringToFront(); Etap1btn.BackColor = Color.FromArgb(255, 54, 52, 103); etap2btn.BackColor = Color.Gray; Etap3btn.BackColor = Color.Gray; }
private void valider_Click(object sender, EventArgs e) { string startDate, endDate = ""; DateTime date = datedp.Value; DateTime bufferstart, bufferend; bufferstart = date; if (bufferstart.Day != 1) { bufferstart = bufferstart.AddMonths(1); bufferstart = new DateTime(bufferstart.Year, bufferstart.Month, 1); } startDate = bufferstart.ToString("yyyy-MM-dd"); bufferend = bufferstart; bufferend = bufferend.AddMonths(int.Parse(moisretinftxt.Text) - 1); try { bufferend = new DateTime(bufferend.Year, bufferend.Month, 30); } catch (Exception) { bufferend = new DateTime(bufferend.Year, bufferend.Month, 27); } endDate = bufferend.ToString("yyyy-MM-dd"); string requete = "insert into Credit (numPay,montant,montantRet,rest,dateDebut,dateFin,cin) values('" + npaytxt.Text + "'," + montantinftxt.Text + "," + mretinftxt.Text + "," + montantinftxt.Text + ",'" + startDate + "','" + endDate + "',UPPER('" + cininftxt.Text + "'))"; string buffer = Utility.nonQuery(requete, MainPage.cnx); if (buffer != null) { MessageBox.Show(buffer); } else { generateContrat(npaytxt.Text, cininftxt.Text, nominftxt.Text, prenominftxt.Text, aadressetxt.Text, montantinftxt.Text, montantretcmb.Text, moisretinftxt.Text, aphontxt.Text); Etap1Panel.BringToFront(); acintxt.Text = ""; npaytxt.Text = ""; montantcmb.Text = ""; montantretcmb.Text = ""; Etap1btn.BackColor = Color.FromArgb(255, 54, 52, 103); etap2btn.BackColor = Color.Gray; Etap3btn.BackColor = Color.Gray; } }