コード例 #1
0
        public async void DeleteCompanyAsync()
        {
            var company = await _companyService.RemoveCompany(Company.Id);

            await _navigationService.NavigateToAccountAsync();

            AlertService.Toast("Bedrijf verwijderd", $"Het bedrijf {company.Name} succesvol verwijderd");
        }
コード例 #2
0
        public async void AddPromotionAsync(String s, Object d)
        {
            var promotion = new Promotion(s, (Discount)d);

            var promotionResult = await _companyService.AddPromotion(Company.Id, promotion);

            Promotions.Add(promotionResult);
            AlertService.Toast("Promotie toegevoegd", $"De promotie {promotionResult.Description} toegevoegd");
        }
コード例 #3
0
        public async void AddEventAsync(string t, string d, DateTime date, string i)
        {
            var @event = new Event(t, d, date, i);

            var eventResult = await _companyService.AddEvent(Company.Id, @event);

            Events.Add(eventResult);
            AlertService.Toast("Event toegevoegd", $"Het event {eventResult.Title} toegevoegd");
            //Company.Events.Add(@event);
        }
コード例 #4
0
        public async void CreateCompany(string name, string description, string keyWordsString, Categories categorie, Owner owner, ICollection <Location> locations, List <OpeningHours> openingHours, string leaveOfAbsence, SocialMedia socialMedia)
        {
            // is overwritten in the backend
            List <Promotion> promotions = null;
            var company = new Company(name, description, keyWordsString, categorie, owner, locations, openingHours, null, socialMedia, promotions);

            var responseCompany = await _companyService.AddCompany(company);

            AlertService.Toast($"{responseCompany.Name} aangemaakt", $"{responseCompany.Name} succesvol toegevoegd");
            await _navigationService.NavigateToCompaniesAsync();
        }
コード例 #5
0
        private async Task AddCompanyToSubscriptionAsync()
        {
            await _userService.AddCompanyToSubscription(Company);

            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Company)));
            if (await CheckIfCompanyIsAlreadySubscribed())
            {
                AlertService.Toast($"Bedrijf {Company.Name}", $"Afgemeld op bedrijf {Company.Name}");
            }
            else
            {
                AlertService.Toast($"Bedrijf {Company.Name}", $"Geabonneerd op bedrijf {Company.Name}");
            }
        }
コード例 #6
0
        public async void RegisterAsync(string sname, string fname, DateTimeOffset date, string email, string uname, string pass, bool ch)
        {
            User user;

            if (ch == true)
            {
                user = new Visitor(sname, fname, date.DateTime, email, pass, UserType.Visitor, new List <Company>());
            }
            else
            {
                user = new Owner(sname, fname, date.DateTime, email, pass, UserType.Owner, new List <Company>());
            }
            var result = await _userService.RegisterUser(user);

            AlertService.Toast($"Succesvol geregistreerd", $"Je bent nu ingelogd als {user.Username}");
            await _navigationService.NavigateToCompaniesAsync();
        }
コード例 #7
0
        private async Task RunTaskAsync(CmdArg Arg)
        {
            try
            {
                if (Arg.Action == Helper.Action._Help)
                {
                    SPC.Services.InternetChecker.OnlineGuard();

                    string Topic = Arg.ShortCut;
                    if (!string.IsNullOrEmpty(Topic))
                    {
                        WaitingService.Wait("Openning Online Help".Translate(), Arg.Url);

                        var theHelpUrl = await SPC.Cloud.HelpService.GetHelpTopicUrlAsync(Topic);

                        nav.NavigateTo(theHelpUrl);

                        WaitingService.Done();
                    }
                }

                else if (Arg.GetShortCutSegment(0).Equals("Debug", StringComparison.OrdinalIgnoreCase))
                {
                    var onoff = Arg.GetDefaultParameter();
                    if (string.IsNullOrEmpty(onoff))
                    {
                        Ctx.AppConfig.DebugMode = !Ctx.AppConfig.DebugMode;
                    }
                    else
                    {
                        Ctx.AppConfig.DebugMode = onoff.ToBoolean();
                    }

                    AlertService.Toast($"Debug Mode is : {(Ctx.AppConfig.DebugMode ? "ON" : "OFF")}");
                }

                else if (Arg.Url.StartsWith("http", StringComparison.OrdinalIgnoreCase)) //Open online resources
                {
                    WaitingService.Wait("Openning browser", Arg.Url);

                    nav.NavigateTo(Arg.Url);

                    WaitingService.Done();
                }

                else if (Arg.Url.StartsWith(@"/", StringComparison.OrdinalIgnoreCase)) //Open Local files
                {
                    WaitingService.Done();
                }

                else if (Arg.Url.StartsWith(@"mailto://", StringComparison.OrdinalIgnoreCase))
                {
                    WaitingService.Wait("Composing mail ...", "");

                    nav.NavigateTo(Arg.Url);

                    WaitingService.Done();
                }

                else if (Arg.Url.MatchesRegExp(@"^[A-Za-z]+://")) //Open other apps "lyft://
                {
                    WaitingService.Done();
                }

                else if (Arg.Action.MatchesRegExp("^Insert$|^Update$|^InsertUpdate$|^UpdateAll$|^Delete$|^DeleteAll$"))
                //NON-UI Commands
                {
                    WaitingService.Wait(Arg.Action, Arg.Url);

                    await SPC.Commands.NonUIActionRunner.RunURLCommandAsync(Arg);

                    WaitingService.Done();
                }

                else
                {
                    var pClass = SPCTypes.GetClassType(Arg.GetShortCutSegment(0), true);

                    if (pClass != null)
                    {
                        //Runable non UI command if Action = Run or the command is not a mix of Editable and Runnable
                        if (pClass.GetInterfaces().Contains(typeof(IRunable)) && (Arg.Action == Helper.Action._Run || !pClass.GetInterfaces().Contains(typeof(IEditable))))
                        {
                            var Sample = BOFactory.CreateSample(pClass) as IRunable;

                            await Sample.RunAsync(Arg);
                        }
                        //Class is ISupportQueryInfoList and the Action = Select
                        else if (Arg.Action == Helper.Action._Select && pClass.GetInterfaces().Contains(typeof(SPC.Interfaces.ISupportQueryInfoList))) //Query BO
                        {
                            if (BOFactory.CreateSample(pClass) is ISupportQueryInfoList sample)
                            {
                                var theList = await sample.GetInfoListAsync(Arg.GetDictionary()) as IList;

                                await ValueSelector.SelectAsync(theList, "Info List");
                            }
                        }

                        else

                        {
                            AlertService.Toast($"Could not find any suitable Page for class : {Arg.ShortCut}");
                            WaitingService.Done();
                        }
                    }


                    else //Short Command is not a class
                    {
                        WaitingService.Done();
                        AlertService.Toast($"Could not find the class {Arg.GetShortCutSegment(0)}");
                    }
                }
            }
            catch (Exception ex)
            {
                WaitingService.Done();
                if (ex.GetType() == typeof(NullReferenceException)) //file extension is not support by ios
                {
                    try
                    {
                        AlertService.ShowError(ex);
                    }
                    catch (Exception ex1)
                    {
                        //ExceptionHandler.LogAndAlert(ex1);
                        // AlertService.ShowError(ex1);
                    }
                }
                //if (ex.GetType() == typeof(ExitScriptException)) //file extension is not support by ios
                //ExceptionHandler.LogAndToast(ex);
                //else
                //ExceptionHandler.LogAndAlert(ex);
                //AlertService.ShowError(ex);
            }
        }