Ejemplo n.º 1
0
        public IPaccessPage()
        {
            // bone = "background.png";
            // btwo = "backgroundnew.png";


            InitializeComponent();
            //bone = "background.png";
            //themeName.Title = "select";
            themeName.Items.Add("Style1");
            themeName.Items.Add("Style2");
            themeName.Items.Add("Style3");
            //themeName.Items.Add("Style4");

            //  btwo = "backgroundnew.png";
            //  this.BackgroundImage = "backnewtwo.png";
            IPQuery          IPBC = new IPQuery();
            SQLiteConnection IPB;

            IPB = DependencyService.Get <ISQLite>().GetConnection();
            IPB.Table <IPaddressDB>();
            //  var tikcount = d.ExecuteScalar<string>("SELECT TicketNum FROM TicketNumber");
            var backnow = IPB.ExecuteScalar <string>("SELECT backgrund FROM IPaddressDB ORDER BY Id DESC LIMIT 1");

            //if (backnow == bone)
            //{
            // this.BackgroundImage = saveback;
            saveback = backnow;
            if (saveback == "Style1")
            {
                this.BackgroundImage = "background.png";
                // splashscreen.gif
            }
            else if (saveback == "Style2")
            {
                this.BackgroundImage = "backgroundnew.png";
            }
            else if (saveback == "Style3")
            {
                this.BackgroundImage = "backnewtwo.png";
                //this.BackgroundImage = "backgroundSmoke.gif";
            }
            //else if (saveback == "Style4")
            //{
            //    // this.BackgroundImage = "backnewtwo.png";
            //    this.BackgroundImage = "backgroundSmoke.gif";
            //}
            //  this.BackgroundImage = saveback;
            //    this.BackgroundImage = bone;
            //}
            //else if(backnow == btwo)
            //{
            //    this.BackgroundImage = "backgroundnew.png";
            //}
            //this.BackgroundImage = backnow;


            DisplayAlert("Background massage", backnow, "OK");


            this.Title = "IP SETUP";

            IPQuery          IPR = new IPQuery();
            SQLiteConnection IPK;

            IPK = DependencyService.Get <ISQLite>().GetConnection();
            IPK.Table <IPaddressDB>();
            //  var tikcount = d.ExecuteScalar<string>("SELECT TicketNum FROM TicketNumber");
            var ipdiso = IPK.ExecuteScalar <string>("SELECT IPnumb FROM IPaddressDB ORDER BY Id DESC LIMIT 1");

            // var backnow = IPK.ExecuteScalar<string>("SELECT backgrund FROM IPaddressDB ORDER BY Id DESC LIMIT 1");
            // DisplayAlert("Existing IP", ipdiso, "OK");

            ipaddressWIFItwo = ipdiso;

            //if (backnow == bone)
            //{
            //    this.BackgroundImage = "background.png";
            //}
            //else if (backnow == btwo)
            //{
            //    this.BackgroundImage = "backgroundnew.png";
            //}
            //else
            //{
            //    this.BackgroundColor = Color.White;
            //    DisplayAlert("No background", "No background", "OK");
            //}
            //  isOnline();

            // ipaddressWIFItwo = "http://172.16.101.236/";
            //WifiManager wifiManager = (WifiManager)context.GetSystemService(Service.WifiService);
            //int ip = wifiManager.ConnectionInfo.IpAddress;
        }
