public async Task <IActionResult> Index(string user, int roleid)
        {
            var cookieValue = "";
            var role        = 1;

            if (user == null)
            {
                cookieValue = HttpContext.Session.GetString("user");
                role        = Convert.ToInt32(HttpContext.Session.GetInt32("position"));
            }
            else
            {
                HttpContext.Session.SetString(SessionKeyName, user);
                HttpContext.Session.SetInt32(SessionKeyRole, roleid);
            }



            cookieValue = HttpContext.Session.GetString("user");
            role        = Convert.ToInt32(HttpContext.Session.GetInt32("position"));

            var homemodel = new GeneralFilter
            {
                roleid   = role,
                username = cookieValue,
                Crimes   = await StaticDataHandler.GetCrimes("https://localhost:44311/api/")
            };

            return(View(homemodel));
        }
        private void DgResults_OnOnFilter(object sender, FilterEvent e)
        {
            var viewModel = (GeneratePurchaseViewModel)DataContext;

            if (_temp == 1)
            {
                viewModel.SelectedPurchaseRow.DetailsList.Clear();
                string filter;
                Dictionary <string, object> valueObjecttemp;
                GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
                viewModel.DetailFilter        = filter;
                viewModel.DetailValuesObjects = valueObjecttemp;
                viewModel.GetDetailData();
            }
            else
            {
                viewModel.SelectedPurchaseRow.DetailsList.Clear();
                string filter;
                Dictionary <string, object> valueObjecttemp;
                GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
                viewModel.DetailFilter        = filter;
                viewModel.DetailValuesObjects = valueObjecttemp;
                viewModel.GetDetail2Data();
            }
        }
 public void SetCvsVideos(CollectionViewSource cvsFromView)
 {
     _cvsVideosFromView = cvsFromView;
     _yearFilter        = new GeneralFilter(cvsFromView, FilterByYear);
     _monthFilter       = new GeneralFilter(cvsFromView, FilterByMonth);
     _dayFilter         = new GeneralFilter(cvsFromView, FilterByDay);
     _hourFilter        = new GeneralFilter(cvsFromView, FilterByHour);
 }
示例#4
0
        private void Grid_OnOnFilter(object sender, FilterEvent e)
        {
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            _viewModel.Filter        = filter;
            _viewModel.ValuesObjects = valueObjecttemp;
        }
示例#5
0
        private void DgDyeingOrderResults_OnOnFilter(object sender, FilterEvent e)
        {
            ViewModel.DyeingOrderHeaderList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            ViewModel.Filter        = filter;
            ViewModel.ValuesObjects = valueObjecttemp;
            ViewModel.SearchHeader();
        }
        private void DetailGrid_OnOnFilter(object sender, FilterEvent e)
        {
            _viewModel.RecieveHeaderList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            _viewModel.DetailSubFilter        = filter;
            _viewModel.DetailSubValuesObjects = valueObjecttemp;
            _viewModel.GetRecieveHeaderListData();
        }
示例#7
0
        private void DetailGrid_OnFilter(object sender, FilterEvent e)
        {
            ViewModel.TransactionHeader.DetailsList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            ViewModel.DetailFilter        = filter;
            ViewModel.DetailValuesObjects = valueObjecttemp;
            ViewModel.GetDetailData();
        }
示例#8
0
        private void MainGrid_OnFilter(object sender, FilterEvent e)
        {
            _viewModel.MainRowList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            _viewModel.Filter        = filter;
            _viewModel.ValuesObjects = valueObjecttemp;
            _viewModel.GetMaindata();
        }
示例#9
0
        private void DetailSubGrid_OnFilter(object sender, FilterEvent e)
        {
            _viewModel.SelectedMainRow.StyleDetailList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            _viewModel.DetailSubFilter        = filter;
            _viewModel.DetailSubValuesObjects = valueObjecttemp;
            _viewModel.GetRecInvStyle();
        }
