public void SelectedDatesCollectionTest_DefaultValues() { ArrayList list = new ArrayList(); SelectedDatesCollection s = new SelectedDatesCollection(list); Assert.AreEqual(0, s.Count, "A1"); Assert.AreEqual(false, s.IsReadOnly, "A2"); Assert.AreEqual(false, s.IsSynchronized, "A3"); Assert.AreEqual(s, s.SyncRoot, "A4"); }
private void calendar_SelectedDatesChanged(object sender, SelectionChangedEventArgs e) { SelectedDatesCollection sdc = calendar.SelectedDates; List <Plan> lp = t.ListPlan; Plan pt = new Plan(); foreach (Plan p in lp) { if (p.ucId == sldPlanId.Value) { p.ucId = Convert.ToByte(sldPlanId.Value); p.ucWeekFlag = 0xfe; uint d = 0; ushort m = 0; p.ucScheduleId = Convert.ToByte(cbxScheduleId.SelectedItem); foreach (DateTime dt in sdc) { int month = dt.Month; int day = dt.Day; d = (uint)((1 << day) | d); m = (ushort)((1 << month) | m); p.usMonthFlag = m; p.ulDayFlag = d; } } else { if (p.ucId >= 1 && p.ucId <= 20) { pt.ucId = Convert.ToByte(sldPlanId.Value); pt.ucWeekFlag = 0xfe; uint d = 0; ushort m = 0; pt.ucScheduleId = Convert.ToByte(cbxScheduleId.SelectedItem); foreach (DateTime dt in sdc) { int month = dt.Month; int day = dt.Day; d = (uint)((1 << day) | d); m = (ushort)((1 << month) | m); pt.usMonthFlag = m; pt.ulDayFlag = d; } } break; } } if (pt.ucId == Convert.ToByte(sldPlanId.Value)) { lp.Add(pt); } }
protected void Calendar1_SelectionChanged(object sender, EventArgs e) { SelectedDatesCollection dts = Calendar1.SelectedDates; foreach (DateTime dt in dts) { Response.Write(dt + "</br>"); } Response.Write("所選日期:" + Calendar1.SelectedDate); Response.Write("</br>------------------------"); }
private void calendarioA_SelectedDatesChanged(object sender, SelectionChangedEventArgs e) { if (calendarioA.SelectedDates.Count > 0) { datasA = calendarioA.SelectedDates; } else { datasA = null; } }
public void SelectRangeMethod() { ArrayList list = new ArrayList(); SelectedDatesCollection s = new SelectedDatesCollection(list); s.Add(DateTime.Today); s.Add(DateTime.Today); // Internally clears the list s.SelectRange(new DateTime(2000, 1, 1), new DateTime(2001, 1, 1)); Assert.AreEqual(367, s.Count, "A1"); }
public void AddMethod() { ArrayList list = new ArrayList(); SelectedDatesCollection s = new SelectedDatesCollection(list); s.Add(DateTime.Today); Assert.AreEqual(true, s.Contains(DateTime.Today), "A1"); Assert.AreEqual(1, s.Count, "A2"); s.Add(DateTime.Today); // Duplicates are not inserted Assert.AreEqual(1, s.Count, "A2"); }
protected void Calendar1_SelectionChanged(object sender, EventArgs e) { LbNonWorkdate.Text = "您選擇的日期是: " + "<br />"; SelectedDatesCollection dates = Calendar1.SelectedDates; Session["date"] += Calendar1.SelectedDate.ToShortDateString() + ","; //for (int i = 0; i <= Calendar1.SelectedDates.Count - 1; i++) //{ // Label1.Text += Calendar1.SelectedDates[i].ToShortDateString() + "<br />"; //} LbNonWorkdate.Text += Session["date"].ToString(); }
protected void ECalendar_Function_SelectionChanged(object sender, EventArgs e) { SelectedDatesCollection theDates = ECalendar_Function.SelectedDates; DataTable dtSelectedDateEvents = ECalendar_Function.EventSource; //txt_EventDate.Text = ECalendar_Function.SelectedDate.ToString("dd/MM/yyyy"); //DateTime FDate = DateTime.ParseExact(txt_EventDate.Text, @"dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); txt_EventDate.Text = ECalendar_Function.SelectedDate.ToString("dd/MM/yyyy"); DateTime FDate = Convert.ToDateTime(txt_EventDate.Text); if (FDate > System.DateTime.Now) { if (ViewState["EventStartDate"] != null) { DataTable dt_Date = (DataTable)ViewState["EventStartDate"]; for (int i = 0; i < dt_Date.Rows.Count; i++) { int flag = 0; foreach (DataRow row in dt_Date.Rows) { DateTime FunctionDate = Convert.ToDateTime(row["EventStartDate"].ToString()); if (FunctionDate.Date.Equals(ECalendar_Function.SelectedDate)) { flag = 1; break; } } if (flag == 1) { //DIV_Main.Visible = false; //DIV_Calendar.Visible = true; COMMONFUNCTIONS.ScriptMsgForAjax("Already Booked,Please Select another Date ", this); } else if (flag == 0) { //DIV_Main.Visible = true; //DIV_Calendar.Visible = false; } } } else if (ViewState["EventStartDate"] == null) { //DIV_Main.Visible = true; //DIV_Calendar.Visible = false; } } else { COMMONFUNCTIONS.ScriptMsgForAjax("Please Select a Valid Date ", this); } }
private void LoadAssignedEmployees() { if (cmbScheduleAssignedShift.SelectedIndex >= 0) { SelectedDatesCollection sdc = mcdSchedule.SelectedDates; if (sdc.Count > 0) { lsbAssignedEmployees.DataSource = calenderManager.GetPersonalAssigned(sdc[0], cmbScheduleAssignedShift.SelectedIndex); } ScheduleUnassignEnabble(); } }
private void Calendar_SelectedDatesChanged(object sender, SelectionChangedEventArgs e) { Calendar cal = sender as Calendar; SelectedDatesCollection col = cal.SelectedDates; this.viewModel_.reloadEventViewModel(col); this.eventListListView_.ItemsSource = this.viewModel_.BindingEventViewModel_; //this.eventListListView_.Items.Refresh(); //this.viewModel_. }
private void Calendar_SelectedDatesChanged(object sender, SelectionChangedEventArgs e) { Calendar calendar = sender as Calendar; SelectedDatesCollection selectedDates = calendar.SelectedDates; /* * foreach (var item in selectedDates) * { * MessageBox.Show(item.ToLocalTime().ToString()); * } */ dateCombo.ItemsSource = selectedDates; }
private void calDonorReg_SelectedDatesChanged(object sender, SelectionChangedEventArgs e) { try { SelectedDatesCollection cc = calDonorReg.SelectedDates; foreach (var item in cc) { Debug.WriteLine(item.ToShortDateString()); //list.Items.Add(item.ToShortDateString()); } } catch (Exception ex) { MessageHandler.ShowErrorMessage(ex.Message); } }
private void ShowCourse() { selectedDates = calendar.SelectedDates; if (selectedDates != null && selectedDates.Count > 0) { if (currenciesListBox.SelectedValue != null) { string currencyCode = (string)currenciesListBox.SelectedValue; DateTime firstDate = selectedDates.First(); DateTime lastDate = selectedDates.Last(); WebClient wc = new WebClient(); wc.DownloadStringCompleted += DownloadQuotesCompleted; Uri uri = CreateUri(firstDate, lastDate, currencyCode); wc.DownloadStringAsync(uri); } } }
private void SelectRange(DateTime dateFrom, DateTime dateTo) { Debug.Assert(dateFrom <= dateTo, "Bad Date Range"); // see if this range differs in any way from the current range // these checks will determine this because the colleciton is sorted TimeSpan ts = dateTo - dateFrom; SelectedDatesCollection selectedDates = Control.SelectedDates; if (selectedDates.Count != ts.Days + 1 || selectedDates[0] != dateFrom || selectedDates[selectedDates.Count - 1] != dateTo) { selectedDates.SelectRange(dateFrom, dateTo); Control.RaiseSelectionChangedEvent(); } }
private void monthCalendar1_DaySelected(object sender, DaySelectedEventArgs e) { // don't edit unless edit is enabled. if (!EditEnable.Checked) { return; } Pabo.Calendar.MonthCalendar month = (Pabo.Calendar.MonthCalendar)sender; SelectedDatesCollection m_dates = month.SelectedDates; //current_date = Convert.ToDateTime( e.Days[0] ); for (int n = 0; n < m_dates.Count; n++) { DateTime dt = m_dates[n]; current_date = dt; int index = month_schedule.FindIndex(IsDate); MonthDayInfo day; if (index < 0) { day = new MonthDayInfo(); day.dr = Local.session_schedule.NewRow(); //day.dr[1] = current_session_sales[1]; day.dr["bingoday"] = current_date; Local.session_schedule.Rows.Add(day.dr); day.date = current_date; month_schedule.Add(day); } else { day = month_schedule[index]; } day.session_sales_info_id = current_session_sales_index; day.session_image_index = current_image_index; day.session_sales_name = current_session_name; day.dr["session_sales_info_id"] = current_session_sales_index; } DateItem[] di = month.Dates.DateInfo(Convert.ToDateTime(e.Days[0])); //Console.WriteLine( e.Days ); //SelectedDatesCollection m_dates = month.SelectedDates; }
/// <summary> /// Fetch all apointments for selected dates on the calendar /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void calendar_SelectedDatesChanged(object sender, SelectionChangedEventArgs e) { SelectedDatesCollection collection = calendar.SelectedDates; string patch = ""; if (collection.Count > 0) { patch = " where "; } foreach (DateTime dt in collection) { patch += "patientid=" + subparent.PatientId + " and convert(date,date)=str_to_date('" + dt.ToShortDateString() + "','%m/%d/%Y')"; if (collection.IndexOf(dt) < (collection.Count - 1)) { patch += " or "; } } if (patch.Equals("")) { patch = " where patientid=" + subparent.PatientId; } listView0.Items.Clear(); DataTable qry = parent.query("select scheduleid, (select concat(lastname,' ',firstname) from doctor where doctor.doctorid=schedule.doctorid) as name,(select specialization from doctor where doctor.doctorid=schedule.doctorid) as specialization, status as attended, schedule.date as schedule, date_added as created from schedule " + patch + " "); foreach (DataRow rw in qry.Rows) { ScheduleHolder schedule = new ScheduleHolder(); schedule.ID = int.Parse(rw["scheduleid"].ToString()); schedule.doctor_name = (rw["name"].ToString()); schedule.specialization = (rw["specialization"].ToString()); schedule.attended = (rw["attended"].ToString()); schedule.schedule = (rw["schedule"].ToString()); schedule.created = (rw["created"].ToString()); listView0.Items.Add(schedule); } }
//Highlight dates on calendar private void HighliteDatesOnCalendar() { try { SelectedDatesCollection dates = ClndOfStuff.SelectedDates; dates.Clear(); DateTime today = DateTime.Today; dates.Add(today); foreach (ToDoRecord date in thingsToDos) { dates.Add(Convert.ToDateTime(date.Date)); } } catch { } }
private void btnUpdateBooking_Click(object sender, RoutedEventArgs e) { try { SelectedDatesCollection Dates = calendarBookingDate.SelectedDates; if (Dates.Count <= 1) { throw new ArgumentException("You need to select and drag a range of dates!"); } if (Dates[0].Date > Dates[Dates.Count - 1].Date) { throw new ArgumentException("The Arrival Date Can't be after the Departure Date!"); } if (Dates.Count > 1) { booking.ArrivalDate = Dates[0]; booking.DepartureDate = Dates[Dates.Count - 1]; booking.ChaletID = facade.setChaletForBooking(Dates[0], Dates[Dates.Count - 1]); } win.updateBookingDates(booking); win.disableButtons(); win.dataGridBooking.SelectedItem = null; win.dataGridCustomer.SelectedItem = null; win.dataGridBooking.Items.Refresh(); win.Show(); this.Close(); } catch (Exception ee) { MessageBox.Show(ee.Message, "Booking"); } }
public void reloadEventViewModel(SelectedDatesCollection col) { //EVENT_INFO_Table_DAOManager daoM = new EVENT_INFO_Table_DAOManager(); //List<string> dateStr = new List<string>(); //foreach (var item in col) //{ // dateStr.Add(item.ToString(StringFormat.DbDateFormat_)); //} //daoM.selectEventDateList(DataBaseConnectManager.ConnectionFactory("myDB"),dateStr); //foreach (var item in daoM.DAOList_) //{ //} this.BindingEventViewModel_.Clear(); List <string> containDates = new List <string>(); foreach (var item in col) { containDates.Add(item.ToString(StringFormat.DbDateFormat_)); } var result = from eve in OTCApplicationEventViewModel.WholeEventViewModel_ where containDates.Contains(eve.Event_date_.ToString(StringFormat.DbDateFormat_)) select eve; foreach (var item in result) { this.BindingEventViewModel_.Add((EventViewModel)item); } //this.BindingEventViewModel_.Add(_eventViewModelMap_[item.ToString(StringFormat.DbDateFormat_)]); }
private void btnNext_Click(object sender, RoutedEventArgs e) { this.booking = new Booking(); try { SelectedDatesCollection Dates = calendarBookingDate.SelectedDates; if (Dates.Count <= 1) { throw new ArgumentException("You need to select and drag a range of dates!"); } if (Dates.Count > 1) { booking.ArrivalDate = Dates[0]; booking.DepartureDate = Dates[Dates.Count - 1]; } if (Dates[0].Date > Dates[Dates.Count - 1].Date) { throw new ArgumentException("The Arrival Date Can't be after the Departure Date!"); } if (customer != null) { BookingDetails winB = new BookingDetails(booking, customer, true); winB.Show(); this.Close(); } else { CustomerWindow win = new CustomerWindow(booking); win.Show(); this.Close(); } } catch (Exception ee) { MessageBox.Show(ee.Message, "Booking"); } }
private bool verificateRoom() { Console.WriteLine("verificateRoom"); if (this.selectedRoom == null) { Label_statusMain.Content = "Вы не выбрали номер"; return(false); } SelectedDatesCollection dates = Calendar_.SelectedDates; bool isIntervalVerificate = true; if (dates.Count > 1) { for (int i = 0; i < dates.Count - 1; i++) { if ((int)(dates[i + 1] - dates[i]).TotalDays != 1) { isIntervalVerificate = false; break; } } } else if (dates.Count < 1) { Label_statusMain.Content = "Вы не выбрали дату заселения"; return(false); } if (!isIntervalVerificate) { Label_statusMain.Content = "Вы выбрали несколько прерывающихся временных отрезков"; return(false); } return(true); }
protected void ECalendar_Function_SelectionChanged(object sender, EventArgs e) { //Locals bool isFreezed = false; SelectedDatesCollection theDates = ECalendar_Function.SelectedDates; DataTable dtSelectedDateEvents = ECalendar_Function.EventSource; txt_EventDate.Text = ECalendar_Function.SelectedDate.ToString("dd/MM/yyyy"); DateTime FDate = Convert.ToDateTime(txt_EventDate.Text); //DateTime FDate = DateTime.ParseExact(txt_EventDate.Text, @"dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); MarriageDetails = ADMIN.Get_MarriageDetails(Convert.ToString(FDate)); ViewState["Eventdate"] = FDate; if (MarriageDetails.Tables[0].Rows.Count > 0) { Guid BookingGid = (Guid)(MarriageDetails.Tables[0].Rows[0]["BookingGuid"]); ViewState["BookingGuid"] = BookingGid; ViewState["BookingDate"] = Convert.ToDateTime(MarriageDetails.Tables[0].Rows[0]["BookingDate"]); isFreezed = Convert.ToBoolean(MarriageDetails.Tables[0].Rows[0]["IsFreezed"]); ViewState["BillStatus"] = Convert.ToBoolean(MarriageDetails.Tables[0].Rows[0]["BillStatus"]); if (isFreezed) { BindDetails(MarriageDetails); } else { BindMarriageDetails(); } } else { COMMONFUNCTIONS.ScriptMsgForAjax("Please Select a Valid Date ", this); } }
/// <summary> /// Initializes a new instance of the Calendar class. /// </summary> public Calendar() { this._blackoutDates = new CalendarBlackoutDatesCollection(this); this._selectedDates = new SelectedDatesCollection(this); this.DisplayDate = DateTime.Today; }
private void Button_Click(object sender, RoutedEventArgs e) { SelectedDatesCollection dates = DateRange.SelectedDates; InactiveCompanies(dates); }
/// <summary> /// Initializes a new instance of the Calendar class. /// </summary> public Calendar() { this._blackoutDates = new CalendarBlackoutDatesCollection(this); this._selectedDates = new SelectedDatesCollection(this); this.FirstDayOfWeek = DateTimeHelper.GetCurrentDateFormat().FirstDayOfWeek; this.DisplayDate = DateTime.Today; }
private void GerarDiasTratamento() { Calendario_Escala.SelectionMode = CalendarSelectionMode.MultipleRange; SelectedDatesCollection selectedDates = new SelectedDatesCollection(Calendario_Escala); Calendario_Escala.SelectedDates.Clear(); selectedDates.AddRange(DateTime.Now, DateTime.Now.AddMonths(1)); List <DateTime> DatasDeTratamento = new List <DateTime>(); for (int i = 0; i < selectedDates.Count; i++) { DateTime data = selectedDates[i]; //MessageBox.Show(selectedDates[i].DayOfWeek.ToString()); if (data.DayOfWeek != DayOfWeek.Sunday) { if (data.DayOfWeek.ToString().Equals(DayOfWeek.Monday.ToString()) && SegundaFeira.IsChecked == true) { Calendario_Escala.SelectedDates.Add(data); DatasDeTratamento.Add(selectedDates[i]); } else if (selectedDates[i].DayOfWeek.ToString().Equals(DayOfWeek.Tuesday.ToString()) && TercaFeira.IsChecked == true) { Calendario_Escala.SelectedDates.Add(selectedDates[i]); DatasDeTratamento.Add(selectedDates[i]); } else if (selectedDates[i].DayOfWeek.Equals(DayOfWeek.Wednesday) && QuartaFeira.IsChecked == true) { Calendario_Escala.SelectedDates.Add(selectedDates[i]); DatasDeTratamento.Add(selectedDates[i]); } else if (selectedDates[i].DayOfWeek.Equals(DayOfWeek.Thursday) && QuintaFeira.IsChecked == true) { Calendario_Escala.SelectedDates.Add(selectedDates[i]); DatasDeTratamento.Add(selectedDates[i]); } else if (selectedDates[i].DayOfWeek.Equals(DayOfWeek.Friday) && SextaFeira.IsChecked == true) { Calendario_Escala.SelectedDates.Add(selectedDates[i]); DatasDeTratamento.Add(selectedDates[i]); } else if (selectedDates[i].DayOfWeek.Equals(DayOfWeek.Saturday) && Sabado.IsChecked == true) { Calendario_Escala.SelectedDates.Add(selectedDates[i]); DatasDeTratamento.Add(selectedDates[i]); } } } txt_dias_tratamento.Text = ""; Label_DiasDefinidos.Content = "Dias de Tratamento: "; int linha = 0; for (int i = 0; i < DatasDeTratamento.Count; i++) { txt_dias_tratamento.Text += DatasDeTratamento[i].ToString("d"); if (i + 1 != DatasDeTratamento.Count) { txt_dias_tratamento.Text += " - "; } linha += 1; if (linha == 5) { txt_dias_tratamento.Text += "\n"; } } Label_TotalDiasDefinidos.Content = "Total Dias: " + DatasDeTratamento.Count; }
//Required Function public void InactiveCompanies(SelectedDatesCollection dates) { bool isInactive = true; //Iterate through dictionary foreach (KeyValuePair <string, List <String> > company in CompanyFeeds) { foreach (String url in company.Value) { //Load Feed XmlReaderSettings settings = new XmlReaderSettings(); settings.DtdProcessing = DtdProcessing.Parse; var r = XmlReader.Create(url, settings); var feed = SyndicationFeed.Load(r); //Add the company name to the slacking group if they havent posted if (checkInactive(feed) == true) { SlackingCompanies.Add(company.Key); continue; } else { //If they have been active in different URL then we will remove //them from the slacking list if they are already in it if (SlackingCompanies.Contains(company.Key)) { SlackingCompanies.Remove(company.Key); } //reset booleon isInactive = true; break; } } } //pass they slacking companies to the grid to be displayed results.CompanyGrid.ItemsSource = SlackingCompanies; results.Show(); bool checkInactive(SyndicationFeed feed) { //Iterate through retrieved posts foreach (SyndicationItem post in feed.Items) { //If there is a post published in the date range continue //If the company hasnt posted in one feed but has in another we will remove it from the slacking pile foreach (DateTime date in dates) { // MessageBox.Show(date.ToString()); // MessageBox.Show(post.PublishDate.Date.ToString()); if (date.Date == post.PublishDate.Date) { isInactive = false; break; } } if (isInactive == false) { break; } } return(isInactive); } }
/// <summary> /// Initializes a new instance of the Calendar class. /// </summary> public Calendar() { this._blackoutDates = new CalendarBlackoutDatesCollection(this); this._selectedDates = new SelectedDatesCollection(this); this.SetCurrentValueInternal(DisplayDateProperty, DateTime.Today); }
public void reloadEventViewModel(SelectedDatesCollection col) { //EVENT_INFO_Table_DAOManager daoM = new EVENT_INFO_Table_DAOManager(); //List<string> dateStr = new List<string>(); //foreach (var item in col) //{ // dateStr.Add(item.ToString(StringFormat.DbDateFormat_)); //} //daoM.selectEventDateList(DataBaseConnectManager.ConnectionFactory("myDB"),dateStr); //foreach (var item in daoM.DAOList_) //{ //} this.BindingEventViewModel_.Clear(); List<string> containDates = new List<string>(); foreach (var item in col) { containDates.Add(item.ToString(StringFormat.DbDateFormat_)); } var result = from eve in OTCApplicationEventViewModel.WholeEventViewModel_ where containDates.Contains(eve.Event_date_.ToString(StringFormat.DbDateFormat_)) select eve; foreach (var item in result) { this.BindingEventViewModel_.Add((EventViewModel)item); } //this.BindingEventViewModel_.Add(_eventViewModelMap_[item.ToString(StringFormat.DbDateFormat_)]); }
protected void Button2_Click(object sender, EventArgs e) { SelectedDatesCollection dates = Calendar1.SelectedDates; }
public void AssignCutOff(SelectedDatesCollection dates) { _cutOff = dates.First(); NotifyOfPropertyChange(() => CutOff); }
public BookingPeriod(SelectedDatesCollection selectedDates) : this(selectedDates.FirstOrDefault(), selectedDates.LastOrDefault()) { }
public void ReplaceSelectedDatesCollection(ObservableCollection<DateTime> selectedDates) { //Replace the existing selected dates collection with a new user provided collection var sdc = new SelectedDatesCollection(this, selectedDates); this.SelectedDates = sdc; //Update the control to display changes this.UpdateMonths(); }
/// <summary> /// Initializes a new instance of the /// <see cref="T:WinRTXamlToolkit.Controls.Calendar" /> class. /// </summary> public Calendar() { DefaultStyleKey = typeof(Calendar); UpdateDisplayDate(this, this.DisplayDate, DateTime.MinValue); GotFocus += new RoutedEventHandler(Calendar_GotFocus); LostFocus += new RoutedEventHandler(Calendar_LostFocus); IsEnabledChanged += new DependencyPropertyChangedEventHandler(OnIsEnabledChanged); PointerReleased += new PointerEventHandler(Calendar_PointerReleased); BlackoutDates = new CalendarBlackoutDatesCollection(this); SelectedDates = new SelectedDatesCollection(this); RemovedItems = new List<object>(); }
/// <summary> /// Initializes a new instance of the /// <see cref="T:System.Windows.Controls.Calendar" /> class. /// </summary> public Calendar() { DefaultStyleKey = typeof(Calendar); UpdateDisplayDate(this, this.DisplayDate, DateTime.MinValue); GotFocus += new RoutedEventHandler(Calendar_GotFocus); LostFocus += new RoutedEventHandler(Calendar_LostFocus); IsEnabledChanged += new DependencyPropertyChangedEventHandler(OnIsEnabledChanged); MouseLeftButtonUp += new MouseButtonEventHandler(Calendar_MouseLeftButtonUp); BlackoutDates = new CalendarBlackoutDatesCollection(this); SelectedDates = new SelectedDatesCollection(this); RemovedItems = new Collection<DateTime>(); }
private void SelectionChanges(object sender) { SelectedDatesCollection dates = sender as SelectedDatesCollection; }
public VacationDialogModel(IObserver <DateTime[]?> finish, DateTime currentMounth, SelectedDatesCollection datesCollection) { Cancel = new SimpleReactiveCommand().Finish(o => o.Select(_ => default(DateTime[])).Subscribe(finish)); var changes = Observable.Create <Unit>(o => { void Next(object?sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs) => o.OnNext(Unit.Default); NotifyCollectionChangedEventHandler eventHandler = Next; datesCollection.CollectionChanged += eventHandler; return(Disposable.Create((eventHandler, datesCollection), h => h.datesCollection.CollectionChanged -= h.eventHandler)); }); Ok = new SimpleReactiveCommand(from _ in changes select datesCollection.Where(SystemClock.IsWeekDay).Any(d => d.Month >= currentMounth.Month)) .Finish(o => (from _ in o select datesCollection.Where(d => d.Month >= currentMounth.Month) .ToArray()) .Subscribe(finish)); }
/// <summary> /// Initializes a new instance of the <see cref="T:Kavand.Windows.Controls.Calendar"/> class. /// </summary> public Calendar() { SetCurrentValue(DisplayDateProperty, Engine.MinSupportedDateTime); _blackoutDates = new BlackoutDatesCollection(this); _selectedDates = new SelectedDatesCollection(this); SetCurrentValue(DisplayDateProperty, DateTime.Today); }
private void OrdersConfirmation1(object sender, RoutedEventArgs e) { SelectedDatesCollection selectedDates = UnitDate.SelectedDates; if (selectedDates.Count == 0) { MessageBox.Show("יש להכניס תאריכים", "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (lineFirstName == null && lineFamilyName == null) { MessageBox.Show("שדה זה הינו חובה", "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); if (lineFamilyName == null) { //asterisk1.Visibility = Visibility.Visible; if (lineFirstName == null) { //asterisk.Visibility = Visibility.Visible; return; } } } BE.GuestRequest guest = (BE.GuestRequest)((Button)sender).DataContext; guest.EntryDate = UnitDate.SelectedDate.Value; guest.ReleaseDate = UnitDate.SelectedDates.Last(); if (BL_imp.loggedInUser.RefId == 0) { try { guest.MailAddress = BL_imp.loggedInUser.Email; BL_imp.loggedInUser.RefId = (bl.CreateGuestRequest(guest)); bl.updateUser(BL_imp.loggedInUser.Id, BL_imp.loggedInUser.RefId); int IdGuest = BL_imp.loggedInUser.RefId; createOrders(IdGuest); } catch (BE.ZimmerException a) { MessageBox.Show(a.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); } } else { //GuestRequest guest1 = bl.ReadGuestRequest(BL_imp.loggedInUser.RefId); GuestRequest guest1 = (BE.GuestRequest)((Button)sender).DataContext; try { bl.UpdateGuestRequest(guest1); } catch (BE.ZimmerException a) { MessageBox.Show(a.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error); } } newGuestRequest.Visibility = Visibility.Hidden; guestRequest.Visibility = Visibility.Visible; }