protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { if (e.Day.IsWeekend) { //IsSelectable布尔属性控制日期是否可被选择 e.Day.IsSelectable = false; } if (e.Day.IsOtherMonth) { //e.Cell属性代表一个日期框 e.Cell.Text = "-"; } //检查日期是否为3月5号。 if (e.Day.Date.Day == 5 && e.Day.Date.Month == 3) { e.Cell.BackColor = System.Drawing.Color.Yellow; //向该列添加静态文本 Label lbl = new Label(); lbl.Text = "<br />学习雷锋好榜样!"; e.Cell.Controls.Add(lbl); } Calendar1.SelectedDate = DateTime.Now.AddDays(2).Date; //下面的代码将使用SelectedDates选中2008年3月的每个星期天 SelectedDatesCollection theDates = Calendar1.SelectedDates; theDates.Clear(); theDates.Add(new DateTime(2008, 3, 2)); theDates.Add(new DateTime(2008, 3, 9)); theDates.Add(new DateTime(2008, 3, 16)); theDates.Add(new DateTime(2008, 3, 23)); }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { if (e.Day.IsWeekend) { e.Day.IsSelectable = false; } //if (e.Day.Date.Month == 12 && e.Day.Date.Day == 5) //{ // // It's your birthday!!! // Label l = new Label(); // l.Text = "<br />Happy Birthday Clait!"; // e.Cell.Controls.Add(l); //} //if (e.Day.Date.Month == 1 && e.Day.Date.Day == 14) //{ // // It's your birthday!!! // Label l = new Label(); // l.Text = "<br />Happy Birthday Kaden!"; // e.Cell.Controls.Add(l); //} //if (e.Day.IsSelected) //{ //} }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { //extract the date being rendered DateTime renderedDay = e.Day.Date; //check to see if the day and the month of the renderedDay maatch my birthday if (e.Day.Date.Month == 3 && e.Day.Date.Day == 28) { //instantiate a new label Label l = new Label(); //set the text of the label l.Text = "<br />Happy Birthday Travis!"; //Happy birthday to me! e.Cell.Controls.Add(l); } //check to see if the day and the month of the renderedDay maatch my birthday if (e.Day.Date.Month == 1 && e.Day.Date.Day == 25) { //instantiate a new label Label l = new Label(); //set the text of the label l.Text = "<br />Happy Birthday Andrew!"; //Happy birthday to me! e.Cell.Controls.Add(l); } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { AgendamentoSessoesDAL agendamentoSessoesDAL = new AgendamentoSessoesDAL(); DataTable dataTable = agendamentoSessoesDAL.ListarAgendaMultiProfissionais(ddlProfissionais.SelectedValue); StringBuilder Texto = new StringBuilder(""); //if (!e.Day.IsOtherMonth) Caso querira somente percorrer os dias do mes atual string Cor1 = "#E3EAEB"; string Cor = string.Empty; foreach (DataRow dr in dataTable.Rows) { if ((dr["DataInicio"].ToString() != DBNull.Value.ToString())) { DateTime dtEvent = Convert.ToDateTime(dr["DataInicio"].ToString()); DateTime dtEventFim = Convert.ToDateTime(dr["DataFim"].ToString()); if (dtEvent.Equals(e.Day.Date)) { if (Cor == Cor1) { Cor = "#E5E5E5"; } else { Cor = "#E3EAEB"; } Texto.Append("<table width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor='"+Cor+"'>"); Texto.Append("<tr><td align='left'>" + dr["HoraInicio"].ToString() + " - " + dr["HoraFim"].ToString() + "</td></tr>"); Texto.Append("<tr><td align='left'>" + dr["ProfissionalNome"].ToString() + "</td></tr>"); Texto.Append("<tr><td align='left'>" + dr["PacienteNome"].ToString() + "</td></tr>"); Texto.Append("</table>"); Texto.Append("<br style='font-size: 5px' >"); e.Cell.Controls.Clear(); e.Cell.Text = e.Day.DayNumberText + "<br>" + Texto; e.Cell.Font.Size = FontUnit.XXSmall; e.Cell.Font.Bold = true; } } } }
protected void calTransferDate_DayRender(object sender, DayRenderEventArgs e) { if (e.Day.Date < DateTime.Today) { e.Day.IsSelectable = false; } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { if(e.Day.Date.Day % 2 == 0 && !e.Day.IsWeekend) { e.Cell.BackColor = Color.BlanchedAlmond; } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { // DateTime dt=Calendar1.SelectedDate; // Response.Write(dt.ToString()); //if (e.Day.Date == dt) //{ //ComboBox a1 = new ComboBox(); //a1.ID = 'a' + i.ToString(); //a1.AutoCompleteMode = ComboBoxAutoCompleteMode.Suggest; //a1.DropDownStyle = ComboBoxStyle.DropDownList; //i++; // e.Cell.Controls.Add(tb); // } //Response.Write(e.Day.Date.ToString()); DateTime dt = Calendar1.SelectedDate; if (e.Day.Date == dt) { ArrayList al=new ArrayList(); al.Add(1); al.Add(2); al.Add(3); ComboBox cb = new ComboBox(); cb.DataSource = al; cb.ID = "a"; cb.AutoCompleteMode = ComboBoxAutoCompleteMode.Suggest; cb.DropDownStyle = ComboBoxStyle.DropDownList; e.Cell.Controls.Add(cb); } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { if (e.Day.Date.DayOfWeek == DayOfWeek.Saturday || e.Day.Date.DayOfWeek == DayOfWeek.Sunday) { e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Red; } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { if (e.Day.Date < DateTime.Now.Date) { e.Cell.Enabled = false; e.Cell.BackColor = Color.White; } }
protected void EndDateCalendar_DayRender(object sender, DayRenderEventArgs e) { if (e.Day.Date < DateTime.Today.AddDays(1).Date) { e.Cell.Enabled = false; // Changes the Cells Enable Property e.Day.IsSelectable = false; // Disables the Cells Click Property } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { if (e.Day.IsSelected == true)//starts adding dates to the list that we created. { datelist.Add(e.Day.Date); } Session["SelectedDates"] = datelist;//ends the adding dates to the list created. try//start the try catch to connect to database and draw the booked days. { using (OdbcConnection connection2 = new OdbcConnection(ConfigurationManager.ConnectionStrings["MySQLConnStr"].ConnectionString)) { connection2.Open(); using (OdbcCommand command2 = new OdbcCommand("SELECT booked_dates FROM confirmed_dates", connection2)) using (OdbcDataReader dr2 = command2.ExecuteReader()) { while (dr2.Read()) { //Test to show calendar str = "SELECT booked_dates FROM confirmed_dates"; com = new OdbcCommand(str, connection2); odbcda = new OdbcDataAdapter(com); dt = new DataTable(); odbcda.Fill(dt); DateTime occasionDate; if (dt.Rows.Count > 0) { //Go through all the rows in the table for (int i = 0; i < dt.Rows.Count; i++) { occasionDate = Convert.ToDateTime(dt.Rows[i]["booked_dates"]); //If the date is in the table || (or) If the date is before today if (e.Day.Date == occasionDate || e.Day.Date < DateTime.Now.Date) { //Make is unselectable and change colour e.Day.IsSelectable = false; e.Cell.BackColor = System.Drawing.Color.Honeydew; e.Cell.Text = e.Day.DayNumberText; } } } } //end of original statement dr2.Close(); } connection2.Close(); } } catch (Exception ex) { Response.Write("An error occured: " + ex.Message); } }
protected void Calendar1_DayRender(object sender, 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 calTransferDate_Render(object o, DayRenderEventArgs e) { if (e.Day.Date.CompareTo(DateTime.Today) < 0) { e.Day.IsSelectable = false; e.Cell.BackColor = System.Drawing.Color.Empty; e.Cell.ForeColor = System.Drawing.Color.DarkRed; } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { string ctrl = Request.QueryString["ctl"]; HyperLink hpl = new HyperLink(); hpl.Text = ((LiteralControl)e.Cell.Controls[0]).Text; hpl.NavigateUrl = "javascript:SetDate('" + e.Day.Date.ToShortDateString() + "','" + ctrl + "');"; e.Cell.Controls.Clear(); e.Cell.Controls.Add(hpl); }
protected void Calendar_DayRender(object sender, DayRenderEventArgs e) { string id = Request.QueryString["ID"] ?? ""; if (id != "") { VanBan data = VanBan.LayTheoID(id); if (data != null) Calendar.SelectedDate = data.NgayBanHanh; } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { CalendarDay d = e.Day; TableCell c = e.Cell; if (assignment[d.Date.Month, d.Date.Day] != null) { c.Controls.Add(new LiteralControl("<br><span style='font-size:8pt;color:#993300'>" + assignment[d.Date.Month, d.Date.Day] + "</span></font>")); } }
protected void PromoDate_DayRender(object sender, DayRenderEventArgs e) { var self = sender as Calendar; var isEnd = self == this.PromoDateEnd; var promotions = Items["Promotions"]; if (e.Day.Date < DateTime.Today || isEnd && e.Day.Date < this.PromoDateStart.SelectedDate || Promotions.Any(r => r.Field<DateTime>("PromotionFrom") <= e.Day.Date && r.Field<DateTime>("PromotionTo") >= e.Day.Date) ) { e.Day.IsSelectable = false; } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { DataSet MYDT = ZWL.DBUtility.DbHelperSQL.GetDataSet("select TitleStr,ID,GongXiangWho from ERPAnPai where datediff(day,TimeStart,'" + e.Day.Date.ToString() + "')=0 and UserName='******'"); for (int i = 0; i < MYDT.Tables[0].Rows.Count; i++) { e.Cell.BackColor = System.Drawing.Color.AntiqueWhite; e.Cell.ToolTip = MYDT.Tables[0].Rows[i]["TitleStr"].ToString(); Label MyContent = new Label(); MyContent.Text = "<BR><a href=\"RiChengView.aspx?ID=" + MYDT.Tables[0].Rows[i]["ID"].ToString() + " \">" + MYDT.Tables[0].Rows[i]["TitleStr"].ToString() + "【" + MYDT.Tables[0].Rows[i]["GongXiangWho"].ToString() + "】</a>"; MyContent.ForeColor = System.Drawing.Color.White; e.Cell.Controls.Add(MyContent); } }
//ENABLE AND DISABLE APPROPRIATE DATES protected void DayRender(object sender, DayRenderEventArgs e) { if (e.Day.Date == day1 || e.Day.Date == day2 || e.Day.Date == day3) { e.Day.IsSelectable = true; } else { e.Day.IsSelectable = false; e.Cell.BackColor = Color.LightGray; e.Cell.ForeColor = Color.DarkGray; } }
protected void wkDayCalendar_DayRender(object sender, DayRenderEventArgs e) { e.Day.IsSelectable = !e.Day.IsWeekend; if (e.Day.Date < (System.DateTime.Now.AddDays(-1)))//.AddDays(_nDaysToBlock))) { e.Cell.BackColor = System.Drawing.Color.Beige; e.Day.IsSelectable = false; e.Cell.Font.Strikeout = true; } if((e.Day.IsSelected == true)){ list.Add(e.Day.Date); } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { ListItem li = ListBox1.Items.FindByText(e.Day.Date.ToString("MMMM - dd - yyyy")); if(li != null) { if (li.Value == RadioButton1.Text) e.Cell.BackColor = Color.Red; else if (li.Value == RadioButton2.Text) e.Cell.BackColor = Color.Blue; else if (li.Value == RadioButton3.Text) e.Cell.BackColor = Color.Yellow; } }
protected void Calendar1_DayRender(object sender, 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.Gray; e.Day.IsSelectable = false; } }
protected void calMeetings_DayRender(object sender, DayRenderEventArgs e) { // the selector function does only make problems if more than a whole year is displayed IEnumerable<Meeting> maTodayMeetings = relevantMeetings.Where(meeting => meeting.datMeeting.DayOfYear == e.Day.Date.DayOfYear); foreach (Meeting thisMeeting in maTodayMeetings) { e.Cell.CssClass = "selectedMeeting"; // this is set if maTodayMeetings has at least one element if (thisMeeting.datModified.CompareTo(CurrentUser.lastLogin) > 0) { e.Cell.CssClass += " updatedMeeting"; return; } } //e.Cell.Font.Bold = true; }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { DateTime date = new DateTime(e.Day.Date.Year, e.Day.Date.Month, e.Day.Date.Day); lstrdv = RendezVousDAL.GetRDVbyDate(date); if (lstrdv.Count > 0) { if (Calendar1.SelectedDate != date) { e.Cell.BackColor = Color.Green; e.Cell.ForeColor = Color.Black; } e.Cell.Controls.Add(new LiteralControl("<br>" + lstrdv.Count + " rdv")); } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { int renderingDate = e.Day.Date.Day; // Checks date is in the list if (dates.Contains(renderingDate)) { int currentIndex = dates.IndexOf(renderingDate); string eventName = events[currentIndex]; // Make the label Label eventLabel = new Label(); eventLabel.Text = "</br>" + eventName; // Add to the calender e.Cell.Controls.Add(eventLabel); } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { e.Cell.Attributes.Add("onmouseover", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#CC33FF'"); e.Cell.Attributes.Add("onmouseout", "this.style.backgroundColor=this.originalstyle;"); int doctorId = Convert.ToInt32(Session["doctorId"].ToString()); Doctor_GetCalendarAppointmentsBL objDoctor_GetCalendarAppointmentsBL = new Doctor_GetCalendarAppointmentsBL(); DataSet ds = objDoctor_GetCalendarAppointmentsBL.Doctor_GetCalendarAppointments(doctorId); for(int i = 0; i < ds.Tables[0].Rows.Count; i++) { int appointmentCount = Convert.ToInt32(ds.Tables[0].Rows[i]["APPOINTMENT_COUNT"].ToString()); string appointmentDate = ds.Tables[0].Rows[i]["APPOINTMENT_DATE"].ToString(); DateTime dt = Convert.ToDateTime(appointmentDate); string url = "DoctorViewAppointmentsByDate.aspx?date=" + e.Day.Date.ToString(); HyperLink hyperlink = new HyperLink(); hyperlink.ID = "hyperlink"; hyperlink.Text = "<br /><b>" + appointmentCount + " Appointments</b>"; hyperlink.Target = "_blank"; hyperlink.NavigateUrl = "javascript:void(0)"; hyperlink.Attributes.Add("onclick", "javascript:window.open('" + url + "','','height=500,width=600,scrollbars');"); hyperlink.ForeColor = System.Drawing.Color.Yellow; if(e.Day.Date == dt) { e.Cell.Controls.Add(hyperlink); } } int empId = Convert.ToInt32(Session["doctorId"].ToString()); Common_GetReminderBL objGetReminderBL = new Common_GetReminderBL(); DataSet ds1 = objGetReminderBL.Common_GetReminder(empId); for(int i = 0; i < ds1.Tables[0].Rows.Count; i++) { int reminderCount = Convert.ToInt32(ds1.Tables[0].Rows[i]["REMINDER_COUNT"].ToString()); string reminderDate = ds1.Tables[0].Rows[i]["REMINDER_DATE"].ToString(); DateTime dt = Convert.ToDateTime(reminderDate); HyperLink hyperlink = new HyperLink(); hyperlink.ID = "hyperlink"; hyperlink.Text = "<br /><b>" + reminderCount + " Reminder</b>"; hyperlink.Target = "_blank"; hyperlink.NavigateUrl = "javascript:void(0)"; hyperlink.Attributes.Add("onclick", "javascript:window.open('" + "../ViewCalendarReminder.aspx?date=" + e.Day.Date.ToString() + "','','height=500,width=550,scrollbars');"); hyperlink.ForeColor = System.Drawing.Color.Yellow; if(e.Day.Date == dt) { e.Cell.Controls.Add(hyperlink); } } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { string lineType = litLineType.Text; // 获取线路类型 if (lineType == "每天发团") { // 可以选择一周之内的出行时间 e.Day.IsSelectable = (e.Day.Date >= DateTime.Now.Date) && (e.Day.Date < DateTime.Now.Date.AddDays(7)); } else if (lineType == "周末发团") { // 周末发团,可以选择三周之内的时间出行 e.Day.IsSelectable = (e.Day.Date >= DateTime.Now.Date) && ((e.Day.Date.DayOfWeek == DayOfWeek.Sunday) || (e.Day.Date.DayOfWeek == DayOfWeek.Saturday)) && (e.Day.Date < DateTime.Now.Date.AddDays(21)); } else { e.Day.IsSelectable = e.Day.Date >= DateTime.Now.Date; } }
protected void cal_DayRender(object sender, DayRenderEventArgs e) { string d= cal.TodaysDate.ToShortDateString(); if(e.Day.IsToday) { e.Cell.BackColor = System.Drawing.Color.Coral; Label lbl = new Label(); lbl.Text = "<br/>"+name; e.Cell.Controls.Add(lbl); } if (e.Day.Date > DateTime.Today) { e.Day.IsSelectable = false; } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { //use data reader to fill the calendar. try { System.Data.SqlClient.SqlConnection conn = null; System.Data.SqlClient.SqlCommand selectCommand = null; try { try { conn = new System.Data.SqlClient.SqlConnection(SqlDataSource1.ConnectionString.ToString()); conn.Open(); selectCommand = new System.Data.SqlClient.SqlCommand("SELECT CLASS_CALENDAR.CCE_DATE, CLASS_CALENDAR.CCE_CONTENT FROM CLASS_INSTANCE INNER JOIN CLASS_CALENDAR ON CLASS_INSTANCE.CLS_ID = CLASS_CALENDAR.CLS_ID WHERE (CLASS_INSTANCE.CDT_ID = @CDT)", conn); selectCommand.Parameters.Add("CDT",SqlDbType.UniqueIdentifier).Value = id; IDataReader dr = selectCommand.ExecuteReader(); while (dr.Read()) { DateTime date = (DateTime)dr[0]; string content = dr[1].ToString(); if (e.Day.Date.ToShortDateString() == date.ToShortDateString()) { e.Cell.BackColor = Color.Firebrick; } } } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } } finally { if (conn != null) conn.Close(); } } catch (Exception ex) { lblResult.Text = "Error: " + ex.Message; } }
private void Calendar1_DayRender(Object source, DayRenderEventArgs e) { try { var holidaylist = objhrms.tbl_E_CalendarHoliday.FirstOrDefault( c => c.IsDeleted == false && c.IsPublished == true && c.OccasionDate == e.Day.Date); var firstdateofthemonth = GetFirstDayOfMonth(e.Day.Date); if (e.Day.IsWeekend) { e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#f1f1f1"); e.Cell.ToolTip = "Weekend"; } if (e.Day.IsToday) { e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFACD"); e.Cell.ForeColor = System.Drawing.Color.Black; } //var lastdate = GetLastDayofMonth(e.Day.Date); if (firstdateofthemonth == e.Day.Date) { e.Cell.Controls.Add( new LiteralControl( "<div style='padding-right:20px;color:#222222;margin-top:-16px;font-weight:bold;font-size:12px;'>" + e.Day.Date.ToString("MMMM").ToUpper() + "<br/></div>")); } if (Page.User.IsInRole("Admin")) { List <LeaveStatu> adminresult; if (Dddepartment.SelectedItem.Text == "Show All") { adminresult = objhrms.LeaveStatus.Where(c => (c.FromDate <= e.Day.Date && c.ToDate >= e.Day.Date)).ToList(); } else { adminresult = objhrms.LeaveStatus.Where(c => c.Department == Dddepartment.SelectedValue && (c.FromDate <= e.Day.Date && c.ToDate >= e.Day.Date)).ToList(); } if (adminresult.Count != 0) { string status = string.Empty; foreach (var items in adminresult) { var firstOrDefault = objhrms.Employees.FirstOrDefault(c => c.Emp_Id == items.Emp_id); if (firstOrDefault != null) { // status = status + "<tr valign='top' style='height:20px;'><td>" + // StrSplitMethod(firstOrDefault.FullName) + // "</td>" + // "<td>" + ApplyCss(Convert.ToInt32(items.EmpLeaveStatus)) + "</td></tr>"; //} status = status + "<tr valign='top' style='height:20px;'><td>" + StrSplitMethod(firstOrDefault.FullName) + "</td>" + "<td class='calendar' " + "dayofweek=" + "'" + e.Day.Date.DayOfWeek + "'" + "msg=" + "'" + "Applied On" + ": " + Convert.ToDateTime(items.LeaveAppliedDate).ToString("dd MMMM, yyyy") + "<br/>" + GetEmployeename(items.FirstLineManager_id) + ": " + ApplyCssForpopup(Convert.ToInt32(items.FirstLineManagerStatus)) + "<br/>" + GetEmployeename(items.SecondLineManager_id) + ": " + ApplyCssForpopup(Convert.ToInt32(items.SecondLineManagerStatus)) + "<br/>" + GetEmployeename(items.Hr_id) + ": " + ApplyCssForpopup(Convert.ToInt32(items.Hr_Status)) + "'>" + ApplyCss(Convert.ToInt32(items.EmpLeaveStatus)) + "</td></tr>"; } } if (holidaylist != null) { e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCEEFF"); e.Cell.Controls.Add(new LiteralControl("<div style='min-height:20px; text-align:center; font-size:10px; font-family:Verdana; font-weight: normal; color:Black; '>" + holidaylist.OccasionName + "</div>")); e.Cell.ToolTip = "Holiday"; } e.Cell.Controls.Add( new LiteralControl( "<div style='min-height:88px;'><table style='text-align:left; font-size:10px; font-family:Verdana; font-weight: normal; color:#238EC6; padding-right:10px;'>" + status + "</table></div>")); } else { if (holidaylist != null) { e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCEEFF"); e.Cell.Controls.Add(new LiteralControl("<div style='min-height:88px; text-align:center; font-size:10px; font-family:Verdana; font-weight: normal; color:Black; '>" + holidaylist.OccasionName + "</div>")); e.Cell.ToolTip = "Holiday"; } else { e.Cell.Controls.Add(new LiteralControl("<div style='min-height:88px;'> </div>")); } } } else { List <LeaveStatu> result; var firstOrDefault = objhrms.Employees.FirstOrDefault(c => c.Emp_Id == Page.User.Identity.Name); string empid = Convert.ToString(firstOrDefault.ID); if (objhrms.tbl_E_Department.Any(c => c.DepartmentHead == empid)) { result = Dddepartment.SelectedItem.Text == "Show All" ? objhrms.LeaveStatus.Where(c => (c.FromDate <= e.Day.Date && c.ToDate >= e.Day.Date)).ToList() : objhrms.LeaveStatus.Where(c => c.Department == Dddepartment.SelectedValue && (c.FromDate <= e.Day.Date && c.ToDate >= e.Day.Date)).ToList(); } else { var departmentname = firstOrDefault.fkDepartment.ToString(); result = objhrms.LeaveStatus.Where(c => c.Department == departmentname && (c.FromDate <= e.Day.Date && c.ToDate >= e.Day.Date)).ToList(); } if (result.Count != 0) { string status = string.Empty; foreach (var items in result) { var orDefault = objhrms.Employees.FirstOrDefault(c => c.Emp_Id == items.Emp_id); if (orDefault != null) { status = status + "<tr valign='top' style='height:20px;'><td>" + StrSplitMethod(orDefault.FullName) + "</td>" + // "<td class='leavestatus' msg=''>" + ApplyCss(Convert.ToInt32(items.EmpLeaveStatus)) + "</td></tr>"; "<td class='calendar' " + "dayofweek=" + "'" + e.Day.Date.DayOfWeek + "'" + "msg=" + "'" + "Applied On" + ": " + Convert.ToDateTime(items.LeaveAppliedDate).ToString("dd MMMM, yyyy") + "<br/>" + GetEmployeename(items.FirstLineManager_id) + ": " + ApplyCssForpopup(Convert.ToInt32(items.FirstLineManagerStatus)) + "<br/>" + GetEmployeename(items.SecondLineManager_id) + ": " + ApplyCssForpopup(Convert.ToInt32(items.SecondLineManagerStatus)) + "<br/>" + GetEmployeename(items.Hr_id) + ": " + ApplyCssForpopup(Convert.ToInt32(items.Hr_Status)) + "'>" + ApplyCss(Convert.ToInt32(items.EmpLeaveStatus)) + "</td></tr>"; } } if (holidaylist != null) { e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCEEFF"); e.Cell.Controls.Add(new LiteralControl("<div style='min-height:20px; text-align:center; font-size:10px; font-family:Verdana; font-weight: normal; color:Black; '>" + holidaylist.OccasionName + "</div>")); e.Cell.ToolTip = "Holiday"; } e.Cell.Controls.Add( new LiteralControl( "<div style='min-height:88px;'><table style='text-align:left; font-size:10px; font-family:Verdana; font-weight: normal; color:#238EC6; padding-right:10px;'>" + status + "</table></div>")); } else { if (holidaylist != null) { e.Cell.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCEEFF"); e.Cell.Controls.Add(new LiteralControl("<div style='min-height:88px; text-align:center; font-size:10px; font-family:Verdana; font-weight: normal; color:Black; '>" + holidaylist.OccasionName + "</div>")); e.Cell.ToolTip = "Holiday"; } else { e.Cell.Controls.Add(new LiteralControl("<div style='min-height:88px;'> </div>")); } } } } catch (Exception ex) { lblErrorMessage.Text = ex.Message; lblErrorMessage.CssClass = "error"; lblErrorMessage.Visible = true; } }
/// <summary> /// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DayRender(object sender, DayRenderEventArgs e) { Session["Calendar"] = oCalendar; oCalendar = new Class.Calendar(); oDB = new DB.Data(); PetName = ""; PetName = Request.QueryString["Name"]; DataTable dtDates = new DataTable(); DataTable dtPet = new DataTable(); Debug.WriteLine(PetName); if (Session["User"] == null) { } //else if (PetName == null) //{ // oUser = (PetStore.Class.User)Session["User"]; // PetName = oDB.GetFirstPetName(oUser.ID); // if (PetName == "") // { // oUser = (PetStore.Class.User)Session["User"]; // } else { oUser = (PetStore.Class.User)Session["User"]; dtDates = oDB.GetDates(oUser.ID); dtPets = oDB.GetPets(oUser.ID); int i = 0; DateTime day; e.Day.IsSelectable = false; dtPet = oDB.GetPet(oUser.ID, PetName); foreach (DataRow row in dtDates.Rows) { if (dtDates.Rows[i]["Pet"].ToString() == Pet) { day = Convert.ToDateTime(dtDates.Rows[i]["Date"]); day = day.Date; if (e.Day.Date == day) { e.Cell.BackColor = Color.LightBlue; e.Day.IsSelectable = true; } } i++; } if (e.Day.IsToday) { e.Cell.BackColor = Color.Tomato; } else if (e.Day.IsSelected) { e.Cell.BackColor = Color.Orange; } // } // end else //}//end if PetName==Null } SqlConnection.ClearAllPools(); }//end dayrender void
protected void CalPlan_DayRender(object sender, DayRenderEventArgs e) { CalendarDay d = ((DayRenderEventArgs)e).Day; TableCell c = ((DayRenderEventArgs)e).Cell; if (intPreMonth == 0) { //日历控件初始化时取得的是第一个月并不是当前月,而是前一个月的月份 if (d.Date.Month != DateTime.Now.Month) { intPreMonth = d.Date.Month; //if (intPreMonth == 12) intPreYear = d.Date.Year; } else { intPreMonth = DateTime.Now.Month; intPreYear = DateTime.Now.Year; } intCurrentMonth = intPreMonth + 1; intCurrentYear = d.Date.Year; if (intCurrentMonth > 12) { intCurrentMonth = 1; intCurrentYear = intPreYear + 1; } intNextMonth = intCurrentMonth + 1; intNextYear = intCurrentYear; if (intNextMonth > 12) { intNextMonth = 1; intNextYear = intCurrentYear + 1; } //得到前一个月有plan的日期数组 //arrPreDays = getArrayDay(d.Date.Year, intPreMonth); //得到当月有plan的日期数组 BLL.C_Curriculum bll = new C_Curriculum(); arrCurrentDays = bll.GetList(intCurrentYear, intCurrentMonth, hdfOpenID.Value); //得到下个月有plan的日期数组 //arrNextDays = getArrayDay(d.Date.Year, intNextMonth); } string strDate = d.Date.Year + "-" + d.Date.Month + "-" + d.Date.Day; string title = d.Date.Month.ToString() + "月" + d.Date.Day.ToString() + "日"; //鼠标移上时显示相应的月日 c.Controls.Clear(); //绘制前先清除 //打开新窗口传递参数. c.Controls.Add(new LiteralControl("<font size = '3' > " + d.Date.Day + " <font>")); int j = 0; int Rownum = 0; if (d.Date.Month.Equals(intPreMonth)) { c.Controls.Clear();//让上月日期不可见 } else if (d.Date.Month.Equals(intCurrentMonth)) { title = d.Date.Month.ToString() + "月" + d.Date.Day.ToString() + "日";//鼠标移上时显示相应的月日 //=====若当月的会议次数为N,当月天数为M 则循环执行M*N次=============================// while (j < arrCurrentDays.Rows.Count) { if (d.Date.Day.Equals(DateTime.Parse(arrCurrentDays.Rows[j]["CurriculumDate"].ToString()).Day)) //判断当前日期的第几天是否与日期数组中的某一个相等 { Rownum++; planTitle = "(" + Rownum.ToString() + ")" + arrCurrentDays.Rows[j]["CurriculumName"] + "<br />";//标题索引与天的索引是一一对应的 if (Rownum == 1) { c.Controls.Clear(); } //当前月有会议安排的日期并设置相应的字体格式于样式 c.BorderWidth = 1; c.BorderColor = System.Drawing.Color.Red; c.BackColor = System.Drawing.Color.Pink; string txt = "课程名称:" + arrCurrentDays.Rows[j]["CurriculumName"].ToString() + "\r\n"; txt += "课程时间:" + arrCurrentDays.Rows[j]["CurriculumDate"].ToString() + "\r\n"; txt += "授课教练:" + arrCurrentDays.Rows[j]["Teacher"].ToString() + "\r\n"; txt += "备注:" + arrCurrentDays.Rows[j]["CurriculumRemark"].ToString() + "\r\n"; if (Rownum == 1) { c.Controls.Add(new LiteralControl("<a href='#' onclick=javascript:SetLab('" + arrCurrentDays.Rows[j]["ID"].ToString() + "'" + ") title='" + title + "'><font color='blue' size='3'>" + d.Date.Day + "<font><br/><div style='text-align:center'><font color='blue' size='2'>" + planTitle + "<font></div></a><input type='hidden' id='" + arrCurrentDays.Rows[j]["ID"].ToString() + "' value='" + txt + "' />")); } else { c.Controls.Add(new LiteralControl("<a href='#' onclick=javascript:SetLab('" + arrCurrentDays.Rows[j]["ID"].ToString() + "'" + ") title='" + title + "'><div style='text-align:center'><font color='blue' size='2'>" + planTitle + "<font></div></a><input type='hidden' id='" + arrCurrentDays.Rows[j]["ID"].ToString() + "' value='" + txt + "' />")); } } j++; } //每次循环后清空变量 planTitle = string.Empty; } else if (d.Date.Month.Equals(intNextMonth)) { c.Controls.Clear();//让下月日期不可见 } }
protected void Calendar_DayRender(object sender, DayRenderEventArgs e) { e.Day.IsSelectable = !e.Day.IsWeekend; }
protected void RadCalendarAttendance_OnDayRender(object sender, DayRenderEventArgs e) { // Do a token replace.. e.Cell.Text = e.Cell.Text.Replace("{DayOfMonth}", e.Day.Date.Day.ToString()); }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { PrehledTreninkuController.SetDay(e); }
protected void MyCalendar_DayRender(Object source, DayRenderEventArgs e) { Label lbl = new Label(); Image img = new Image(); if (e.Day.IsOtherMonth) { e.Day.IsSelectable = false; } if (e.Day.Date.DayOfWeek == DayOfWeek.Wednesday && !e.Day.IsOtherMonth) { e.Cell.BackColor = System.Drawing.Color.LightGoldenrodYellow; lbl.Text = "<br/>"; img.ImageUrl = "~/Images/books.png"; img.Width = Unit.Pixel(20); img.Height = Unit.Pixel(20); e.Cell.Controls.Add(lbl); e.Cell.Controls.Add(img); } if ((e.Day.Date.Day == 3 || e.Day.Date.Day == 18 || e.Day.Date.Day == 27) && !e.Day.IsOtherMonth) { e.Cell.BackColor = System.Drawing.Color.GhostWhite; } if (e.Day.Date.Day == 12 && e.Day.Date.Month == 4) { lbl.Text = "<br/>40% off Sale!!"; lbl.ForeColor = System.Drawing.Color.Tomato; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } //Holidays if (e.Day.Date.Day == 1 && e.Day.Date.Month == 1) { lbl.Text = "<br/> New Year's Day"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 31 && e.Day.Date.Month == 12) { lbl.Text = "<br/> New Year's Eve"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 1 && e.Day.Date.Month == 4) { lbl.Text = "<br/> April Fool's Day"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 24 && e.Day.Date.Month == 12) { lbl.Text = "<br/> Christmas Eve"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 25 && e.Day.Date.Month == 12) { lbl.Text = "<br/> Christmas Day"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 15 && e.Day.Date.Month == 1) { lbl.Text = "<br/> Martin Luther King, Jr. Day"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 4 && e.Day.Date.Month == 7) { lbl.Text = "<br/> Independence Day"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 22 && e.Day.Date.Month == 11) { lbl.Text = "<br/> Thanksgiving"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 3 && e.Day.Date.Month == 9) { lbl.Text = "<br/> Labor Day"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 27 && e.Day.Date.Month == 5) { lbl.Text = "<br/> Memorial Day"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 14 && e.Day.Date.Month == 10) { lbl.Text = "<br/> Columbus Day"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } if (e.Day.Date.Day == 11 && e.Day.Date.Month == 11) { lbl.Text = "<br/> Veterans' Day"; lbl.ForeColor = System.Drawing.Color.Azure; lbl.Font.Size = 8; e.Cell.Controls.Add(lbl); } }
void cal_DayRender(Object sender, DayRenderEventArgs e) { e.Cell.Width = new Unit(_cellWidth, UnitType.Pixel); e.Cell.Height = new Unit(_cellHeight, UnitType.Pixel); Color noColorBG = System.Drawing.Color.FromArgb(0xc0, 0xc0, 0xc0); if (!e.Day.IsOtherMonth) { int weekNum = weekNumber(e.Day.Date); bool semainePaye = weekNum % 2 == (this.chkOtherWeek.Checked ? 0 : 1); Color myBgColor = _PapaColor; if (this.rad2sem.Checked) { if (e.Day.Date.DayOfWeek == _firstDayOfSwitch) { _weekBrakeValue++; } if (_weekBrakeValue == 4) { _weekBrakeValue = 0; } if (_weekBrakeValue == 0 || _weekBrakeValue == 1) { myBgColor = _PapaColor; } else { myBgColor = _MamaColor; } } else { if (weekNum % 2 == 0) { myBgColor = _PapaColor; } else { myBgColor = _MamaColor; } } if (this.chkInvertColor.Checked) { if (myBgColor == _PapaColor) { myBgColor = _MamaColor; } else { myBgColor = _PapaColor; } } if (this.chkHilitePayDay.Checked && e.Day.Date.DayOfWeek == selectedDayOfWeek() && semainePaye) { e.Cell.BackColor = System.Drawing.Color.Yellow; } else { e.Cell.BackColor = this.chkNoColor.Checked ? noColorBG : myBgColor; } loadDataset(); DataRow[] rowz = _dataset.Tables["dailynotes"].Select(String.Format("id_cal={0} AND notedate='{1}'", CurrentCalendarID, e.Day.Date.ToShortDateString())); if (rowz.Length > 0) { String note = rowz[0]["note"].ToString(); if (!String.IsNullOrEmpty(note)) { e.Cell.Style.Add("background-image", "url(star.gif)"); e.Cell.Style.Add("background-position", "center"); e.Cell.Style.Add("background-repeat", "no-repeat"); e.Cell.ForeColor = System.Drawing.Color.Black; e.Cell.ToolTip = note; } } } else { e.Cell.BackColor = e.Cell.ForeColor = System.Drawing.Color.White; } return; }
public void MenuDeliveryCalendarControl_DayRender(object sender, DayRenderEventArgs e) { Boolean showLine = true; if (calendarDataSet != null) { foreach (DataRow dr in calendarDataSet.Tables[0].Rows) { if (Convert.ToDateTime(dr["DeliveryDate"]).ToString("MM/dd/yyyy") == e.Day.Date.ToString("MM/dd/yyyy")) { LinkButton calendarLinkButton = new LinkButton(); string deliveryType = dr["DeliveryTypeName"].ToString().Trim(); if (deliveryType == "Rescheduled") { deliveryType = "Extra"; } e.Cell.Controls.Add(new LiteralControl("<br />")); calendarLinkButton.Text = deliveryType + " " + dr["MealTypeName"].ToString().Trim(); calendarLinkButton.Font.Name = "Arial"; calendarLinkButton.Font.Bold = false; calendarLinkButton.Font.Size = FontUnit.Parse("8"); if (e.Day.Date.Month != DeliveryCalendarControl.VisibleDate.Month) { calendarLinkButton.ForeColor = System.Drawing.ColorTranslator.FromHtml("#004D45"); } else { calendarLinkButton.ForeColor = System.Drawing.Color.White; } calendarLinkButton.ID = "ExceptionLinkButton" + GCFDGlobals.dbGetValue(dr, "DeliveryTypeID"); calendarLinkButton.Attributes.Add("href", "javascript:__doPostBack('CalendarLinkButton','" + e.Day.Date.ToString("MM/dd/yyyy") + "," + dr["DeliveryTypeName"].ToString().Trim() + "," + dr["MealTypeID"].ToString().Trim() + "')"); e.Cell.Controls.Add(calendarLinkButton); } } DateTime firstDate = e.Day.Date; DataRow[] drFiltered = mealCountTotalDataSet.Tables[0].Select("DeliveryDate = #" + e.Day.Date.ToString("MM/dd/yyyy") + "#"); for (int i = 0; i < drFiltered.Length; i++) { string mealCount = "0"; if (!String.IsNullOrEmpty(GCFDGlobals.dbGetValue(drFiltered[i], "MealCount"))) { mealCount = GCFDGlobals.dbGetValue(drFiltered[i], "MealCount"); } if (showLine) { e.Cell.Controls.Add(new LiteralControl("<hr />")); showLine = false; } Label mealCountLabel = new Label(); mealCountLabel.Text = GCFDGlobals.dbGetValue(drFiltered[i], "MealTypeName") + " Count = " + mealCount; mealCountLabel.Font.Name = "Arial"; mealCountLabel.Font.Bold = false; mealCountLabel.Font.Size = FontUnit.Parse("8"); mealCountLabel.ID = "MealCountButton" + GCFDGlobals.dbGetValue(drFiltered[i], "MealTypeID"); e.Cell.Controls.Add(mealCountLabel); e.Cell.Controls.Add(new LiteralControl("<br />")); } } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs de) { renderDate2(de); }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { try { #region oldregion DateTime TodaysDate = System.DateTime.Now;////////paetd by mmohit /// if (e.Day.Date.DayOfWeek == DayOfWeek.Sunday) if (e.Day.Date.DayOfWeek == DayOfWeek.Sunday && e.Day.Date < TodaysDate) { e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; //December DateTime dt = new DateTime(); string t = "2013-12-22 00:00:00.000"; dt = Convert.ToDateTime(t); if (e.Day.Date == dt) { e.Day.IsSelectable = true; e.Cell.ForeColor = System.Drawing.Color.Black; } } /// DateTime TodaysDate = System.DateTime.Now; if (TodaysDate.Date > e.Day.Date) { e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; } if (e.Day.Date == new DateTime(e.Day.Date.Year, 01, 01)) { e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; } if (e.Day.Date == new DateTime(e.Day.Date.Year, 07, 4)) { e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; } if (e.Day.Date == new DateTime(e.Day.Date.Year, 12, 25)) { e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; } //may if (e.Day.Date == new DateTime(2010, 05, 31)) { e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; } //september if (e.Day.Date == new DateTime(2010, 09, 06)) { e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; } //november if (e.Day.Date == new DateTime(2010, 11, 25)) { e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; } #endregion } catch { } }
private void calendarMonth_DayRender(object sender, DayRenderEventArgs e) { SharedBasePage requestPage = this.Page as SharedBasePage; MonthViewCalendar eventSource = sender as MonthViewCalendar; // This is a standard text label with just the day. This may get tossed later when // we add a HyperLink for those days that have entries. Otherwise, this serves to // override the default LinkButton/PostBack behavior. e.Cell.Controls.Clear(); Literal day = new Literal(); day.Text = e.Day.DayNumberText; e.Cell.Controls.Add(day); //For every entry this month, see if we have to render it in this day. // I'm sure there are cleaner and faster ways to get this, but I'm using OutputCaching // in the ASCX page, so I don't feel so bad. It's inefficient, but it's largely cached. bool controlsCleared = false; foreach (Entry entry in eventSource.EntriesThisMonth) { if (e.Day.Date == entry.CreatedLocalTime.Date) { if (controlsCleared == false) { controlsCleared = true; //Override the default LinkButton and PostBack stuff and // replace with a simpler HyperLink Control. e.Cell.Controls.Clear(); HyperLink dayLink = new HyperLink(); dayLink.Text = e.Day.DayNumberText; dayLink.NavigateUrl = SiteUtilities.GetDayViewUrl(requestPage.SiteConfig, e.Day.Date); e.Cell.Controls.Add(dayLink); } e.Day.IsSelectable = false; Literal lit = new Literal(); lit.Text = "<br />"; e.Cell.Controls.Add(lit); HyperLink link = new HyperLink(); link.Text = (entry.Title != null ? entry.Title : TruncateDotDotDot(entry.Content)); link.NavigateUrl = SiteUtilities.GetPermaLinkUrl(requestPage.SiteConfig, (ITitledEntry)entry); e.Cell.Controls.Add(link); e.Day.IsSelectable = true; //Poorman's spacer Literal lit2 = new Literal(); lit2.Text = "<br />-<br />"; e.Cell.Controls.Add(lit2); } } // Because we are using the CssClass property, we explicitely want to check // whether a day is both weekend _and_ lastmonth. // Otherwise this day would show up either // with 'hCalendarOtherMonthStyle' or with 'hCalendarWeekendStyle'. if ((e.Day.IsWeekend) && (e.Day.IsOtherMonth)) { e.Cell.CssClass = "lCalendarOtherMonthWeekendStyle"; } }
void DayRender(Object sender, DayRenderEventArgs e) { //if (e.Day.Date.Month != this.Calendar1.VisibleDate.Month) //{ // e.Cell.Text = ""; //} e.Day.IsSelectable = false; string futureflag = "N"; StringBuilder objtablebuilder = new StringBuilder(); objtablebuilder.Append("<table style='width:80%'>"); objtablebuilder.Append("<tr>"); objtablebuilder.Append("<td colspan='2' align='left'>"); // if(e.) if (!checkcutoffdate(e.Day.Date)) { // e.Cell.Enabled = true; e.Cell.BackColor = System.Drawing.Color.LightBlue; //Rajneeh-14-sep // if ((e.Day.Date.ToString("dddd") == "Saturday" && ((e.Day.Date.Day > 7 & e.Day.Date.Day < 15) || (e.Day.Date.Day > 21 && e.Day.Date.Day < 29))) || e.Day.Date.ToString("dddd") == "Sunday") //comment on 21 March2018 //if ((e.Day.Date.ToString("dddd") == "Saturday" && ((e.Day.Date.Day > 7 & e.Day.Date.Day < 15) || (e.Day.Date.Day > 21 && e.Day.Date.Day < 29)) && e.Day.Date < Convert.ToDateTime("08/18/2017"))) //{ // e.Cell.BackColor = System.Drawing.Color.LightGreen;// .LightSkyBlue; // // e.Cell.ForeColor = System.Drawing.Color.DarkGreen; // e.Cell.Font.Bold = true; // objtablebuilder.Append("Week-Off"); //} ////else if ((e.Day.Date.ToString("dddd") == "Saturday" && ((e.Day.Date.Day > 7 & e.Day.Date.Day < 21)) && e.Day.Date > Convert.ToDateTime("08/18/2017")) || e.Day.Date.ToString("dddd") == "Sunday") //else if ((e.Day.Date.ToString("dddd") == "Saturday" && ((e.Day.Date.Day > 7 & e.Day.Date.Day < 22)) && e.Day.Date > Convert.ToDateTime("08/18/2017")) || e.Day.Date.ToString("dddd") == "Sunday") //{ // e.Cell.BackColor = System.Drawing.Color.LightGreen;// .LightSkyBlue; // //// e.Cell.ForeColor = System.Drawing.Color.DarkGreen; // //e.Cell.Font.Bold = true; // //objtablebuilder.Append("Week-Off"); //} //else //endcomment 21march 2018 if (e.Day.Date.ToString("dddd") == "Sunday") { e.Cell.BackColor = System.Drawing.Color.LightGreen;// .LightSkyBlue; // e.Cell.ForeColor = System.Drawing.Color.DarkGreen; e.Cell.Font.Bold = true; // objtablebuilder.Append("Week-Off"); objtablebuilder.Append("<a href='Addefforts.aspx?date=" + e.Day.Date.ToString("dd/MM/yyyy") + "'> Add Efforts</a>"); } else if (IsOnLeave(e.Day.Date.Day) && e.Day.Date.Month == currentmonth) { e.Cell.BackColor = System.Drawing.Color.MediumPurple;// .LightSkyBlue; //e.Cell.Font.Bold = true; ; //objtablebuilder.Append("On-Leave"); //e.Day.IsSelectable = false; //futureflag = "N"; } else if (IsOnCompOff(e.Day.Date.Day) && e.Day.Date.Month == currentmonth) { e.Cell.BackColor = System.Drawing.Color.MediumOrchid;// .LightSkyBlue; //e.Cell.Font.Bold = true; ; //objtablebuilder.Append("On-Leave"); //e.Day.IsSelectable = false; //futureflag = "N"; } else if (!checkAdditioncutoffdate(e.Day.Date)) { // e.Cell.BackColor = System.Drawing.Color.Green; objtablebuilder.Append("<a href='Addefforts.aspx?date=" + e.Day.Date.ToString("dd/MM/yyyy") + "'> Add Efforts</a>"); } else { e.Cell.BackColor = System.Drawing.Color.LightGray; e.Day.IsSelectable = false; futureflag = "Y"; } } else { // e.Cell.Enabled = false; e.Cell.BackColor = System.Drawing.Color.LightPink; } if (Session["Currentmonthefforts"] != null) { decimal Todaysefforts = 0; string dat = e.Day.Date.ToString("dd/MM/yyyy"); dat = dat.Replace("-", "/"); DataRow[] DR = ((DataTable)Session["Currentmonthefforts"]).Select("TEDate='" + e.Day.Date.ToString("dd/MM/yyyy") + "'"); DataRow[] DR1 = ((DataTable)Session["Currentmonthefforts"]).Select("TEDate='" + dat + "'"); DataTable dt = (DataTable)Session["Currentmonthefforts"]; decimal check = 0; if (DR1 != null && DR1.Count() > 0) { check = Convert.ToDecimal(DR1[0]["ActualEfforts"]); } //if (IsOnLeave(e.Day.Date.Day)) // e.Cell.Text = "On-Leave";else if (e.Day.Date > this.Calendar1.TodaysDate && e.Day.Date.Month > this.Calendar1.TodaysDate.Month) { e.Cell.Text = ""; } else { objtablebuilder.Append("</td>"); objtablebuilder.Append("</tr>"); objtablebuilder.Append("<tr>"); objtablebuilder.Append("<td align='left'>"); //Rajneesh-14Sep2017 //if ((e.Day.Date.ToString("dddd") == "Saturday" && ((e.Day.Date.Day > 7 & e.Day.Date.Day < 15) || (e.Day.Date.Day > 21 && e.Day.Date.Day < 29))) || e.Day.Date.ToString("dddd") == "Sunday") //if ((e.Day.Date.ToString("dddd") == "Saturday" && ((e.Day.Date.Day > 7 & e.Day.Date.Day < 15) || (e.Day.Date.Day > 21 && e.Day.Date.Day < 29)) && e.Day.Date < Convert.ToDateTime("08/18/2017"))) //{ // e.Cell.BackColor = System.Drawing.Color.LightGreen;// .LightSkyBlue; // // e.Cell.ForeColor = System.Drawing.Color.DarkGreen; // e.Cell.Font.Bold = true; // objtablebuilder.Append("Week-Off"); //} //else if ((e.Day.Date.ToString("dddd") == "Saturday" && ((e.Day.Date.Day > 7 & e.Day.Date.Day < 22)) && e.Day.Date > Convert.ToDateTime("08/18/2017")) || e.Day.Date.ToString("dddd") == "Sunday") if (e.Day.Date.ToString("dddd") == "Sunday" && check < 1) //((DR != null && DR.Count() > 0) ? (Convert.ToDecimal(DR[0]["ActualEfforts"]) < 1 ? true : false) : true)) { e.Cell.BackColor = System.Drawing.Color.LightGreen; // .LightSkyBlue; // e.Cell.ForeColor = System.Drawing.Color.DarkGreen; e.Cell.Font.Bold = true; objtablebuilder.Append("Week-Off"); } else if (IsOnLeave(e.Day.Date.Day) && e.Day.Date.Month == currentmonth) { e.Cell.BackColor = System.Drawing.Color.MediumPurple;// .LightSkyBlue; // e.Cell.ForeColor = System.Drawing.Color.DarkGreen; e.Cell.Font.Bold = true; objtablebuilder.Append("On-Leave"); } else if (IsOnCompOff(e.Day.Date.Day) && e.Day.Date.Month == currentmonth) { e.Cell.BackColor = System.Drawing.Color.MediumOrchid;// .LightSkyBlue; // e.Cell.ForeColor = System.Drawing.Color.DarkGreen; e.Cell.Font.Bold = true; objtablebuilder.Append("Comp-Off"); } else { objtablebuilder.Append("Actual Efforts :"); objtablebuilder.Append("</td>"); objtablebuilder.Append("<td align='left'>"); if (DR != null && DR.Count() > 0) { Todaysefforts = Convert.ToDecimal(DR[0]["ActualEfforts"]); //e.Cell.Controls.Add(new LiteralControl("<br/>AE=" + Todaysefforts)); } else if (DR1 != null && DR1.Count() > 0) { Todaysefforts = Convert.ToDecimal(DR1[0]["ActualEfforts"]); } objtablebuilder.Append(Todaysefforts); } objtablebuilder.Append("</td>"); objtablebuilder.Append("</tr>"); objtablebuilder.Append("</table>"); if (futureflag == "N") { e.Cell.Controls.Add(new LiteralControl(objtablebuilder.ToString())); } objtablebuilder.Clear(); } } // 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")); //} e.Cell.Height = 90; e.Cell.Width = 50; }
protected void calendarFechas_DayRender(object sender, DayRenderEventArgs e) { e.Day.IsSelectable = false; }
protected void startDateCalendar_DayRender(object sender, DayRenderEventArgs e) { //if the day is full make it red //if james is already working, make it yellow if (TwilightCheckbox.Checked) { float date1 = (e.Day.Date - DateTime.Today.Date).Days; date1 -= .41f; if (e.Day.Date < DateTime.Today.Date) { //e.Day.IsSelectable = false; e.Cell.BackColor = System.Drawing.Color.DarkGray; } else { if (e.Day.Date == DateTime.Today.Date) { //e.Day.IsSelectable = false; e.Cell.Font.Underline = true; e.Cell.Font.Bold = true; //e.Cell.Font.Italic = true; } var reader = DbConn.dBRead("EXEC getTwilightDateInfo '" + e.Day.Date + "'"); try { if (reader.Read()) { if ((bool)reader["isActive"] == true) { if ((int)reader["Openings"] > 0) { e.Cell.ForeColor = System.Drawing.Color.Green; } if ((int)reader["Openings"] <= 0) { e.Cell.ForeColor = System.Drawing.Color.Red; e.Day.IsSelectable = false; } } else { e.Day.IsSelectable = false; } } } catch { //e.Cell.BackColor = System.Drawing.Color.Green; } } } else { float date1 = (e.Day.Date - DateTime.Today.Date).Days; date1 -= .41f; if (e.Day.Date < DateTime.Today.Date) { //e.Day.IsSelectable = false; e.Cell.BackColor = System.Drawing.Color.DarkGray; } else { if (e.Day.Date == DateTime.Today.Date) { //e.Day.IsSelectable = false; e.Cell.Font.Underline = true; e.Cell.Font.Bold = true; //e.Cell.Font.Italic = true; } var reader = DbConn.dBRead("EXEC getDayDateInfo '" + e.Day.Date + "'"); try { if (reader.Read()) { if ((bool)reader["isActive"] == true) { if ((int)reader["Openings"] > 0) { e.Cell.ForeColor = System.Drawing.Color.Green; } if ((bool)reader["IsJames"] == false) { e.Cell.ForeColor = System.Drawing.Color.Orange; } if ((int)reader["Openings"] <= 0) { e.Cell.ForeColor = System.Drawing.Color.Red; e.Day.IsSelectable = false; } } else { e.Day.IsSelectable = false; } } } catch { //e.Cell.BackColor = System.Drawing.Color.Green; } } } }
private void DayRenderEventHandler(object sender, DayRenderEventArgs e) { days++; e.Cell.BackColor = Color.Yellow; }
protected void Calendar1_DayRender1(object sender, DayRenderEventArgs e) { }
protected void Calendar1_DayRender1(object sender, DayRenderEventArgs e) { //Chart2.Titles[0].Text = " 的趋势区线"; for (int i = 0; i < ListBox3.Items.Count; i++) { string date = ListBox3.Items[i].Value.ToString(); string hour = string_caozuo.Get_Xiahuaxian_String(date, 1); string min = string_caozuo.Get_Xiahuaxian_String(date, 2); string sec = string_caozuo.Get_Xiahuaxian_String(date, 3); //e.Day.IsSelectable = e.Day.Date == DateTime.Parse(hour + "-" + min + "-" + sec); //if (e.Day.Date != DateTime.Parse(hour + "-" + min + "-" + sec)) //{ // e.Cell.ForeColor = System.Drawing.Color.LightGray; //} } // if (Calendar1.SelectedDate == DateTime.Parse("1900-01-01")) return; if (e.Day.IsSelected == true) { // 选择了某日 #region // DateTime select_datetime = Calendar1.SelectedDate; //string date_string = select_datetime.Year.ToString().PadLeft(4, '0') + "_" + select_datetime.Month.ToString().PadLeft(2, '0') + "_" + select_datetime.Day.ToString().PadLeft(2, '0'); ArrayList filelist_1 = FileCaozuo.Read_All_Files("D:\\data\\", "*.txt"); // 读取第一个文件作为基准 string file_jizhun = (string)filelist_1[0]; string[] jizhun_list = FileCaozuo.Read_All_Line("D:\\data\\" + file_jizhun); int count = 0; double jizhun = 0; string position_string = ""; // 寻找相应的索引 foreach (string line in jizhun_list) { position_string = string_caozuo.Get_Table_String(line, 1); string postion_value_string = string_caozuo.Get_Table_String(line, 2); double positon_value = double.Parse(postion_value_string); double position = double.Parse(position_string); count++; if (position == click_value) { jizhun = positon_value; break; } } // 查询一天的 Chart2.Series[0].Points.Clear(); try { ArrayList filelist = FileCaozuo.Read_All_Files("D:\\data\\" + listbox3_select, "*.txt"); foreach (string file in filelist) { try { ArrayList allfiles = FileCaozuo.Read_All_Files("D:\\data\\" + listbox3_select, "*.txt"); string myline = FileCaozuo.Get_Line("D:\\data\\" + listbox3_select + "\\" + file, count - 1); string myvalue_string = string_caozuo.Get_Table_String(myline, 2); double myvalue = double.Parse(myvalue_string); string time_string = string_caozuo.Get_Dian_String(file, 1); string day_string = string_caozuo.Get_HengGang_String(time_string, 1); string sub_time_string = string_caozuo.Get_HengGang_String(time_string, 2); string year = string_caozuo.Get_Xiahuaxian_String(day_string, 1); string month = string_caozuo.Get_Xiahuaxian_String(day_string, 2); string day = string_caozuo.Get_Xiahuaxian_String(day_string, 3); string hour = string_caozuo.Get_Xiahuaxian_String(sub_time_string, 1); string min1 = string_caozuo.Get_Xiahuaxian_String(sub_time_string, 2); string sec = string_caozuo.Get_Xiahuaxian_String(sub_time_string, 3); DateTime time = DateTime.Parse(year + "-" + month + "-" + day + " " + hour + ":" + min1 + ":" + sec); Chart2.Series[0].Points.AddXY(time.ToOADate(), Math.Abs(jizhun - myvalue) * (1 - Math.Sqrt(3) / 2) / 0.0482); Chart2.ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm:ss"; DateTime time1 = DateTime.Parse(year + "-" + month + "-" + day + " " + "00" + ":" + "00" + ":" + "00"); DateTime time2 = DateTime.Parse(year + "-" + month + "-" + day + " " + "23" + ":" + "59" + ":" + "59"); Chart2.ChartAreas[0].AxisX.Minimum = time1.ToOADate(); Chart2.ChartAreas[0].AxisX.Maximum = time2.ToOADate(); Chart2.ChartAreas[0].AxisX.IntervalType = System.Web.UI.DataVisualization.Charting.DateTimeIntervalType.Hours; Chart2.ChartAreas[0].AxisX.Interval = 1; max = Chart2.ChartAreas[0].AxisX.Maximum; min = Chart2.ChartAreas[0].AxisX.Minimum; Chart2.Titles[0].Text = year + "年" + month + "月" + day + "日 位置:" + position_string + " 的趋势区线"; //Label11.Text = "执行了"; } catch { } } return; } catch { } #endregion } }
protected void CalendarEvent_DayRender(object sender, DayRenderEventArgs e) { try { if (!e.Day.IsOtherMonth) { e.Cell.Attributes.Add("class", "overout"); foreach (DataRow dr in dt.Rows) { DateTime dts = (DateTime)dr.Field <DateTime?>("dtFromDate"); DateTime todts = (DateTime)dr.Field <DateTime?>("dtTodate"); if (e.Day.Date == dts.Date) { LinkButton lb = new LinkButton(); LinkButton lbcolor = new LinkButton(); DataTable dttooltip = new DataTable(); objDO.dtFromDate = dts; if (Convert.ToString(ViewState["CompareDate"]) != Convert.ToString(objDO.dtFromDate)) { dttooltip = objDA.GetDataTable(objDO, DA_Scrl_GroupEventsTbl.Scrl_GroupEventsTbl.GetEventDetailsByDate); } if (dttooltip.Rows.Count > 0) { HtmlGenericControl createAnDv = new HtmlGenericControl("DIV"); createAnDv.Attributes["class"] = "event-info"; e.Cell.Attributes["class"] += " active"; ViewState["CompareDate"] = objDO.dtFromDate; string evtCount = Convert.ToString(dttooltip.Rows[0]["Maxcount"]); lb.Text = evtCount; lb.CssClass = "calendarCount calendar-count"; createAnDv.Controls.Add(lb); // e.Cell.Controls.Add(lb); lbcolor.Style.Add("vertical-align", "text-bottom"); lbcolor.Text = evtCount == "1" ? "Event" : "Events"; lbcolor.CssClass = "event1"; // e.Cell.Controls.Add(lbcolor); createAnDv.Controls.Add(lbcolor); e.Cell.ToolTip = "Calendar"; ViewState["appEvent"] = objDO.dtFromDate; HtmlGenericControl createDiv = new HtmlGenericControl("DIV"); createDiv.ID = "createDiv" + dts.Date.Day; string eventPopId = "eventPop" + dts.Date.Day; StringBuilder div = new StringBuilder(); div.Append("<div style=\"display:none;\" class=\"eventDetailsPop event-dtails-popup arrow_box card\" id=\""); div.Append(eventPopId); div.Append("\" clientidmode=\"Static\"><div class=\"overflow-scroll-tooltip\"><div class=\"event-close\"><span class=\"events-heading-m\">Events</span><span class=\"cross-icon\"aria-hidden=\"true\">×</span></div>"); foreach (DataRow drt in dttooltip.Rows) { div.Append(" <div class=\"eventPopDetails event-popup-detail\"><div class=\"color1Pop dvcolor\" style=\"background-color:"); div.Append(drt["strColor"] + "\"> </div><div class=\"tooltip-details\">"); div.Append(" <div class=\"headingPop heading-tooltip\"> <label> "); div.Append(drt["strTitle"]); div.Append(" </label></div>"); div.Append(" <div class=\"eventDtl event-tooltip-des\"><label>"); div.Append(drt["strDescription"]); div.Append(" </ label ></div>"); div.Append("<div class=\"eventTiming event-tooltip-timing\"><label> "); div.Append(drt["dtFromDate"]); div.Append(" - "); div.Append(drt["dtTodate"]); div.Append(" </ label ></div></div></div><hr class=\"event-seprator\" />"); } div.Append("</div></div>"); createDiv.InnerHtml = div.ToString(); createAnDv.Controls.Add(createDiv); // e.Cell.Controls.Add(createDiv); e.Cell.Controls.Add(createAnDv); e.Cell.Attributes.Add("onmouseover", "$(\"#" + eventPopId + "\").show();$(\"body\").addClass(\"remove-scroller-m\");"); e.Cell.Attributes.Add("onmouseout", "$(\"#" + eventPopId + "\").hide();$(\"body\").removeClass(\"remove-scroller-m\");"); //e.Cell.Attributes.Add("onmouseover", "showpopevnt('" + dts.ToString() + "','" + dttooltip.Rows[0]["intGrpEventtId"] + "','" + ViewState["intGroupId"].ToString() + "')"); } } } } else { e.Cell.Text = ""; } } catch (Exception ex) { ex.Message.ToString(); } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { //2017-10-25建立一個判斷星期的物件 Lib.WorkWeek wk = new Lib.WorkWeek(e.Day.Date.Year); Calendar1.Visible = true; TaiwanCalendar tc = new TaiwanCalendar(); CultureInfo ci = new CultureInfo("zh-TW"); ci.DateTimeFormat.Calendar = tc; ci.DateTimeFormat.YearMonthPattern = "民國yy年MM月"; ci.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday; Thread.CurrentThread.CurrentCulture = ci; if (Page.IsPostBack) { allow = Lib.SysSetting.getAllowedDates(this.cneterSel.SelectedValue); deny = Lib.SysSetting.getDeniedDates(this.cneterSel.SelectedValue); //if (e.Day.IsWeekend)//判斷是不是非工作日 //2017-11-29要先檢查是不是null if (wk.DicWeek[e.Day.Date.DayOfWeek] == false)//2017-10-25新寫法 { DateTime dt = Lib.SysSetting.ToWorldDate(e.Day.Date.ToShortDateString()); bool _isOver = Lib.SysSetting.isOverTime(dt); if (_isOver == true) { LiteralControl l = (LiteralControl)e.Cell.Controls[0]; e.Cell.Controls.RemoveAt(0); e.Cell.Text = l.Text; } else { if (dt.DayOfWeek == DayOfWeek.Friday) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; LiteralControl l = (LiteralControl)e.Cell.Controls[0]; e.Cell.Controls.RemoveAt(0); e.Cell.Text = l.Text; } else { int i = 0; foreach (KeyValuePair <string, DateTime> s in allow) { if (e.Day.Date == s.Value) { e.Cell.BackColor = System.Drawing.Color.Green; e.Cell.ForeColor = System.Drawing.Color.White; } else { i++; } } if (i == allow.Count) { LiteralControl l = (LiteralControl)e.Cell.Controls[0]; e.Cell.Controls.RemoveAt(0); e.Cell.Text = l.Text; } } } } //if (!e.Day.IsWeekend)//判斷是不是工作日 if (wk.DicWeek[e.Day.Date.DayOfWeek] == true)//2017-10-25新寫法 { DateTime dt = Lib.SysSetting.ToWorldDate(e.Day.Date.ToShortDateString()); bool _isOver = Lib.SysSetting.isOverTime(dt); if (_isOver == true) { LiteralControl l = (LiteralControl)e.Cell.Controls[0]; e.Cell.Controls.RemoveAt(0); e.Cell.Text = l.Text; } else { if (dt.DayOfWeek == DayOfWeek.Friday) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; LiteralControl l = (LiteralControl)e.Cell.Controls[0]; e.Cell.Controls.RemoveAt(0); e.Cell.Text = l.Text; } else { foreach (KeyValuePair <string, DateTime> d in deny) { if (e.Day.Date == d.Value) { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; LiteralControl l = (LiteralControl)e.Cell.Controls[0]; e.Cell.Controls.RemoveAt(0); e.Cell.Text = l.Text; } } } } } } Calendar1.Visible = true; ci.DateTimeFormat.Calendar = tc; ci.DateTimeFormat.YearMonthPattern = "民國yy年MM月"; ci.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday; Thread.CurrentThread.CurrentCulture = ci; }
protected void cldExam_DayRender(object sender, DayRenderEventArgs e) { if (IsCanRender == true) { BLL.ExamScheduleBiz biz = new BLL.ExamScheduleBiz(); Func <string, string> GetCrit = anyString => { return(string.IsNullOrEmpty(anyString) ? string.Empty : anyString); }; string strExamPlaceGroup = GetCrit(ddlPlaceGroup.SelectedValue); string strExamPlace = GetCrit(ddlPlace.SelectedIndex == 0 ? "" : ddlPlace.SelectedValue); string strLicenseType = GetCrit(ddlTypeLicense.SelectedIndex == 0 ? "" : ddlTypeLicense.SelectedValue); string strYearMonth = string.Empty; strYearMonth = GetCrit(ConvertToYearMonth(e.Day.Date.Month)); string strTime = GetCrit(ddlTime.SelectedIndex == 0 ? "" : ddlTime.SelectedValue); //var ls = biz.GetExamByCriteria(strExamPlaceGroup, strExamPlace, strLicenseType, strYearMonth, strTime, null); //DataSet ds = ls.DataResponse; //if (ds != null) //{ // DataTable dt = ds.Tables[0]; // var list = dt.AsEnumerable().Select(s => s.Field<DateTime>("TESTING_DATE")).Distinct().ToList(); // for (int i = 0; i < list.Count; i++) // { // ExamRender examrender = new ExamRender(); // if (e.Day.Date == list[i].Date) // { // e.Cell.Controls.Add(new LiteralControl("</br>")); // Label lbl = new Label { ID = "btn" + i.ToString(), Text = "รายละเอียด" }; // e.Cell.Controls.Add(lbl); // examrender.testingDate = e.Day.Date; // examrender.ID = "btn" + i.ToString(); // examrender.Name = "รายละเอียด"; // lsRender.Add(examrender); // } // else // { // } // } //} } else { if (lsRender.Count != 0) { DateTime dtToday = DateTime.Today; DateTime dtFinish = DateTime.Today.AddDays(+5); foreach (ExamRender item in lsRender) { if (e.Day.Date == item.testingDate) { e.Cell.Controls.Add(new LiteralControl("</br>")); Label lbl = new Label { ID = item.ID, Text = item.Name }; e.Cell.Controls.Add(lbl); } if (e.Day.Date == item.testingDate && item.IsSetProperty) { e.Cell.Enabled = false; e.Day.IsSelectable = false; e.Cell.ForeColor = System.Drawing.Color.Gray; } } } } }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { e.Cell.Attributes["onclick"] = "popupModal('" + e.Day.Date.ToString("yyyy-MM-dd") + "');"; }
//This method happens every time when the page is reloaded or there was a postback //And updates the calendar. Here you provide all the information about how does the //calendar should look in any situation protected void BookingCalendar_DayRender(object sender, DayRenderEventArgs e) { DateTime daySelected = BookingCalendar.SelectedDate; BookingCalendar.SelectedDates.Clear(); e.Day.IsSelectable = false; if (e.Day.Date < DateTime.Today) { e.Cell.Font.Italic = true; e.Cell.BackColor = System.Drawing.Color.DimGray; e.Cell.BorderColor = System.Drawing.Color.Gray; e.Cell.ForeColor = System.Drawing.Color.Gray; e.Cell.Font.Name = "Courier New"; } if (e.Day.Date.DayOfWeek == DayOfWeek.Saturday || e.Day.Date.DayOfWeek == DayOfWeek.Sunday) { if (e.Day.Date == daySelected) { e.Cell.ForeColor = System.Drawing.Color.Yellow; } else { e.Cell.ForeColor = System.Drawing.Color.Red; } } Service1Client service = new Service1Client(); if (!Page.IsPostBack) { foreach (DateTime d in GetAllAvailableTutoringDates(allTutoringTimes)) { if (e.Day.Date.Equals(d)) { e.Cell.BackColor = System.Drawing.Color.Green; e.Day.IsSelectable = true; } } } else { //Select available dates by subject if (SubjectDrL.SelectedValue != "Select subject") { foreach (DateTime d in GetAllAvailableTutoringDates(GetAllAvailableTutoringTimesForSubject(SubjectDrL.SelectedValue))) { if (e.Day.Date.Equals(d)) { e.Cell.BackColor = System.Drawing.Color.Green; e.Day.IsSelectable = true; } } } //If the selection is Select subject it changes color to green to all available //tutoring times dates no matter what subject it is else { foreach (DateTime d in GetAllAvailableTutoringDates(allTutoringTimes)) { if (e.Day.Date.Equals(d)) { e.Cell.BackColor = System.Drawing.Color.Green; e.Day.IsSelectable = true; } } } //Select available dates by teacher //If the teacher is selected than it changes color to green to all //dates which have that speciffic teachers tuturing dates if (TeacherDrL.SelectedValue != "Select teacher") { e.Day.IsSelectable = false; e.Cell.BackColor = System.Drawing.Color.White; if (e.Day.Date < DateTime.Today) { e.Cell.Font.Italic = true; e.Cell.BackColor = System.Drawing.Color.DimGray; e.Cell.BorderColor = System.Drawing.Color.Gray; e.Cell.ForeColor = System.Drawing.Color.Gray; e.Cell.Font.Name = "Courier New"; } foreach (DateTime d in GetAllAvailableTutoringDates(GetAllAvailableTutoringTimesForTeacher(TeacherDrL.SelectedValue))) { if (e.Day.Date.Equals(d)) { e.Cell.BackColor = System.Drawing.Color.Green; e.Day.IsSelectable = true; } } } } BookingCalendar.SelectedDate = daySelected; BookingCalendar.SelectedDayStyle.ForeColor = System.Drawing.Color.Yellow; }
protected void uoCalendarDashboard_DayRender(object sender, DayRenderEventArgs e) { DateTime day = e.Day.Date; //DataTable dt = null; IDataReader dr = null; try { string sPendingFilter = "0"; string sRegion = "0"; string sCountry = "0"; string sCity = "0"; string sPort = "0"; string sHotel = "0"; string sVehicle = "0"; sPendingFilter = GlobalCode.Field2Int(Session["strPendingFilter"]).ToString(); sRegion = GlobalCode.Field2Int(Session["Region"]).ToString(); sCountry = GlobalCode.Field2Int(Session["Country"]).ToString(); sCity = GlobalCode.Field2Int(Session["City"]).ToString(); sPort = GlobalCode.Field2Int(Session["Port"]).ToString(); sHotel = GlobalCode.Field2Int(Session["Hotel"]).ToString(); sVehicle = GlobalCode.Field2Int(Session["Vehicle"]).ToString(); dr = SeafarerTravelBLL.GetTravelManifestDashboard(day.ToString("MM/dd/yyyy"), day.ToString("MM/dd/yyyy"), GlobalCode.Field2String(Session["UserName"]), sPendingFilter, sRegion, sCountry, sCity, "", "1", "", sPort, sHotel, sVehicle, "0", "0", "0", "0", uoHiddenFieldRole.Value); if (dr.Read()) { //Label lblOnOff = new Label(); //lblOnOff.Text = "<br/>On:" + dr["SignOn"].ToString() + "<br/>"; //lblOnOff.Text += "Off:" + dr["SignOff"].ToString() + "<br/>"; //lblOnOff.ForeColor = Color.Red; //lblOnOff.Font.Size = 8; //e.Cell.Controls.Add(lblOnOff); ////e.Cell.ToolTip = "On:" + dr["SignOn"].ToString() + " Off: " + dr["SignOff"].ToString(); ////e.Cell.CssClass = "testCSS"; if (dr["SignOn"].ToString() != "0") { Label lblOn = new Label(); lblOn.Text = "*"; lblOn.ForeColor = Color.Green; e.Cell.Controls.Add(lblOn); } if (dr["SignOff"].ToString() != "0") { Label lblOff = new Label(); lblOff.Text = "*"; lblOff.ForeColor = Color.Red; e.Cell.Controls.Add(lblOff); } e.Cell.CssClass = "hoverDate"; e.Cell.ID = day.ToString("MM_dd_yyyy"); } } catch (Exception ex) { throw ex; } finally { if (dr != null) { dr.Close(); dr.Dispose(); } } }
/// <summary> /// Handles the DayRender event of the calendarConsumables control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DayRenderEventArgs"/> instance containing the event data.</param> /// <exception cref="System.NotImplementedException"></exception> void calendarConsumables_DayRender(object sender, DayRenderEventArgs e) { e.Cell.Style.Add("cursor", "hand"); e.Cell.Attributes.Add("onClick", e.SelectUrl); }
/** * <summary> * This method renders each day shown in the calendar as non-selectable. * </summary> * * @method Calendar1_DayRender * @return {void} */ protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { // sets days in calendar to non-selectable e.Day.IsSelectable = false; }
protected void Calendar_Test_DayRender(object sender, DayRenderEventArgs e) { Debug.WriteLine("Calendar_Test_DayRender invoked: date selected: " + e.Day.Date.ToShortDateString()); }
protected void checkInBigCalendar_DayRender(Object sender, DayRenderEventArgs e) { renderPending(sender, e); renderReserved(sender, e); renderAvailable(sender, e); }
protected void DayRender(Object Sender, DayRenderEventArgs e) { e.Day.IsSelectable = false; if (e.Day.Date != calThis.SelectedDate) { e.Cell.Attributes.Add("onmouseover", "CalendarOver(this);"); e.Cell.Attributes.Add("onmouseout", "CalendarOut(this);"); } e.Cell.Attributes.Add("onclick", "DateSelect('" + e.Day.Date.ToShortDateString() + "');"); e.Cell.ToolTip = e.Day.Date.ToLongDateString(); if (boolAll == false) { e.Cell.Text = "<div style=\"width:100%;height:80;overflow:hidden\">"; } else { e.Cell.Text = "<div style=\"width:100%;height:100%;overflow:visible\">"; } e.Cell.Text += "<table width=\"100%\" cellpadding=\"1\" 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>"; } ds = oHoliday.Get(e.Day.Date); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { e.Cell.Text += "<tr><td class=\"calendarred\">" + dr["name"].ToString() + "</span></td></tr>"; } } else { ds = oVacation.Get(e.Day.Date, intApplication); int intCount = 0; if (ds.Tables[0].Rows.Count > 0) { while (intCount < ds.Tables[0].Rows.Count && intCount < intRows) { string strType = ""; string strReason = ds.Tables[0].Rows[intCount]["reason"].ToString(); if (ds.Tables[0].Rows[intCount]["vacation"].ToString() == "1") { strType = "V:"; strReason = "Vacation"; } else if (ds.Tables[0].Rows[intCount]["holiday"].ToString() == "1") { strType = "F:"; strReason = "Floating Holiday"; } else if (ds.Tables[0].Rows[intCount]["personal"].ToString() == "1") { strType = "P:"; strReason = "Personal / Sick day"; } else if (strReason == "Highland Hills") { strType = "HH:"; } if (e.Day.IsOtherMonth == false && e.Day.IsWeekend == false) { e.Cell.Text += "<tr><td class=\"calendar\"><span title=\"" + ds.Tables[0].Rows[0]["username"].ToString() + " " + strReason + " " + e.Day.Date.ToString("MMMM dd, yyyy") + "\">" + strType + ds.Tables[0].Rows[intCount]["username"].ToString() + "</span></td></tr>"; } else { e.Cell.Text += "<tr><td class=\"calendarother\"><span title=\"" + ds.Tables[0].Rows[0]["username"].ToString() + " " + strReason + " " + e.Day.Date.ToString("MMMM dd, yyyy") + "\">" + strType + ds.Tables[0].Rows[intCount]["username"].ToString() + "</span></td></tr>"; } intCount++; } } } e.Cell.Text += "</table>"; //if (boolAll == false) e.Cell.Text += "</div>"; }
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { arrCurrentDays = null; CalendarDay d = ((DayRenderEventArgs)e).Day; TableCell c = ((DayRenderEventArgs)e).Cell; string ss = ""; if (pd) { if ((dt.Year == d.Date.Year) && (dt.Month == d.Date.Month)) { arrCurrentDays = DAL.MovieServer.getArrayDay(DateTime.Now); } else { arrCurrentDays = null; //Utility.JavaScript.Alert(dt.Date.ToString(), this); arrCurrentDays = DAL.MovieServer.getArrayDayNext(dt); } } else { arrCurrentDays = DAL.MovieServer.getArrayDay(DateTime.Now); } int j = 0; int n; int[] arrCurrent = arrCurrentDays; while (!arrCurrentDays[j].Equals(0)) { n = arrCurrentDays[j]; if (d.Date.Day == n) { ss = ss + n; //Utility.JavaScript.Alert(n.ToString(), this); e.Cell.ForeColor = System.Drawing.Color.Red; e.Day.IsSelectable = true; break; //TableCell tc = new TableCell(); //Utility.JavaScript.Alert(n.ToString(), this); // c.Controls.Clear(); // LinkButton lb = new LinkButton(); // lb.Attributes.Add("class", "tc"); // lb.Command += new CommandEventHandler(this.lv_Click); // //lb.Click += new System.EventHandler(lv_Click); //lb.Text = arrCurrentDays[j].ToString(); //c.Controls.Add(lb); } else { e.Cell.ForeColor = System.Drawing.Color.Gray; e.Day.IsSelectable = false; } j++; } //Utility.JavaScript.Alert(ss, this); }