Ejemplo n.º 2
0
        public void Addr_btn_Clicked(object sender, EventArgs e)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                try
                {
                    Navigation.PopModalAsync(true);
                    //FoodTabPage.imagedeta = null;
                    //GC.Collect();
                    //TableQuery p = new TableQuery();
                    //SQLiteConnection s;
                    //s = DependencyService.Get<ISQLite>().GetConnection();
                    //s.Table<TempTbl>();
                    //var count = s.ExecuteScalar<string>("SELECT max(TblName) FROM TempTbl");

                    TicketQuery      y = new TicketQuery();
                    SQLiteConnection d;
                    d = DependencyService.Get <ISQLite>().GetConnection();
                    d.Table <TicketNumber>();
                    var tikcount = d.ExecuteScalar <string>("SELECT max(TicketNum) FROM TicketNumber");
                    // var tikcount = d.ExecuteScalar<string>("SELECT TicketNum FROM TicketNumber ORDER BY Id DESC LIMIT 1");
                    // DisplayAlert("tick", tikcount, "ok");
                    // ticketnow.Text = tikcount;

                    IPQuery          IPR = new IPQuery();
                    SQLiteConnection IPK;
                    IPK = DependencyService.Get <ISQLite>().GetConnection();
                    IPK.Table <IPaddressDB>();
                    //  var tikcount = d.ExecuteScalar<string>("SELECT TicketNum FROM TicketNumber");
                    var TerminalNo     = IPK.ExecuteScalar <string>("SELECT Terminal FROM IPaddressDB ORDER BY Id DESC LIMIT 1");
                    var OrderCounterNu = IPK.ExecuteScalar <string>("SELECT Counter FROM IPaddressDB ORDER BY Id DESC LIMIT 1");

                    // long itmID = Convert.tolo ItemID.Text;


                    decimal qty     = Convert.ToDecimal(Qty.Text);
                    decimal total   = Convert.ToDecimal(Price.Text);
                    decimal Total   = (qty * total);
                    int     BatchNo = Convert.ToInt16(Batch.Text);

                    long LocationDetail = OnlineLoginPage.LocationDetail;
                    //Total =+Total;
                    // tablenow.Text = count;
                    if (StuwardSelect.StuwardNme == null)
                    {
                        UsorSt = "GUEST";
                        StuwardSelect.StuwardIDn = 19834000000000;
                    }
                    else
                    {
                        UsorSt = StuwardSelect.StuwardNme;
                        StuwardSelect.StuwardIDn = StuwardSelect.StuwardIDn;
                    }


                    //if (StuwardSelect.StuwardIDn == null)
                    //{
                    //    UsortStNum = 10834000000000;
                    //}
                    //else
                    //{
                    //    UsorSt = StuwardSelect.StuwardNme;
                    //}



                    //var client = RestService.HttpClient;
                    var    client   = new HttpClient();
                    var    postData = new List <KeyValuePair <string, string> >();
                    string name     = OnlineLoginPage.UserName;
                    long   UserIDn  = OnlineLoginPage.UserID;
                    // string uid = OnlineLoginPage.us
                    int fromApp   = 1;
                    int NoRadyKOT = 0;
                    var deviceID  = TestProject.Data.Hardware.Default.DeviceId;
                    // var device = Resolver.Resolve<IDevice>();

                    // var table = s.Table<CartRecord>();
                    //  foreach (var item in table)
                    if (BatchNo < 1)
                    {
                        DisplayAlert("Wrong entry", "Invalid", "OK");
                    }
                    else
                    {
                        postData.Add(new KeyValuePair <string, string>("Language", Convert.ToString(1)));              //Language
                        postData.Add(new KeyValuePair <string, string>("Company", Convert.ToString(1)));               //Company
                        postData.Add(new KeyValuePair <string, string>("Branch", Convert.ToString(1)));                //Branch
                        postData.Add(new KeyValuePair <string, string>("Location", Convert.ToString(LocationDetail))); //Location
                        postData.Add(new KeyValuePair <string, string>("ItemID", Convert.ToString(itId)));             //ItemID
                        postData.Add(new KeyValuePair <string, string>("ItemCode", codedetails.Text));                 //ItemCode
                        postData.Add(new KeyValuePair <string, string>("Name", Name.Text));
                        postData.Add(new KeyValuePair <string, string>("CostPrice", CostPriceDetail.Text));            //CostPrice
                        postData.Add(new KeyValuePair <string, string>("Price", Price.Text));
                        postData.Add(new KeyValuePair <string, string>("Quantity", Qty.Text));
                        postData.Add(new KeyValuePair <string, string>("Transaction", Convert.ToString(1)));                      //Transaction   ????
                        postData.Add(new KeyValuePair <string, string>("Reciptno", Convert.ToString(1)));                         //Reciptno ??????
                        postData.Add(new KeyValuePair <string, string>("UserID", Convert.ToString(UserIDn)));                     //UserID
                        postData.Add(new KeyValuePair <string, string>("UserName", name));                                        //UserName
                        postData.Add(new KeyValuePair <string, string>("Unit", Convert.ToString(0)));                             //Unit////////////////////was 1 ?????
                        postData.Add(new KeyValuePair <string, string>("Terminal", Convert.ToString(TerminalNo)));                //Terminal
                        postData.Add(new KeyValuePair <string, string>("IsServiceChargeOnItem", isservicechargeinfo.Text));       ///////
                        postData.Add(new KeyValuePair <string, string>("TransID", Convert.ToString(1)));                          //TransctionTYP/////////chamge from 1 ?????
                        postData.Add(new KeyValuePair <string, string>("SaleTypeId", Convert.ToString(1)));                       // ????????????????????????????
                        postData.Add(new KeyValuePair <string, string>("UnitOfMeasureId", Convert.ToString(0)));                  //// not  ????????????????????????????
                        postData.Add(new KeyValuePair <string, string>("BatchNumber", Convert.ToString(BatchNo)));                //BatchNumber
                        postData.Add(new KeyValuePair <string, string>("ExpiryDate", Convert.ToString(null)));
                        postData.Add(new KeyValuePair <string, string>("TaxOne", Convert.ToString(0)));                           //TaxOne  ??????????????????
                        postData.Add(new KeyValuePair <string, string>("TaxTwo", Convert.ToString(0)));                           //TaxTwo   ??????????????????
                        postData.Add(new KeyValuePair <string, string>("TaxThree", Convert.ToString(0)));                         //TaxThree  ?????????????????
                        postData.Add(new KeyValuePair <string, string>("TaxFour", Convert.ToString(0)));                          //TaxFour   ?????????????????
                        postData.Add(new KeyValuePair <string, string>("TaxFive", Convert.ToString(0)));                          //TaxFive    ????????????????
                        postData.Add(new KeyValuePair <string, string>("TaxpersentOne", Convert.ToString(0.00)));                 //TaxpersentOne   ????????????????
                        postData.Add(new KeyValuePair <string, string>("TaxpersentTwo", Convert.ToString(0.00)));                 //TaxpersentTwo    ?????????????????
                        postData.Add(new KeyValuePair <string, string>("TaxpersentThree", Convert.ToString(0.00)));               //TaxpersentThree   ?????????????
                        postData.Add(new KeyValuePair <string, string>("TaxpersentFour", Convert.ToString(0)));                   //TaxpersentFour   ????????????????????
                        postData.Add(new KeyValuePair <string, string>("TaxpersentFive", Convert.ToString(0)));                   //TaxpersentFive    ???????????????????
                        postData.Add(new KeyValuePair <string, string>("CustomerID", Convert.ToString(1)));                       //CustomerID bigint////    ???????????
                        postData.Add(new KeyValuePair <string, string>("Customer", "Sam"));                                       //CustomerName varchar///////////////      ????????????????
                        postData.Add(new KeyValuePair <string, string>("CustomerType", Convert.ToString(0)));                     //CustomerTyp int///////////    ??????????????
                        postData.Add(new KeyValuePair <string, string>("LoyaltyType", Convert.ToString(0)));                      //LoyaltyType int/////////////**************???????????
                        postData.Add(new KeyValuePair <string, string>("IsPromotion", Convert.ToString(0)));                      //Ispromotion bit///////    ???????????????????
                        postData.Add(new KeyValuePair <string, string>("FixedDiscount", Convert.ToString(0.00)));                 /// not                ????????????????
                        postData.Add(new KeyValuePair <string, string>("FixedDiscountPercentage", Convert.ToString(0.00)));       //// not     ?????????????????
                        postData.Add(new KeyValuePair <string, string>("PromotionID", Convert.ToString(0)));                      //IspromotionID bigint////////----was 1    ?????????????
                        postData.Add(new KeyValuePair <string, string>("OrderCounter", Convert.ToString(3)));                     //OrderCounter///////////////////changes req/////////////////////////default need to be 1////????????????
                        postData.Add(new KeyValuePair <string, string>("Ticket", Convert.ToString(thiTable)));
                        postData.Add(new KeyValuePair <string, string>("KotBotCounterId", Convert.ToString(0)));                  ///??????????????????
                        postData.Add(new KeyValuePair <string, string>("TestTicket", tikcount.Replace("\r\n", "")));
                        postData.Add(new KeyValuePair <string, string>("OrderNum", Convert.ToString(3)));                         //OrderNum   ///???????????????
                        postData.Add(new KeyValuePair <string, string>("IsNew", Convert.ToString(1)));                            ///////????????????????????
                        postData.Add(new KeyValuePair <string, string>("StuwardID", Convert.ToString(StuwardSelect.StuwardIDn))); //StuwardID
                        postData.Add(new KeyValuePair <string, string>("StuwardName", UsorSt));                                   // StuwardSelect.StuwardNme));//StuwardName

                        postData.Add(new KeyValuePair <string, string>("CurrentRowNo", Convert.ToString(0)));                     // not ????????????????????????????
                        postData.Add(new KeyValuePair <string, string>("IsAddonApplicable", Convert.ToString(0)));                ////IsAddOnApplicable ?????????????????????????????????
                        postData.Add(new KeyValuePair <string, string>("IsAddonItem", Convert.ToString(0)));                      //////???????????????????????????????
                        postData.Add(new KeyValuePair <string, string>("IsRetailItem", Convert.ToString(0)));                     ///////////////?????????????????????
                        postData.Add(new KeyValuePair <string, string>("BasedAddOnItemId", Convert.ToString(0)));                 //////????????????????????????
                        postData.Add(new KeyValuePair <string, string>("IsStaffDiscount", Convert.ToString(0)));                  ///IsStaffDiscount  /////////????????????????
                        postData.Add(new KeyValuePair <string, string>("IsGuideCommission", Convert.ToString(0)));                ///IsStaffDiscount  ///////////////?????????????????????
                        postData.Add(new KeyValuePair <string, string>("IsTakeAway", Convert.ToString(0)));                       ///IsStaffDiscount /////////////????????
                        postData.Add(new KeyValuePair <string, string>("PPno", ""));                                              //PPnumber varchar(30)////////??????????????????????
                        postData.Add(new KeyValuePair <string, string>("BPno", ""));                                              //BPnumber varchar(30)///////////???????????????????????
                        postData.Add(new KeyValuePair <string, string>("FLNo", ""));                                              //BPnumber varchar(30)///////////FLNo???????????????????????
                        postData.Add(new KeyValuePair <string, string>("IsReadyToKot", Convert.ToString(NoRadyKOT)));
                        postData.Add(new KeyValuePair <string, string>("IsFromApp", Convert.ToString(fromApp)));                  //fromApp


                        var content = new FormUrlEncodedContent(postData);
                        // var response = client.PostAsync("http://192.168.43.226/cartorderInsertNew.php", content);// correct one 1
                        // var response = client.PostAsync("http://192.168.43.226/CartOrderInsert.php", content);
                        // var response = client.PostAsync("http://192.168.43.226/InsertSPNewCart.php", content); // test for SP in php
                        // var response = client.PostAsync("http://192.168.43.226/cartorderInsertNewSP.php", content);  // correct two sp test//////////////////
                        var response = client.PostAsync(RestService.ipupdate + "cartorderInsertNewSP.php", content); // correct two sp test//////////////////
                                                                                                                     // http://192.168.43.226/cartorderInsertNewSP.php

                        Navigation.PushAsync(new OnlineCart(Total));
                    }


                    //  Image.Source = null;
                    //  Xamarin.Forms.Application.Current.MainPage.Navigation.RemovePage(FoodTabbedPage);
                    // Navigation.PopAsync().ConfigureAwait(false);

                    //var MyAppsFirstPage = new contentpage();
                    //Application.Current.MainPage = new NavigationPage(MyAppsFirstPage);
                    //Application.Current.MainPage.Navigation.PushAsync(FoodTabbedPage);
                    //Navigation.PopAsync();
                    // Navigation.RemovePage(FoodTabbedPage);
                    ///////----- end of modification --------------------------
                    ////Device.BeginInvokeOnMainThread(async () => await Navigation.PopModalAsync());
                    //if (BatchNo < 1)
                    //{
                    //    DisplayAlert("Wrong entry", "Invalid", "OK");
                    //}
                    //else
                    //{
                    //    Navigation.PushAsync(new OnlineCart(Total));
                    //}

                    GC.Collect(1);
                    // await _navigation.PushAsync(new Page2(argument_goes_here));
                    //for (int PageIndex = Navigation.NavigationStack.Count; PageIndex >= 2; PageIndex--)
                    //{
                    //    Navigation.RemovePage(Navigation.NavigationStack[PageIndex]);
                    //}
                    //string name = OnlineLoginPage.UserName;
                    // FoodTabPage.imagedeta= null;
                    // clearImag.
                }
                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");
            }
        }
