示例#1
0
 async protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     if (NavigationContext.QueryString.TryGetValue("msg", out item_name))
     {
         WebService web = new WebService();
         var task = web.AskWebService("StoreManager/getStoreByName?keyword=" + item_name);
         await task;
         var query = web.value.Descendants();
         foreach (XElement ele in query)
         {
             if (ele.Name.ToString().Contains("name"))
             {
                 NomStore.Text = ele.Value;
             }
             else if (ele.Name.ToString().Contains("website"))
             {
                 CateText.Text = ele.Value;
             }
             else if (ele.Name.ToString().Contains("picture"))
             {
                 ImageStore.Source = new BitmapImage(new Uri(Img.ecole + "Store/" + ele.Value, UriKind.Absolute));
             }
             else if (ele.Name.ToString().Contains("id") && !ele.Name.ToString().Contains("address") && !ele.Name.ToString().Contains("company"))
             {
                 get_product(ele.Value);
             }
         }
     }
 }
示例#2
0
 async protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     string object_id = "";
     if (NavigationContext.QueryString.TryGetValue("msg", out object_id))
     {
         WebService web = new WebService();
         var task = web.AskWebService("GlobalManager/getNewsInfo?id=" + object_id);
         await task;
         var query = web.value.Descendants();
         foreach (XElement ele in query)
         { 
             if (ele.Name.ToString().Contains("body"))
             {
                 TextNews.Text = ele.Value;
             }
             if (ele.Name.ToString().Contains("picture"))
             {
                 ImgNews.Source = new BitmapImage(new Uri(Img.ecole + "News/" + ele.Value, UriKind.Absolute)); 
             }
             if (ele.Name.ToString().Contains("title"))
             {
                 TitleNews.Text = ele.Value;
             }
         }
     }
 }
示例#3
0
 async protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     if (NavigationContext.QueryString.TryGetValue("msg", out item_name))
     {
         WebService web = new WebService();
         var task = web.AskWebService("ProductManager/getProductByName?name=" + item_name);
         await task;
         var query = web.value.Descendants();
         foreach (XElement ele in query)
         {
             if (ele.Name.ToString().Contains("name"))
             {
                 NomProduit.Text = ele.Value;
             }
             else if (ele.Name.ToString().Contains("brand"))
             {
                 CateText.Text = ele.Value;
             }
             else if (ele.Name.ToString().Contains("picture"))
             {
                 ImageProduit.Source = new BitmapImage(new Uri(Img.ecole + "Product/" + ele.Value, UriKind.Absolute));
             }
             else if (ele.Name.ToString().Contains("id"))
             {
                 id_product = ele.Value;
                 do_my_desc(ele.Value);
                 do_my_comment(ele.Value);
             }
         }
     }
 }
