public static bool isAddOk()
        {
            bool ageOk = AddNewTripViewModel.Instance.AddTrip.TRIP_MEMBER.Count != 0;

            if (ageOk)
            {
                TRIP temp = AddNewTripViewModel.Instance.AddTrip;
                temp.ISDONE = temp.RETURNDATE < DateTime.Now;
                temp.TITTLE = temp.TITTLE.Trim();
                HomeScreen.GetDatabaseEntities().TRIPS.Add(temp);
                HomeScreen.GetDatabaseEntities().SaveChanges();
                if ((bool)temp.ISDONE)
                {
                    HaveTakenTripsListViewModel.Instance.AddTrip(temp);
                }
                else
                {
                    BeingTakenTripsListViewModel.Instance.AddTrip(temp);
                }
                SettingsViewModel.Instance.UpdateTripSortMethod();
                MessageBox.Show("Thêm thành công");
            }
            else
            {
                MessageBox.Show("Nhập thiếu trường dữ liệu");
            }
            return(ageOk);
        }
 public AddNewTripViewModel() : base()
 {
     AddTrip                 = new TRIP();
     AddTrip.TOTALCOSTS      = 0;
     AddTrip.CURRENTPROCEEDS = 0;
     MEMBERs                 = new ObservableCollection <MEMBER>(HomeScreen.GetDatabaseEntities().MEMBERS.ToList());
     LOCATIONs               = new ObservableCollection <LOCATION>(HomeScreen.GetDatabaseEntities().LOCATIONS.ToList());
     Instance                = this;
 }
示例#3
0
 public void Add(TRIP item)
 {
     Items.Add(item);
 }