///lore 30.08.3019 private void DgvListaDePreturiClienti_CellEndEdit(object sender, DataGridViewCellEventArgs e) { this.modedit = true; if (this.lSeIncarca || e.RowIndex < 0) { return; } try { incepeIncarcarea(); Tuple <BClientiComenzi, BListaPreturiClienti> valori = this.dgvListaComenzi.Rows[e.RowIndex].Tag as Tuple <BClientiComenzi, BListaPreturiClienti>; if (valori == null) { return; } BClientiComenzi pelement = valori.Item1; BListaPreturiClienti pretClient = valori.Item2; // BListaPreturiClienti pretClient = BListaPreturiClienti.GetPretClient(pelement.IdLucrare, pelement.IdClient, CDL.iStomaLab.CDefinitiiComune.EnumStare.Activa, null); BListaPreturiStandard pretStandard = BListaPreturiStandard.getById(pelement.IdLucrare, null); bool refresh = false; if (pretClient != null) { refresh = pretClient.UpdatePret(CUtil.GetAsDouble(this.dgvListaComenzi.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)); //numar = this.dgvListaComenzi.Rows[e.RowIndex].Cells[e.ColumnIndex].Value } else { //Adaugare double pretNou = CUtil.GetAsDouble(this.dgvListaComenzi.Rows[e.RowIndex].Cells[e.ColumnIndex].Value); if (pretNou != pretStandard.GetValoare()) { int id = BListaPreturiClienti.Add(pretStandard.Id, this.lClient.Id, pretNou, pretStandard.GetMoneda(), pretStandard.TermenMediuZile, null); if (id > 0) { refresh = true; pretClient = new BListaPreturiClienti(id); } } } /* if (refresh) * { * incarcaRand(this.dgvListaComenzi.Rows[e.RowIndex], pelement);//, pretStandard, pretClient); * }*/ incarcaRand(this.dgvListaComenzi.Rows[e.RowIndex], pelement); } catch (Exception ex) { GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex); } finally { finalizeazaIncarcarea(); } }
private void DgvClientListaPreturi_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (this.lSeIncarca || e.RowIndex < 0) { return; } try { incepeIncarcarea(); Tuple <BListaPreturiStandard, BListaPreturiClienti> valori = this.dgvClientListaPreturi.Rows[e.RowIndex].Tag as Tuple <BListaPreturiStandard, BListaPreturiClienti>; if (valori == null) { return; } BListaPreturiStandard pretStandard = valori.Item1; BListaPreturiClienti pretClient = valori.Item2; bool refresh = false; if (pretClient != null) { //Update refresh = pretClient.UpdatePret(CUtil.GetAsDouble(this.dgvClientListaPreturi.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)); } else { //Adaugare double pretNou = CUtil.GetAsDouble(this.dgvClientListaPreturi.Rows[e.RowIndex].Cells[e.ColumnIndex].Value); if (pretNou != pretStandard.GetValoare()) { int id = BListaPreturiClienti.Add(pretStandard.Id, this.lClient.Id, pretNou, pretStandard.GetMoneda(), pretStandard.TermenMediuZile, null); if (id > 0) { refresh = true; pretClient = new BListaPreturiClienti(id); } } } if (refresh) { incarcaRand(this.dgvClientListaPreturi.Rows[e.RowIndex], pretStandard, pretClient); } } catch (Exception ex) { GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex); } finally { finalizeazaIncarcarea(); } }
private void DgvClientListaPreturi_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (this.lSeIncarca) { return; } try { incepeIncarcarea(); Tuple <BListaPreturiStandard, BListaPreturiClienti> valori = this.dgvClientListaPreturi.Rows[this.dgvClientListaPreturi.CurrentCell.RowIndex].Tag as Tuple <BListaPreturiStandard, BListaPreturiClienti>; BListaPreturiStandard pretStandard = valori.Item1; BListaPreturiClienti pretClient = valori.Item2; if (pretClient != null) { pretClient.TermenAgreat = pretStandard.TermenMediuZile; if (pretClient.ValoareRON == 0) { double valoareEuro = CUtil.GetAsDouble(this.dgvClientListaPreturi.Rows[e.RowIndex].Cells[e.ColumnIndex].Value); pretClient.ValoareRON = 0; pretClient.ValoareEUR = valoareEuro; } else { double valoareRon = CUtil.GetAsDouble(this.dgvClientListaPreturi.Rows[e.RowIndex].Cells[e.ColumnIndex].Value); pretClient.ValoareRON = valoareRon; pretClient.ValoareEUR = 0; } pretClient.UpdateAll(); } else { if (pretStandard.ValoareRON == 0) { double valoareEuro = CUtil.GetAsDouble(this.dgvClientListaPreturi.Rows[e.RowIndex].Cells[e.ColumnIndex].Value); BListaPreturiClienti.Add(pretStandard.Id, this.lClient.Id, 0, valoareEuro, pretStandard.TermenMediuZile, null); } else { double valoareRon = CUtil.GetAsDouble(this.dgvClientListaPreturi.Rows[e.RowIndex].Cells[e.ColumnIndex].Value); BListaPreturiClienti.Add(pretStandard.Id, this.lClient.Id, 0, valoareRon, pretStandard.TermenMediuZile, null); } } } catch (Exception ex) { GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex); } finally { finalizeazaIncarcarea(); } }