public void NavigateFunc()
 {
     if (getName == null)
     {
         Navigation.PushAsync(new CartPage());
     }
     else
     {
         var      getUsername = Convert.ToString(Application.Current.Properties["USERNAME"]);
         CartDB   cartDB      = new CartDB();
         string[] exPrice     = getPrice.Split('.');
         int      total       = Convert.ToInt32(exPrice[1]);
         cartDB.Username = getUsername;
         cartDB.Name     = getName;
         cartDB.Price    = getPrice;
         cartDB.Qty      = getQuantity.ToString();
         cartDB.Total    = (getQuantity * total).ToString();
         cartDB.Image    = getImage;
         CartQuery cartQuery = new CartQuery();
         var       i         = cartQuery.InsertDetails(cartDB);
         if (i > 0)
         {
             Navigation.PushAsync(new CartPage());
         }
         else
         {
             DisplayAlert("Issue", "Something went wrong..", "Ok");
         }
     }
 }
        private void Button_Clicked(object sender, EventArgs e)
        {
            CartRecord pd    = new CartRecord();
            int        qty   = Convert.ToInt32(Qty.Text);
            int        total = Convert.ToInt16(pPrice);

            pd.Name  = MyTitle.Text;
            pd.Price = MyPrice.Text;
            pd.Total = (qty * total).ToString();
            pd.Qty   = qty + "";
            pd.Image = pImage;
            CartQuery c = new CartQuery();

            c.InsertDetails(pd);
            Navigation.PushAsync(new Cart());
        }
示例#3
0
        public void Add_btn_Clicked(object sender, EventArgs e)
        {
            CartRecord pd    = new CartRecord();
            int        qty   = Convert.ToInt16(Qty.Text);
            double     total = Convert.ToDouble(pprice);

            pd.Name  = Name.Text;
            pd.Price = Price.Text;
            pd.Total = (qty * total).ToString();
            pd.Qty   = qty + "";
            pd.Image = pimage;
            CartQuery c = new CartQuery();

            c.InsertDetails(pd);
            GC.Collect(1);
            Navigation.PushAsync(new Cart());
        }
 public void Add_btn_Clicked(object sender, EventArgs e)
 {
     if (Application.Current.Properties.ContainsKey("USERNAME"))
     {
         var getUserName = Convert.ToString(Application.Current.Properties["USERNAME"]);
         if (getUserName.Equals("As Guest"))
         {
             int quantity1 = Convert.ToInt32(Qty.Text);
             Navigation.PushAsync(new LoginPage(selImage, Name.Text, Price.Text, quantity1));
         }
         else
         {
             var      getUsername = Convert.ToString(Application.Current.Properties["USERNAME"]);
             CartDB   cartDB      = new CartDB();
             int      quantity    = Convert.ToInt32(Qty.Text);
             string[] exPrice     = Price.Text.Split('.');
             int      total       = Convert.ToInt32(exPrice[1]);
             cartDB.Username = getUsername;
             cartDB.Name     = Name.Text;
             cartDB.Price    = Price.Text;
             cartDB.Qty      = quantity.ToString();
             cartDB.Total    = (quantity * total).ToString();
             cartDB.Image    = selImage;
             CartQuery cartQuery = new CartQuery();
             var       i         = cartQuery.InsertDetails(cartDB);
             if (i > 0)
             {
                 Navigation.PushAsync(new CartPage());
             }
             else
             {
                 DisplayAlert("Issue", "Something went wrong..", "Ok");
             }
         }
     }
 }