/// <summary>
        ///		Metoda specifica pt apasarea butonului de stergere.
        /// </summary>
        private void btnSterge_Click(object sender, System.EventArgs e)
        {
            try
            {
                int BoalaID       = Convert.ToInt32(txtBoalaID.Text);
                int sePoateSterge = new Salaries.Business.NomenclatorBoli().CheckIfBoalaCanBeDeleted(BoalaID);

                if (sePoateSterge == 0)
                {
                    new Salaries.Business.NomenclatorBoli().DeleteBoala(BoalaID);
                }
                if (sePoateSterge == 1)
                {
                    Response.Write("<script> alert('Aceasta boala nu poate fi stearsa pentru ca exista integistrari atasate ei!'); </script>");
                }
                if (sePoateSterge == 2)
                {
                    Response.Write("<script>alert('Operatiunea nu a fost efectuata deoarece nomenclatoul trebuie sa contina cel putin o boala.');</script>");
                }
            }
            catch (Exception ex)
            {
                litError.Text  = "The following error occurred: <br>";
                litError.Text += ex.Message;
            }
        }
        /// <summary>
        ///		Metoda care se apeleaza la apasarea butonului de salvare din fereastra de editare.
        ///		Se selecteaza optiunea de Update sau Insert cu datele aferente.
        /// </summary>
        private void btnSalveaza_Click(object sender, System.EventArgs e)
        {
            try
            {
                this.VarExists = new Salaries.Business.NomenclatorBoli().GetBoli(this.txtBoalaID.Text).Tables[0].Rows.Count > 0;
                Salaries.Data.Boala boala = new Salaries.Data.Boala();

                boala.CodBoala       = this.txtCodBoala.Text;
                boala.CategorieBoala = this.txtCategorieBoala.Text;
                boala.Procent        = float.Parse(this.txtProcent.Text);
                boala.BoalaId        = (this.VarExists) ? int.Parse(this.txtBoalaID.Text) : -1;
                boala.Stagiu         = cbStagiu.Checked;

                string stagiu = cbStagiu.Checked ? "da" : "nu";

                //se verifica mai intai daca nu exista o boala cu aceleasi date
                bool adauga = new Salaries.Business.NomenclatorBoli().CheckIfBoalaCanBeAdded(boala.BoalaId, boala.CodBoala, boala.CategorieBoala, boala.Procent, stagiu);
                if (adauga)
                {
                    if (this.VarExists)
                    {
                        new Salaries.Business.NomenclatorBoli().UpdateBoala(boala);
                    }
                    else
                    {
                        new Salaries.Business.NomenclatorBoli().AddBoala(boala);
                    }
                }
                else
                {
                    //daca exista se va afisa un mesaj de avertizare
                    Response.Write("<script> alert('Mai exista o boala cu aceste date!'); </script>");
                }
                this.EditMode = false;                //adaugat de vlad
            }
            catch (Exception ex)
            {
                litError.Text  = "The following error occurred: <br>";
                litError.Text += ex.Message;
            }
        }
        /// <summary>
        ///		Metoda care se apeleaza cand se doreste adaugarea unei noi boli sau
        ///		editarea uneia existente.
        /// </summary>
        private void btnEdit_Click(object sender, System.EventArgs e)
        {
            this.EditMode  = true;
            this.VarExists = new Salaries.Business.NomenclatorBoli().GetBoli(this.txtBoalaID.Text).Tables[0].Rows.Count > 0;
            try
            {
                if (this.VarExists)
                {
                    int BoalaID = Convert.ToInt32(txtBoalaID.Text);
                    Salaries.Data.Boala boala = new Salaries.Business.NomenclatorBoli().GetDetalii(this.txtBoalaID.Text);

                    this.txtCodBoala.Text       = boala.CodBoala;
                    this.txtCategorieBoala.Text = boala.CategorieBoala;
                    this.txtProcent.Text        = boala.Procent.ToString();
                    this.cbStagiu.Checked       = boala.Stagiu;
                    this.btnSterge.Visible      = true;
                }
                else
                {
                    this.txtCodBoala.Text       = "";
                    this.txtCategorieBoala.Text = "";
                    this.txtProcent.Text        = "";
                    this.cbStagiu.Checked       = false;
                    this.btnSterge.Visible      = false;
                }
                list_form.Style.Add("display", "none");
                add_form.Style.Add("display", "");
                btnSalveaza.Visible = true;
                btnInapoi.Visible   = true;

                this.btnSalveaza.Enabled = true;

                Utilities.CreateTableHeader(add_header, "Nomenclator boli", "../", "small");
            }
            catch (Exception ex)
            {
                litError.Text  = "The following error occurred: <br>";
                litError.Text += ex.Message;
            }
        }