public void OnTicketClicked(object sender, EventArgs e) { if (CrossConnectivity.Current.IsConnected) { try { var GroupTik = (sender as Button).BindingContext as TicketGroupModel; TicketNumber tik = new TicketNumber(); SQLiteConnection s; s = DependencyService.Get <ISQLite>().GetConnection(); s.Table <TicketNumber>(); tik.TicketNum = Convert.ToString(GroupTik.TicketID); //tbr.TblName = Convert.ToString(data.ID); TicketQuery c = new TicketQuery(); c.InsertDetails(tik); //TicketQuery y = new TicketQuery(); //SQLiteConnection d; //d = DependencyService.Get<ISQLite>().GetConnection(); //d.Table<TicketNumber>(); // var tikcount = s.ExecuteScalar<string>("SELECT TicketNum FROM TicketNumber WHERE max(Id)"); var tikcount = s.ExecuteScalar <string>("SELECT TicketNum FROM TicketNumber ORDER BY Id DESC LIMIT 1"); // DisplayAlert("ticket", tikcount, "ok"); // GroupTik.TicketID; decimal toti = 0; Navigation.PushAsync(new OnlineCart(toti)); } catch (Exception ex) { // Console.WriteLine("An error occurred: '{0}'", ex); } } else { // write your code if there is no Internet available DisplayAlert("NETWORK ERROR", "SYSTEM IS OFFLINE", "Ok"); } }
public async void GetTicketinfo() { var TicketNu = 0; var FlagNu = 0; int tablupdate = 3; long LocationId = OnlineLoginPage.LocationDetail; var client = RestService.HttpClient; var postData = new List <KeyValuePair <string, string> >(); postData.Add(new KeyValuePair <string, string>("LocationId", Convert.ToString(LocationId))); postData.Add(new KeyValuePair <string, string>("TableID", tikettable));//////// postData.Add(new KeyValuePair <string, string>("IdentityID", Convert.ToString(tablupdate))); var content = new FormUrlEncodedContent(postData); // var response = await client.PostAsync("http://192.168.43.226/GetTicketNew.php", content); var response = await client.PostAsync(RestService.ipupdate + "GetTicketNew.php", content); JsonTicketNewNum ObjContactList = new JsonTicketNewNum(); if (response.IsSuccessStatusCode) { string JsonTiket = response.Content.ReadAsStringAsync().Result; ObjContactList = JsonConvert.DeserializeObject <JsonTicketNewNum>(JsonTiket); foreach (TiketViewModel t in ObjContactList.TicketInfo) { TicketNu = t.TiketNumb; FlagNu = t.FlagNum; } } // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); TicketNumber tik = new TicketNumber(); SQLiteConnection s; s = DependencyService.Get <ISQLite>().GetConnection(); s.Table <TicketNumber>(); tik.TicketNum = Convert.ToString(TicketNu); //tbr.TblName = Convert.ToString(data.ID); TicketQuery c = new TicketQuery(); c.InsertDetails(tik); }
public async void GetTicketinfo() { TableQuery p = new TableQuery(); SQLiteConnection r; r = DependencyService.Get <ISQLite>().GetConnection(); r.Table <TempTbl>(); var count = r.ExecuteScalar <string>("SELECT max(TblName) FROM TempTbl"); // await DisplayAlert("tableID", count, "OK"); var TicketNu = 0; var FlagNu = 0; long LocationId = OnlineLoginPage.LocationDetail; var client = new HttpClient(); var postData = new List <KeyValuePair <string, string> >(); postData.Add(new KeyValuePair <string, string>("LocationId", Convert.ToString(LocationId))); postData.Add(new KeyValuePair <string, string>("TableID", Convert.ToString(JsonTable.tablenew)));//////// postData.Add(new KeyValuePair <string, string>("IdentityID", Convert.ToString(2))); var content = new FormUrlEncodedContent(postData); // var response = await client.PostAsync("http://192.168.43.226/GetTicketNew.php", content); var response = await client.PostAsync(RestService.ipupdate + "GetTicketNew.php", content); JsonTicketNewNum ObjContactList = new JsonTicketNewNum(); if (response.IsSuccessStatusCode) { string JsonTiket = response.Content.ReadAsStringAsync().Result; ObjContactList = JsonConvert.DeserializeObject <JsonTicketNewNum>(JsonTiket); foreach (TiketViewModel t in ObjContactList.TicketInfo) { TicketNu = t.TiketNumb; FlagNu = t.FlagNum; } } // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); TicketNumber tik = new TicketNumber(); SQLiteConnection s; s = DependencyService.Get <ISQLite>().GetConnection(); s.Table <TicketNumber>(); tik.TicketNum = Convert.ToString(TicketNu); //tbr.TblName = Convert.ToString(data.ID); TicketQuery c = new TicketQuery(); c.InsertDetails(tik); decimal toti = 0; if (FlagNu == 0) { //await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); // await Navigation.PushAsync(new OnlineTabbed()); await Navigation.PushAsync(new FoodTabbedPage()); } else if (FlagNu == 1) { // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); await Navigation.PushAsync(new OnlineCart(toti)); } else { // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); await Navigation.PushAsync(new CartTiketsPage()); } }
//public async void Higlight() //{ // if (Newtab == Usetab) // //{ // await DisplayAlert("ocupied tables are", Convert.ToString(Usetab), "OK"); // // //Button btn = new Button(); // // //btn.BackgroundColor = Color.FromHex("#22ac38"); // //} //} public async void GetTicketinfo() { //TableQuery p = new TableQuery(); //SQLiteConnection r; //r = DependencyService.Get<ISQLite>().GetConnection(); //r.Table<TempTbl>(); //var count = r.ExecuteScalar<string>("SELECT max(TblName) FROM TempTbl"); // await DisplayAlert("tableID", count, "OK"); var TicketNu = 0; var FlagNu = 0; long LocationId = OnlineLoginPage.LocationDetail; var client = RestService.HttpClient; var postData = new List <KeyValuePair <string, string> >(); postData.Add(new KeyValuePair <string, string>("LocationId", Convert.ToString(LocationId))); postData.Add(new KeyValuePair <string, string>("TableID", Convert.ToString(tablenew)));//////// postData.Add(new KeyValuePair <string, string>("IdentityID", Convert.ToString(resul))); var content = new FormUrlEncodedContent(postData); // var response = await client.PostAsync("http://192.168.43.226/GetTicketNew.php", content); var response = await client.PostAsync(RestService.ipupdate + "GetTicketNew.php", content); JsonTicketNewNum ObjContactList = new JsonTicketNewNum(); if (response.IsSuccessStatusCode) { string JsonTiket = response.Content.ReadAsStringAsync().Result; ObjContactList = JsonConvert.DeserializeObject <JsonTicketNewNum>(JsonTiket); foreach (TiketViewModel t in ObjContactList.TicketInfo) { TicketNu = t.TiketNumb; FlagNu = t.FlagNum; } } // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); TicketNumber tik = new TicketNumber(); SQLiteConnection s; s = DependencyService.Get <ISQLite>().GetConnection(); s.Table <TicketNumber>(); tik.TicketNum = Convert.ToString(TicketNu); //tbr.TblName = Convert.ToString(data.ID); TicketQuery c = new TicketQuery(); c.InsertDetails(tik); TempTbl tbr = new TempTbl(); SQLiteConnection p; p = DependencyService.Get <ISQLite>().GetConnection(); p.Table <TempTbl>(); tbr.TblNumbe = tablenew; //tbr.TblName = itemSelectedData.Name; TableQuery d = new TableQuery(); d.InsertDetails(tbr); decimal toti = 0; if (FlagNu == 0 && resul != 3) { //await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); // await Navigation.PushAsync(new OnlineTabbed()); await Navigation.PushAsync(new StuwardSelect()); } else if (FlagNu == 1 && resul != 3) { // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); await Navigation.PushAsync(new OnlineCart(toti)); } else if (FlagNu > 1 || resul == 0) { // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); await Navigation.PushAsync(new CartTiketsPage()); } else if (FlagNu == 2 || resul == 2) { // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); await Navigation.PushAsync(new FoodTabbedPage()); } else if (FlagNu == 2 || resul == 3) { int flgyes = 3; // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); //await Navigation.PushAsync(new FoodTabbedPage()); await Navigation.PushAsync(new MainVedioPage(flgyes)); } //TicketQuery y = new TicketQuery(); //SQLiteConnection d; //d = DependencyService.Get<ISQLite>().GetConnection(); //d.Table<TicketNumber>(); //var tikcount = d.ExecuteScalar<string>("SELECT max(TicketNum) FROM TicketNumber"); //await DisplayAlert("tiket numb", tikcount, "OK"); //decimal toti = 0; //if (FlagNu == 0) //{ ////await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); //// await Navigation.PushAsync(new OnlineTabbed()); //await Navigation.PushAsync(new StuwardSelect()); //} //else if(FlagNu == 1) // { // // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); // await Navigation.PushAsync(new OnlineCart(toti)); // } // else // { // // await DisplayAlert("ticket", Convert.ToString(TicketNu), "OK"); // await Navigation.PushAsync(new CartTiketsPage()); // } }