示例#10
0
        private void DetailGrid_OnFilter(object sender, FilterEvent e)
        {
            _viewModel.SelectedMainRow.DetailsList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            _viewModel.DetailFilter        = filter;
            _viewModel.DetailValuesObjects = valueObjecttemp;
            _viewModel.GetDetailData();
        }
示例#11
0
        public void FilterByInvalidRating()
        {
            var api     = new Mock <ITourApi>().Object;
            var handler = new Mock <IImportExportHandler>().Object;
            var filter  = new GeneralFilter();
            var tp      = new TourPlannerClient(api, handler, filter);

            tp.UpdateFilter("Terrible");
            var ok = tp.FilterMethod(tour);

            Assert.IsFalse(ok);
        }
示例#12
0
        public void FilterByValidDescription()
        {
            var api     = new Mock <ITourApi>().Object;
            var handler = new Mock <IImportExportHandler>().Object;
            var filter  = new GeneralFilter();
            var tp      = new TourPlannerClient(api, handler, filter);

            tp.UpdateFilter("ed diam nonumy");
            var ok = tp.FilterMethod(tour);

            Assert.IsTrue(ok);
        }
示例#13
0
        private void RecGrid_OnOnFilter(object sender, FilterEvent e)
        {
            var viewModel = (PurchaseOrderRequestViewModel)DataContext;

            viewModel.SelectedMainRow.RecHeaderList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            viewModel.DetailSubFilter        = filter;
            viewModel.DetailSubValuesObjects = valueObjecttemp;
            viewModel.GetRecHeader();
        }
示例#14
0
        private void DgResults_OnOnFilter(object sender, FilterEvent e)
        {
            var viewModel = (IssueJournalViewModel)DataContext;

            viewModel.SelectedMainRow.SubDetailList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            viewModel.DetailSubFilter        = filter;
            viewModel.DetailSubValuesObjects = valueObjecttemp;
            viewModel.GetSubDetaildata();
        }
示例#15
0
        private void MainGrid_OnFilter(object sender, FilterEvent e)
        {
            var viewModel = DataContext as AccessoriesViewModel;

            viewModel.MainRowList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            viewModel.Filter        = filter;
            viewModel.ValuesObjects = valueObjecttemp;
            viewModel.GetAllAcc();
        }
        private void MainGrid_OnFilter(object sender, FilterEvent e)
        {
            var viewModel = DataContext as GlobalRetailBusinessBudgetViewModel;

            viewModel.MainRowList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            viewModel.Filter        = filter;
            viewModel.ValuesObjects = valueObjecttemp;
            viewModel.GetMaindata();
        }
        private void DgResults_OnOnFilter(object sender, FilterEvent e)
        {
            var viewModel = (FabricDefectsViewModel)DataContext;

            viewModel.TransactionHeaderList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            viewModel.DetailFilter        = filter;
            viewModel.DetailValuesObjects = valueObjecttemp;
            viewModel.SearchHeader();
        }
        private void DgResults_OnOnFilter(object sender, FilterEvent e)
        {
            var viewModel = (DyeingOrderInvoiceViewModel)DataContext;

            viewModel.MainRowList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            viewModel.DetailFilter        = filter;
            viewModel.DetailValuesObjects = valueObjecttemp;
            viewModel.SearchHeader();
        }
示例#19
0
        private void DgResults_OnOnFilter(object sender, FilterEvent e)
        {
            var viewModel = (PurchaseOrderRequestViewModel)DataContext;

            viewModel.MainRowList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            viewModel.Filter        = filter;
            viewModel.ValuesObjects = valueObjecttemp;
            viewModel.GetMaindata();
        }
