Beispiel #1
0
        private void cal_DayRender(object sender, DayRenderEventArgs e)
        {
            if (e.Day.IsOtherMonth)
            {
                e.Cell.Text = "";
                return;
            }
            else
                e.Cell.Attributes.Add("class", "ms-picker-daycenter");

            if(e.Day.IsToday)
                e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#edb244");

            InitData(e);

            IntiDeleteEvent(e);

            e.Cell.Text = e.Day.Date.Day.ToString();

            string html = GetDayHtml(e.Day.Date);

            if (html != "")
            {
                e.Cell.Attributes.Add("title", html);

                if (e.Day.IsToday)
                    e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#edb244");
                else
                    e.Cell.BackColor = System.Drawing.Color.Yellow;
            }

            e.Cell.Attributes.Add("style", "cursor:hand;");

            e.Cell.Attributes.Add("onclick", "javascript:window.location.href='" + _ViewUrl + "?CalendarPeriod=day&CalendarDate=" + e.Day.Date.Year + "%2F" + e.Day.Date.Month + "%2F" + e.Day.Date.Day + "';return false;");
        }
        protected void datefilterPlanMeal_DayRender(object sender, DayRenderEventArgs e)
        {
            OleDbCommand command = new OleDbCommand("SELECT * FROM PlannedMeal WHERE UserDataID = " + userID + " ORDER BY CreatedDate DESC", myConnection);

            OleDbDataReader dr = command.ExecuteReader();
            // Read DataReader till it reaches the end
            while (dr.Read() == true)
            {
                // Assign the Calendar control dates
                // already contained in the database
                //datefilterPlanMeal.SelectedDates.Add((DateTime)dr["CreatedDate"]);
                if (e.Day.Date == (DateTime)dr["CreatedDate"])
                {
                    e.Cell.BackColor = System.Drawing.Color.Silver;
                }
            }
            if (e.Day.IsSelected)
            {
                e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#4db6ac");
                e.Cell.ForeColor = System.Drawing.Color.White;
            }

            // Close DataReader
            dr.Close();
        }
Beispiel #3
0
 protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
 {
     DataView dv = (DataView)myEventDS.Select(DataSourceSelectArguments.Empty);
     int i = 1;
     string content = "";
     bool flag = false;
     foreach (DataRowView dr in dv)
     {
         if (e.Day.Date.ToString() == (Convert.ToDateTime(dr["EventDate"]).Date.ToString()))
         {
             e.Cell.BackColor = System.Drawing.Color.Red;
             DateTime select = Calendar1.SelectedDate;
             DateTime compare = Convert.ToDateTime(dr["EventDate"]).Date;
             if (select == compare)
             {
                 content = content + "<p> [" + i + "]  "
                     + Convert.ToDateTime(dr["EventDate"]).TimeOfDay.ToString() + " "
                     + dr["EventDescription"].ToString() + "</p> <br/>";
                 i++;
                 flag = true;
             }
         }
     }
     if (flag)
     {
         Label1.Text = content;
     }
     else if (content != "")
     {
         Label1.Text = "No Events Scheduled for Today!";
     }
 }
 private void RenderDayOutsideTheCurrentMonth(DayRenderEventArgs e)
 {
     if (e.Day.IsOtherMonth)
     {
         e.Day.IsSelectable = false;
     }
 }
        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            if (tempTaskId!=-1)
            {
                using (chaodyzDBEntities1 db = new chaodyzDBEntities1())
                {

                        var calendar = (from c in db.Calendars
                                        where c.TaskId == tempTaskId
                                        select c).FirstOrDefault();
                        if (calendar !=null)
                        {
                            tempDateString = calendar.date;
                            // split date
                            string[] dates = tempDateString.Split(' ');
                            // draw date(s) that has been selected 
                            for (int i = 0; i < dates.Length; i++)
                            {
                                if (e.Day.Date.ToString("yyyy-MM-dd") == dates[i])
                                {
                                    e.Cell.BackColor = System.Drawing.Color.Red;
                                }
                            }
                        }
                        else
                        {
                        label1.Visible = true;
                        label1.Text = "There are no record.";
                    }
            }
               
            }                           
        }
        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            string path = HttpContext.Current.Server.MapPath("~/App_Data/ARC_ORG_DB.mdb");
            OleDbConnection connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path);
            OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM [Event_Calendar]",connection);
            DataSet ds = new DataSet("Event_Calendar");
            adapter.Fill(ds);            
            foreach (DataRow row in ds.Tables[0].Rows) // loop through each rows in order to compare with day cell's date  
            {
                try
                {
                    if (Convert.ToDateTime(row["Event_Date"]) == e.Day.Date)
                    {
                        if (e.Cell.Controls.Count > 1)
                        {
                            Image img = new Image();
                            img.ImageUrl = Convert.ToString(row["Icon_Path"]);
                            img.ToolTip = Convert.ToString(row["Additional_Info"]);
                            e.Cell.Controls.Add(img);
                            string linkbutn = Convert.ToString(row["Event_Name"]);
                            linkbutn = linkbutn + "<br />";
                            Label linkb = new Label();
                            linkb.Text = linkbutn;
                            //linkb.OnClientClick = "LinkButtonClick()";
                            linkb.ToolTip = Convert.ToString(row["Additional_Info"]);
                            linkb.Font.Size = 10;
                            e.Cell.Controls.Add(linkb);

                        }
                        else
                        {
                            e.Cell.Controls.Clear();
                            Label label = new Label();
                            string labelstring = e.Day.Date.Day.ToString();
                            labelstring = labelstring + "<br />";
                            label.Text = labelstring;
                            e.Cell.Controls.Add(label);
                            Image img = new Image();
                            img.ImageUrl = Convert.ToString(row["Icon_Path"]);
                            img.ToolTip = Convert.ToString(row["Additional_Info"]);
                            e.Cell.Controls.Add(img);
                            string linkbutn = Convert.ToString(row["Event_Name"]);
                            linkbutn = linkbutn + "<br />";
                            Label linkb = new Label();
                            linkb.Text = linkbutn;
                            //linkb.OnClientClick = "LinkButtonClick()";
                            linkb.ToolTip = Convert.ToString(row["Additional_Info"]);
                            linkb.Font.Size = 10;
                            e.Cell.Controls.Add(linkb);
                        }

                    }
                }
                catch
                {
                    return;
                }

            }
        }
 protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
 {
     if (availableDays.Contains(e.Day.Date))
         e.Day.IsSelectable = true;
     else
         e.Day.IsSelectable = false;
 }