示例#4
0
        async private void Envoyer_Click(object sender, RoutedEventArgs e)
        {
            if (NewPass.Text == RetypePass.Text)
            {
                WebService web = new WebService();

                var task = web.AskWebService("UserManager/changePassword?id_user="******"&old_password="******"&new_password="******"return"))
                    {
                        if (Convert.ToBoolean(ele.Value) == true)
                        {
                            MessageBox.Show("Changement du mot de passe reussi");
                            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
                        }
                        else
                        {
                            MessageBox.Show("Changement de mot de passe n'a pas etait effectuer,veuillez reeesaye ulterieurement");
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Mauvais mot de passe ou le nouveau mot de passe est mal taper");
            }
        }
示例#5
0
 async private void get_product(string id)
 {
     WebService web = new WebService();
   
     var task = web.AskWebService("ProductUtilManager/getProductByStore?id=" + id);
     await task;
     var query = web.value.Descendants();
     ObservableCollection<Item> Product = new ObservableCollection<Item>();
     
     foreach (XElement ele in query)
     {
         if (ele.Name.ToString().Contains("id_product"))
         {
              var i = find_product_name(ele.Value);
              await i;
         }
         if (ele.Name.ToString().Contains("price"))
         {
             Product.Add(new Item() { name = tmp, price = ele.Value});
         }
     }
     ProductList.ItemsSource = Product;
 }
示例#6
0
        async private void do_my_comment(string id)
        {
            string tempo = "";
            WebService web = new WebService();

            var task = web.AskWebService("GlobalManager/getRate?id_target=" + id + "&id_target_type=2");
            await task;
            var query = web.value.Descendants();
            foreach (XElement ele in query)
            {
                if (ele.Name.ToString().Contains("commentary"))
                {
                    tempo = ele.Value;
                }
                if (ele.Name.ToString().Contains("id_user"))
                {
                    if (tempo != "")
                    {
                        id_item = id;
                        do_rate_comment(ele.Value, id, tempo);
                    }
                }
            }
        }
示例#7
0
 async Task<int> complet_list(int id)
 {
     WebService web = new WebService();
     var task = web.AskWebService("GlobalManager/getItemsLists?id_list=" + id);
     await task;
     var query = web.value.Descendants();
     ListValue.Clear();
     foreach (XElement ele in query)
     {
         if (ele.Name.ToString().Contains("id_product"))
         {
             var t = find_product(Convert.ToInt32(ele.Value));
             await t;
         }
     }
     return 1;
 }
示例#8
0
        async Task<int> find_product(int id)
        {
            WebService web = new WebService();
            var task = web.AskWebService("ProductManager/getProductInfo?id=" + id);
            await task;
            var query = web.value.Descendants();

            foreach (XElement ele in query)
            {
                if (ele.Name.ToString().Contains("name"))
                {
                    ListValue.Add(ele.Value);
                }
            }
            return 1;
        }
示例#9
0
 async private Task<int> find_list(int id_user)
 {
     WebService web = new WebService();
     var task = web.AskWebService("GlobalManager/getUserList?id_user="******"id") && ele.Name.ToString().Contains("id_user") == false)
         {
             listInfo.id = Convert.ToInt32(ele.Value);
             var t = complet_list(Convert.ToInt32(ele.Value));
             await t;
         }
         if (ele.Name.ToString().Contains("name"))
         {
             listInfo.name = ele.Value;
         }
         if (ele.Name.ToString().Contains("nb_items"))
         {
             listInfo.nb_items = Convert.ToInt32(ele.Value);
         }
         if (ele.Name.ToString().Contains("publics"))
         {
             listInfo.publics = Convert.ToInt32(ele.Value);
         }
         if (ele.Name.ToString().Contains("type"))
         {
             listInfo.type = Convert.ToInt32(ele.Value);
             Utilisateur.myList.Add(listInfo, ListValue);
             ListValue = new List<string>();
             listInfo = new list();
         }
     }
     return 1;
 }
示例#10
0
        async private void SendConnexionButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                WebService web = new WebService();
                var task = web.AskWebService("UserManager/connectAccount?username="******"&password="******"return"))
                    {
                        if (Convert.ToBoolean(ele.Value) == true)
                        {
                            Utilisateur.appSettings.Clear();

                            Utilisateur.isConnect = true;
                            var b = Find_id(usernameBox.Text);
                            await b;
                            var t = find_list(Utilisateur.id);
                            await t;
                            MessageBox.Show("Connexion reussi");
                            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
                        }
                        else
                        {
                            MessageBox.Show("Compte utilisateur ou mot de passe incorrect");
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("Echec lors de la connexion");
            }

        }
示例#11
0
 async private void do_rate_comment(string id_user, string id, string comment)
 {
     WebService web = new WebService();
     var task = web.AskWebService("GlobalManager/getRateStatus?id_user="******"&id_target=" + id + "&id_target_type=2");
     await task;
     var query = web.value.Descendants();
     foreach (XElement ele in query)
     {
         if (ele.Name.ToString().Contains("return"))
         {
             CommentList.Items.Add(comment);
         }
     }
 }
示例#12
0
        async private void Envoyer_Click(object sender, RoutedEventArgs e)
        {
            List<New> lnew = new List<New>();
            WebService web = new WebService();

            var task = web.AskWebService("GlobalManager/createComment?id_user="******"&id_target=" + id_pd + "&id_target_type=2" + "&commentary=" + CommentText.Text);
            await task;
            var query = web.value.Descendants();
            foreach (XElement ele in query)
            {
                if (ele.Name.ToString().Contains("return"))
                {
                    if (Convert.ToInt32(ele.Value) > 0)
                    {
                        MessageBox.Show("Ajout de commentaire reussi");
                        NavigationService.GoBack();
                    }
                }
            }
        }
