private void btnpayer_Click(object sender, RoutedEventArgs e) { Layouts.TK_et_FK t = new TK_et_FK(id); t.Show(); this.Close(); Commande c = new Commande(); DAL.CommandeDAO daoc = new DAL.CommandeDAO(); c = daoc.getById(id); DataSet DSreport = new DSreport(); DSreport.Reset(); List <Commande> lstCom = new List <Commande>(); lstCom = daoc.getAll(); g.dataGrid.DataContext = lstCom; g.PerformRefresh(); }
private void btnValider_Click(object sender, RoutedEventArgs e) { double som; string s = txtSomme.Text.ToString(); if (txtSomme.Text.ToString() == "" || txtDate.Text.ToString() == "" || txtNomSo.Text.ToString() == "") { MessageBox.Show("Les champs sant obligatoire !"); } else if (!double.TryParse(s, out som)) { MessageBox.Show("Montant doit etre un reel !"); } decimal sum; decimal.TryParse(txtSomme.Text, out sum); sum = sum - ((sum * 10) / 100); if (sum >= prix) { TK_et_FK tk = new TK_et_FK(com); tk.ShowDialog(); CommandeDAO daoc = new CommandeDAO(); daoc.updateEtat(com); decimal some; DateTime d; TicketDAO daoch = new TicketDAO(); DateTime.TryParse(txtDate.Text, out d); Decimal.TryParse(txtSomme.Text, out some); int lastch = daoch.getLasttk(); Ticket tkt = new Ticket(some, d, txtNomSo.Text); Payement pa = new Payement(lastch, 1, com, sum); PayementDAO daop = new PayementDAO(); daop.addPayTicket(pa); g.PerformRefresh(); TableDAO table = new TableDAO(); Commande c = daoc.getById(com); table.update(c.NumTable, false); decimal res = prix - sum; this.p.txtEspece.Text = "" + res; this.p.lbltotal.Content = "" + res; this.Close(); p.Close(); g.PerformRefresh(); } else { CommandeDAO daoc = new CommandeDAO(); decimal some; DateTime d; TicketDAO daoch = new TicketDAO(); DateTime.TryParse(txtDate.Text, out d); Decimal.TryParse(txtSomme.Text, out some); int lastch = daoch.getLasttk(); Ticket tkt = new Ticket(some, d, txtNomSo.Text); decimal cl = some - ((some * 10) / 100); Payement pa = new Payement(lastch, 1, com, cl); PayementDAO daop = new PayementDAO(); daop.addPayTicket(pa); g.PerformRefresh(); TableDAO table = new TableDAO(); Commande c = daoc.getById(com); decimal res = prix - cl; this.p.txtEspece.Text = "" + res; this.p.lbltotal.Content = "" + res; this.Close(); g.PerformRefresh(); } }
private void Valider_Click(object sender, RoutedEventArgs e) { double som; string s = somme.Text.ToString(); string cinC = cinClient.Text.ToString(); string numC = numCheque.Text.ToString(); if (somme.Text.ToString() == "" || numCheque.Text.ToString() == "" || nomClient.Text.ToString() == "" || cinClient.Text.ToString() == "") { MessageBox.Show("Les champs sant obligatoire !"); } else if (!double.TryParse(s, out som)) { MessageBox.Show("Montant doit etre un reel !"); } else if (!double.TryParse(cinC, out som)) { MessageBox.Show("CIN doit etre un entier !"); } else if (!double.TryParse(numC, out som)) { MessageBox.Show("Numéro du compte doit etre un entier !"); } else if (nomClient.Text == "") { MessageBox.Show("Nom et prénom incorect !"); } decimal sum; decimal.TryParse(somme.Text, out sum); if (prix == sum) { TK_et_FK tk = new TK_et_FK(com); tk.ShowDialog(); CommandeDAO daoc = new CommandeDAO(); daoc.updateEtat(com); decimal some; DateTime d; ChequeDAO daoch = new ChequeDAO(); DateTime.TryParse(dateCheque.Text, out d); Decimal.TryParse(somme.Text, out some); int lastch = daoch.getLastCheque() + 1; Cheque cheque = new Cheque(some, d, nomClient.Text, cinClient.Text, numCheque.Text); daoch.add(cheque); Payement pa = new Payement(1, lastch, com, sum); PayementDAO daop = new PayementDAO(); daop.addPaycheque(pa); g.PerformRefresh(); TableDAO table = new TableDAO(); Commande c = daoc.getById(com); table.update(c.NumTable, false); this.Close(); p.Close(); } else { decimal res = prix - sum; this.p.txtEspece.Text = "" + res; this.p.lbltotal.Content = "" + res; decimal some; DateTime d; ChequeDAO daoch = new ChequeDAO(); DateTime.TryParse(dateCheque.Text, out d); Decimal.TryParse(somme.Text, out some); int lastch = daoch.getLastCheque() + 1; Cheque cheque = new Cheque(some, d, nomClient.Text, cinClient.Text, numCheque.Text); daoch.add(cheque); Payement pa = new Payement(1, lastch, com, sum); PayementDAO daop = new PayementDAO(); daop.addPaycheque(pa); g.PerformRefresh(); this.Close(); } }