示例#1
0
        private void GetCarsByFilter()
        {
            try
            {
                var model     = (MainWindowModel)DataContext;
                var priceFrom = model.PriceFrom.ToDouble(null);
                var priceTo   = model.PriceTo.ToDouble(null);

                if (model.DateFrom != null && model.DateTo != null && model.DateFrom > model.DateTo)
                {
                    throw new Exception("Неверный диапазон дат");
                }
                if (priceFrom != null && priceTo != null && priceFrom > priceTo)
                {
                    throw new Exception("Неверный диапазон цены");
                }

                var filter = new Common.Filter();
                filter.City      = model.SelectedCity;
                filter.Model     = model.SelectedModel;
                filter.Mark      = model.SelectedMark;
                filter.Type      = model.SelectedType;
                filter.DateFrom  = model.DateFrom;
                filter.DateTo    = model.DateTo;
                filter.PriceFrom = priceFrom;
                filter.PriceTo   = priceTo;

                model.Cars = DbCarWorker.GetCarsByFilter(filter);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#2
0
 public void SetFilter(Common.Filter filter)
 {
     this._qlikViewConnector.SetFilter(filter);
 }
示例#3
0
 public FileFilter()
 {
     ExtensionFilter = new Common.Filter(this);
     StringFilter = new Common.Filter(this);
 }