Ejemplo n.º 3
0
        public OnlineLoginPage()
        {
            InitializeComponent();
            Init();

            IPQuery          IPBC = new IPQuery();
            SQLiteConnection IPB;

            IPB = DependencyService.Get <ISQLite>().GetConnection();
            IPB.Table <IPaddressDB>();
            //  var tikcount = d.ExecuteScalar<string>("SELECT TicketNum FROM TicketNumber");
            var backnow = IPB.ExecuteScalar <string>("SELECT backgrund FROM IPaddressDB ORDER BY Id DESC LIMIT 1");

            //if (backnow == bone)
            //{
            // this.BackgroundImage = saveback;
            saveback = backnow;
            if (saveback == "Style1")
            {
                this.BackgroundImage = "background.png";
            }
            else if (saveback == "Style2")
            {
                this.BackgroundImage = "backgroundnew.png";
            }
            else if (saveback == "Style3")
            {
                this.BackgroundImage = "backnewtwo.png";
            }
            // this.BackgroundImage = "backgroundnew.png";
            this.Title = "Login";
            NavigationPage.SetHasBackButton(this, false);
            // GetIPAddress();
            //  Task<bool> IsRemoteReachable(string host, int port = 80, int msTimeout = 5000);
            // string ipaddress = DependencyService.Get<IIPAddressManager>().GetIPAddress();

            //  DisplayAlert("Net", ipaddress,"OK");

            //  DisplayAlert("Net", IPaccessPage.ipaddressWIFItwo, "OK");

            IPQuery          IPR = new IPQuery();
            SQLiteConnection IPK;

            IPK = DependencyService.Get <ISQLite>().GetConnection();
            IPK.Table <IPaddressDB>();
            //  var tikcount = d.ExecuteScalar<string>("SELECT TicketNum FROM TicketNumber");
            var ipdiso = IPK.ExecuteScalar <string>("SELECT IPnumb FROM IPaddressDB ORDER BY Id DESC LIMIT 1");

            // DisplayAlert("Existing IP", ipdiso, "OK");

            ipinfotop.Text = "EXISTING IP ADDRESS OF THE SYSTEM IS :" + ipdiso;

            //var saveButton = new Button { Text = "Save" };
            //saveButton.Clicked += (sender, e) => {
            //    DependencyService.Get<ISaveAndLoad>().SaveText("temp.txt", input.Text);
            //};
            //var loadButton = new Button { Text = "Load" };
            //loadButton.Clicked += (sender, e) => {
            //    output.Text = DependencyService.Get<ISaveAndLoad>().LoadText("temp.txt");
            //};
            //Java.Util.IEnumeration networkInterfaces = NetworkInterface.NetworkInterfaces;

            //while (networkInterfaces.HasMoreElements)
            //{
            //    Java.Net.NetworkInterface netInterface =
            //                              (Java.Net.NetworkInterface)networkInterfaces.NextElement();
            //    DisplayAlert("network", netInterface.ToString(), "OK");

            //   // Console.WriteLine(netInterface.ToString());
            //}
            try
            {
                int         newnumber = 1;
                ToolbarItem cartItem  = new ToolbarItem();
                cartItem.Order = ToolbarItemOrder.Primary;
                cartItem.Text  = "IP SETUP";
                // cartItem.Icon = "orderNewThree.png";

                //cartItem.Command = new Command(() => Navigation.PushAsync(new IPaccessPage()));
                cartItem.Command = new Command(() => Navigation.PushAsync(new Login()));

                ToolbarItems.Add(cartItem);

                //SQLiteConnection m;
                //m = DependencyService.Get<ISQLite>().GetConnection();
                //TempTbl mit = new TempTbl();
                //m.Table<TempTbl>();
                //m.DeleteAll<TempTbl>();
            }
            catch (Exception ex)
            {
                // Console.WriteLine("An error occurred: '{0}'", ex);
            }
        }