Example #1
0
        /// <summary>
        /// Procedura calculeaza nr de zile de CO lunare de angajat
        /// </summary>
        /// <param name="dataStart">Data de inceput</param>
        /// <param name="dataEnd">Data de sfarsit</param>
        /// <param name="IntervalID">Id-ul intervalului</param>
        /// <returns>Returneaza nr de zile de CO</returns>
        public int GetAngajatNrZileCOLuateAn(DateTime dataStart, DateTime dataEnd, int IntervalID)
        {
            try
            {
                Data.PontajAngajat pa = new Data.PontajAngajat(settings.ConnectionString);

                DataSet ds = pa.GetAngajatNrZileAbsenteTipLuna(angajatId, dataStart, dataEnd, SituatieLunaraAngajat.codAbsente[2]);

                //sterge CO care au inceput in anul precedent si se termina in anul curent (pt ca apartin de anul precedent)
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    if ((DateTime)dr["DataStart"] < dataStart || (DateTime)dr["DataStart"] > dataEnd || IntervalID == int.Parse(dr["IntervalAbsentaID"].ToString()))
                    {
                        ds.Tables[0].Rows.RemoveAt(i);
                        i--;
                    }
                }

                //pt cazul in care concediul incepe in Decembrie si se termina prin Ianuarie
                if ((DateTime)ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["DataStart"] <= dataEnd && dataEnd < (DateTime)ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["DataEnd"])
                {
                    dataEnd = (DateTime)ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["DataEnd"];
                }

                return(TimpAbsente(ds, pa, dataStart, dataEnd));
            }
            catch
            {
                return(0);
            }
        }
Example #2
0
        /// <summary>
        /// Procedura calculeaza nr de zile de absente de un anumit tip
        /// </summary>
        /// <param name="dataStart">Data de inceput</param>
        /// <param name="dataEnd">Data de sfarsit</param>
        /// <param name="tipAbsente">Tipul absentei</param>
        /// <returns>Returneaza nr de zile calculete</returns>
        public int GetAngajatNrZileCuSarbatoriAbsenteTipLuna(DateTime dataStart, DateTime dataEnd, string tipAbsente)
        {
            try
            {
                Data.PontajAngajat pa = new Data.PontajAngajat(settings.ConnectionString);
                DataSet            ds = pa.GetAngajatNrZileAbsenteTipLuna(angajatId, dataStart, dataEnd, tipAbsente);

                return(TimpAbsenteCuWeekend(ds, pa, dataStart, dataEnd));
            }
            catch
            {
                return(0);
            }
        }
Example #3
0
 /// <summary>
 /// Procedura selecteaza nr de zile de absenta de un anumit tip pe luna
 /// </summary>
 /// <param name="luna">Luna pentru care se selecteaza</param>
 /// <param name="tipAbsente">Tipul absentelor</param>
 /// <returns>Returneaza nr de zile de absenta</returns>
 public int GetAngajatNrZileAbsenteTipLuna(int luna, string tipAbsente)
 {
     try
     {
         Data.PontajAngajat pa       = new Data.PontajAngajat(settings.ConnectionString);
         DataSet            ds       = pa.GetAngajatNrZileAbsenteTipLuna(angajatId, luna, tipAbsente);
         DateTime           primaZi  = pa.GetPrimaZiDinLuna(luna);
         DateTime           ultimaZi = new DateTime(primaZi.Year, primaZi.Month, DateTime.DaysInMonth(primaZi.Year, primaZi.Month));
         return(TimpAbsente(ds, pa, primaZi, ultimaZi));
     }
     catch
     {
         return(0);
     }
 }