/// <summary> /// constructor for new entry pesage 2 /// </summary> /// <param name="poids_bascule_"></param> /// <param name="owner_"></param> public EntreeStock(int entry_n, double poids_bascule_) { InitializeComponent(); this.Text = "Entrée Stock : Pesage 2"; operation = 1; _p = PesageHeaderDao.getPesageHeader(entry_n); nticket_tb.Text = _p.n_ticket; date_entree_dtp.Value = _p.date_entree; camion_cb.Text = _p.matricule_camion; chauffeur_cb.Text = _p.nom_chauffeur; poids_recep_tb.Text = _p.poids_reception.ToString(); //date_sortie_dtp.Value = _p.date_sortie; --> pesage1_tb.Text = _p.pesage_1.ToString(); pesage2_tb.Text = poids_bascule_.ToString(); poids_net_tb.Text = Math.Abs((double.Parse(pesage1_tb.Text) - double.Parse(pesage2_tb.Text))).ToString("0.000"); // controls status nticket_tb.Enabled = false; date_entree_dtp.Enabled = false; camion_cb.Enabled = false; chauffeur_cb.Enabled = false; pesage1_tb.Enabled = false; }
private void ajouter_bl_Click(object sender, EventArgs e) { LineFournisseur _form = new LineFournisseur(_p.entry_n); if (_form.ShowDialog() == DialogResult.OK) { poids_recep_tb.Text = PesageHeaderDao.updateWeightPesageHeader(_p.entry_n).ToString(); getBLs(_p.entry_n); } }
private void editer_b_Click(object sender, EventArgs e) { try { int entry_n = int.Parse(BLs_DGV.CurrentRow.Cells["Entry N°"].Value.ToString()); LineFournisseur _form = new LineFournisseur(_p.entry_n, entry_n); if (_form.ShowDialog() == DialogResult.OK) { poids_recep_tb.Text = PesageHeaderDao.updateWeightPesageHeader(_p.entry_n).ToString(); getBLs(_p.entry_n); } } catch { } }
private void supprimer_bl_Click(object sender, EventArgs e) { try { if (MessageBox.Show(this, "Etes-vous sûr ?", "ATTENTION !!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { int entry_n = int.Parse(BLs_DGV.CurrentRow.Cells["Entry N°"].Value.ToString()); PesageLineDao.deletePesageLine(entry_n); poids_recep_tb.Text = PesageHeaderDao.updateWeightPesageHeader(_p.entry_n).ToString(); getBLs(_p.entry_n); } } catch { } }
private void transit_but_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "Etes-vous sûr ?", "ATTENTION !!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { try { //Action si l'utilisateur est sûr int Entry_N = int.Parse(STOCK_DGV.CurrentRow.Cells["Entry N°"].Value.ToString()); PesageHeaderDao.deleteCloPesageHeader(Entry_N); getPesageList(); } catch (Exception exep) { System.Windows.Forms.MessageBox.Show(exep.Message); } } }
/// <summary> /// constructor for update old entry /// </summary> /// <param name="poids_bascule_"></param> /// <param name="owner_"></param> /// <param name="entry_n"></param> public EntreeStock(int entry_n) { InitializeComponent(); this.Text = "Entrée Stock : Modification Pesage"; operation = 2; _p = PesageHeaderDao.getPesageHeader(entry_n); // P1 nticket_tb.Text = _p.n_ticket; date_entree_dtp.Value = _p.date_entree; camion_cb.Text = _p.matricule_camion; chauffeur_cb.Text = _p.nom_chauffeur; pesage1_tb.Text = _p.pesage_1.ToString(); //P2 poids_recep_tb.Text = _p.poids_reception.ToString(); date_sortie_dtp.Value = _p.date_sortie; pesage1_tb.Text = _p.pesage_1.ToString(); pesage2_tb.Text = _p.pesage_2.ToString(); poids_net_tb.Text = _p.poids_net.ToString(); }
/// <summary> /// Controls events handlers /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Enregistrer_Click(object sender, EventArgs e) { int verifData = WithErrors(); if (verifData != 0) { INFO_MSG form = new INFO_MSG("Compléter la saisie : \n" + GlobVars.errorDictionary[verifData]); form.ShowDialog(); return; } //P1 _p.type_oper = 1; _p.n_ticket = nticket_tb.Text; _p.date_entree = date_entree_dtp.Value; _p.matricule_camion = camion_cb.Text; _p.nom_chauffeur = chauffeur_cb.Text; _p.pesage_1 = int.Parse(pesage1_tb.Text); _p.destination = ""; //P2 _p.date_sortie = date_sortie_dtp.Value; _p.pesage_2 = int.Parse(pesage2_tb.Text); _p.poids_net = int.Parse(poids_net_tb.Text); _p.ecart_poids = _p.poids_net - _p.poids_reception; int ret = new int(); switch (operation) { // P1 new entry case 0: ret = PesageHeaderDao.savePesageHeader(_p); if (ret != -1) { _p.entry_n = ret; bls_tp.Enabled = true; prTabControl.SelectTab(1); operation = 2; } break; case 1: if (Math.Abs(_p.ecart_poids) > GlobVars.maxEcartWeight) { MessageBox.Show("Ecart poids > " + GlobVars.maxEcartWeight, "Alerte", MessageBoxButtons.OK, MessageBoxIcon.Warning); } ret = PesageHeaderDao.closurePesageHeader(_p); break; case 2: ret = PesageHeaderDao.updatePesageHeader(_p); break; default: break; } }