示例#20
0
        public StoreCommissionViewModel() : base(PermissionItemName.StoreCommission)
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                MainRowList = new ObservableCollection <TblStoreCommission>();

                BankDepositClient.GetLookUpStoreCompleted += (s, e) =>
                {
                    StoreList = e.Result;
                    foreach (var item in MainRowList)
                    {
                        item.TblStore1 = StoreList.FirstOrDefault(st => st.iserial == item.Tblstore);
                    }
                };

                GetComboData();
                BankDepositClient.GetStoreCommissionCompleted += (s, sv) =>
                {
                    MainRowList.Clear();
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblStoreCommission();

                        newrow.InjectFrom(row);
                        newrow.TblStore1 = StoreList.FirstOrDefault(st => st.iserial == row.Tblstore);
                        MainRowList.Add(newrow);
                    }
                    Loading = false;
                    if (SearchWindow != null)
                    {
                        SearchWindow.Loading = false;
                    }
                    if (FullCount == 0 && MainRowList.Count == 0)
                    {
                        AddNewMainRow(false);
                    }
                };
                BankDepositClient.UpdateOrInsertStoreCommissionCompleted += (s, x) => SaveCompleted(x.Result, x.Error);
                FilterCommand = new RelayCommand <FilterEvent>((e) => {
                    string filter;
                    Dictionary <string, object> valueObjecttemp;
                    GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
                    Filter        = filter;
                    ValuesObjects = valueObjecttemp;
                    GetMaindata();
                });
                GetMaindata();
                //AddNewMainRow(false);
            }
        }
示例#21
0
        private void StandardBomGrid_OnFilter(object sender, FilterEvent e)
        {
            if (_viewModel.Loading)
            {
                return;
            }
            _viewModel.StandardBomList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            _viewModel.DetailFilter        = filter;
            _viewModel.DetailValuesObjects = valueObjecttemp;
            _viewModel.GetStandardBom();
        }
示例#22
0
        public override void OnFilter(Os.Controls.DataGrid.Events.FilterEvent e)
        {
            base.OnFilter(e);
            ItemsList.Clear();// هنفضى الريكوردات
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            Filter        = filter;          //الفيلتر موجود فى البيز
            ValuesObjects = valueObjecttemp; // ده كمان فى البيز
            if (GetDataCommand.CanExecute(GetDataParameter))
            {
                GetDataCommand.Execute(GetDataParameter);
            }
        }
示例#23
0
        private void MainGrid_OnFilter(object sender, FilterEvent e)
        {
            var viewModel = DataContext as ColorLinkViewModel;

            if (viewModel != null)
            {
                viewModel.ColorsList.Clear();
                string filter;
                Dictionary <string, object> valueObjecttemp;
                GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
                viewModel.DetailFilter        = filter;
                viewModel.DetailValuesObjects = valueObjecttemp;
                viewModel.GetDetaildata();
            }
        }
        public async Task <IActionResult> GetVehicleDetails(GeneralFilter generalFilter)
        {
            var user = HttpContext.Session.GetString("user");

            var insurance     = new VehicleInsurance();
            var outputHandler = new OutputHandler();

            try
            {
                var requestUrl = $"{BaseUrl}{apiUri}/GetInsuranceDetails?loggedInUser={user}&RegistrationNumber={generalFilter.RegistrationNumber}";
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(requestUrl);
                    var response = await client.GetAsync(requestUrl);



                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        outputHandler = await response.Content.ReadAsAsync <OutputHandler>();

                        if (!outputHandler.IsErrorOccured
                            )
                        {
                            insurance = JsonConvert.DeserializeObject <VehicleInsurance>(outputHandler.Result.ToString());
                        }
                    }
                    else
                    {
                        outputHandler = await response.Content.ReadAsAsync <OutputHandler>();

                        outputHandler.IsErrorOccured = true;
                    }
                };
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            if (outputHandler.IsErrorOccured)
            {
                VehicleInsuranceNotFound(outputHandler);
                return(View(nameof(VehicleInsuranceNotFound)));
            }

            return(View(insurance));
        }
        // the not used parameter is kept here to satisfy
        // the interface of RelayCommand
        public void ResetFilters(object parameter = null)
        {
            // clear filters
            if (CanResetFilters)
            {
                GeneralFilter[] filters = new GeneralFilter[]
                {
                    _yearFilter, _monthFilter, _dayFilter, _hourFilter
                };

                foreach (GeneralFilter filter in filters)
                {
                    filter.RemoveFilter();
                }
            }
        }