Beispiel #8
0
 protected void Calendar1_DayRender(Object source, DayRenderEventArgs e)
 {
     if (e.Day.Date.ToString("d") == DateTime.Now.ToString("d"))
     {
         e.Cell.BackColor = System.Drawing.Color.LightGray;
     }
 }
        protected void cldEvent_DayRender(object sender, DayRenderEventArgs e)
        {
            e.Day.IsSelectable = false;
            e.Cell.Attributes.Add("onclick", "ShowCalendarEvents('" + e.Day.Date.Year + "','" + e.Day.Date.Month + "','" + e.Day.Date.Day + "','" + CategoryID + "','" + dvEventloading.ClientID + "','" + pnlEventData.ClientID + "','" + lbtnEvent.ClientID + "','" + pnlEvent.ClientID + "');return false;");

            if (events == null || events.Count <= 0)
                return;

            TableCell oTableCell = e.Cell;
            LiteralControl lControl = (LiteralControl)e.Cell.Controls[0];
            oTableCell.Controls.Clear();
            oTableCell.Controls.Add(lControl);
            foreach (DataLayer.Entities.Event oEvent in events)
            {
                if (EventManager.ValidAddEvent(oEvent, e.Day.Date))
                {
                    oTableCell.BackColor = System.Drawing.Color.FromName(hdColor.Value);
                    e.Cell.Style.Add(HtmlTextWriterStyle.Cursor, "Pointer");
                    string toolTip = oTableCell.ToolTip;
                    if (string.IsNullOrEmpty(toolTip))
                    {
                        toolTip = oEvent.Name;
                    }
                    else
                    {
                        toolTip += Environment.NewLine + oEvent.Name;

                    }

                    oTableCell.ToolTip = toolTip;
                }
            }
        }
 protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
 {
     if(e.Day.IsOtherMonth || e.Day.IsWeekend)
     { e.Day.IsSelectable = false;
     e.Cell.BackColor = System.Drawing.Color.Azure;
     }
 }
Beispiel #11
0
 protected void calrundate_DayRender(object sender, DayRenderEventArgs e)
 {
     if (e.Day.IsOtherMonth)
     {
         e.Cell.Text = string.Empty;
     }
 }
 protected void navCalendar_DayRender(object sender, DayRenderEventArgs e)
 {
     if (e.Day.Date == DateTime.Today)
      {
     e.Cell.Style.Add("border", "solid 1px red");
      }
 }
 protected void startDateCalander_DayRender(object sender, DayRenderEventArgs e)
 {
     if (e.Day.Date.CompareTo(DateTime.Today) < 0)
     {
         e.Day.IsSelectable = false;
     }
 }
 protected void endDateCalander_DayRender(object sender, DayRenderEventArgs e)
 {
     if (e.Day.Date.CompareTo(startDateCalander.SelectedDate.AddDays(1)) < 0)
     {
         e.Day.IsSelectable = false;
     }
 }
 protected void Calendar2_DayRender(object sender, DayRenderEventArgs e)
 {
     if (e.Day.IsOtherMonth)
     {
         e.Cell.Controls.Clear();
     }
 }
        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
           
                if (e.Day.Date.ToString("yyyy-MM-dd") =="2015-08-03")
                {
                    e.Cell.BackColor = System.Drawing.Color.Red;
                }
               if (e.Day.Date.ToString("yyyy-MM-dd") =="2015-08-05")
                {
                    e.Cell.BackColor = System.Drawing.Color.Red;
                }
               if (e.Day.Date.ToString("yyyy-MM-dd") =="2015-07-05")
                {
                    e.Cell.BackColor = System.Drawing.Color.Red;
                }
               // Change the background color of the days in the month
         // to yellow.
         if (!e.Day.IsOtherMonth && !e.Day.IsWeekend)
         {
            e.Cell.BackColor=System.Drawing.Color.Yellow;
         }

         // Add custom text to cell in the Calendar control.
         if (e.Day.Date.Day == 18)
         {
            e.Cell.Controls.Add(new LiteralControl("<br />Holiday"));
         }
            }
 protected void Calendar1_DayRender(object sender,
                                    System.Web.UI.WebControls.DayRenderEventArgs e)
 {
     if (e.Day.Date.Day == 5 && e.Day.Date.Month == 9)
     {
         e.Cell.BackColor = System.Drawing.Color.Yellow;
         Label lbl = new Label();
         lbl.Text = "<br>Teachers Day!";
         e.Cell.Controls.Add(lbl);
         Image g1 = new Image();
         g1.ImageUrl = "download.jpeg";
         g1.Height   = 20;
         g1.Width    = 20;
         e.Cell.Controls.Add(g1);
     }
     if (e.Day.Date.Day == 13 && e.Day.Date.Month == 9)
     {
         Calendar1.SelectedDate = new DateTime(2018, 9, 12);
         Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate,
                                             Calendar1.SelectedDate.AddDays(10));
         Label lbl1 = new Label();
         lbl1.Text = "<br>Ganpati!";
         e.Cell.Controls.Add(lbl1);
     }
 }
 protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
 {
     e.Day.IsSelectable = false;
     if (e.Day.Date < System.DateTime.Today)
     {
         e.Cell.Font.Strikeout = true;
     }
 }
 void c_DayRender(object sender, DayRenderEventArgs e)
 {
     if (e.Day.Date < (System.DateTime.Now.AddDays(-1)))//.AddDays(_nDaysToBlock)))
     {
         e.Day.IsSelectable = false;
         e.Cell.Font.Strikeout = true;
     }
 }
 protected void DisablePastDays(object sender, DayRenderEventArgs e)
 {
     if (e.Day.Date < System.DateTime.Today)
     {
         e.Day.IsSelectable = false;
         e.Cell.ForeColor = Color.Gray;
     }
 }
