Exemple #1
0
        public void UpdateListSource()
        {
            // filter
            if (FilterFinished)
            {
                listChuyendi = ChuyendiDAO.GetAll().Where(ele => ele.Status.Equals(TTChuyendi.STATUS[4])).ToList();
            }
            else
            if (FilterNotFinished)
            {
                listChuyendi = ChuyendiDAO.GetAll().Where(ele => !ele.Status.Equals(TTChuyendi.STATUS[4])).ToList();
            }
            else
            {
                listChuyendi = ChuyendiDAO.GetAll();
            }

            //search
            if (searchTextBox.Text.Length > 0)
            {
                listChuyendi = listChuyendi.Where(ele =>
                                                  ele.Name.ToLower().Contains(searchTextBox.Text.ToLower()) ||
                                                  ele.Place.ToLower().Contains(searchTextBox.Text.ToLower()) ||
                                                  ele.Members.Any(mem => mem.Name.ToLower().Contains(searchTextBox.Text.ToLower()))
                                                  ).ToList();
            }


            chuyendiListView.ItemsSource = listChuyendi;
            chuyendiListView.Items.Refresh();
            chuyendiListView.ScrollIntoView(chuyendiListView.Items[0]);
        }
        public void UpdateList()
        {
            listViewMembers.ItemsSource = ChuyendiDAO.GetAll()[IDTTChuyendi].Members;
            listViewMembers.Items.Refresh();

            // Binding avg TTChuyendi
            Binding bindingAvgCD = new Binding("Avg");

            bindingAvgCD.Source = ChuyendiDAO.GetAll()[IDTTChuyendi];
            bindingAvgCD.Mode   = BindingMode.TwoWay;
            bindingAvgCD.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            avgTextBlock.SetBinding(TextBlock.TextProperty, bindingAvgCD);

            // Binding total TTChuyendi
            Binding bindingTotalCD = new Binding("Total");

            bindingTotalCD.Source = ChuyendiDAO.GetAll()[IDTTChuyendi];
            bindingTotalCD.Mode   = BindingMode.TwoWay;
            bindingTotalCD.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            totalTextBlock.SetBinding(TextBlock.TextProperty, bindingTotalCD);

            Binding bindingMem = new Binding("Members");

            bindingMem.Source = ChuyendiDAO.GetAll()[IDTTChuyendi];
            bindingMem.Mode   = BindingMode.TwoWay;
            bindingMem.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            chartController.SetBinding(PieSeries.ItemsSourceProperty, bindingMem);
            chartController.Refresh();
        }
        private void addBillButton_Click(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;

            ChuyendiDAO.GetAll()[IDTTChuyendi].Members.Where(mem => mem.Name.Equals(btn.Tag)).ToList()[0].Bills.Insert(0, new Bill());
            ChuyendiDAO.GetAll()[IDTTChuyendi].Update();
            UpdateList();
        }
Exemple #4
0
        private void WrapPanel_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            int pos          = ChuyendiDAO.GetAll().IndexOf(chuyendiListView.SelectedItem as TTChuyendi);
            var DetailScreen = new TTChuyendiManager(pos);

            DetailScreen.ShowDialog();

            UpdateListSource();
        }
 private void addMemberBtn_Click(object sender, RoutedEventArgs e)
 {
     ChuyendiDAO.GetAll()[IDTTChuyendi].Members.Insert(0, new Thanhvien()
     {
         Name = "Nhập tên", Bills = new List <Bill>(), Debt = 0, Paid = 0
     });
     ChuyendiDAO.GetAll()[IDTTChuyendi].Update();
     UpdateList();
 }
        private void addTTChuyenDiBtn_Click(object sender, RoutedEventArgs e)
        {
            ChuyendiDAO.Add(newTTChuyendi);

            AppSettings.appSettings.ImgIDCurrent++;
            AppSettings.SaveSettings();

            MessageBox.Show("Đã thêm thành công!");

            this.Close();
        }
Exemple #7
0
        public MainWindow()
        {
            InitializeComponent();

            ChuyendiDAO.ConnectToVirtualDataBase();

            FilterFinished    = false;
            FilterNotFinished = false;

            var bc = new BrushConverter();

            filterFinishedBtn.Background    = (Brush)bc.ConvertFrom(color_notchoose);
            filterNotFinishedBtn.Background = (Brush)bc.ConvertFrom(color_notchoose);

            listChuyendi = ChuyendiDAO.GetAll();

            chuyendiListView.ItemsSource = listChuyendi;
        }
        public TTChuyendiManager(int IDChuyendi)
        {
            this.DataContext = this;
            InitializeComponent();
            IDTTChuyendi = IDChuyendi;
            TTChuyendi thisCD = ChuyendiDAO.GetAll()[IDChuyendi];

            listViewMembers.ItemsSource = ChuyendiDAO.GetAll()[IDChuyendi].Members;

            // Binding name TTChuyendi
            Binding bindingNameCD = new Binding("Name");

            bindingNameCD.Source = ChuyendiDAO.GetAll()[IDChuyendi];
            bindingNameCD.Mode   = BindingMode.TwoWay;
            bindingNameCD.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            nameCDTextBlock.SetBinding(TextBlock.TextProperty, bindingNameCD);

            // Binding place TTChuyendi
            Binding bindingPlaceCD = new Binding("Place");

            bindingPlaceCD.Source = ChuyendiDAO.GetAll()[IDChuyendi];
            bindingPlaceCD.Mode   = BindingMode.TwoWay;
            bindingPlaceCD.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            placeTextBlock.SetBinding(TextBlock.TextProperty, bindingPlaceCD);

            imageImg.Source = new BitmapImage(new Uri(AppSettings.WorkingDerectory + thisCD.ImgLink));


            // Binding total TTChuyendi
            Binding bindingTotalCD = new Binding("Total");

            bindingTotalCD.Source = ChuyendiDAO.GetAll()[IDChuyendi];
            bindingTotalCD.Mode   = BindingMode.TwoWay;
            bindingTotalCD.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            totalTextBlock.SetBinding(TextBlock.TextProperty, bindingTotalCD);

            // Binding avg TTChuyendi
            Binding bindingAvgCD = new Binding("Avg");

            bindingAvgCD.Source = ChuyendiDAO.GetAll()[IDChuyendi];
            bindingAvgCD.Mode   = BindingMode.TwoWay;
            bindingAvgCD.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            avgTextBlock.SetBinding(TextBlock.TextProperty, bindingAvgCD);

            //Binding Combobox
            statusChangeComboBox.ItemsSource = TTChuyendi.STATUS;

            Binding bindingStatus = new Binding("Status");

            bindingStatus.Source = ChuyendiDAO.GetAll()[IDChuyendi];
            bindingStatus.Mode   = BindingMode.TwoWay;
            bindingStatus.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            statusChangeComboBox.SetBinding(ComboBox.SelectedValueProperty, bindingStatus);



            Binding bindingMem = new Binding("Members");

            bindingMem.Source = ChuyendiDAO.GetAll()[IDChuyendi];
            bindingMem.Mode   = BindingMode.TwoWay;
            bindingMem.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            chartController.SetBinding(PieSeries.ItemsSourceProperty, bindingMem);
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     BackgroundTTChuyendi.ImageSource = new BitmapImage(new Uri(AppSettings.WorkingDerectory + ChuyendiDAO.GetAll()[IDTTChuyendi].ImgLink));
 }
 private void costTxtBox_LostFocus(object sender, RoutedEventArgs e)
 {
     ChuyendiDAO.GetAll()[IDTTChuyendi].Update();
     UpdateList();
 }