示例#13
0
 async private void do_my_desc(string id)
 {
     WebService web = new WebService();
     var task = web.AskWebService("ProductUtilManager/getSpecification?id_product=" + id);
     await task;
     var query = web.value.Descendants();
     int l = 0;
     try
     {
         foreach (XElement ele in query)
         {
             if (ele.Name.ToString().Contains("type"))
             {
                 l =Convert.ToInt32(ele.Value);
             }
             if (l == 0 && ele.Name.ToString().Contains("value"))
             {
                 desc.Text = ele.Value;
             }
         }
     }
     catch
     {
         desc.Text = "";
     }
 }
示例#14
0
        async private void AimeButton_Click(object sender, RoutedEventArgs e)
        {
            if (Utilisateur.isConnect == true)
            {
                WebService web = new WebService();

                var task = web.AskWebService("GlobalManager/likeSomething?id_user="******"1" + "&id_target=" + id_product + "&id_target_type=2");
                await task;
                var query = web.value.Descendants();
                foreach (XElement ele in query)
                {
                    if (ele.Name.ToString().Contains("return"))
                    {
                        if (Convert.ToBoolean(ele.Value) == true)
                        {
                            MessageBox.Show("Produit aimer");
                        }
                    }

                }
            }
            else
            {
                MessageBox.Show("Vous n'etes pas connecte");
            }
        }
示例#15
0
        async Task<int> Find_id(string username)
        {
            WebService web = new WebService();

            var task = web.AskWebService("UserManager/getUserByUsername?username="******"email", Utilisateur.email);
                    Utilisateur.appSettings.Save();
                }
                if (i == 6)
                {
                    Utilisateur.firstname = ele.Value;
                    Utilisateur.appSettings.Add("firstname", Utilisateur.firstname);
                    Utilisateur.appSettings.Save();
                }
                if (i == 7)
                {
                    Utilisateur.id = Convert.ToInt32(ele.Value);
                    Utilisateur.appSettings.Add("id", Utilisateur.id);
                    Utilisateur.appSettings.Save();
                }
                if (i == 8)
                {
                    Utilisateur.city = ele.Value;
                    Utilisateur.appSettings.Add("city", Utilisateur.city);
                    Utilisateur.appSettings.Save();
                }
                if (i == 9)
                {
                    Utilisateur.name = ele.Value;
                    Utilisateur.appSettings.Add("name", Utilisateur.name);
                    Utilisateur.appSettings.Save();
                }
                //if (i == 10)
                //{
                //    Utilisateur.password = ele.Value;
                //    Utilisateur.appSettings.Add("Name", Utilisateur.name);
                //}
                //if (i == 11)
                //    Utilisateur.tel = Convert.ToInt32(ele.Value);
                //short desc
                //if (i == 13)
                //    Utilisateur.email = ele.Value;
                if (i == 14)
                {
                    Utilisateur.username = ele.Value;
                    Utilisateur.appSettings.Add("username", Utilisateur.username);
                    Utilisateur.appSettings.Save();
                }
                i++;
            };
            Utilisateur.appSettings.Add("connect", Utilisateur.isConnect);
            Utilisateur.appSettings.Save();
            return 1;
        }
示例#16
0
 async private void Valider_Click(object sender, RoutedEventArgs e)
 {
     WebService web = new WebService();
     var task = web.AskWebService("UserManager/updateAccount?" + "id=" + Utilisateur.id + "&" + "firstname=" + PrenomBox.Text + "&" + "lastname=" + NomBox.Text + "&phone=" + TelBox.Text + "&id_adress=75");
     await task;
     if (Convert.ToBoolean(web.value) == true)
     {
         MessageBox.Show("Changement reussi");
         Utilisateur.city = VilleBox.Text;
         Utilisateur.name = NomBox.Text;
         Utilisateur.firstname = PrenomBox.Text;
         NavigationService.Navigate(new Uri("/Profil.xaml", UriKind.Relative));
     }
     else
     {
         MessageBox.Show("Error");
     }
 }
示例#17
0
  async private void do_my_new()
 {
     string tempo = "";
     string id_tempo = "";
     List<New> lnew = new List<New>();
     WebService web = new WebService();
     var task =  web.AskWebService("GlobalManager/getNews");
     await task;
     var query = web.value.Descendants();
     foreach (XElement ele in query)
     {
         if (ele.Name.ToString().Contains("title"))
         {
             New p = new New() { titleNew = ele.Value, imageNew =  Img.ecole + "News/" + tempo, id = id_tempo };
             lnew.Add(p);
         }
         if (ele.Name.ToString().Contains("picture"))
         {
             tempo = ele.Value;
         }
         if (ele.Name.ToString().Contains("id"))
         {
             id_tempo = ele.Value;
         }
     }
     listNews.DataContext = lnew;
 }