Beispiel #21
0
 protected void Calendar_DayRender(object sender, DayRenderEventArgs e)
 {
     if (e.Day.Date.CompareTo(DateTime.Today) < 0)
     {
         e.Cell.BackColor = Color.Gray;
         e.Day.IsSelectable = false;
     }
 }
Beispiel #22
0
        protected void CalendarDRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
        {
            //if (e.Day.IsOtherMonth)
            //{

            //    e.Cell.Text ="";
            //}
        }
Beispiel #23
0
 protected void grayOutPreviousDates(object sender, DayRenderEventArgs e)
 {
     if (e.Day.Date.CompareTo(DateTime.Today) < 0)
     {
         e.Day.IsSelectable = false;
         e.Cell.BackColor = System.Drawing.Color.LightGray;
     }
 }
        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            //Get Event Data for Calendar
            AppCode appcode = new AppCode();
            string sc = "Calendar_DayRender_Select";
            DataSet ds = new DataSet();
            ds = appcode.SelectQuery(sc);
            foreach (DataRow row in ds.Tables[0].Rows) // loop through each rows in order to compare with day cell's date  
            {
                try
                {
                    if (Convert.ToDateTime(row["Event_Date"]) == e.Day.Date)
                    {
                        if (e.Cell.Controls.Count > 1)
                        {
                            Image img = new Image();
                            img.ImageUrl = Convert.ToString(row["Icon_Path"]);
                            img.ToolTip = Convert.ToString(row["Additional_Info"]);
                            e.Cell.Controls.Add(img);
                            string linkbutn = Convert.ToString(row["Event_Name"]);
                            linkbutn = linkbutn + "<br />";
                            Label linkb = new Label();
                            linkb.Text = linkbutn;
                            linkb.ToolTip = Convert.ToString(row["Additional_Info"]);
                            linkb.Font.Size = 10;
                            e.Cell.Controls.Add(linkb);

                        }
                        else
                        {
                            e.Cell.Controls.Clear();
                            Label label = new Label();
                            string labelstring = e.Day.Date.Day.ToString();
                            labelstring = labelstring + "<br />";
                            label.Text = labelstring;
                            e.Cell.Controls.Add(label);
                            Image img = new Image();
                            img.ImageUrl = Convert.ToString(row["Icon_Path"]);
                            img.ToolTip = Convert.ToString(row["Additional_Info"]);
                            e.Cell.Controls.Add(img);
                            string linkbutn = Convert.ToString(row["Event_Name"]);
                            linkbutn = linkbutn + "<br />";
                            Label linkb = new Label();
                            linkb.Text = linkbutn;
                            linkb.ToolTip = Convert.ToString(row["Additional_Info"]);
                            linkb.Font.Size = 10;
                            e.Cell.Controls.Add(linkb);
                        }

                    }
                }
                catch
                {
                    return;
                }

            }
        }
 protected void calDayRender(Object source, DayRenderEventArgs e)
 {
     IEnumerable<calendar_event> var = ((IEnumerable<calendar_event>)Cache["CalendarEvent2"]).Where(i => i.createtime == e.Day.Date);
     if (var.Count() > 0)
     {
         e.Cell.BackColor = Color.YellowGreen;
         e.Cell.ForeColor = Color.White;
     }
 }
Beispiel #26
0
 protected void calendario_DayRender(object sender, DayRenderEventArgs e)
 {
     if (e.Day.IsSelected == true)
     {
         list.Add(e.Day.Date);
         Lab += e.Day.Date.ToShortDateString() + ",";
     }
     Session["SelectedDates"] = list;
 }
 private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
 {
     if (e.Day.IsWeekend)
     {
         e.Cell.BackColor   = System.Drawing.Color.Green;
         e.Cell.ForeColor   = System.Drawing.Color.Yellow;
         e.Day.IsSelectable = false;
     }
 }
        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            if (e.Day.IsSelected == true)
            {
                dateList.Add(e.Day.Date);

            }
            Session["SelectedDates"] = dateList;
        }
Beispiel #29
0
        protected void calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            DataRow[] rows =
                GroupEvents.Select(
                    String.Format("Date >= #{0}# AND Date < #{1}#", e.Day.Date.ToString(CultureInfo.InvariantCulture),
                                  e.Day.Date.AddDays(1).ToString(CultureInfo.InvariantCulture)));

            if (rows != null && rows.Length > 0) e.Cell.CssClass = "eventselected";
        }
Beispiel #30
0
        protected void CalendarControl_DayRender(object sender, DayRenderEventArgs e)
        {
            var scm = ScriptManager.GetCurrent(Page);
            
            if (scm != null && scm.IsInAsyncPostBack)
                return;

            e.Day.IsSelectable = HasEvent(e.Day.Date);
        }
 protected void endDateDayRender(object sender, DayRenderEventArgs e)
 {
     // Gray-out and disable endDates that are < currently-selected beginDate
     DateTime beginDate = CalendarBeginDate.SelectedDate;
     if (e.Day.Date < beginDate)
     {
         e.Day.IsSelectable = false;
         e.Cell.ForeColor = System.Drawing.Color.Gray;
     }
 }
