/// <summary>
        /// Procedura determina zilele din luna cu intreruperi
        /// </summary>
        /// <param name="z"></param>
        /// <returns>Returneaza un DataSet care contine aceste date</returns>
        private DataSet GetZileLunaIntreruperi(Zile z)
        {
            try
            {
                DataSet ds     = new IntervaleIntreruperiAngajat(this.GetAngajat()).GetIntervaleIntreruperiAngajatLuna(this.SelectedDate);
                DataSet dsZile = z.GetZileIntrerupereContract(this.SelectedDate.Year, this.SelectedDate.Month, (DateTime)ds.Tables[0].Rows[0]["DataStart"], (DateTime)ds.Tables[0].Rows[0]["DataEnd"]);

                for (int i = 1; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    dsZile.Merge(z.GetZileIntrerupereContract(this.SelectedDate.Year, this.SelectedDate.Month, (DateTime)dr["DataStart"], (DateTime)dr["DataEnd"]));
                }
                return(dsZile);
            }
            catch (Exception)
            {
                return(null);
            }
        }
 /// <summary>
 /// Procedura determina zilele imposibile din luna
 /// </summary>
 /// <param name="z"></param>
 /// <returns>Returneaza un DataSet care contine aceste date</returns>
 private DataSet GetZileLunaImposibile(Zile z)
 {
     try
     {
         Salaries.Business.Angajat ang = new Salaries.Business.Angajat();
         ang.AngajatId = GetAngajat();
         ang.LoadAngajat();
         //Modified: Ionel Popa
         //Description: Nu se ia in considerare DataPanaLa si DataLichidare
         if (ang.DataLichidare.Year == 1 && ang.DataLichidare.Month == 1 && ang.DataLichidare.Day == 1)
         {
             return(null);
         }
         DataSet ds = z.GetZileLunaImposibile(SelectedDate.Year, SelectedDate.Month, ang.DataLichidare);
         return(ds);
     }
     catch
     {
         return(null);
     }
 }