示例#18
0
 async private void AjouterListButton_Click(object sender, RoutedEventArgs e)
 {
     if (TextBoxList.Text != "")
     {
         WebService web = new WebService();
         var task = web.AskWebService("GlobalManager/createLists?name=" + TextBoxList.Text + "&publics=1" + "&type=8" + "&nb_items=0"+  "&id_user="******"return"))
             {
                 list l = new list();
                 l.id = Convert.ToInt32(ele.Value);
                 l.name = TextBoxList.Text;
                 l.publics = 1;
                 l.type = 8;
                 l.nb_items = 0;
                 List<string> t = new List<string>();
                 Utilisateur.myList.Add(l, t);
                 ListItem.Items.Add(l.name);
             }
         }
     }
     else
     {
         MessageBox.Show("veuillez choisir un nom de liste");
     }
 }
示例#19
0
        async private void do_my_history()
        {
            if (Utilisateur.isConnect == true)
            {
                complettype();
                List<New> lnew = new List<New>();

                WebService web = new WebService();
                var task = web.AskWebService("UserUtilManager/getUserHistory?id_user="******"action_type"))
                    {
                        HistoryList.Items.Add(Utilisateur.name + " " + dtype[ele.Value.ToString()]);
                    }
                }
            }
            else
            {
                MessageBox.Show("Vous n'etes pas connecte");
            }
        }
示例#20
0
        async void Find_item_name_by_id(string id)
        {
            WebService web = new WebService();

            var task = web.AskWebService("ProductManager/getProductInfo?id=" + id);
            await task;
            var query = web.value.Descendants();
            foreach (XElement ele in query)
            {
                if (ele.Name.ToString().Contains("name"))
                {
                    foreach (list t in Utilisateur.myList.Keys)
                    {
                        if (t.name.Equals(ListBox.SelectedItems[0]))
                        {
                            if (!Utilisateur.myList[t].Contains(ele.Value))
                                Utilisateur.myList[t].Add(ele.Value);
                        }
                    }
                }
            }
        }
示例#21
0
        async private void Ajouter_Click(object sender, RoutedEventArgs e)
        {
            foreach (list t in Utilisateur.myList.Keys)
            {
                if (t.name == ListBox.SelectedValue.ToString())
                {
                    WebService web = new WebService();

                    var task = web.AskWebService("GlobalManager/createItem?id_list=" + t.id + "&id_product=" + object_name + "&id_user=0");
                    await task;
                    var query = web.value.Descendants();
                    foreach (XElement ele in query)
                    {
                        if (ele.Name.ToString().Contains("return"))
                        {
                            Find_item_name_by_id(object_name);
                            MessageBox.Show("Produit bien ajoute a la liste");
                            NavigationService.GoBack();
                        }
                    }
                    break;
                }
            }
        }
示例#22
0
        async private void SendInscriptionButton_Click(object sender, RoutedEventArgs e)
        {
            WebService web = new WebService();

            var task = web.AskWebService("UserManager/registerAccount?" + "username="******"&" + "password="******"&" + "email=" + EmailBox.Text);
            await task;
            var query = web.value.Descendants();
            foreach (XElement ele in query)
            {

                if (ele.Name.ToString().Contains("return"))
                {
                    if (Convert.ToInt32(ele.Value) == -1)
                    {
                        MessageBox.Show("Username deja utilise");
                    }
                    else if (Convert.ToInt32(ele.Value) == -2)
                    {
                        MessageBox.Show("Email deja utilise");
                    }
                    else
                    {
                        MessageBox.Show("Inscription reusi");
                    }
                }
            }
        }
示例#23
0
        async private void ShareButton_Click(object sender, RoutedEventArgs e)
        {
            WebService web = new WebService();
            var task = web.AskWebService("UserUtilManager/createHistory?id_user="******"&action_type=5" + "&id_type=2" + "&id_target=" + id_item);
            await task;
            var query = web.value.Descendants();
            foreach (XElement ele in query)
            {
                if (ele.Name.ToString().Contains("return"))
                {
                    if (Convert.ToInt32(ele.Value) > 0)
                    {

                    }

                }
            }
        }