示例#26
0
        // the not used parameter is kept here to satisfy
        // the interface of RelayCommand
        public void ResetFilters(object parameter = null)
        {
            // clear filters
            if (CanResetFilters)
            {
                GeneralFilter[] filters = new GeneralFilter[]
                {
                    _ageGroupFilter, _difficultyFilter
                };

                foreach (GeneralFilter filter in filters)
                {
                    filter.RemoveFilter();
                }
            }
        }
        public async Task<IActionResult> ChargeForSpecific(GeneralFilter generalFilter)
        {
            var crime = new CrimeDTO();
            crime.CrimeName = generalFilter.CrimeName;
            crime.VehicleRegistrationNumber = generalFilter.RegistrationNumber;
            crime.LicenseNumber = generalFilter.LicenseNumber;
            crime.LoggedInUser  = HttpContext.Session.GetString("user");

            var outputHandler = new OutputHandler();
            try
            {
                var requestUrl = $"{BaseUrl}{apiUri}/Charged";
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(requestUrl);
                    var response = await client.PostAsJsonAsync(requestUrl, crime);

                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        outputHandler = await response.Content.ReadAsAsync<OutputHandler>();

                        if (!outputHandler.IsErrorOccured)
                        {
                            crime = JsonConvert.DeserializeObject<CrimeDTO>(outputHandler.Result.ToString());

                        }
                    };

                };

            }
            catch (Exception ex)
            {

                throw new Exception(ex.Message);
            }

            if (outputHandler.Result == null)
            {
                outputHandler.IsErrorOccured = true;
                outputHandler.Message = "Something went wrong";
                return View();
            }

            return View(crime);

        }
示例#28
0
        private void MainGrid_OnFilter(object sender, FilterEvent e)
        {
            var _viewModel = DataContext as PromHeaderViewModel;

            if (_viewModel.Loading)
            {
                return;
            }
            _viewModel.DetailList.Clear();
            string filter;
            Dictionary <string, object> valueObjecttemp;

            GeneralFilter.GeneralFilterMethod(out filter, out valueObjecttemp, e);
            _viewModel.DetailFilter        = filter;
            _viewModel.DetailValuesObjects = valueObjecttemp;
            _viewModel.GetDetailData();
        }
        public async Task <IActionResult> GetLicenseDetails(GeneralFilter generalFilter)
        {
            var driverLicense = new LicenseViewModel();
            var outputHandler = new OutputHandler();

            try
            {
                var requestUrl = $"{BaseUrl}{apiUri}?loggedInUser=Denzel&LicenseNumber={generalFilter.LicenseNumber}&Vehicle={generalFilter.RegistrationNumber}";
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(requestUrl);
                    var response = await client.GetAsync(requestUrl);

                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        outputHandler = await response.Content.ReadAsAsync <OutputHandler>();

                        if (!outputHandler.IsErrorOccured)
                        {
                            driverLicense = JsonConvert.DeserializeObject <LicenseViewModel>(outputHandler.Result.ToString());
                        }
                    }
                    ;
                };
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            if (outputHandler.Result == null)
            {
                outputHandler.Identifier = generalFilter.LicenseNumber;
                LicenseNotFound(outputHandler);
                return(View(nameof(LicenseNotFound)));
            }

            return(View(driverLicense));
        }
示例#30
0
 /// <summary>
 /// Allows setting of _cvsRoutesFromView from the View's constructor in (.xaml.cs)
 /// </summary>
 /// <param name="cvsFromView"></param>
 public void SetCvsRoutes(CollectionViewSource cvsFromView)
 {
     _cvsRoutesFromView = cvsFromView;
     _ageGroupFilter    = new GeneralFilter(cvsFromView, FilterByAgeGroup);
     _difficultyFilter  = new GeneralFilter(cvsFromView, FilterByDifficulty);
 }