/// <summary>
        /// Sterge o intrerupere CIM
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStergeDate_Click()
        {
            ErrHandler.MyErrHandler.WriteError("RetineriAngajat.ascx - start - StergeRetinere() - angID: " + AngajatID + " - " + txtDataStart.Text + " - " + txtDataEnd.Text);
            int retinereId = Convert.ToInt32(txtRetinereID.Value);

            Salaries.Business.RetineriRecurenteAngajat ret = new Salaries.Business.RetineriRecurenteAngajat();
            ret.GetRetinere(retinereId);
            DateTime dataStart = ret.RetAng.DataInceput;
            DateTime dataEnd   = ret.RetAng.DataSfarsit;
            DateTime data1     = new DateTime(dataStart.Year, dataStart.Month, 1);
            DateTime data2;

            if (dataEnd.Month != 12)
            {
                data2 = new DateTime(dataEnd.Year, dataEnd.Month + 1, 1);
                data2 = data2.AddDays(-1);
            }
            else
            {
                data2 = new DateTime(dataEnd.Year, dataEnd.Month, 31);
            }

            if (data1.CompareTo(ret.RetAng.DataInceput) != 0 && data1 < dataStartLunaActiva)
            {
                Response.Write("<script> alert('Nu se pot modifica retinerile pentru lunile anterioare'); </script>");
                return;
            }
            //if (data1.CompareTo(ret.RetAng.DataInceput) >= 0 && data2 >= dataStartLunaActiva )
            if ((data1.CompareTo(ret.RetAng.DataInceput) > 0 || (data1.CompareTo(ret.RetAng.DataInceput) == 0 && (data1.CompareTo(dataStartLunaActiva) < 0))) &&
                data2 >= dataStartLunaActiva)
            {
                Response.Write("<script> alert('Se va updata intervalul astfel incat sa ramana doar perioada dinaintea lunii active.'); </script>");
                //se face update la retinerea deja existenta...se modifica data sfarsit si anume pana la luna activa
                ret.RetAng.DataSfarsit = dataStartLunaActiva.AddDays(-1);
                ret.UpdateRetinereRecurentaAngajat();
                LoadRetineriAngajat();
                this.txtDataStart.Text = "";
                this.txtDataEnd.Text   = "";
                return;
            }

            //daca am perioada activa trebuie sa modific valorile retinerilor
            //actualizarea retinerilor
            if (ret.RetAng.DataInceput <= dataStartLunaActiva && dataStartLunaActiva <= ret.RetAng.DataSfarsit)
            {
                Salaries.Business.TipuriRetineriValori tipuri = new Salaries.Business.TipuriRetineriValori();
                tipuri.UpdateValoareRetinere((int)lunaID, AngajatID, ret.RetAng.TipRetinere, 0);
            }
            ret.DeleteRetinereRecurentaAngajat();

            Salaries.Business.SituatieLunaraAngajat sitAngajat = new Salaries.Business.SituatieLunaraAngajat(AngajatID);
            sitAngajat.GenerareSituatieLunaraAngajat((int)AngajatID, (int)lunaID);

            LoadRetineriAngajat();
            this.txtDataStart.Text = "";
            this.txtDataEnd.Text   = "";

            ErrHandler.MyErrHandler.WriteError("RetineriAngajat.ascx - end - StergeRetinere() - angID: " + AngajatID);
        }
        /// <summary>
        /// Modifica o intrerupere CIM
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnModificaDate_Click()
        {
            ErrHandler.MyErrHandler.WriteError("RetineriAngajat.ascx - start - ModificaRetinere() - angID: " + AngajatID + " - " + txtDataStart.Text + " - " + txtDataEnd.Text);
            try
            {
                int retinereId = Convert.ToInt32(txtRetinereID.Value);
                Salaries.Business.RetineriRecurenteAngajat ret = new Salaries.Business.RetineriRecurenteAngajat();
                ret.GetRetinere(retinereId);
                Salaries.Business.RetineriRecurenteAngajat retinereVeche = ret;
                DateTime dataStart        = SiemensTM.utils.Utilities.ConvertText2DateTime(txtDataStart.Text /*DateStart.Value*/);
                DateTime dataEnd          = SiemensTM.utils.Utilities.ConvertText2DateTime(txtDataEnd.Text /*DateEnd.Value*/);
                string   tipRetinere      = ddlTipuriRetineri.SelectedValue;
                string   denumireRetinere = txtRetinere.Text;
                decimal  valoare          = decimal.Parse(txtValoare.Text);
                bool     alerta           = chkAlerta.Checked;
                DateTime data1            = new DateTime(dataStart.Year, dataStart.Month, 1);
                DateTime data2;
                if (dataEnd.Month != 12)
                {
                    data2 = new DateTime(dataEnd.Year, dataEnd.Month + 1, 1);
                    data2 = data2.AddDays(-1);
                }
                else
                {
                    data2 = new DateTime(dataEnd.Year, dataEnd.Month, 31);
                }

                //daca noile date sunt inaintea lunii active
                if (data1.CompareTo(ret.RetAng.DataInceput) != 0 && data1 < dataStartLunaActiva)
                {
                    Response.Write("<script> alert('Nu se pot modifica retinerile pentru lunile anterioare') </script>");
                    return;
                }
                if ((data1.CompareTo(ret.RetAng.DataInceput) > 0 || (data1.CompareTo(ret.RetAng.DataInceput) == 0 && (data1.CompareTo(dataStartLunaActiva) < 0))) &&
                    data2 >= dataStartLunaActiva && valoare != ret.RetAng.Valoare)
                {
                    Response.Write("<script> alert('Se vor realiza doua intervale separate pentru ca difera valorile retinerii pentru lunile anterioare si cele viitoare'); </script>");
                    //se face update la retinerea deja existenta...se modifica data sfarsit si anume pana la luna activa
                    ret.RetAng.DataSfarsit = dataStartLunaActiva.AddDays(-1);
                    ret.UpdateRetinereRecurentaAngajat();
                    //se adauga o noua inregistrare cu noua retinere
                    ret.RetAng.AngajatID        = AngajatID;
                    ret.RetAng.IdRetinere       = 0;
                    ret.RetAng.TipRetinere      = tipRetinere;
                    ret.RetAng.DenumireRetinere = denumireRetinere;
                    ret.RetAng.DataInceput      = dataStartLunaActiva;
                    ret.RetAng.DataSfarsit      = data2;
                    ret.RetAng.Valoare          = valoare;
                    ret.RetAng.Alerta           = alerta;
                    ret.InsertRetinereRecurentaAngajat();

                    //daca am perioada activa trebuie sa modific valorile retinerilor
                    //actualizarea retinerilor
                    if (ret.RetAng.DataInceput <= dataStartLunaActiva && dataStartLunaActiva <= ret.RetAng.DataSfarsit)
                    {
                        Salaries.Business.TipuriRetineriValori tipuri = new Salaries.Business.TipuriRetineriValori();
                        tipuri.UpdateValoareRetinere((int)lunaID, AngajatID, ret.RetAng.TipRetinere, ret.RetAng.Valoare);
                    }

                    LoadRetineriAngajat();
                    this.txtDataStart.Text = "";
                    this.txtDataEnd.Text   = "";
                    return;
                }

                // in rest	se face modificare...inseamna ca se modifica doar alerta sau datele astfel incat sa nu influeneteze
                ret = new Salaries.Business.RetineriRecurenteAngajat();
                ret.RetAng.AngajatID        = AngajatID;
                ret.RetAng.IdRetinere       = retinereId;
                ret.RetAng.TipRetinere      = tipRetinere;
                ret.RetAng.DenumireRetinere = denumireRetinere;
                ret.RetAng.DataInceput      = data1;
                ret.RetAng.DataSfarsit      = data2;
                ret.RetAng.Valoare          = valoare;
                ret.RetAng.Alerta           = alerta;
                ret.UpdateRetinereRecurentaAngajat();

                //daca am perioada activa trebuie sa modific valorile retinerilor
                //actualizarea retinerilor
                if (ret.RetAng.DataInceput <= dataStartLunaActiva && dataStartLunaActiva <= ret.RetAng.DataSfarsit && retinereVeche.RetAng.Valoare != ret.RetAng.Valoare)
                {
                    Salaries.Business.TipuriRetineriValori tipuri = new Salaries.Business.TipuriRetineriValori();
                    tipuri.UpdateValoareRetinere((int)lunaID, AngajatID, ret.RetAng.TipRetinere, ret.RetAng.Valoare);
                }

                Salaries.Business.SituatieLunaraAngajat sitAngajat = new Salaries.Business.SituatieLunaraAngajat(AngajatID);
                sitAngajat.GenerareSituatieLunaraAngajat((int)AngajatID, (int)lunaID);

                LoadRetineriAngajat();
                this.txtDataStart.Text = "";
                this.txtDataEnd.Text   = "";
            }
            catch (Exception ex)
            {
                litError.Text  = "The following error occurred: <br>";
                litError.Text += ex.Message;
                ErrHandler.MyErrHandler.WriteError("RetineriAngajat.ascx - error - ModificaRetinere() - angID: " + AngajatID + " - " + ex.Message);
            }
            ErrHandler.MyErrHandler.WriteError("RetineriAngajat.ascx - end - ModificaRetinere() - angID: " + AngajatID);
        }