Пример #1
0
        ///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();
            }
        }