示例#1
0
        private bool Salveaza()
        {
            bool esteValid = BListaPreturiStandard.SuntInformatiileNecesareCoerente(this.txtDenumireLucrare.Text);

            if (this.lLucrare == null)
            {
                if (esteValid)
                {
                    int id = BListaPreturiStandard.Add(this.txtDenumireLucrare.Text, this.txtPrescurtareLucrare.Text, this.txtCodLucrare.Text, CUtil.GetTextInt32(this.txtTermenMediuLucrare.Text), getIdCategorie(), getValoareRon(), getValoareEuro(), null);
                    this.lLucrare = BListaPreturiStandard.getById(id, null);
                    salveazaEtape(this.lLucrare.Id);
                }
                else
                {
                    seteazaAlerta();
                }
            }
            else
            {
                this.lLucrare.Denumire            = this.txtDenumireLucrare.Text;
                this.lLucrare.DenumirePrescurtata = this.txtPrescurtareLucrare.Text;
                this.lLucrare.CodIntern           = this.txtCodLucrare.Text;
                this.lLucrare.IdCategorie         = getIdCategorie();

                Tuple <double, EnumTipMoneda> tupleValoare = this.ctrlValoareMonetara.ValoareTuple;

                if (tupleValoare.Item2 == EnumTipMoneda.Lei)
                {
                    this.lLucrare.ValoareRON = tupleValoare.Item1;
                    this.lLucrare.ValoareEUR = 0;
                }
                else
                {
                    this.lLucrare.ValoareRON = 0;
                    this.lLucrare.ValoareEUR = tupleValoare.Item1;
                }
                this.lLucrare.TermenMediuZile = CUtil.GetTextInt32(this.txtTermenMediuLucrare.Text);
                if (esteValid)
                {
                    this.lLucrare.UpdateAll();
                    salveazaEtape(this.lLucrare.Id);
                }
                else
                {
                    seteazaAlerta();
                }
            }

            return(esteValid);
        }
        internal bool Salveaza()
        {
            bool esteValid = BListaPreturiStandard.SuntInformatiileNecesareCoerente(this.txtDenumireLucrare.Text);

            if (this.lPretLucrare == null)
            {
                if (esteValid)
                {
                    int id = BListaPreturiStandard.Add(this.txtDenumireLucrare.Text, this.txtPrescurtareLucrare.Text, this.txtCodLucrare.Text, CUtil.GetTextInt32(this.txtTermenMediuLucrare.Text), getIdCategorie(), getValoareRon(), getValoareEuro(), null);
                    this.lPretLucrare = BListaPreturiStandard.getLucrareById(id, null);
                }
                else
                {
                    seteazaAlerta();
                }
            }
            else
            {
                this.lPretLucrare.Denumire            = this.txtDenumireLucrare.Text;
                this.lPretLucrare.DenumirePrescurtata = this.txtPrescurtareLucrare.Text;
                this.lPretLucrare.CodIntern           = this.txtCodLucrare.Text;
                this.lPretLucrare.IdCategorie         = getIdCategorie();
                if (this.lPretLucrare.ValoareRON != 0)
                {
                    this.lPretLucrare.ValoareRON = Double.Parse(this.txtValoareLucrare.Text);
                }
                else
                {
                    this.lPretLucrare.ValoareEUR = Double.Parse(this.txtValoareLucrare.Text);
                }
                this.lPretLucrare.TermenMediuZile = CUtil.GetTextInt32(this.txtTermenMediuLucrare.Text);
                if (esteValid)
                {
                    this.lPretLucrare.UpdateAll();
                    if (this.dgvListaEtapaAdaugate.RowCount > 0)
                    {
                        salveazaEtape(this.lPretLucrare.Id);
                    }
                }
                else
                {
                    seteazaAlerta();
                }
            }

            return(esteValid);
        }
        private bool SalveazaNull()
        {
            bool esteValid = BListaPreturiStandard.SuntInformatiileNecesareCoerente(this.txtDenumireLucrare.Text);

            if (this.lPretLucrare == null)
            {
                if (esteValid)
                {
                    int id = BListaPreturiStandard.Add(this.txtDenumireLucrare.Text, this.txtPrescurtareLucrare.Text, this.txtCodLucrare.Text, CUtil.GetTextInt32(this.txtTermenMediuLucrare.Text), getIdCategorie(), getValoareRon(), getValoareEuro(), null);
                    this.lPretLucrare = BListaPreturiStandard.getLucrareById(id, null);
                }
                else
                {
                    seteazaAlerta();
                }
            }
            else
            {
                return(true);
            }

            return(esteValid);
        }