Beispiel #32
0
        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            string sEvents = GetHolidaysForDay(e.Day.Date);

            sEvents += GetEventsForDay(e.Day.Date);

            e.Cell.Text = e.Day.Date.Day.ToString();

            if (sEvents.Length > 3)
                e.Cell.Text += sEvents;
        }
        void VacacionesCalendar_DayRender(object sender, DayRenderEventArgs e)
        {
            // buscar vacaciones
            var recursoLicencia = from rl in DbsrContext.RecursoLicencia
                                  where rl.FechaDesde <= e.Day.Date && e.Day.Date <= rl.FechaHasta
                                  orderby rl.Recurso.IdTipoRecurso, rl.Recurso.Nombre
                                  select rl;

            if (e.Day.Date.Month == VacacionesCalendar.VisibleDate.Month && (e.Day.Date.DayOfWeek == DayOfWeek.Saturday || e.Day.Date.DayOfWeek == DayOfWeek.Sunday))
            {
                e.Cell.BackColor = Color.LightBlue;
            }

            string feriado;
            if (e.Day.Date.Month == VacacionesCalendar.VisibleDate.Month && _feriados.TryGetValue(e.Day.Date.Day, out feriado))
            {
                e.Cell.BackColor = Color.LightCoral;
                e.Cell.Controls.Add(new LiteralControl("<br /><strong>" + feriado + "</strong>"));
            }

            if (e.Day.Date == DateTime.Now.Date)
            {
                e.Cell.BackColor = Color.LightGreen;
            }

            foreach (RecursoLicencia rl in recursoLicencia)
            {
                string msg = "<br/>" + rl.Recurso.Nombre;

                if (rl.Recurso.IdTipoRecurso == 2)
                {
                    // buscar equipo
                    var pls = from rp in DbsrContext.RecursoProyecto
                              where rp.IdRecurso == rl.IdRecurso && (((rp.FechaDesde ?? DateTime.MinValue) <= e.Day.Date) && (e.Day.Date <= (rp.FechaHasta ?? DateTime.MaxValue)))
                              select rp.Proyecto.Recurso;

                    if (pls != null)
                    {
                        var nombrePls = new List<string>();
                        foreach (Recurso pl in pls)
                        {
                            string nombre = "";
                            foreach (string s in pl.Nombre.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
                            {
                                nombre += s[0].ToString();
                            }
                            nombrePls.Add(nombre.ToUpper());
                        }
                        msg += " (" + String.Join(",", nombrePls.ToArray()) + ")";
                    }
                }
                e.Cell.Controls.Add(new Label() { Text = msg, ToolTip = rl.MotivoLicencia.Descripcion + (!String.IsNullOrEmpty(rl.Observaciones) ? " - " + rl.Observaciones : "" ) } );
            }
        }
Beispiel #34
0
 protected void datepicker_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
 {
     // Select all dates in the past
     if (e.Day.Date < DateTime.Today)
     {
         // Disable date
         e.Day.IsSelectable = false;
         // Change color of disabled date
         e.Cell.ForeColor = Color.Gray;
     }
 }
Beispiel #35
0
        private void StatsCalendar_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
        {
            int voterNumber = new Voters().GetDayStats(SurveyId, e.Day.Date);

            if (voterNumber > 0)
            {
                e.Cell.Controls.Add(new LiteralControl(string.Format("<br /><b>" + GetPageResource("EntriesNumber") + "</b>", voterNumber)));
            }
            else
            {
                e.Cell.Controls.Add(new LiteralControl(string.Format("<br />&nbsp;")));
            }
        }
Beispiel #36
0
 private void calendar_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
 {
     if (eventTable.Rows.Count > 0)
     {
         System.DateTime testDate;
         foreach (System.Data.DataRow testRow in eventTable.Rows)
         {
             testDate = (System.DateTime)testRow["EventDate"];
             if (testDate.Date == e.Day.Date)
             {
                 e.Cell.BackColor = Color.Red;
             }
         }
     }
 }
Beispiel #37
0
 private void calBasic_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
 {
     //시작일 설정
     if (e.Day.Date.ToShortDateString() == this.BeginTime.Text)
     {
         e.Cell.BackColor = Color.Violet;
         e.Cell.ForeColor = Color.White;
         e.Cell.Font.Bold = true;
         e.Cell.Font.Size = FontUnit.Small;
         e.Cell.Controls.Add(new LiteralControl(" ☞"));
     }
     //중간의 포함된 날짜
     if (this.BeginTime.Text != "" && this.EndTime.Text != "")
     {
         //초기화
         DateTime sd = Convert.ToDateTime(BeginTime.Text);
         DateTime ed = Convert.ToDateTime(EndTime.Text);
         if (e.Day.Date > sd && e.Day.Date < ed)
         {
             e.Cell.BackColor     = Color.Thistle;
             e.Cell.Font.Italic   = true;
             e.Cell.Font.Overline = true;
         }
     }
     //종료일설정
     if (e.Day.Date.ToShortDateString() == this.EndTime.Text)
     {
         e.Cell.BackColor = Color.Purple;
         e.Cell.ForeColor = Color.White;
         e.Cell.Font.Bold = true;
         e.Cell.Font.Size = FontUnit.Small;
         if (BeginTime.Text != EndTime.Text)
         {
             e.Cell.Controls.AddAt(0, new LiteralControl("☜ "));
         }
         else
         {
             e.Cell.Controls.RemoveAt(1);
         }
     }
     if (e.Day.IsSelected)
     {
         e.Cell.BackColor = Color.Purple;
     }
 }
Beispiel #38
0
        private void blogCal_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
        {
            e.Day.IsSelectable = false;
            DateTime start = StartDate.Date;

            foreach (DayEntry day in data.Days)
            {
                if (e.Day.Date == day.Date.Date)
                {
                    e.Cell.Controls.Clear();
                    HyperLink link = new HyperLink();
                    link.Text        = e.Day.DayNumberText;
                    link.NavigateUrl = "default.aspx?date=" + e.Day.Date.ToString("s");
                    e.Cell.Controls.Add(link);
                    break;
                }
            }
        }
Beispiel #39
0
        private void calBasic_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
        {
            if (e.Day.Date.ToShortDateString() == this.BeginTime.Text)
            {
                e.Cell.BackColor = Color.Pink;
                //e.Cell.Controls.Add(new LiteralControl("<br><font size='1'>*</font>"));
            }
            if (e.Day.Date.ToShortDateString() == this.EndTime.Text)
            {
                e.Cell.BackColor = Color.Purple;
                e.Cell.ForeColor = Color.White;
            }

            if (e.Day.IsSelected)
            {
                e.Cell.BackColor = Color.Purple;
            }
        }
Beispiel #40
0
    protected void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
    {
        if (e.Day.IsOtherMonth)
        {
            e.Day.IsSelectable = false;
        }
        else
        {
            if (ModeHiddenField.Value == "0")
            {
                if (e.Day.Date >= minDate && e.Day.Date <= maxDate)
                {
                    e.Cell.Controls.Clear();

                    HtmlGenericControl link = new HtmlGenericControl();
                    link.TagName   = "a";
                    link.InnerText = e.Day.DayNumberText;
                    string href = "javascript: SelectDate('" +
                                  e.Day.Date.ToString("MM/dd/yyyy") + "');";
                    link.Attributes.Add("href", href);

                    e.Cell.Controls.Add(link);
                }
                else
                {
                    e.Day.IsSelectable = false;
                }
            }
            else
            {
                e.Cell.Controls.Clear();

                HtmlGenericControl link = new HtmlGenericControl();
                link.TagName   = "a";
                link.InnerText = e.Day.DayNumberText;
                string href = "javascript: SelectDate('" +
                              e.Day.Date.ToString("MM/dd/yyyy") + "');";
                link.Attributes.Add("href", href);

                e.Cell.Controls.Add(link);
            }
        }
    }
Beispiel #41
0
    //Barry - Calender. Inserts into textbox
    protected void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
    {
        DateTime pastday = e.Day.Date;
        DateTime date    = DateTime.Now;
        int      year    = date.Year;
        int      month   = date.Month;
        int      day     = date.Day;
        DateTime today   = new DateTime(year, month, day);

        if (pastday.CompareTo(today) < 0)
        {
            e.Cell.BackColor   = System.Drawing.Color.LightGray;
            e.Day.IsSelectable = false;
        }
        else
        {
            projectDate.Text = Calendar1.SelectedDate.ToString("MM/dd/yyyy");
        }
    }
 public void calBirthDateSchedule_DayRender(Object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
 {
     DataRow[] birthdaysOnThisDay = this.birthdayClubMemberRecords.Select("Birthdate = '" + e.Day.Date.ToShortDateString() + "'");
     if (birthdaysOnThisDay != null)
     {
         Literal lit = new Literal();
         lit.Visible = true;
         lit.Text    = "<br />";
         e.Cell.Controls.Add(lit);
         System.Text.StringBuilder memberNames = new System.Text.StringBuilder(256);
         foreach (DataRow row in birthdaysOnThisDay)
         {
             memberNames.AppendFormat("{0}<br>", row["MemberName"].ToString());
         }
         Label lbl = new Label();
         lbl.Visible = true;
         lbl.Text    = string.Format("<font color='red'>{0}</font>", memberNames.ToString());
         e.Cell.Controls.Add(lbl);
     }
 }
Beispiel #43
0
        protected void cal_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
        {
            CalendarDay day = (CalendarDay)e.Day;
            SqlCommand  cmd = new SqlCommand("select *  from parentevents", con);



            SqlDataAdapter da = new SqlDataAdapter(cmd);

            DataTable dtEvents = new DataTable();

            da.Fill(dtEvents);
            foreach (DataRow oItem in dtEvents.Rows)
            {
                if (Convert.ToDateTime(oItem["eventdate"]).ToString("dd-MM-yyyy") == e.Day.Date.ToString("dd-MM-yyyy"))
                {
                    Literal ltrl = new Literal();
                    ltrl.Text = "<BR />";
                    e.Cell.Controls.Add(ltrl);

                    // e.Cell.BorderColor = System.Drawing.Color.Aqua;
                    e.Cell.BackColor   = System.Drawing.Color.SkyBlue;
                    e.Cell.BorderStyle = BorderStyle.Solid;
                    e.Cell.BorderColor = System.Drawing.ColorTranslator.FromHtml("#003399");
                    e.Cell.BorderWidth = 1;

                    Label b = new Label();
                    b.Font.Size = 8;
                    b.Font.Bold = true;
                    b.ForeColor = System.Drawing.ColorTranslator.FromHtml("#003399");
                    b.Text      = oItem["eventname"].ToString();
                    e.Cell.Controls.Add(b);
                }
                if (e.Day.IsToday)
                {
                    e.Cell.BackColor = System.Drawing.Color.Salmon;
                }
            }
        }
Beispiel #44
0
    /// <summary>
    /// Replaces the standard post-back link for each calendar day
    /// with the javascript to set the opener window's TextBox text.
    /// Eliminates a needless round-trip to the server.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
    {
        // Clear the link from this day
        e.Cell.Controls.Clear();

        // Add the custom link
        System.Web.UI.HtmlControls.HtmlGenericControl Link = new System.Web.UI.HtmlControls.HtmlGenericControl();
        Link.TagName   = "a";
        Link.InnerText = e.Day.DayNumberText;
        SiteSettings settings = SiteSettings.GetSharedSettings();

        String.Format(settings.DateFormat.ToString(), e.Day.DayNumberText);
        Link.Attributes.Add("href", String.Format("JavaScript:window.opener.document.{0}.value = \'{1:d}\'; window.close();", Request.QueryString["field"], e.Day.Date));

        // By default, this will highlight today's date.
        if (e.Day.IsSelected)
        {
            Link.Attributes.Add("style", this.Calendar1.SelectedDayStyle.ToString());
        }

        // Now add our custom link to the page
        e.Cell.Controls.Add(Link);
    }
        protected void DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
        {
            e.Cell.ToolTip = e.Day.Date.ToLongDateString();
            int intCount = 0;

            if (ds.Tables[0].Rows.Count > 0)
            {
                e.Cell.Text  = "<div style=\"width:100%;height:100%;overflow:visible\">";
                e.Cell.Text += "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
                if (e.Day.IsOtherMonth == false && e.Day.IsWeekend == false)
                {
                    e.Cell.Text += "<tr><td class=\"calendarhead\">" + e.Day.DayNumberText + "</td></tr>";
                }
                else
                {
                    e.Cell.Text += "<tr><td class=\"calendarotherhead\">" + e.Day.DayNumberText + "</td></tr>";
                }

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    start_date   = DateTime.Parse(dr["startdate"].ToString());
                    end_date     = DateTime.Parse(dr["enddate"].ToString());
                    current_date = e.Day.Date;

                    if (current_date >= start_date && current_date <= end_date)
                    {
                        e.Cell.Text += "<tr><td class=\"default\">" + dr["username"].ToString().Trim() + "<br>" + dr["title"].ToString().Trim() + "<br>" + dr["starttime"].ToString().Trim() + "-" + dr["endtime"].ToString().Trim() + "<br>[<a href=\"javascript:void()\" onclick=\"test();\" class=\"default\">Delete</a>]" + "<span style=\"width:100%;border-bottom:1 dotted #CCCCCC;\"/></span></td></tr>";
                        e.Cell.Text += "";
                    }
                    intCount++;
                }

                e.Cell.Text += "</table>";
                e.Cell.Text += "</div>";
            }
        }
Beispiel #46
0
        /// <summary>
        /// Handles the DayRender event of the prjCalendar control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.DayRenderEventArgs"/> instance containing the event data.</param>
        protected void prjCalendar_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
        {
            if (e.Day.IsToday)
            {
                //TODO: If issues are due today in 7 days or less then create as red, else use blue?
            }


            List <QueryClause> queryClauses = new List <QueryClause>();

            switch (dropView.SelectedValue)
            {
            case "IssueDueDates":
                QueryClause q = new QueryClause("AND", "iv.[IssueDueDate]", "=", e.Day.Date.ToShortDateString(), SqlDbType.DateTime);
                queryClauses.Add(q);

                q = new QueryClause("AND", "iv.[Disabled]", "=", "false", SqlDbType.Bit);
                queryClauses.Add(q);

                List <Issue> issues = IssueManager.PerformQuery(queryClauses, ProjectId);
                foreach (Issue issue in issues)
                {
                    if (issue.Visibility == (int)IssueVisibility.Private && issue.AssignedDisplayName != Security.GetUserName() && issue.CreatorDisplayName != Security.GetUserName() && (!UserManager.IsSuperUser() || !UserManager.IsInRole(issue.ProjectId, Globals.ProjectAdminRole)))
                    {
                        continue;
                    }

                    string cssClass = string.Empty;

                    if (issue.DueDate <= DateTime.Today)
                    {
                        cssClass = "calIssuePastDue";
                    }
                    else
                    {
                        cssClass = "calIssue";
                    }

                    if (issue.Visibility == (int)IssueVisibility.Private)
                    {
                        cssClass += " calIssuePrivate";
                    }

                    string title = string.Format(@"<div id=""issue"" class=""{3}""><a href=""{4}{2}"">{0} - {1}</a></div>", issue.FullId.ToUpper(), issue.Title, issue.Id, cssClass, Page.ResolveUrl("~/Issues/IssueDetail.aspx?id="));
                    e.Cell.Controls.Add(new LiteralControl(title));
                }
                break;

            case "MilestoneDueDates":
                List <Milestone> milestones = MilestoneManager.GetByProjectId(ProjectId).FindAll(m => m.DueDate == e.Day.Date);
                foreach (Milestone m in milestones)
                {
                    string cssClass = string.Empty;

                    if (m.DueDate <= DateTime.Today)
                    {
                        cssClass = "calIssuePastDue";
                    }
                    else
                    {
                        cssClass = "calIssue";
                    }

                    string projectName = ProjectManager.GetById(ProjectId).Name;
                    string title       = string.Format(@"<div id=""issue"" class=""{4}""><a href=""{6}{2}&m={3}"">{1} - {0} </a><br/>{5}</div>", m.Name, projectName, m.ProjectId, m.Id, cssClass, m.Notes, Page.ResolveUrl("~/Issues/IssueDetail.aspx?pid="));
                    e.Cell.Controls.Add(new LiteralControl(title));
                }
                break;
            }


            //Set the calendar to week mode only showing the selected week.
            if (dropCalendarView.SelectedValue == "Week")
            {
                if (Week(e.Day.Date) != Week(prjCalendar.VisibleDate))
                {
                    e.Cell.Visible = false;
                }
                e.Cell.Height = new Unit("300px");
            }
            else
            {
                //e.Cell.Height = new Unit("80px");
                //e.Cell.Width = new Unit("80px");
            }
        }
        /// <summary>
        ///     Render each day in the event (i.e. Cells)
        /// </summary>
        protected void EventCalendar_DayRender(object sender, DayRenderEventArgs e)
        {
            var objEvent    = default(EventInfo);
            var cellcontrol = new LiteralControl();

            _objEventInfoHelper = new EventInfoHelper(ModuleId, TabId, PortalId, Settings);

            // Get Events/Sub-Calendar Events
            var dayEvents    = new ArrayList();
            var allDayEvents = default(ArrayList);

            allDayEvents = _objEventInfoHelper.GetDateEvents(_selectedEvents, e.Day.Date);
            allDayEvents.Sort(new EventInfoHelper.EventDateSort());

            foreach (EventInfo tempLoopVar_objEvent in allDayEvents)
            {
                objEvent = tempLoopVar_objEvent;
                //if day not in current (selected) Event month OR full enrollments should be hidden, ignore
                if ((Settings.ShowEventsAlways || e.Day.Date.Month == SelectedDate.Month) &&
                    !HideFullEvent(objEvent))
                {
                    dayEvents.Add(objEvent);
                }
            }

            // If No Cell Event Display...
            if (Settings.Monthcellnoevents)
            {
                if (Settings.ShowEventsAlways == false && e.Day.IsOtherMonth)
                {
                    e.Cell.Text = "";
                    return;
                }

                if (dayEvents.Count > 0)
                {
                    e.Day.IsSelectable = true;

                    if (e.Day.Date == SelectedDate)
                    {
                        e.Cell.CssClass = "EventSelectedDay";
                    }
                    else
                    {
                        if (e.Day.IsWeekend)
                        {
                            e.Cell.CssClass = "EventWeekendDayEvents";
                        }
                        else
                        {
                            e.Cell.CssClass = "EventDayEvents";
                        }
                    }

                    if (Settings.Eventtooltipmonth)
                    {
                        var themeCss = GetThemeSettings().CssClass;

                        var tmpToolTipTitle = Settings.Templates.txtTooltipTemplateTitleNT;
                        if (tmpToolTipTitle.IndexOf("{0}") + 1 > 0)
                        {
                            tmpToolTipTitle = tmpToolTipTitle.Replace("{0}", "{0:d}");
                        }
                        var tooltipTitle =
                            Convert.ToString(HttpUtility.HtmlDecode(string.Format(tmpToolTipTitle, e.Day.Date))
                                             .Replace(Environment.NewLine, ""));
                        var cellToolTip = ""; //Holds control generated tooltip

                        foreach (EventInfo tempLoopVar_objEvent in dayEvents)
                        {
                            objEvent = tempLoopVar_objEvent;
                            //Add horizontal row to seperate the eventdescriptions
                            if (!string.IsNullOrEmpty(cellToolTip))
                            {
                                cellToolTip = cellToolTip + "<hr/>";
                            }

                            cellToolTip +=
                                CreateEventName(
                                    objEvent,
                                    Convert.ToString(Settings.Templates.txtTooltipTemplateBodyNT
                                                     .Replace(Constants.vbLf, "").Replace(Constants.vbCr, "")));
                        }
                        e.Cell.Attributes.Add(
                            "title",
                            "<table class=\"" + themeCss + " Eventtooltiptable\"><tr><td class=\"" + themeCss +
                            " Eventtooltipheader\">" + tooltipTitle + "</td></tr><tr><td class=\"" + themeCss +
                            " Eventtooltipbody\">" + cellToolTip + "</td></tr></table>");
                        e.Cell.ID = "ctlEvents_Mod_" + ModuleId + "_EventDate_" + e.Day.Date.ToString("yyyyMMMdd");
                    }

                    var dailyLink = new HyperLink();
                    dailyLink.Text = string.Format(Settings.Templates.txtMonthDayEventCount, dayEvents.Count);
                    var socialGroupId = GetUrlGroupId();
                    var socialUserId  = GetUrlUserId();
                    if (dayEvents.Count > 1)
                    {
                        if (Settings.Eventdaynewpage)
                        {
                            if (socialGroupId > 0)
                            {
                                dailyLink.NavigateUrl =
                                    _objEventInfoHelper.AddSkinContainerControls(
                                        Globals.NavigateURL(TabId, "Day", "Mid=" + ModuleId,
                                                            "selecteddate=" +
                                                            Strings.Format(e.Day.Date, "yyyyMMdd"),
                                                            "groupid=" + socialGroupId), "?");
                            }
                            else if (socialUserId > 0)
                            {
                                dailyLink.NavigateUrl =
                                    _objEventInfoHelper.AddSkinContainerControls(
                                        Globals.NavigateURL(TabId, "Day", "Mid=" + ModuleId,
                                                            "selecteddate=" +
                                                            Strings.Format(e.Day.Date, "yyyyMMdd"),
                                                            "userid=" + socialUserId), "?");
                            }
                            else
                            {
                                dailyLink.NavigateUrl =
                                    _objEventInfoHelper.AddSkinContainerControls(
                                        Globals.NavigateURL(TabId, "Day", "Mid=" + ModuleId,
                                                            "selecteddate=" +
                                                            Strings.Format(e.Day.Date, "yyyyMMdd")), "?");
                            }
                        }
                        else
                        {
                            if (socialGroupId > 0)
                            {
                                dailyLink.NavigateUrl =
                                    Globals.NavigateURL(TabId, "", "ModuleID=" + ModuleId, "mctl=EventDay",
                                                        "selecteddate=" + Strings.Format(e.Day.Date, "yyyyMMdd"),
                                                        "groupid=" + socialGroupId);
                            }
                            else if (socialUserId > 0)
                            {
                                dailyLink.NavigateUrl =
                                    Globals.NavigateURL(TabId, "", "ModuleID=" + ModuleId, "mctl=EventDay",
                                                        "selecteddate=" + Strings.Format(e.Day.Date, "yyyyMMdd"),
                                                        "userid=" + socialUserId);
                            }
                            else
                            {
                                dailyLink.NavigateUrl =
                                    Globals.NavigateURL(TabId, "", "ModuleID=" + ModuleId, "mctl=EventDay",
                                                        "selecteddate=" + Strings.Format(e.Day.Date, "yyyyMMdd"));
                            }
                        }
                    }
                    else
                    {
                        // Get detail page url
                        dailyLink = GetDetailPageUrl((EventInfo)dayEvents[0], dailyLink);
                    }
                    using (var stringWrite = new StringWriter())
                    {
                        using (var eventoutput = new HtmlTextWriter(stringWrite))
                        {
                            dailyLink.RenderControl(eventoutput);
                            cellcontrol.Text = "<div class='EventDayScroll'>" + stringWrite + "</div>";
                            e.Cell.Controls.Add(cellcontrol);
                        }
                    }
                }
                else
                {
                    e.Day.IsSelectable = false;
                }
                return;
            }

            //Make day unselectable
            if (!Settings.Monthdayselect)
            {
                e.Day.IsSelectable = false;
            }

            //loop through records and render if startDate = current day and is not null
            var celldata = ""; // Holds Control Generated HTML

            foreach (EventInfo tempLoopVar_objEvent in dayEvents)
            {
                objEvent = tempLoopVar_objEvent;
                var dailyLink  = new HyperLink();
                var iconString = "";

                // See if an Image is to be displayed for the Event
                if (Settings.Eventimage && Settings.EventImageMonth && objEvent.ImageURL != null &&
                    objEvent.ImageDisplay)
                {
                    dailyLink.Text = ImageInfo(objEvent.ImageURL, objEvent.ImageHeight, objEvent.ImageWidth);
                }

                if (Settings.Timeintitle)
                {
                    dailyLink.Text = dailyLink.Text + objEvent.EventTimeBegin.ToString("t") + " - ";
                }

                var eventtext = CreateEventName(objEvent, Settings.Templates.txtMonthEventText);
                dailyLink.Text = dailyLink.Text + eventtext.Trim();

                if (!IsPrivateNotModerator || UserId == objEvent.OwnerID)
                {
                    dailyLink.ForeColor = GetColor(objEvent.FontColor);
                    iconString          = CreateIconString(objEvent, Settings.IconMonthPrio,
                                                           Settings.IconMonthRec, Settings.IconMonthReminder,
                                                           Settings.IconMonthEnroll);

                    // Get detail page url
                    dailyLink = GetDetailPageUrl(objEvent, dailyLink);
                }
                else
                {
                    dailyLink.Style.Add("cursor", "text");
                    dailyLink.Style.Add("text-decoration", "none");
                    dailyLink.Attributes.Add("onclick", "javascript:return false;");
                }

                // See If Description Tooltip to be added
                if (Settings.Eventtooltipmonth)
                {
                    var isEvtEditor = IsEventEditor(objEvent, false);
                    dailyLink.Attributes.Add(
                        "title",
                        ToolTipCreate(objEvent, Settings.Templates.txtTooltipTemplateTitle,
                                      Settings.Templates.txtTooltipTemplateBody, isEvtEditor));
                }

                // Capture Control Info & save
                using (var stringWrite = new StringWriter())
                {
                    using (var eventoutput = new HtmlTextWriter(stringWrite))
                    {
                        dailyLink.ID = "ctlEvents_Mod_" + ModuleId + "_EventID_" + objEvent.EventID +
                                       "_EventDate_" + e.Day.Date.ToString("yyyyMMMdd");
                        dailyLink.RenderControl(eventoutput);
                        if (objEvent.Color != null && (!IsPrivateNotModerator || UserId == objEvent.OwnerID))
                        {
                            celldata = celldata + "<div style=\"background-color: " + objEvent.Color + ";\">" +
                                       iconString + stringWrite + "</div>";
                        }
                        else
                        {
                            celldata = celldata + "<div>" + iconString + stringWrite + "</div>";
                        }
                    }
                }
            }

            // Add Literal Control Data to Cell w/DIV tag (in order to support scrolling in cell)
            cellcontrol.Text = "<div class='EventDayScroll'>" + celldata + "</div>";
            e.Cell.Controls.Add(cellcontrol);
        }
Beispiel #48
0
    /// <summary>
    /// Replaces the standard post-back link for each calendar day
    /// with the javascript to set the opener window's TextBox text.
    /// Eliminates a needless round-trip to the server.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void Calendar_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
    {
        try
        {
            // Clear the link from this day
            e.Cell.Controls.Clear();

            // Add the custom link
            HtmlGenericControl Link = new HtmlGenericControl();
            Link.TagName = "a";
            //Link.InnerText = string.Format("{0,2}", int.Parse(e.Day.DayNumberText)).Replace(" ", " ");
            Link.InnerText = e.Day.DayNumberText;
            if (Link.InnerText.Length == 1)
            {
                Link.InnerText = " " + Link.InnerText;
            }
            string javaScript = "JavaScript:" +
                                                                            //"if(window.opener!=null){{" +		// 親ウィンドウが閉じられたときの対策だが、結局スクリプトエラーになる?のでコメントにした。
#if FOR_WINDOW_OPEN
                                "window.opener.document.{0}.value='{1}';" + /*{1:d}*/
                                "window.opener.document.{0}.focus();" +
                                "window.returnValue='{1}';" +
#else
                                "window.returnValue='{1}';" +
#endif
                                //"}}" +
                                "window.close();";
            string field  = Request.QueryString[pmField];
            string format = string.IsNullOrEmpty(Request.QueryString[pmFormat]) ? defaultFormat : Request.QueryString[pmFormat];
            string value  = String.Format(javaScript, field, e.Day.Date.ToString(format) + time);
            Link.Attributes.Add("href", value);
            Link.Attributes.Add("title", "" /*e.Day.DayNumberText + "日"*/);

            // By default, this will highlight today's date.
            if (e.Day.IsSelected)
            {
                Link.Attributes.Add("style", this.Calendar.SelectedDayStyle.ToString());
            }

            if (e.Day.IsOtherMonth)
            {
                //string color = "#" + this.Calendar.OtherMonthDayStyle.ForeColor.ToArgb().ToString("X").Substring(2);
                string color = this.Calendar.OtherMonthDayStyle.ForeColor.ToArgb().ToString("X");
                Link.Style.Add("color", "#" + color.Substring(2));
            }
            else
            {
                if (e.Day.IsWeekend)
                {
                    string color = this.Calendar.WeekendDayStyle.ForeColor.Name;
                    Link.Style.Add("color", color);
                }
            }

            // Now add our custom link to the page
            e.Cell.Controls.Add(Link);
        }
        catch (Exception exp)
        {
            try
            {
                e.Cell.ToolTip = exp.Message;
            }
            catch (Exception _exp)
            {
                Debug.WriteLine(_exp.Message);
            }
        }
    }