public void OnService1(object sender, System.EventArgs args)
        {
            btn_service1.IsEnabled  = false;
            text_service1.IsEnabled = false;
            App.servicename         = service1.serviceName;

            Image image = sender as Image;

            if (image != null)
            {
                string source = image.Source as FileImageSource;
                if (String.Equals(source, "bluebutton.png"))
                {
                    image.Source = "bluebutton2.png";
                }
                else
                {
                    image.Source = "bluebutton.png";
                }
            }

            UIReturn uiReturn = BranchActionsController.getInstance().reserveQueueBranch(service1);

            if (uiReturn.isSuccess)
            {
                BranchSessionModel.bookingQ = (Queue)uiReturn.returnObject;
                if (BranchSessionModel.bookingQ != null)
                {
                    Navigation.PushAsync(new BranchSummaryQueuePage());
                }
            }
            else
            {
                DisplayAlert("Error", uiReturn.getDescription(), "Cancel");
            }
        }
Esempio n. 2
0
        public void OnImageSubmit(object sender, System.EventArgs args)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                if (chooseCouter.SelectedItem != null)
                {
                    App.CounterUser = chooseCouter.SelectedItem.ToString();

                    UIReturn uiReturn = UserActionServiceController.getInstance().openService(UserSessionModel.choosedBranch, UserSessionModel.choosedGroup, App.CounterUser);
                    if (uiReturn.isSuccess)
                    {
                        Navigation.PushAsync(new UserActionQueuePage());
                    }
                    else
                    {
                        DisplayAlert(App.AppicationName, uiReturn.getDescription(), "cancel");
                    }
                }
            }
            else
            {
                DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
        public UIReturn LoginUser(Login input)
        {
            if (String.IsNullOrEmpty(input.username))
            {
                return(Constants.uiErrorEmptyUserName);
            }
            if (String.IsNullOrEmpty(input.password))
            {
                return(Constants.uiErrorEmptyPassword);
            }

            UserLoginRq req = UserLoginService.getInstance().getUserLoginRq(input);
            UserLoginRs res = UserLoginService.getInstance().CallLogin(req);

            if (res.header.isSuccess)
            {
                UserSessionModel.loginUser = res.user;
                App.Database.SaveItem(DBConstants.ID_LOGIN_USER, JsonConvert.SerializeObject(UserSessionModel.loginUser));
            }

            UIReturn ret = new UIReturn(res.header);

            return(ret);
        }
        public void OnImageSignin(object sender, System.EventArgs args)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                var      username  = mUsernameEntry.Text;
                var      password  = mPasswordEntry.Text;
                Login    MasQLogin = new Login(username, password);
                UIReturn uiReturn  = BranchLoginController.getInstance().LoginBranch(MasQLogin);

                if (uiReturn.isSuccess)
                {
                    if (App.IPAdress != "")
                    {
                        List <Service> Service      = (List <Service>)BranchActionsController.getInstance().getBranchServices().returnObject;
                        int            CountService = Service.Count;

                        //CountService = 2;

                        if (CountService == 1)
                        {
                            App.NumberServiceBranch = 1;
                            Navigation.PushAsync(new Service1Page());
                        }
                        else if (CountService == 2)
                        {
                            App.NumberServiceBranch = 1;
                            Navigation.PushAsync(new Service2Page());
                        }
                        else if (CountService == 3)
                        {
                            App.NumberServiceBranch = 3;
                            Navigation.PushAsync(new Service3Page());
                        }
                        else if (CountService == 4)
                        {
                            App.NumberServiceBranch = 4;
                            Navigation.PushAsync(new Service4Page());
                        }
                        else if (CountService == 5)
                        {
                            App.NumberServiceBranch = 5;
                            Navigation.PushAsync(new Service5Page());
                        }
                        else if (CountService == 6)
                        {
                            App.NumberServiceBranch = 6;
                            Navigation.PushAsync(new Service6Page());
                        }
                        else if (CountService == 7)
                        {
                            App.NumberServiceBranch = 7;
                            Navigation.PushAsync(new Service7Page());
                        }
                        else if (CountService == 8)
                        {
                            App.NumberServiceBranch = 8;
                            Navigation.PushAsync(new Service8Page());
                        }
                        else if (CountService == 9)
                        {
                            App.NumberServiceBranch = 9;
                            Navigation.PushAsync(new Service9Page());
                        }
                        else if (CountService == 10)
                        {
                            App.NumberServiceBranch = 10;
                            Navigation.PushAsync(new Service10Page());
                        }
                        else if (CountService == 11)
                        {
                            App.NumberServiceBranch = 11;
                            Navigation.PushAsync(new Service11Page());
                        }
                        else if (CountService == 12)
                        {
                            App.NumberServiceBranch = 12;
                            Navigation.PushAsync(new Service12Page());
                        }
                        else if (CountService == 13)
                        {
                            App.NumberServiceBranch = 13;
                            Navigation.PushAsync(new Service13Page());
                        }
                        else if (CountService == 14)
                        {
                            App.NumberServiceBranch = 14;
                            Navigation.PushAsync(new Service14Page());
                        }
                        else if (CountService == 15)
                        {
                            App.NumberServiceBranch = 15;
                            Navigation.PushAsync(new Service15Page());
                        }
                        else if (CountService == 16)
                        {
                            App.NumberServiceBranch = 16;
                            Navigation.PushAsync(new Service16Page());
                        }
                        else if (CountService == 17)
                        {
                            App.NumberServiceBranch = 17;
                            Navigation.PushAsync(new Service17Page());
                        }
                        else if (CountService == 18)
                        {
                            App.NumberServiceBranch = 18;
                            Navigation.PushAsync(new Service18Page());
                        }
                        else if (CountService == 19)
                        {
                            App.NumberServiceBranch = 19;
                            Navigation.PushAsync(new Service19Page());
                        }
                        else if (CountService == 20)
                        {
                            App.NumberServiceBranch = 20;
                            Navigation.PushAsync(new Service20Page());
                        }
                    }
                    else
                    {
                        DisplayAlert(App.AppicationName, "กรุณาตั้งค่า IP Address ก่อนเข้าระบบ", "Close");
                        Navigation.PushAsync(new BranchSetIPAddress());
                    }
                }
                else
                {
                    DisplayAlert(App.AppicationName, uiReturn.getDescription(), "Close");
                }
            }
            else
            {
                DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
Esempio n. 5
0
        public void QRCode()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                App.TextSearch = "";
                bool CheckQR = false;
                if (SessionModel.bookingQ == null || String.IsNullOrEmpty(SessionModel.bookingQ.queueNumber))
                {
                    Branch b        = new Branch();
                    Branch BranchID = new Branch();
                    double BranchNumber;
                    var    scanPage = new ZXingScannerPage();
                    scanPage.Title = "Scan QR Code";
                    // Navigate to our scanner page
                    Navigation.PushAsync(scanPage);

                    scanPage.OnScanResult += (result) =>
                    {
                        // Stop scanning
                        scanPage.IsScanning = false;

                        // Pop the page and show the result
                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            await Navigation.PopAsync();
                            //await DisplayAlert("Scanned Barcode", result.Text, "OK");
                            try
                            {
                                BranchNumber = Convert.ToDouble(result.Text.Substring(1));
                                CheckQR      = true;
                            }
                            catch
                            {
                                await DisplayAlert(App.AppicationName, Utils.getLabel(LabelConstants.MAIN_PAGE_NOINFORMATION), "Close");
                                CheckQR = false;
                            }

                            if (CheckQR == true)
                            {
                                b.branchID = result.Text;
                                if (b.branchID != null || b.branchID != "")
                                {
                                    UIReturn uiR = SearchController.getInstance().getBranchDetail(b);
                                    if (!uiR.isSuccess)
                                    {
                                        await DisplayAlert(App.AppicationName, uiR.getDescription(), "Close");
                                    }
                                    else
                                    {
                                        BranchID = (Branch)uiR.returnObject;
                                        await Navigation.PushAsync(new ServicePage(BranchID));
                                        App.SearchID = 2;
                                    }
                                }
                            }
                        });
                    };

                    var options = new MobileBarcodeScanningOptions
                    {
                        AutoRotate = false,
                        UseFrontCameraIfAvailable = true,
                        TryHarder       = true,
                        PossibleFormats = new List <ZXing.BarcodeFormat>
                        {
                            ZXing.BarcodeFormat.EAN_8, ZXing.BarcodeFormat.EAN_13
                        }
                    };

                    //add options and customize page
                    scanPage = new ZXingScannerPage(options)
                    {
                        IsAnalyzing                   = true,
                        DefaultOverlayTopText         = "Align the barcode within the frame",
                        DefaultOverlayBottomText      = string.Empty,
                        DefaultOverlayShowFlashButton = true
                    };
                }
                else
                {
                    DisplayAlert(App.AppicationName, Utils.getLabel(LabelConstants.MAIN_PAGE_QBLOCK), "Close");
                }
            }
            else
            {
                DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
Esempio n. 6
0
        public void Process()
        {
            CountstartMain = true;
            Service s = new Service();

            s.serviceID = SessionModel.bookingQ.serviceID;
            s.branchID  = SessionModel.bookingQ.branchID;
            UIReturn ChkQueue = ReserveQController.getInstance().reserveQueue(SessionModel.bookingQ);

            if (App.fristtime)
            {
                App.fristtime  = false;
                ChkTime        = SessionModel.bookingQ.estimateTime.GetHashCode() * 60;
                App.timercount = ChkTime;
                if (App.timercount < 900)
                {
                    App.Massage15 = false;
                }
            }

            if (App.RePage == false)
            {
                Device.StartTimer(new TimeSpan(0, 0, 1), () =>
                {
                    if (SessionModel.bookingQ != null)
                    {
                        if (CrossConnectivity.Current.IsConnected)
                        {
                            if (CountstartMain == true)
                            {
                                App.Recount = App.Recount + 1;
                            }

                            TimeSpan time = TimeSpan.FromSeconds(App.timercount);

                            TimesQ.Text = time.ToString(@"hh\:mm\:ss");
                            if (App.timercount == 0)
                            {
                                App.Massage15 = false;
                                App.Massage5  = false;
                            }

                            if (App.timercount <= 900 && App.Massage15 == true)
                            {
                                DependencyService.Get <IFNotification>().SendNotification(Utils.getLabel(LabelConstants.MAIN_PAGE_YOURQUEUE) + " " + SessionModel.bookingQ.queueNumber, Utils.getLabel(LabelConstants.MAIN_PAGE_NOTIFICATION1));
                                App.Massage15 = false;
                            }

                            if (App.timercount == 300 && App.Massage5 == true)
                            {
                                DependencyService.Get <IFNotification>().SendNotification(Utils.getLabel(LabelConstants.MAIN_PAGE_YOURQUEUE) + " " + SessionModel.bookingQ.queueNumber, Utils.getLabel(LabelConstants.MAIN_PAGE_NOTIFICATION2));
                                App.Massage5 = false;
                            }

                            if (App.timercount == 0 && App.Massage0 == true)
                            {
                                DependencyService.Get <IFNotification>().SendNotification(Utils.getLabel(LabelConstants.MAIN_PAGE_YOURQUEUE) + " " + SessionModel.bookingQ.queueNumber, String.Format(ChkQueue.getDescription(), SessionModel.bookingQ.queueBefore));
                                App.Massage0 = false;
                            }

                            if (!ChkQueue.isSuccess)
                            {
                                DisplayAlert(App.AppicationName, ChkQueue.getDescription(), "Close");
                                TimesQ.Text    = "00:00:00";
                                App.timercheck = false;
                            }
                            else
                            {
                                DetailQ.Text  = String.Format(ChkQueue.getDescription(), SessionModel.bookingQ.queueBefore);
                                NumberQ.Text  = SessionModel.bookingQ.queueNumber;
                                NumberQ2.Text = SessionModel.bookingQ.queueBefore.ToString();
                                if (SessionModel.loginMember != null)
                                {
                                    UserNames.Text = Utils.getLabel(LabelConstants.MAIN_PAGE_HELLO) + " " + SessionModel.loginMember.firstName + "  " + SessionModel.loginMember.lastName;
                                }

                                Main_History.Text = Utils.getLabel(LabelConstants.MAIN_PAGE_HISTORY);
                                Main_Booking.Text = Utils.getLabel(LabelConstants.MAIN_PAGE_BOOKING);
                                Main_QR.Text      = Utils.getLabel(LabelConstants.MAIN_PAGE_QR);
                                YourQ.Text        = Utils.getLabel(LabelConstants.MAIN_PAGE_YOURQUEUE);
                                AllQ.Text         = Utils.getLabel(LabelConstants.MAIN_PAGE_ALLQUEUE);
                                WaitTime.Text     = Utils.getLabel(LabelConstants.MAIN_PAGE_WATETIME);

                                if (App.Thai == true)
                                {
                                    btn_cancel.IsVisible  = false;
                                    btn_cancel2.IsVisible = true;
                                }
                                else
                                {
                                    btn_cancel.IsVisible  = true;
                                    btn_cancel2.IsVisible = false;
                                }

                                if (App.timercount == 0)
                                {
                                    TimesQ.Text = "00:00:00";
                                }
                            }

                            if (App.Recount == App.TimeReface)
                            {
                                App.Recount = 0;

                                Queue Queue = (Queue)ReserveQController.getInstance().reserveQueue(SessionModel.bookingQ).returnObject;
                                ChkTime2    = SessionModel.bookingQ.estimateTime * 60;


                                if (ChkTime2 < App.timercount)
                                {
                                    ChkTime        = SessionModel.bookingQ.estimateTime * 60;
                                    App.timercount = SessionModel.bookingQ.estimateTime * 60;
                                    NumberQ2.Text  = SessionModel.bookingQ.queueBefore.ToString();
                                }
                                else
                                {
                                    if (App.timercount == 0)
                                    {
                                        App.timercount = ChkTime2;
                                    }
                                }

                                ChkQueue = ReserveQController.getInstance().reserveQueue(SessionModel.bookingQ);
                                if (!ChkQueue.isSuccess)
                                {
                                    App.timercheck = false;
                                    DisplayAlert(App.AppicationName, ChkQueue.getDescription(), "Close");
                                    TimesQ.Text = "00:00:00";
                                }
                                else
                                {
                                    if (ChkQueue.id == 58)
                                    {
                                        DependencyService.Get <IFNotification>().SendNotification(Utils.getLabel(LabelConstants.MAIN_PAGE_YOURQUEUE) + " " + SessionModel.bookingQ.queueNumber, ChkQueue.getDescription());
                                        DetailQ.Text   = ChkQueue.getDescription();
                                        App.timercheck = false;
                                        CountstartMain = false;
                                        App.fristtime  = true;
                                        Navigation.PushAsync(new RatingPage());
                                        TimesQ.Text          = "00:00:00";
                                        b_booking1.IsVisible = true;
                                        b_booking2.IsVisible = false;
                                        b_qr1.IsVisible      = true;
                                        b_qr2.IsVisible      = false;
                                    }
                                    else if (ChkQueue.id == 63)
                                    {
                                        DependencyService.Get <IFNotification>().SendNotification(Utils.getLabel(LabelConstants.MAIN_PAGE_YOURQUEUE) + " " + SessionModel.bookingQ.queueNumber, ChkQueue.getDescription());
                                        SessionModel.clearQueue();
                                        DetailQ.Text          = ChkQueue.getDescription();
                                        NumberQ.Text          = "-";
                                        App.timercheck        = false;
                                        CountstartMain        = false;
                                        App.fristtime         = true;
                                        TimesQ.Text           = "00:00:00";
                                        b_booking1.IsVisible  = true;
                                        b_booking2.IsVisible  = false;
                                        b_qr1.IsVisible       = true;
                                        b_qr2.IsVisible       = false;
                                        btn_cancel.IsVisible  = false;
                                        btn_cancel2.IsVisible = false;
                                    }
                                    else
                                    {
                                        if (SessionModel.bookingQ != null)
                                        {
                                            DetailQ.Text = String.Format(ChkQueue.getDescription(), SessionModel.bookingQ.queueBefore);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    return(App.timercheck);
                });
            }
        }
Esempio n. 7
0
 private void getProvince()
 {
     UIReturn result = SearchController.getInstance().getProvinces();
 }
        async void OnImageJoin(object sender, System.EventArgs args)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                var name     = mNameEntry.Text;
                var lastname = mLastNameEntry.Text;
                var Email    = mEmailEntry.Text;

                var birthdate = mBirthdateEntry.Date.ToString("dd/MM/yyyy");
                var Password1 = PasswordEdit.ToString();
                var Password2 = PasswordEdit.ToString();
                var Phone     = mPhone.Text;

                Member member = new Member();
                member.email           = Email;
                member.password        = Password1;
                member.confirmPassword = Password2;
                member.firstName       = name;
                member.lastName        = lastname;
                member.birthDate       = birthdate;
                member.tel             = Phone;
                member.memberID        = SessionModel.loginMember.memberID;

                var answer = await DisplayAlert(Utils.getLabel(LabelConstants.PROFILE_PAGE_PROFILE), Utils.getLabel(LabelConstants.PROFILE_PAGE_EDITPROFILE), "Yes", "No");

                if (answer == true)
                {
                    UIReturn result = EditProfileController.getInstance().editProfile(member);

                    if (result.isSuccess)
                    {
                        mNameEntry.IsEnabled      = false;
                        mLastNameEntry.IsEnabled  = false;
                        mEmailEntry.IsEnabled     = false;
                        mPhone.IsEnabled          = false;
                        mBirthdateEntry.IsEnabled = false;
                        mPasswordEntry.IsEnabled  = false;
                        mPassword2Entry.IsEnabled = false;

                        imgEditProfile.IsVisible  = true;
                        imgEditProfile.IsEnabled  = true;
                        imgSave1.IsVisible        = false;
                        imgSave1.IsEnabled        = false;
                        imgEditPassword.IsVisible = true;
                        imgEditPassword.IsEnabled = true;
                        imgSave2.IsVisible        = false;
                        imgSave2.IsEnabled        = false;

                        await DisplayAlert(App.AppicationName, result.getDescription(), "OK");

                        await Navigation.PushAsync(new MainPage());
                    }
                    else
                    {
                        await DisplayAlert(App.AppicationName, result.getDescription(), "Close");
                    }
                }
            }
            else
            {
                await DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
        public UIReturn logout()
        {
            UIReturn ret = new UIReturn();

            return(ret);
        }
Esempio n. 10
0
        public void Process()
        {
            Service s = new Service();

            s.serviceID = SessionModel.bookingQ.serviceID;
            s.branchID  = SessionModel.bookingQ.branchID;
            UIReturn ChkQueue = ReserveQController.getInstance().reserveQueue(SessionModel.bookingQ);

            if (App.fristtime)
            {
                ChkTime        = SessionModel.bookingQ.estimateTime.GetHashCode() * 60;
                App.fristtime  = false;
                App.timercount = ChkTime;
                if (App.timercount < 900)
                {
                    App.Massage15 = false;
                }
            }

            Device.StartTimer(new TimeSpan(0, 0, 1), () =>
            {
                if (SessionModel.bookingQ != null)
                {
                    if (CountstartQ == true)
                    {
                        App.Recount = App.Recount + 1;
                    }

                    TimeSpan time = TimeSpan.FromSeconds(App.timercount);

                    TimesQ.Text = time.ToString(@"hh\:mm\:ss");

                    if (App.timercount <= 900 && App.Massage15 == true)
                    {
                        DependencyService.Get <IFNotification>().SendNotification("คิวเลขที่ " + SessionModel.bookingQ.queueNumber, "อีก 15 นาทีจะถึงคิวของคุณ");
                        App.Massage15 = false;
                    }

                    if (App.timercount <= 300 && App.Massage5 == true)
                    {
                        DependencyService.Get <IFNotification>().SendNotification("คิวเลขที่ " + SessionModel.bookingQ.queueNumber, "อีก 5 นาทีจะถึงคิวของคุณ");
                        App.Massage5 = false;
                    }

                    if (App.timercount == 0 && App.Massage0 == true)
                    {
                        DependencyService.Get <IFNotification>().SendNotification("คิวเลขที่ " + SessionModel.bookingQ.queueNumber, String.Format(ChkQueue.getDescription(), SessionModel.bookingQ.queueBefore));
                        App.Massage0 = false;
                    }

                    if (!ChkQueue.isSuccess)
                    {
                        App.timercheck = false;
                        DisplayAlert("", ChkQueue.getDescription(), "Close");
                        TimesQ.Text = "00:00:00";
                    }
                    else
                    {
                        if (SessionModel.bookingQ != null)
                        {
                            DetailQ.Text = String.Format(ChkQueue.getDescription(), SessionModel.bookingQ.queueBefore);
                        }

                        if (App.timercount == 0)
                        {
                            TimesQ.Text = "00:00:00";
                        }
                    }

                    if (App.Recount == 10)
                    {
                        App.Recount = 0;

                        Queue Queue = (Queue)ReserveQController.getInstance().reserveQueue(SessionModel.bookingQ).returnObject;
                        ChkTime2    = SessionModel.bookingQ.estimateTime.GetHashCode() * 60;
                        if (ChkTime2 < App.timercount)
                        {
                            ChkTime        = SessionModel.bookingQ.estimateTime.GetHashCode() * 60;
                            App.timercount = SessionModel.bookingQ.estimateTime.GetHashCode() * 60;
                        }

                        ChkQueue = ReserveQController.getInstance().reserveQueue(SessionModel.bookingQ);
                        if (!ChkQueue.isSuccess)
                        {
                            App.timercheck = false;
                            DisplayAlert("", ChkQueue.getDescription(), "Close");
                            TimesQ.Text = "00:00:00";
                        }
                        else
                        {
                            if (ChkQueue.id == 58)
                            {
                                DependencyService.Get <IFNotification>().SendNotification("คิวเลขที่ " + SessionModel.bookingQ.queueNumber, ChkQueue.getDescription());
                                DetailQ.Text   = ChkQueue.getDescription();
                                App.timercheck = false;
                                CountstartQ    = false;
                                Navigation.PushAsync(new RatingPage());
                                TimesQ.Text = "00:00:00";
                            }
                            else if (ChkQueue.id == 63)
                            {
                                DependencyService.Get <IFNotification>().SendNotification("คิวเลขที่ " + SessionModel.bookingQ.queueNumber, ChkQueue.getDescription());
                                DetailQ.Text = ChkQueue.getDescription();
                                SessionModel.clearQueue();
                                NumberQ.Text   = "-";
                                App.timercheck = false;
                                CountstartQ    = false;
                                Navigation.PushAsync(new MainPage());
                                TimesQ.Text = "00:00:00";
                            }
                            else
                            {
                                if (SessionModel.bookingQ != null)
                                {
                                    DetailQ.Text = String.Format(ChkQueue.getDescription(), SessionModel.bookingQ.queueBefore);
                                }
                            }
                        }
                    }
                }
                return(App.timercheck);
            });
        }