Example #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();
            }
        }
Example #2
0
        private void incarcaRand(DataGridViewRow pRand, BListaPreturiStandard pElem)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaSelectieUnica(pRand, this.lEcranInModificare);
            pRand.Cells[EnumColoaneDGV.colDenumire.ToString()].Value = pElem.Denumire;
            pRand.Cells[EnumColoaneDGV.colPret.ToString()].Value     = pElem.GetValoare();
            pRand.Cells[EnumColoaneDGV.colMoneda.ToString()].Value   = pElem.GetEtichetaMoneda();
        }
        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 incarcaRandPretStandard(DataGridViewRow pRand, BListaPreturiStandard pElem, BListaPreturiClienti pElemClient)
        {
            pElemClient = BListaPreturiClienti.GetPretClient(pElem.Id, this.lClient.Id, CDL.iStomaLab.CDefinitiiComune.EnumStare.Activa, null);

            pRand.Tag = new Tuple <BListaPreturiStandard, BListaPreturiClienti>(pElem, pElemClient);

            pRand.Cells[EnumColoaneDGV.colLucrare.ToString()].Value      = pElem.Denumire;
            pRand.Cells[EnumColoaneDGV.colMoneda.ToString()].Value       = pElem.GetEtichetaMoneda();
            pRand.Cells[EnumColoaneDGV.colPretStandard.ToString()].Value = pElem.GetValoare();

            if (pElemClient != null)
            {
                pRand.Cells[EnumColoaneDGV.colPretClient.ToString()].Value = pElemClient.GetValoareClient();
                pRand.Cells[EnumColoaneDGV.colAjustare.ToString()].Value   = pElemClient.GetEtichetaAjustare();
            }
            else
            {
                pRand.Cells[EnumColoaneDGV.colPretClient.ToString()].Value = pElem.GetValoare();
            }
            pRand.Cells[EnumColoaneDGV.colPretClient.ToString()].Tag = new Tuple <BListaPreturiStandard, BListaPreturiClienti>(pElem, pElemClient);
        }
        private void incarcaRand(DataGridViewRow pRand, BListaPreturiStandard pElem, BListaPreturiClienti pPretClient)
        {
            pRand.Tag = new Tuple <BListaPreturiStandard, BListaPreturiClienti>(pElem, pPretClient);

            pRand.Cells[EnumColoaneDGV.colLucrare.ToString()].Value = pElem.Denumire;
            pRand.Cells[EnumColoaneDGV.colMoneda.ToString()].Value  = pElem.GetEtichetaMoneda();

            pRand.Cells[EnumColoaneDGV.colPretStandard.ToString()].Value = pElem.GetValoare();
            if (pPretClient != null)
            {
                pRand.Cells[EnumColoaneDGV.colPretClient.ToString()].Value = pPretClient.GetValoareClient();
                pRand.Cells[EnumColoaneDGV.colAjustare.ToString()].Value   = pPretClient.GetEtichetaAjustare();
            }
            else
            {
                pRand.Cells[EnumColoaneDGV.colPretClient.ToString()].Value = pElem.ValoareRON == 0 ? pElem.ValoareEUR : pElem.ValoareRON;
            }
        }