gestion de la modification de commandes commencé
This commit is contained in:
parent
439d996e03
commit
116d3c090b
2 changed files with 39 additions and 2 deletions
1
MediaTekDocuments/view/FrmMediatek.Designer.cs
generated
1
MediaTekDocuments/view/FrmMediatek.Designer.cs
generated
|
|
@ -2181,6 +2181,7 @@ namespace MediaTekDocuments.view
|
|||
this.dgvCommandes.Size = new System.Drawing.Size(843, 154);
|
||||
this.dgvCommandes.TabIndex = 5;
|
||||
this.dgvCommandes.SelectionChanged += new System.EventHandler(this.dgvCommandes_SelectionChanged);
|
||||
this.dgvCommandes.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgvCommandes_MouseDown);
|
||||
//
|
||||
// label66
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1337,15 +1337,19 @@ namespace MediaTekDocuments.view
|
|||
}
|
||||
}
|
||||
|
||||
// Checkpoint
|
||||
private void RemplirCommandesListe(List<CommandeDocument> lesCommandes)
|
||||
{
|
||||
dgvCommandes.DataSource = null;
|
||||
dgvCommandes.Columns.Clear();
|
||||
dgvCommandes.DataSource = lesCommandes;
|
||||
string[] toHide = { "id", "idLivreDvd", "idSuivi", "LibelleSuivi" };
|
||||
string[] toHide = { "id", "idLivreDvd", "idSuivi" };
|
||||
foreach (string col in toHide)
|
||||
if (dgvCommandes.Columns.Contains(col)) dgvCommandes.Columns[col].Visible = false;
|
||||
dgvCommandes.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
|
||||
dgvCommandes.ClearSelection();
|
||||
dgvCommandes.CurrentCell = null;
|
||||
}
|
||||
|
||||
private void AfficheCommandeLivresInfos(Livre livre)
|
||||
|
|
@ -1370,11 +1374,26 @@ namespace MediaTekDocuments.view
|
|||
grpNewCommande.Enabled = false;
|
||||
}
|
||||
|
||||
|
||||
//Checkpoint
|
||||
private void dgvCommandes_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (dgvListeLivre2.CurrentCell != null)
|
||||
if (dgvCommandes.CurrentRow?.DataBoundItem is CommandeDocument commande)
|
||||
{
|
||||
btnDeleteCommande.Enabled = true;
|
||||
cboSuivi.Enabled = true;
|
||||
|
||||
if (dgvCommandes.CurrentRow.Cells["Montant"].Value != null)
|
||||
{
|
||||
CommandeDocument commandeDocument = (CommandeDocument)dgvCommandes.CurrentRow.DataBoundItem;
|
||||
updownMontant.Value = Convert.ToDecimal(dgvCommandes.CurrentRow.Cells["Montant"].Value);
|
||||
updownNbExemplaire.Value = Convert.ToDecimal(dgvCommandes.CurrentRow.Cells["NbExemplaire"].Value);
|
||||
string etape = commandeDocument.LibelleSuivi;
|
||||
cboSuivi.SelectedIndex = cboSuivi.FindStringExact(etape);
|
||||
//cboSuivi.SelectedIndex = etape;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1445,5 +1464,22 @@ namespace MediaTekDocuments.view
|
|||
List<CommandeDocument> lesCommandes = controller.GetCommandesDocument(livre.Id);
|
||||
RemplirCommandesListe(lesCommandes);
|
||||
}
|
||||
|
||||
private void dgvCommandes_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
DataGridView.HitTestInfo hit = dgvCommandes.HitTest(e.X, e.Y);
|
||||
if (hit.Type == DataGridViewHitTestType.None || hit.Type == DataGridViewHitTestType.ColumnHeader)
|
||||
{
|
||||
dgvCommandes.ClearSelection();
|
||||
dgvCommandes.CurrentCell = null;
|
||||
ViderZonesSaisieCommande();
|
||||
}
|
||||
}
|
||||
|
||||
private void ViderZonesSaisieCommande()
|
||||
{
|
||||
updownMontant.Value = 0;
|
||||
updownNbExemplaire.Value = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue