private void RibbonButton_Click(object sender, RoutedEventArgs e) { int i = dataGridTurar.SelectedIndex; if (i == -1) { //MessageBox.Show(" Það er enginn túr valinn. ", // "Aðvörun .", // MessageBoxButton.OK, // MessageBoxImage.Hand); dtoTour tour = _ltour[0]; winNewTour nt = new winNewTour(); nt.globl_new_tour = false; nt.p_filtercarid = false; nt.DtoTour = tour; string sm = tour.id.ToString(); nt.Show(); } else { dtoTour tour = _ltour[i]; winNewTour nt = new winNewTour(); nt.globl_new_tour = false; nt.p_filtercarid = true; nt.DtoTour = tour; string sm = tour.id.ToString(); nt.Show(); } }
private void carToolbarComRecSave_Click(object sender, RoutedEventArgs e) { DtoTour = tmpTour.FirstOrDefault(); //var idel = isdelCheckBox.IsChecked.Value; if (globl_new_tour == true) { var window2 = Application.Current.Windows .Cast <Window>() .FirstOrDefault(window => window is MainWindow) as MainWindow; ltour.Add(DtoTour); window2.memListTour = ltour; DBManager dm = new DBManager(); var rmsg = dm.SaveToursToFile(DtoTour); tmpTour.Remove(DtoTour); } else { DBManager dm = new DBManager(); var rmsg = dm.SaveToursToFile(DtoTour); winTurar wt = new winTurar(); wt.Show(); } this.Close(); }
public string SaveToursToFile(dtoTour dt) { string sTimeStamp = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString(); string fname = "list_tours" + sTimeStamp + ".bin"; File.Copy(GetAppConfigSetting() + "list_tours.bin", GetAppDataBackupConfigSetting() + fname); if (memListTour.Count == 0) { using (FileStream fs = new FileStream(GetAppConfigSetting() + "list_tours.bin", FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); memListTour = (List <dtoTour>)bf.Deserialize(fs); } } FileStream fst = new FileStream(GetAppConfigSetting() + "list_tours.bin", FileMode.Create); memListTour.Add(dt); BinaryFormatter bff = new BinaryFormatter(); bff.Serialize(fst, memListTour); fst.Close(); string rvalue = " Túr geymdur"; return(rvalue); }
private bool TurarCustomerFilter(object itour) { dtoTour dtour = itour as dtoTour; string sid = filtervalues[3]; int iid = Convert.ToInt32(sid); return(dtour.idcustomer.Equals(iid)); }
private bool TurarDateFromFilter(object itour) { dtoTour _tour = itour as dtoTour; if (_tour.tdatetime <= _parDateTo && _tour.tdatetime >= _parDateFrom) { return(true); } else { return(false); } }
private bool TurarSingelDateFilter(object itour) { dtoTour _tour = itour as dtoTour; if (_tour.tdatetime.ToShortDateString() == filtervalues[0]) { return(true); } else { return(false); } }
private void carToolbarComRecNew_Click(object sender, RoutedEventArgs e) { System.Windows.Data.CollectionViewSource dtoTourViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("dtoTourViewSource"))); dtoTourViewSource.Source = ltour; int int_id = ltour.FirstOrDefault().id + ltour.Count(); //Debug.WriteLine(int_id.ToString()); dtoTour obj_tour = new dtoTour(); obj_tour.id = int_id; ltour.Add(obj_tour); dtoTourViewSource.View.MoveCurrentToLast(); var window2 = Application.Current.Windows .Cast <Window>() .FirstOrDefault(window => window is MainWindow) as MainWindow; window2.memListTour = ltour; }
private void rComReportRec_Click(object sender, RoutedEventArgs e) { p_repid = 2; int i = dataGridTurar.SelectedIndex; if (i == -1) { MessageBox.Show(" Það er enginn túr valinn. ", "Aðvörun .", MessageBoxButton.OK, MessageBoxImage.Hand); } else { p_DtoTour = _ltour[i]; frmReports frm = new frmReports(); frm.Show(); } }