Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="date">the DateTime object associated with this particular RadCalendarDay.</param>
        /// <param name="owner">the CalendarDayCollection that contains this particular RadCalendarDay.</param>
        /// <returns></returns>
        internal protected static RadCalendarDay CreateDay(DateTime date, CalendarDayCollection owner)
        {
            RadCalendarDay temp = new RadCalendarDay(date);

            temp.Owner = owner;
            return(temp);
        }
 protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (e.Property == VisualElement.FontProperty && e.NewValueSource == ValueSource.Inherited)
     {
         this.oldFont = (Font)e.NewValue;
     }
     else
     {
         if (e.Property != CalendarCellElement.SpecialDayProperty)
         {
             return;
         }
         if ((bool)e.NewValue && this.Calendar != null)
         {
             RadCalendarDay specialDay = this.Calendar.SpecialDays[(object)this.Date];
             if (specialDay != null)
             {
                 this.ToolTipText = specialDay.ToolTip;
                 return;
             }
         }
         this.ToolTipText = string.Empty;
     }
 }
Example #3
0
 protected internal virtual string GetToolTip(RadCalendarDay calendarDay)
 {
     if (calendarDay.ToolTip != string.Empty)
     {
         return(calendarDay.ToolTip);
     }
     return(this.GetToolTip(calendarDay.Date));
 }
Example #4
0
 public RenderElementEventArgs(
     LightVisualElement cell,
     RadCalendarDay day,
     CalendarView currentView)
 {
     this.day     = day;
     this.element = cell;
     this.view    = currentView;
 }
Example #5
0
        public void updater()
        {
            Cursor.Current = Cursors.WaitCursor;

            xd = Mantenimiento.returnInt("SELECT [IDEmpleado] FROM [Empleado] where [Nombre] ='" + userCmb.Text + "'");



            //CalendarReset
            for (int i = radCalendar1.SpecialDays.Count - 1; i >= 0; i--)
            {
                radCalendar1.SpecialDays.Remove(radCalendar1.SpecialDays[i]);
            }


            // Counters
            permiso.Text     = Mantenimiento.lookerSt("select count(IDpermiso) from Permiso where month(FechaInicio) = month(getdate()) and year(FechaInicio) = year(getdate()) and  IDEmpleado =" + xd + "");
            incapacidad.Text = Mantenimiento.lookerSt("select count(IDIncapacidad) from Incapacidad where month(FechaInicio) = month(getdate()) and year(FechaInicio) = year(getdate()) and  IDEmpleado =" + xd + "");

            //CalendarPainter
            Mantenimiento bol = new Mantenimiento();

            if (bol.Buscar("select * from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Ordinaria'") == false)
            {
                vac1.Text = "--/--/----";
            }
            else
            {
                //Ordinaria START
                f1        = DateTime.Parse(Mantenimiento.lookerSt("select top 1 Inicio from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Ordinaria' order by IDVac desc"));
                f2        = DateTime.Parse(Mantenimiento.lookerSt("select top 1 Final from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Ordinaria' order by IDVac desc"));
                vac1.Text = f1.ToString("dd-MM-yyyy") + " - " + f2.ToString("dd-MM-yyyy");

                double xi = (f2 - f1).TotalDays;
                for (int i = 0; i <= xi; i++)
                {
                    DateTime date1 = f1;
                    DateTime data2 = date1.AddDays(0 + i);
                    Telerik.WinControls.UI.RadCalendarDay day = new Telerik.WinControls.UI.RadCalendarDay(data2);
                    radCalendar1.SpecialDays.Add(day);

                    radCalendar1.ElementRender += radCalendar1_ElementRender;
                }
                //Ordinaria END

                radCalendar1.FocusedDate = f1;
            }

            Cursor.Current = Cursors.Default;
        }
Example #6
0
        protected internal virtual RadCalendarDay GetSpecialDay(DateTime processedDate)
        {
            if (this.Calendar == null)
            {
                return((RadCalendarDay)null);
            }
            RadCalendarDay specialDay = this.Calendar.SpecialDays[(object)processedDate];

            if (specialDay == null)
            {
                for (int index = 0; index < this.Calendar.SpecialDays.Count; ++index)
                {
                    if (this.Calendar.SpecialDays[index].IsRecurring(processedDate, this.Calendar.CurrentCalendar) != RecurringEvents.None)
                    {
                        specialDay = this.Calendar.SpecialDays[index];
                        break;
                    }
                }
            }
            return(specialDay);
        }