Exemple #3
0
        static void Main(string[] args)
        {
            Zile z = Zile.Miercuri;

            switch (z)
            {
            case Zile.Luni:
                break;

            case Zile.Marti:
                break;

            case Zile.Miercuri:
                break;

            case Zile.Joi:
                break;

            case Zile.Vineri:
                break;

            case Zile.Sambata:
                break;

            case Zile.Duminica:
                break;

            default:
                break;
            }
            Zile z2 = (Zile)3;

            Console.WriteLine(z2);

            DataC.DataCalendaristica dc = new DataC.DataCalendaristica();
            dc.SetZi(7);
            dc.SetLuna(LunileAnului.Mai);
            dc.SetAn(2018);
        }
        protected void CreateTimeStamp()
        {
            Table    t        = new Table();
            TableRow r_days   = new TableRow();
            TableRow r_stamps = new TableRow();

            Zile z = new Zile();

            DataSet ds = z.GetLuna(this.SelectedDate.Year, this.SelectedDate.Month);

            SituatieAngajat sa = new SituatieAngajat(this.AngajatID);
            //Lungu Andreea - 08.09.2008
            //Se folosesc doua dataset-uri pentru a aduce datele necesare
            //Pentru a incerca sa optimizam timpul
            DateTime dataStart = DateTime.Parse(ds.Tables[0].Rows[0]["Data"].ToString());
            DateTime dataEnd   = DateTime.Parse(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["Data"].ToString());
            DataSet  ds_ore    = sa.GetOreZiLuna(dataStart, dataEnd);
            DataSet  ds_norma  = sa.GetNormaZiLuna(dataStart, dataEnd);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                TableCell tc = new TableCell();
                tc.CssClass            = "tabBackground";
                tc.Width               = 40;
                tc.Attributes["align"] = "center";
                tc.Font.Size           = FontUnit.Small;
                tc.Font.Name           = "arial";

                tc.Attributes["style"]       = "cursor:hand";
                tc.Attributes["onmouseover"] = "Light(this)";
                tc.Attributes["onmouseout"]  = "Delight(this)";

                System.Drawing.Color back;

                DateTime dt = DateTime.Parse(dr["Data"].ToString());

                if (dt.ToShortDateString() == this.SelectedDate.ToShortDateString())
                {
                    back = Definitions.Color_ZiSelected;
                }
                else
                {
                    back = z.IsSarbatoare(dt) ? Definitions.Color_ZiSarbatoare : Definitions.Color_ZiLucru;
                }

                tc.BackColor = back;
                tc.Text      = "<b>" + dt.Day + "</b>";

                tc.Attributes["onclick"] = "SelectZiLuna(" + dt.Day + ")";

                r_days.Cells.Add(tc);

                tc                     = new TableCell();
                tc.CssClass            = "tabBackground";
                tc.Width               = 40;
                tc.Attributes["align"] = "center";
                tc.Font.Size           = FontUnit.Small;
                tc.Font.Name           = "arial";

                tc.Attributes["style"]       = "cursor:hand";
                tc.Attributes["onmouseover"] = "Light(this)";
                tc.Attributes["onmouseout"]  = "Delight(this)";
                tc.Attributes["onclick"]     = "SelectZiLuna(" + dt.Day + ")";

                dt   = DateTime.Parse(dr["Data"].ToString());
                back = Definitions.Color_StampNecompletat;

                //Lungu Andreea - 08.09.2008
                //sunt luate din dataset datele corespunzatoare unei anumite zile
                float oreZi = 0;
                if (ds_ore != null)
                {
                    foreach (DataRow dr_ore in ds_ore.Tables[0].Rows)
                    {
                        if (dr_ore["Data"].ToString().Equals(dr["Data"].ToString()))
                        {
                            oreZi = (float)Double.Parse(dr_ore["OreZi"].ToString());
                        }
                    }
                }
                int normaZi = 0;
                if (ds_norma != null)
                {
                    foreach (DataRow dr_norma in ds_norma.Tables[0].Rows)
                    {
                        if (dr_norma["Data"].ToString().Equals(dr["Data"].ToString()))
                        {
                            normaZi = (int)Double.Parse(dr_norma["ProgramLucru"].ToString());
                        }
                    }
                }

                //float oreZi = sa.GetOreZi(dt);
                //int normaZi = sa.GetNormaZi( dt );
                if (oreZi > 0)
                {
                    if (z.IsSarbatoare(dt))
                    {
                        back = Definitions.Color_StampCompletat;
                    }
                    else
                    {
                        back = (oreZi < normaZi) ? Definitions.Color_StampCompletatPartial : Definitions.Color_StampCompletat;
                    }
                }

                tc.BackColor = back;

                tc.Text = "&nbsp;" + oreZi;

                r_stamps.Cells.Add(tc);
            }

            DataSet myDs = GetZileLunaImposibile(z);

            if (myDs != null)
            {
                foreach (DataRow dr in myDs.Tables[0].Rows)
                {
                    //completeaza zilele cu -
                    r_stamps.Cells[((DateTime)dr["Data"]).Day - 1].Text      = Definitions.TextZileLunaImposibile;
                    r_stamps.Cells[((DateTime)dr["Data"]).Day - 1].BackColor = Definitions.Color_StampZileLunaImposibile;
                }
            }

            myDs = GetZileLunaIntreruperi(z);
            if (myDs != null)
            {
                foreach (DataRow dr in myDs.Tables[0].Rows)
                {
                    //completeaza zilele cu -
                    r_stamps.Cells[((DateTime)dr["Data"]).Day - 1].Text      = Definitions.TextZileLunaImposibile;
                    r_stamps.Cells[((DateTime)dr["Data"]).Day - 1].BackColor = Definitions.Color_StampZileLunaIntreruperi;
                }
            }

            myDs = sa.GetIntervaleAbsentaAngajatLunaByDataInside(this.SelectedDate);

            for (int i = 0; i < r_stamps.Cells.Count; i++)
            {
                DateTime time = new DateTime(this.SelectedDate.Year, this.SelectedDate.Month, i + 1);
                string   cod  = CompleteazaZiAbsentaLuna(myDs, i, sa);
                if (cod != "")
                {
                    r_stamps.Cells[i].Text = cod;
                    if (cod == Salaries.Business.SituatieLunaraAngajat.codAbsente[8] || cod == Salaries.Business.SituatieLunaraAngajat.codAbsente[9])
                    {
                        r_stamps.Cells[i].BackColor = Definitions.Color_StampDelegatie;
                    }
                    else
                    {
                        float oreZi = 0;
                        if (ds_ore != null)
                        {
                            foreach (DataRow dr_ore in ds_ore.Tables[0].Rows)
                            {
                                if (dr_ore["Data"].ToString().Equals(time.ToString()))
                                {
                                    oreZi = (float)Double.Parse(dr_ore["OreZi"].ToString());
                                }
                            }
                        }
                        //if( cod==Salaries.Business.SituatieLunaraAngajat.codAbsente[ 10 ]+" "+sa.GetOreZi( time ).ToString())
                        if (cod == Salaries.Business.SituatieLunaraAngajat.codAbsente[10] + " " + oreZi.ToString())
                        {
                            r_stamps.Cells[i].BackColor = Definitions.Color_StampEmergencyService;
                        }
                        else
                        {
                            r_stamps.Cells[i].BackColor = Definitions.Color_StampAbsenta;
                        }
                    }
                }
            }

            t.Rows.Add(r_days);
            t.Rows.Add(r_stamps);

            this.cell_container.Controls.Add(t);
        }