/// <summary> /// Вызывается при получении заявки в друзья /// </summary> /// <param name="idSender"></param> public void GetFriendRequest(Service.Profile Sender) { //MessageBox.Show("123"); // Service.Profile pr = await dp.GetProfileAsync(idSender); MainWindow.shopWindows.reqestrefresh(Sender); }
public MailConfirmation(Service.Profile profile, string hashpassword) { string data1 = Environment.CurrentDirectory + "\\Content\\maets.cur"; var cursor = new Cursor(data1); this.Cursor = cursor; client = new Service.WCFServiceClient(new System.ServiceModel.InstanceContext(new CallbackClass()), "NetTcpBinding_IWCFService"); this.Title = "Maets"; List <Service.Profile> profiles = client.GetAllUsers().ToList(); for (int i = 0; i < profiles.Count; i++) { if (profiles[i].Login == profile.Login) { throw new Exception("Этот логин занят!"); } } this.profile = profile; this.hashpassword = hashpassword; InitializeComponent(); tb.Text = "Введите код подтвержения, отправленный на почту " + profile.Mail; code = client.CheckMailRegister(profile.Mail); }
public ResetPassword(string Login) { string data1 = Environment.CurrentDirectory + "\\Content\\maets.cur"; var cursor = new Cursor(data1); this.Cursor = cursor; this.Title = "Maets"; client = new Service.WCFServiceClient(new System.ServiceModel.InstanceContext(new CallbackClass()), "NetTcpBinding_IWCFService"); List <Service.Profile> profiles = client.GetAllUsers().ToList(); for (int i = 0; i < profiles.Count; i++) { if (profiles[i].Login == Login) { profile = profiles[i]; break; } ; } if (profile.Login != Login) { throw new Exception("Такого пользовaтеля не существует"); } InitializeComponent(); profile = client.CheckProfile(profile.ID); tb.Text = "Введите код подтвержения, отправленный на почту " + profile.Mail; code = client.CheckMailResetPassword(profile.Mail); }
public Chat(Service.Profile Sender, Service.Profile Resiver) { this.Title = "Maets"; string data1 = Environment.CurrentDirectory + "\\Content\\maets.cur"; var cursor = new Cursor(data1); this.Cursor = cursor; Senderg = Sender; Resiverg = Resiver; InitializeComponent(); btnBack.Content = " <-Назад"; Lvfriend.Items.Add(Resiver); chatnow = this; chat = ShopWindows.client.GetChat(Sender.ID, Resiver.ID).ToList(); scrl.ScrollToVerticalOffset(int.MaxValue); foreach (Service.UserMessage msg in chat) { if (msg.IDSender == Senderg.ID) { // msg.message.PadRight(100); tbChat.Text += Senderg.Login + " " + msg.date + ": "; } else if (msg.IDSender == Resiverg.ID) { // msg.message.PadLeft(100); tbChat.Text += Resiverg.Login + " " + msg.date + ": "; } tbChat.Text += msg.message; tbChat.Text += "\n"; } scrl.ScrollToVerticalOffset(int.MaxValue); }
public Product(Service.Product tv, Service.Profile profile) { string data1 = Environment.CurrentDirectory + "\\Content\\maets.cur"; var cursor = new Cursor(data1); this.Cursor = cursor; tv1 = tv; InitializeComponent(); prof = profile; Inicialize(tv1); int p = 0; if (ShopWindows.mainfprofile.Count != 0) { for (int i = 0; i < ShopWindows.mainfprofile.Count; i++) { if (ShopWindows.mainfprofile[i].Id == tv1.Id) { p++; } } if (p != 0) { btnBuy.Visibility = Visibility.Hidden; btnkorzina.Visibility = Visibility.Visible; } } if (check(tv)) { BuyAlready.Visibility = Visibility.Visible; BuyAlready.ToolTip = "Этот товар уже есть в вашей библиотеке, вы можете купить его только оптом(2+ штук))"; } }
public void reqestrefresh(Service.Profile reqestprof) { fr.Add(reqestprof); if (fr.Count != 0) { Reaestfriends.Visibility = Visibility.Visible; howmanynewfriends.Text = "+" + fr.Count; } }
private bool FilterProfile(object obj) { bool result = true; Service.Profile profile = obj as Service.Profile; if (!string.IsNullOrWhiteSpace(FilterText) && profile != null && !profile.Login.Contains(FilterText)) { result = false; } return(result); }
public void friendsonline(Service.Profile id) { Lvfriend.Items.Clear(); for (int i = 0; i < r.Count; i++) { if (r[i].ID == id.ID) { r[i].status = "Online"; } Lvfriend.Items.Add(r[i]); } }
public ModelProfileMessage MakeModelProfileMessage(Service.Profile profile, string mes) { DataProvider dp = new DataProvider(); ModelProfileMessage modelProfile = new ModelProfileMessage(); modelProfile.Name = profile.Name; modelProfile.Image = dp.GetImageFromByte(profile.MainImage); modelProfile.ID = profile.ID; modelProfile.Login = profile.Login; modelProfile.status = profile.status; modelProfile.message = mes; return(modelProfile); }
public Korzina(Service.Profile profile) { string data1 = Environment.CurrentDirectory + "\\Content\\maets.cur"; var cursor = new Cursor(data1); this.Cursor = cursor; this.Title = "Maets"; this.profile = profile; InitializeComponent(); newminimum(); allprice(); }
public messagefriends() { this.Title = "Заявки в друзья"; string data1 = Environment.CurrentDirectory + "\\Content\\maets.cur"; var cursor = new Cursor(data1); this.Cursor = cursor; InitializeComponent(); foreach (Service.UserMessage person in ShopWindows.frmail) { who = ShopWindows.client.CheckProfile(person.IDSender); whom = whom.MakeModelProfileMessage(who, person.message); mail.Add(whom); } Lvfriendnew.ItemsSource = mail; }
private void refresh(Service.Profile pr) { // searchproduct.DataContext = new ProductViewModel(); //Lvm.DataContext = searchproduct.DataContext; // searchprofile.DataContext = new ProfileViewModel(); // AllUser.DataContext = searchprofile.DataContext; fr = client.GetFriendRequests(profile.ID).ToList(); if (fr.Count != 0) { Reaestfriends.Visibility = Visibility.Visible; howmanynewfriends.Text = "+" + fr.Count; } else { Reaestfriends.Visibility = Visibility.Hidden; } mylibrary.Items.Clear(); foreach (Service.Product p in pr.Games.ToList()) { mylibrary.Items.Add(p); } // searchlibrary.DataContext = new LibraryViewModel(pr.Games.ToList()); // mylibrary.DataContext = searchlibrary.DataContext; if (mainfprofile.Count != 0) { KorzinaCount.Visibility = Visibility.Visible; howmanyproduct.Text = Convert.ToString(mainfprofile.Count); } else { KorzinaCount.Visibility = Visibility.Hidden; howmanyproduct.Text = Convert.ToString(0); } // imMainImage.Source = dp.GetImageFromByte(profile.MainImage); // tbLogin.Content = pr.Login; // lbName.Content = pr.Name; // Lvmylibrary.ItemsSource = pr.Games; btnMoney.Content = Convert.ToString(pr.Money) + " р"; profile = pr; }
public ModelProfile MakeModelProfile(Service.Profile profile) { DataProvider dp = new DataProvider(); ModelProfile modelProfile = new ModelProfile(); modelProfile.Name = profile.Name; modelProfile.Image = dp.GetImageFromByte(profile.MainImage); modelProfile.Mail = profile.Mail; modelProfile.ID = profile.ID; modelProfile.Login = profile.Login; modelProfile.Friends = profile.Friends; modelProfile.Games = profile.Games; modelProfile.AccessRight = profile.AccessRight; modelProfile.Telephone = profile.Telephone; modelProfile.status = profile.status; modelProfile.Money = profile.Money; modelProfile.Discount = profile.Discount; return(modelProfile); }
private void Inicialize(Service.Profile productnow) { tbFriendUser.Text = "Друзья1 пользователя " + productnow.Login; //Service.WCFServiceClient client1 = new Service.WCFServiceClient("NetTcpBinding_IWCFService"); if (Sender.AccessRight == 4) { cng.Visibility = Visibility.Visible; ttt.Visibility = Visibility.Visible; right.Visibility = Visibility.Visible; } // tbgame.Text = productnow.Name; // tbgame1.Text = productnow.Login; imMainImage.Source = dp.GetImageFromByte(productnow.MainImage); lbLogin.Text = productnow.Login; tbmail.Text = productnow.Mail; lbStatus.Content = productnow.status; tbName.Text = productnow.Name; tbPhone.Text = productnow.Telephone; Lv.ItemsSource = productnow.Friends; }
private void btnRegister_Click(object sender, RoutedEventArgs e) { try { if (tbLogin.Text == "") { throw new Exception("Поле логин не может быть пустым"); } if (tbMail.Text == "") { throw new Exception("Поле почта не может быть пустым"); } if (tbPassword.Password == "") { throw new Exception("Поле пароль не может быть пустым"); } if (tbPassword.Password != tbPassword2.Password) { throw new Exception("Пароли не совпадают"); } WCFServiceClient client = new WCFServiceClient(new System.ServiceModel.InstanceContext(new CallbackClass()), "NetTcpBinding_IWCFService"); Service.Profile profile = new Service.Profile(); profile.Login = tbLogin.Text; profile.Mail = tbMail.Text; string hashpassword = dp.HashPassword(tbPassword.Password); profile.AccessRight = 1; profile.Telephone = tbTelephone.Text; profile.Name = tbName.Text; MailConfirmation q = new MailConfirmation(profile, hashpassword); q.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public profilefriend(Service.Profile tv1) { string data1 = Environment.CurrentDirectory + "\\Content\\maets.cur"; var cursor = new Cursor(data1); this.Cursor = cursor; this.Title = "Maets"; Sender = MainWindow.shopWindows.profile; Resiver = tv1; tv = tv1; Service.Profile productnow = tv1; InitializeComponent(); btnBack.Content = " <-Назад"; if (productnow.status == @"Offline") { lbStatus.Foreground = new SolidColorBrush(Colors.Red); } else { lbStatus.Foreground = new SolidColorBrush(Colors.Green); } if (ShopWindows.client.CheckBlacklist(Resiver.ID, Sender.ID)) { blacklistgo.Visibility = Visibility.Hidden; blacklistout.Visibility = Visibility.Visible; blacklistout.Content = "Удалить из \n из Чёрного списка"; } else { blacklistgo.Visibility = Visibility.Visible; blacklistout.Visibility = Visibility.Hidden; } if (ShopWindows.client.CheckBlacklist(Sender.ID, Resiver.ID)) { btnChat.Visibility = Visibility.Hidden; btnnewfriend.Visibility = Visibility.Hidden; imMainImage.Source = dp.GetImageFromByte(productnow.MainImage); lbLogin.Text = productnow.Login; lbStatus.Content = productnow.status; lbName.Content = "Этот пользователь добавил вас в Чёрный список"; } else { // Lv.ItemsSource = tv.Friends.ToList() ; Inicialize(productnow); blacklistgo.Content = "Дoбавить пользователя \n в Чёрный список"; if (FriendYN.Visibility != Visibility.Visible) { if (checkfriends()) { btnChat.Visibility = Visibility.Visible; btnnewfriend.Visibility = Visibility.Hidden; btndelfriend.Visibility = Visibility.Visible; } else { if (checkfriendsrequesti()) { FriendYN.Visibility = Visibility.Hidden; btndelfriend.Visibility = Visibility.Hidden; btnnewfriend.Visibility = Visibility.Hidden; newreqest.Visibility = Visibility.Visible; } if (checkfriendsrequest()) { FriendYN.Visibility = Visibility.Visible; btndelfriend.Visibility = Visibility.Hidden; btnnewfriend.Visibility = Visibility.Hidden; } } } Loaded += Window_Loaded; } }
public void friendsnew(Service.Profile id) { r.Add(id); Lvfriend.Items.Add(id); }
public void AcceptFriendRequest(Service.Profile User) { MainWindow.shopWindows.friendsnew(User); }