Example #7
0
        /// <summary>
        /// Gets the RadCalendarDay object associated with a particular DateTime object if any.
        /// </summary>
        /// <param name="processedDate">DateTime object to be tested.</param>
        /// <returns>The retrieved RadCalendarDay object.</returns>
        internal protected virtual RadCalendarDay GetSpecialDay(DateTime processedDate)
        {
            if (this.Calendar != null)
            {
                RadCalendarDay tempDay = this.Calendar.SpecialDays[processedDate];
                if (tempDay == null)
                {
                    RecurringEvents matches = RecurringEvents.None;
                    for (int i = 0; i < this.Calendar.SpecialDays.Count; i++)
                    {
                        matches = this.Calendar.SpecialDays[i].IsRecurring(processedDate, this.Calendar.CurrentCalendar);
                        if (matches != RecurringEvents.None)
                        {
                            tempDay = this.Calendar.SpecialDays[i];
                            //this.Calendar.AddViewRepeatableDay(processedDate.ToString("yyyy_M_d"), tempDay.Date.ToString("yyyy_M_d"));
                            break;
                        }
                    }
                }
                return(tempDay);
            }

            return(null);
        }
Example #8
0
        public void updater()
        {
            Cursor.Current = Cursors.WaitCursor;

            //Convenios Start
            conveniosTXT.Text = "";

            xd = Mantenimiento.returnInt("SELECT [IDEmpleado] FROM [Empleado] where [Nombre] ='" + enfCmb.Text + "'");

            SqlDataReader Lect;

            using (SqlConnection Cone = Conexion.generarConexion())
            {
                Cone.Open();
                SqlCommand comando = new SqlCommand("SELECT top 10 FechaInicio FROM Convenio where IDEmpleado = " + xd + "and month(FechaInicio) = month(GETDATE()) order by FechaInicio DESC", Cone);

                Lect = comando.ExecuteReader();

                while (Lect.Read())
                {
                    dateconv           = DateTime.Parse(Lect["FechaInicio"].ToString());
                    conveniosTXT.Text += dateconv.ToString("dd-MM-yyyy hh:mm tt") + "\n";
                }
                Cone.Close();
            }
            //ConveniosEnd

            //CalendarReset
            for (int i = radCalendar1.SpecialDays.Count - 1; i >= 0; i--)
            {
                radCalendar1.SpecialDays.Remove(radCalendar1.SpecialDays[i]);
            }


            //Counters
            permiso.Text     = Mantenimiento.lookerSt("select count(IDpermiso) from Permiso where month(FechaInicio) = month(getdate()) and year(FechaInicio) = year(getdate()) and  IDEmpleado =" + xd + "");
            incapacidad.Text = Mantenimiento.lookerSt("select count(IDIncapacidad) from Incapacidad where month(FechaInicio) = month(getdate()) and year(FechaInicio) = year(getdate()) and  IDEmpleado =" + xd + "");

            //CalendarPainter
            Mantenimiento bol = new Mantenimiento();

            if (bol.Buscar("select * from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Ordinaria'") == false)
            {
                vac1.Text = "--/--/----";
                prof.Text = "--/--/----";
            }
            else
            {
                //Ordinaria START
                f1        = DateTime.Parse(Mantenimiento.lookerSt("select top 1 Inicio from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Ordinaria' order by IDVac desc"));
                f2        = DateTime.Parse(Mantenimiento.lookerSt("select top 1 Final from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Ordinaria' order by IDVac desc"));
                vac1.Text = f1.ToString("dd-MM-yyyy") + " - " + f2.ToString("dd-MM-yyyy");

                double xi = (f2 - f1).TotalDays;
                for (int i = 0; i <= xi; i++)
                {
                    DateTime date1 = f1;
                    DateTime data2 = date1.AddDays(0 + i);
                    Telerik.WinControls.UI.RadCalendarDay day = new Telerik.WinControls.UI.RadCalendarDay(data2);
                    radCalendar1.SpecialDays.Add(day);

                    radCalendar1.ElementRender += radCalendar1_ElementRender;
                }
                //Ordinaria END

                //Profilactica START

                if (Mantenimiento.lookerSt("select TieneProfilactica from Empleado where IDEmpleado =" + xd + "") == "SI")
                {
                    if (bol.Buscar("select * from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Profilactica'") == false)
                    {
                        //MessageBox.Show("No tiene vacaciones profilacticas asignadas");
                        prof.Text = "--/--/----";
                    }
                    else
                    {
                        pro1      = DateTime.Parse(Mantenimiento.lookerSt("select top 1 Inicio from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Profilactica' order by IDVac desc"));
                        pro2      = DateTime.Parse(Mantenimiento.lookerSt("select top 1 Final from Vacaciones where IDEmpleado =" + xd + " and TipoVacacion = 'Profilactica' order by IDVac desc"));
                        prof.Text = pro1.ToString("dd-MM-yyyy") + " - " + pro2.ToString("dd-MM-yyyy");
                    }
                }

                double xr = (pro2 - pro1).TotalDays;
                for (int i = 0; i <= xr; i++)
                {
                    DateTime date1 = pro1;
                    DateTime data2 = date1.AddDays(0 + i);
                    Telerik.WinControls.UI.RadCalendarDay day = new Telerik.WinControls.UI.RadCalendarDay(data2);
                    radCalendar1.SpecialDays.Add(day);

                    radCalendar1.ElementRender += radCalendar1_ElementRender;
                }

                //Profilactica END

                radCalendar1.FocusedDate = f1;
            }

            Cursor.Current = Cursors.Default;
        }