async void OnImageJoin2(object sender, System.EventArgs args)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                var Password1 = mPasswordEntry.Text;
                var Password2 = mPassword2Entry.Text;

                var name      = mNameEntry.Text;
                var lastname  = mLastNameEntry.Text;
                var Email     = mEmailEntry.Text;
                var birthdate = mBirthdateEntry.Date.ToString("dd/MM/yyyy");
                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.LOGIN_PAGE_PASSWORD), Utils.getLabel(LabelConstants.PROFILE_PAGE_EDITPASSWORD), "Yes", "No");

                if (answer == true)
                {
                    UIReturn result = EditProfileController.getInstance().changePassword(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;

                        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");
            }
        }
Example #2
0
        public void OnImageSignin(object sender, System.EventArgs args)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                if (App.RePagelogin == true)
                {
                    App.RePagelogin = false;
                    Navigation.PushAsync(new LoginPage());
                }
                else
                {
                    App.RePagelogin = false;
                    var      username  = mUsernameEntry.Text;
                    var      password  = mPasswordEntry.Text;
                    Login    MasQLogin = new Login(username, password);
                    UIReturn uiReturn  = LoginController.getInstance().LoginMember(MasQLogin);

                    if (uiReturn.isSuccess)
                    {
                        App.fristtime = true;
                        Navigation.PushAsync(new MainPage());
                    }
                    else
                    {
                        DisplayAlert(App.AppicationName, uiReturn.getDescription(), "Close");
                    }
                }
            }
            else
            {
                App.RePagelogin = true;
                DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
Example #3
0
        public void OnImageDelete(object sender, System.EventArgs args)
        {
            if (SessionModel.bookingQ != null)
            {
                DependencyService.Get <IFNotification>().SendNotification("คิวเลขที่ " + SessionModel.bookingQ.queueNumber, "ยกเลิกการจองคิวแล้ว");

                UIReturn uiReturn = ReserveQController.getInstance().cancelQueue(SessionModel.bookingQ);
                if (uiReturn.isSuccess)
                {
                    App.fristtime  = true;
                    App.timercheck = false;
                    CountstartQ    = false;
                    Navigation.PushAsync(new MainPage());
                    App.Massage0  = true;
                    App.Massage5  = true;
                    App.Massage15 = true;
                }
                else
                {
                    App.timercheck = false;
                    CountstartQ    = false;
                    DisplayAlert("", uiReturn.getDescription(), "Close");
                }
            }
        }
Example #4
0
        public void itemTapped(object sender, System.EventArgs args)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                Service serviceID = (Service)ServiceListview.SelectedItem;
                //Service s = new Service();
                //s.serviceID = serviceID.serviceID;
                //s.branchID = serviceID.branchID;

                //var answer = await DisplayAlert(Utils.getLabel(LabelConstants.MAIN_PAGE_BOOKING), Utils.getLabel(LabelConstants.SERVICE_PAGE_CONFIRMBOOKING) + " " + serviceID.serviceName​, "Yes", "No");
                //if (answer == true)
                //{
                //UIReturn ChkQ = ReserveQController.getInstance().reserveQueue(s);
                UIReturn ChkQ = ReserveQController.getInstance().reserveQueue(serviceID);
                if (!ChkQ.isSuccess)
                {
                    App.TextSearch = "";
                    DisplayAlert(App.AppicationName, ChkQ.getDescription(), "Close");
                    SessionModel.bookingQ = null;
                }
                else
                {
                    App.RePage     = false;
                    App.TextSearch = "";
                    //App.timerStart();
                    Navigation.PushAsync(new MainPage());
                }
                //}
            }
            else
            {
                DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
        async void OnImageMainExit(object sender, System.EventArgs args)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                var answer = await DisplayAlert(Utils.getLabel(LabelConstants.MAIN_PAGE_LOGOUT), Utils.getLabel(LabelConstants.MAIN_PAGE_CONFIRMLOGOUT), "Yes", "No");

                if (answer == true)
                {
                    UIReturn Chklogout = BranchLoginController.getInstance().LogutBranch();
                    if (!Chklogout.isSuccess)
                    {
                        await DisplayAlert(App.AppicationName, Chklogout.getDescription(), "Close");
                    }
                    else
                    {
                        Navigation.InsertPageBefore(new BranchLoginPage(), this);
                        await Navigation.PopAsync();
                    }
                }
            }
            else
            {
                await DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
Example #6
0
        async void OnImageDelete(object sender, System.EventArgs args)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                if (App.RePagemain == true)
                {
                    App.RePagemain = false;
                    await Navigation.PushAsync(new MainPage());
                }
                else
                {
                    App.TextSearch = "";
                    if (SessionModel.bookingQ != null)
                    {
                        var answer = await DisplayAlert(Utils.getLabel(LabelConstants.MAIN_PAGE_CANCEL), Utils.getLabel(LabelConstants.MAIN_PAGE_CONFIRMCANCEL) + " " + SessionModel.bookingQ.queueNumber, "Yes", "No");

                        if (answer == true)
                        {
                            DependencyService.Get <IFNotification>().SendNotification(Utils.getLabel(LabelConstants.MAIN_PAGE_YOURQUEUE) + " " + SessionModel.bookingQ.queueNumber, " " + Utils.getLabel(LabelConstants.MAIN_PAGE_BOOKINGCANCEL));

                            UIReturn uiReturn = ReserveQController.getInstance().cancelQueue(SessionModel.bookingQ);
                            if (uiReturn.isSuccess)
                            {
                                App.fristtime  = true;
                                App.timercheck = false;
                                CountstartMain = false;
                                //Navigation.PushAsync(new MainPage());
                                App.Massage0          = true;
                                App.Massage5          = true;
                                App.Massage15         = true;
                                TimesQ.Text           = "00:00:00";
                                NumberQ.Text          = "-";
                                NumberQ2.Text         = "-";
                                DetailQ.Text          = "";
                                btn_cancel.IsVisible  = false;
                                btn_cancel2.IsVisible = false;

                                b_booking1.IsVisible = true;
                                b_booking2.IsVisible = false;
                                b_qr1.IsVisible      = true;
                                b_qr2.IsVisible      = false;
                            }
                            else
                            {
                                App.timercheck = false;
                                CountstartMain = false;
                                await DisplayAlert(App.AppicationName, uiReturn.getDescription(), "Close");
                            }
                        }
                    }
                }
            }
            else
            {
                App.RePagemain = false;
                await DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
        public void itemTapped(object sender, System.EventArgs args)
        {
            Service service = (Service)ServiceListview.SelectedItem;

            App.servicename       = service.serviceName;
            ShowWatting.IsVisible = true;

            ServiceListview.ItemTapped -= itemTapped;

            //var answer = await DisplayAlert(Utils.getLabel(LabelConstants.MAIN_PAGE_BOOKING), Utils.getLabel(LabelConstants.SERVICE_PAGE_CONFIRMBOOKING) + " " + servicename​, "Yes", "No");
            //if (answer == true)
            //{
            UIReturn uiReturn = BranchActionsController.getInstance().reserveQueueBranch(service);

            if (uiReturn.isSuccess)
            {
                BranchSessionModel.bookingQ = (Queue)uiReturn.returnObject;
                if (BranchSessionModel.bookingQ != null)
                {
                    //TimeSpan time = TimeSpan.FromSeconds(BranchSessionModel.bookingQ.estimateTime * 60);
                    //string TimesQ = time.ToString(@"hh\:mm\:ss");

                    Navigation.PushAsync(new BranchSummaryQueuePage());

                    //switch (Device.RuntimePlatform)
                    //{
                    //    case Device.iOS:
                    //        DependencyService.Get<IFSocket>().SendMessage("P," + BranchSessionModel.bookingQ.queueNumber + "," + BranchSessionModel.bookingQ.queueBefore + "," + servicename + "," + TimesQ + "<EOF>", App.IPAdress, 11111);
                    //        break;
                    //    default:
                    //        DependencyService.Get<IFSocket>().SendMessage("P," + BranchSessionModel.bookingQ.queueNumber + "," + BranchSessionModel.bookingQ.queueBefore + "," + servicename + "," + TimesQ + "<EOF>", App.IPAdress, 11111);
                    //        break;
                    //}

                    //if (App.CheckSocket == true)
                    //{
                    //    ServiceListview.IsEnabled = true;
                    //    //ShowWatting.IsVisible = false;
                    //    await Navigation.PushAsync(new BranchSummaryQueuePage());
                    //}
                    //else
                    //{
                    //    App.SetIPPage = 1;
                    //    await DisplayAlert(App.AppicationName, App.NoSocket, "Close");
                    //    ServiceListview.IsEnabled = true;
                    //    //ShowWatting.IsVisible = false;
                    //    await Navigation.PushAsync(new BranchSetIPAddress());
                    //}
                }
            }
            else
            {
                DisplayAlert("Error", uiReturn.getDescription(), "Cancel");
            }
            //}
        }
        public void gennaratepicker()
        {
            //List<Province> provinces = (List<Province>)SearchController.getInstance().getProvinces().returnObject;
            //foreach (Province p in provinces)
            //{
            //	ColumnPicker.Items.Add(p.provinceNameTh);

            //}
            //ColumnPicker.Unfocused += (sender, args) =>
            //{
            //	if (ColumnPicker.SelectedIndex >= 0)
            //	{
            //		Province p = provinces.ToArray()[ColumnPicker.SelectedIndex];
            //		List<District> districts = (List<District>)SearchController.getInstance().getDistricts(p).returnObject;
            //		ColumnPicker2.Items.Clear();
            //		searchDistrict = new District();
            //		foreach (District d in districts)
            //		{
            //			ColumnPicker2.Items.Add(d.districtNameTh);
            //		}
            //		searchProvince = p;
            //		ColumnPicker2.Unfocused += (sender2, args2) =>
            //		{
            //			if (ColumnPicker2.SelectedIndex >= 0)
            //			{
            //				District d = districts.ToArray()[ColumnPicker2.SelectedIndex];
            //				searchDistrict = d;
            //			}
            //		};
            //	}
            //};

            if (App.TextSearch != "")
            {
                var searchtxt = App.TextSearch.Trim();
                mSearchEntry.Text = searchtxt;
                UIReturn      uiR    = SearchController.getInstance().getBranches(searchtxt);
                List <Branch> Branch = (List <Branch>)uiR.returnObject;
                BranchView.ItemsSource = Branch;
                if (!uiR.isSuccess)
                {
                    DisplayAlert(App.AppicationName, uiR.getDescription(), "Cancel");
                }
            }
            else
            {
                var           searchtxt = "";
                UIReturn      uiR       = SearchController.getInstance().getBranches(searchtxt);
                List <Branch> Branch    = (List <Branch>)uiR.returnObject;
                BranchView.ItemsSource = Branch;
                if (!uiR.isSuccess)
                {
                    DisplayAlert(App.AppicationName, uiR.getDescription(), "Cancel");
                }
            }
        }
 public void OnImageJoin(object sender, System.EventArgs args)
 {
     if (CrossConnectivity.Current.IsConnected)
     {
         var   username = mUsernameEntry.Text;
         Login m        = new Login();
         m.username = username;
         UIReturn uiReturn = ForgetPasswordController.getInstance().getPassword(m);
         if (uiReturn.isSuccess)
         {
             DisplayAlert(App.AppicationName, uiReturn.getDescription(), "Close");
         }
         else
         {
             DisplayAlert(App.AppicationName, uiReturn.getDescription(), "Close");
         }
     }
     else
     {
         DisplayAlert(App.AppicationName, App.NoInternet, "Close");
     }
 }
Example #10
0
        public void OnImageSearch(object sender, System.EventArgs args)
        {
            //if (ColumnPicker.SelectedIndex >= 0)
            //{
            //	UIReturn uiR = SearchController.getInstance().getBranches(searchProvince, searchDistrict);
            //	List<Branch> Branch = (List<Branch>)uiR.returnObject;
            //	BranchView.ItemsSource = Branch;
            //	if (!uiR.isSuccess)
            //	{
            //		DisplayAlert("", uiR.getDescription(), "Cancel");
            //	}
            //}
            //        else if (mSearchEntry.Text != null)
            //        {
            //            var searchtxt = mSearchEntry.Text;
            //            UIReturn uiR = SearchController.getInstance().getBranches(searchtxt);
            //List<Branch> Branch = (List<Branch>)uiR.returnObject;
            //BranchView.ItemsSource = Branch;
            //if (!uiR.isSuccess)
            //{
            //	DisplayAlert("", uiR.descriptionEN, "Cancel");
            //}
            //}

            if (CrossConnectivity.Current.IsConnected)
            {
                if (mSearchEntry.Text != null)
                {
                    var searchtxt = mSearchEntry.Text;
                    App.TextSearch = searchtxt;
                    UIReturn      uiR    = SearchController.getInstance().getBranches(searchtxt);
                    List <Branch> Branch = (List <Branch>)uiR.returnObject;
                    BranchView.ItemsSource = Branch;
                    if (!uiR.isSuccess)
                    {
                        DisplayAlert(App.AppicationName, uiR.getDescription(), "Cancel");
                    }
                }
            }
            else
            {
                DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
        public void OnImageJoin1(object sender, System.EventArgs args)
        {
            Service s = new Service();

            s.serviceID = searchServece.serviceID;
            s.branchID  = searchServece.branchID;
            UIReturn ChkQ = ReserveQController.getInstance().reserveQueue(s);

            if (!ChkQ.isSuccess)
            {
                DisplayAlert("", ChkQ.getDescription(), "Close");
                SessionModel.bookingQ = null;
            }
            else
            {
                App.timerStart();
                Navigation.PushAsync(new QueuePage());
            }
        }
Example #12
0
        async void OnImageMainExit(object sender, System.EventArgs args)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                if (App.RePagemain == true)
                {
                    App.RePagemain = false;
                    await Navigation.PushAsync(new MainPage());
                }
                else
                {
                    var answer = await DisplayAlert(Utils.getLabel(LabelConstants.MAIN_PAGE_LOGOUT), Utils.getLabel(LabelConstants.MAIN_PAGE_CONFIRMLOGOUT), "Yes", "No");

                    if (answer == true)
                    {
                        UIReturn Chklogout = LoginController.getInstance().LogutMember();
                        if (!Chklogout.isSuccess)
                        {
                            App.timercheck = false;
                            CountstartMain = false;
                            await DisplayAlert(App.AppicationName, Chklogout.getDescription(), "Close");
                        }
                        else
                        {
                            App.timercheck = false;
                            CountstartMain = false;
                            //SessionModel.bookingQ = null;
                            Navigation.InsertPageBefore(new LoginPage(), this);
                            await Navigation.PopAsync();
                        }
                    }
                }
            }
            else
            {
                App.RePagemain = false;
                await DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
Example #13
0
 public void OnImageRating4(object sender, System.EventArgs args)
 {
     if (CrossConnectivity.Current.IsConnected)
     {
         SessionModel.bookingQ.rank = "5";
         UIReturn uiReturn = ReserveQController.getInstance().ratingStaff(SessionModel.bookingQ);
         if (uiReturn.isSuccess)
         {
             App.Massage0  = true;
             App.Massage5  = true;
             App.Massage15 = true;
             Navigation.PushAsync(new MainPage());
         }
         else
         {
             DisplayAlert(App.AppicationName, uiReturn.getDescription(), "Close");
         }
     }
     else
     {
         DisplayAlert(App.AppicationName, App.NoInternet, "Close");
     }
 }
Example #14
0
        public void OnImageJoin(object sender, System.EventArgs args)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                var name      = mNameEntry.Text;
                var lastname  = mLastNameEntry.Text;
                var Phone     = mPhone.Text;
                var Email     = mEmailEntry.Text;
                var birthdate = mBirthdateEntry.Date.ToString("dd/MM/yyyy");
                var Password1 = mPasswordEntry.Text;
                var Password2 = mPassword2Entry.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;

                UIReturn uiReturn = RegisterController.getInstance().register(member);

                if (uiReturn.isSuccess)
                {
                    Navigation.PushAsync(new MainPage());
                }
                else
                {
                    DisplayAlert(App.AppicationName, uiReturn.getDescription(), "Close");
                }
            }
            else
            {
                DisplayAlert(App.AppicationName, App.NoInternet, "Close");
            }
        }
        public void OnService17(object sender, System.EventArgs args)
        {
            btn_service17.IsEnabled  = false;
            text_service17.IsEnabled = false;
            App.servicename          = service17.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(service17);

            if (uiReturn.isSuccess)
            {
                BranchSessionModel.bookingQ = (Queue)uiReturn.returnObject;
                if (BranchSessionModel.bookingQ != null)
                {
                    Navigation.PushAsync(new BranchSummaryQueuePage());
                }
            }
            else
            {
                DisplayAlert("Error", uiReturn.getDescription(), "Cancel");
            }
        }
Example #16
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 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");
            }
        }
Example #18
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);
            });
        }
Example #19
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");
            }
        }
Example #20
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);
                });
            }
        }