public void PropertyChanged(PersonalProperty prop) { DataBaseInterface.SetPersonalProperty( DataSaver.UId, DataSaver.PasswordHash, prop.Name, prop.Value); }
public PUserInfoForm(int id) { this.InitializeComponent(); User u = DataBaseInterface.GetUserById(DataSaver.UId, DataSaver.PasswordHash, id); XUserInfoList.Items.Insert(XUserInfoList.Items.Count - 1, new PropertyShower("login", u.Login)); XUserInfoList.Items.Insert(XUserInfoList.Items.Count - 1, new PropertyShower("ФИО", u.FIO)); foreach (Contact t in u.Contacts) { XUserInfoList.Items.Insert(XUserInfoList.Items.Count - 1, new PropertyShower(t.Type, t.Value)); } if (u.Company != null) { XUserCompanyLink.Href = "PCompanyInfoForm.xaml?" + u.Company.Id; } else { XUserIfManager.Visibility = Visibility.Hidden; } if (u.Avatar != null) { XUserAvatar.Source = u.Avatar; } else { XUserAvatar.Source = new BitmapImage(new Uri(DataSaver.Path + "camera_a.png")); } XResumeLink.Href = "PResumeForm.xaml?" + id; XCommentsLink.Href = "PReferencesForm.xaml?u" + id; XWriteMessage.Href = "PWriteMessageForm.xaml?" + id; }
public PVacancyForm(int id) { this.InitializeComponent(); Vacancy v = DataBaseInterface.GetVavancyById(DataSaver.UId, DataSaver.PasswordHash, id); XVacancyBox.Vacancy = v; }
public PSearchForm(string keyWord) { this.InitializeComponent(); SearchResult result = DataBaseInterface.Search(DataSaver.UId, DataSaver.PasswordHash, keyWord); XSearchResultList.Items.Add(new Separator("Вакансии: " + result.Vacancies.Count)); foreach (Vacancy v in result.Vacancies) { XSearchResultList.Items.Add(new VacancyShower(v)); } XSearchResultList.Items.Add(new Separator("Пользователи: " + result.Users.Count)); Link t; foreach (User u in result.Users) { t = new Link(); t.Margin = new Thickness(30, 0, 0, 0); t.Text = u.Login + ": " + u.FIO; t.Href = "PUserInfoForm.xaml?" + u.Id; XSearchResultList.Items.Add(t); } XSearchResultList.Items.Add(new Separator("Компании: " + result.Companies.Count)); foreach (Company c in result.Companies) { t = new Link(); t.Margin = new Thickness(30, 0, 0, 0); t.Text = c.Name; t.Href = "PCompanyInfoForm.xaml?" + c.Id; XSearchResultList.Items.Add(t); } }
public PResumeEditForm() { this.InitializeComponent(); var code = DataBaseInterface.GetUserResume(DataSaver.UId, DataSaver.PasswordHash, DataSaver.UId); XResumeCode.OnProperyChanged += XResumeCode_OnProperyChanged; }
public PResumeForm(int id) { this.InitializeComponent(); string resumeCode = DataBaseInterface.GetUserResume(DataSaver.UId, DataSaver.PasswordHash, id); XResumePresenter.NavigateToString(resumeCode); }
private void XCompanyLogo_MouseDown_1(object sender, MouseButtonEventArgs e) { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog(); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DataBaseInterface.SetAvatar(DataSaver.UId, DataSaver.PasswordHash, ofd.FileName); XCompanyLogo.Source = new BitmapImage(new Uri(ofd.FileName)); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { Vacancy v = new Vacancy(); v.Description = XVacancyDescription.PValue.ToString(); v.MaxPay = Convert.ToInt32(XMaxPay.Text); v.MinPay = Convert.ToInt32(XMinPay.Text); v.CompanyId = DataSaver.CurrentUser.Company.Id; DataBaseInterface.AddVacancy(DataSaver.UId, DataSaver.PasswordHash, v); }
private DataBaseEntities.Comment commentsShower_OnAddComment_1(string comment) { Comment c = new Comment(); c.Author = DataSaver.CurrentUser; c.Text = comment; c.Time = DateTime.Now; DataBaseInterface.AddCommentToUser(DataSaver.UId, DataSaver.PasswordHash, c); return(c); }
private Comment XComments_OnAddComment_1(string comment) { Comment c = new Comment(); c.Author = DataSaver.CurrentUser; c.Time = DateTime.Now; c.Text = comment; DataBaseInterface.AddCommentToVacancy(DataSaver.UId, DataSaver.PasswordHash, c); return(c); }
public PWriteMessageForm(int id) { this.InitializeComponent(); User u = DataBaseInterface.GetUserById(DataSaver.UId, DataSaver.PasswordHash, id); XTo.Items.Add(u.Login + ":" + u.FIO); XTo.SelectedIndex = 0; XTo.IsEnabled = false; XTo.IsReadOnly = true; }
public PMailForm() { this.InitializeComponent(); List <Message> messages = DataBaseInterface.GetMail(DataSaver.UId, DataSaver.PasswordHash); foreach (Message m in messages) { XMailList.Items.Add(m); } XMailList.MouseDoubleClick += XMailList_MouseDoubleClick; }
void PManagerListForm_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Delete) //todo: check if user is admin of the company { try { DataBaseInterface.RemoveManager(DataSaver.UId, DataSaver.PasswordHash, (CompanyManager)XManagersList.SelectedItem); XManagersList.Items.Remove(XManagersList.SelectedItem); } catch { } } }
public PManagerListForm() { this.InitializeComponent(); this.KeyDown += PManagerListForm_KeyDown; DataSaver.CurrentUser.Company = new Company(); DataSaver.CurrentUser.Company.Id = 0;//todo: dalate this str var managers = DataBaseInterface.GetCompanyManagers(DataSaver.UId, DataSaver.PasswordHash, DataSaver.CurrentUser.Company.Id); foreach (CompanyManager item in managers) { XManagersList.Items.Insert(XManagersList.Items.Count, item); } }
private void XSubscribeButton_Click_1(object sender, RoutedEventArgs e) { if (XSubscribeButton.Content.ToString() == "Подписаться") { DataBaseInterface.AddSubscribe(DataSaver.UId, DataSaver.PasswordHash, _id); XSubscribeButton.Content = "Отписаться"; } else { DataBaseInterface.RemoveSubscribe(DataSaver.UId, DataSaver.PasswordHash, _id); XSubscribeButton.Content = "Подписаться"; } }
private void OnLoginBtn(object sender, RoutedEventArgs e) { var user = DataBaseInterface.Login(XloginBox.Text, XpasswordBox.Password); if (user != null) { DataSaver.CurrentUser = user; ((MainWindow)Application.Current.MainWindow).Navigate(new PPersonalForm()); } else { MessageBox.Show("Введенные данные не верны"); } }
public PManagerForm() { _company = DataBaseInterface.GetUserCompany(DataSaver.UId, DataSaver.PasswordHash); this.InitializeComponent(); XCompanyLogo.Source = new BitmapImage(new Uri(DataSaver.Path + "camera_a.png", UriKind.Absolute)); if (_company == null) { XCompanyInfo.Visibility = Visibility.Hidden; XCompanyReg.Visibility = Visibility.Visible; } else { _init(); } }
void XPersonalListBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Delete) { try { var t = ((PersonalProperyShower)XPersonalListBox.SelectedItem).Property; if (t.Type == PropertyType.Contact) { DataBaseInterface.RemoveContact(t); XPersonalListBox.Items.Remove(XPersonalListBox.SelectedItem); } } catch { } } }
public PUserReferences(char type, int id) { this.InitializeComponent(); if (type == 'c') { _comments = DataBaseInterface.GetCompanyReferences(DataSaver.UId, DataSaver.PasswordHash, id); } else { _comments = DataBaseInterface.GetUserReferences(DataSaver.UId, DataSaver.PasswordHash, id); } foreach (Comment c in _comments) { XCommentsShower.Add(c); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (DataSaver.PasswordHash != Hasher.GetHash(XOldPassword.Password)) { MessageBox.Show("Неверный пароль!"); return; } if (XNewPassword.Password == XNewPasswordRepeat.Password) { DataBaseInterface.ChangePassword(DataSaver.UId, DataSaver.PasswordHash, XNewPassword.Password); DataSaver.PasswordHash = Hasher.GetHash(XNewPassword.Password); } else { MessageBox.Show("Пароли не совпадают!"); } }
private void XAddButton_Click_1(object sender, RoutedEventArgs e) { var t = DataBaseInterface.GetUserByLogin(DataSaver.UId, DataSaver.PasswordHash, XNewManagerLogin.Text); if (t != null && t.Company == null) { DataBaseInterface.AddCompanyManager(DataSaver.UId, DataSaver.PasswordHash, t.Id); XManagersList.Items.Add(new CompanyManager(t)); } else if (t == null) { MessageBox.Show("Пользователя с таким логином не существует"); } else { MessageBox.Show("Пользователь уже является менеджером компании, пользователь не может быть менеджером более чем одной компании"); } }
public PSearchForm(char type, int id) { InitializeComponent(); List <Vacancy> result; if (type == 'c') { result = DataBaseInterface.GetCompanyVacancies(DataSaver.UId, DataSaver.PasswordHash, id); } else { result = DataBaseInterface.GetUserSubscribeNews(DataSaver.UId, DataSaver.PasswordHash); } foreach (Vacancy v in result) { XSearchResultList.Items.Add(new VacancyShower(v)); } }
public PCompanyInfoForm(int id) { _id = id; this.InitializeComponent(); Company c = DataBaseInterface.GetCompanyById(DataSaver.UId, DataSaver.PasswordHash, id); XCompanyAvatar.Source = c.Logo; XCompanyInfoList.Items.Add(new PropertyShower("Название", c.Name)); XCompanyInfoList.Items.Add(new PropertyShower("Специализация", c.Specialization)); foreach (Contact t in c.Contacts) { XCompanyInfoList.Items.Add(new PropertyShower(t.Type, t.Value)); } XComments.Href = "PReferencesForm.xaml?c" + c.Id; XVacancies.Href = "PSearchForm.xaml?c" + c.Id; if (DataBaseInterface.HasSubscribe(DataSaver.UId, DataSaver.PasswordHash, _id)) { XSubscribeButton.Content = "Отписаться"; } }
private void ButtonRegistration(object sender, EventArgs e) { try { _company = DataBaseInterface.RegistrateCompany(DataSaver.UId, DataSaver.PasswordHash, XCompanyName.PValue.ToString(), Convert.ToInt32(XCompanyFoundated.PValue.ToString()), XCompanySpecializing.PValue.ToString(), XCompanyAddress.PValue.ToString(), XCompanyLogoR.PPath, XCompanyAbout.PValue.ToString()); XCompanyReg.Visibility = Visibility.Hidden; XCompanyInfo.Visibility = Visibility.Visible; _init(); } catch { MessageBox.Show("Не все данные верны"); } }
void aci_KeyDown(object sender, KeyEventArgs e) { AddContactItem aci = (AddContactItem)sender; if (e.Key == Key.Enter) { Contact t = new Contact(); t.Value = aci.XContactValue.Text; t.Type = aci.XContactName.Text; DataBaseInterface.AddContact(DataSaver.UId, DataSaver.PasswordHash, t); this.XPersonalListBox.Items.Remove(aci); this.XPersonalListBox.Items.Insert(this.XPersonalListBox.Items.Count - 1, new PersonalProperyShower( new PersonalProperty(t.Type, t.Value, PropertyType.Contact), this)); } else if (e.Key == Key.Escape) { this.XPersonalListBox.Items.Remove(aci); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { Message m = new Message(); m.Text = XText.Text; m.Topic = XTopic.Text; m.From = DataSaver.CurrentUser; try { m.To = GetAddresant(); } catch { MessageBox.Show("Невозможно отправить письмо без адресата"); } if (m.Text.Length == 0 && m.Topic.Length == 0) { MessageBox.Show("Невозможно отправить пустое письмо"); return; } DataBaseInterface.SendMessage(DataSaver.UId, DataSaver.PasswordHash, m); ((MainWindow)Application.Current.MainWindow).Navigate(new PMailForm()); }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (XSignPasswordBox.Password != XSignRepeatBox.Password) { MessageBox.Show("Пароли не совпадают"); return; } else if (XSignPasswordBox.Password.Length < 5) { MessageBox.Show("Пароль слишком короткий"); return; } User u = DataBaseInterface.Registrate(XSignLoginBox.Text, Hasher.GetHash(XSignPasswordBox.Password)); if (u == null) { MessageBox.Show("Логин уже занят"); } else { DataSaver.CurrentUser = u; ((MainWindow)Application.Current.MainWindow).Navigate(new PPersonalForm()); } }
public PPersonalForm() { this.InitializeComponent(); XAvatarImage.Source = new BitmapImage(new Uri(DataSaver.Path + "camera_a.png", UriKind.Absolute)); //==initialize personal properties this.XPersonalListBox.Items.Add(new PersonalProperyShower( new PersonalProperty("Фамилия", DataSaver.CurrentUser.FirstName, PropertyType.Name), this)); this.XPersonalListBox.Items.Add(new PersonalProperyShower( new PersonalProperty("Имя", DataSaver.CurrentUserLastName, PropertyType.Name), this)); this.XPersonalListBox.Items.Add(new PersonalProperyShower( new PersonalProperty("Отчество", DataSaver.CurrentUserMidleName, PropertyType.Name), this)); this.XPersonalListBox.Items.Add(new PersonalProperyShower( new PersonalProperty("Дата рождения", DataSaver.CurrentUserBirthDate, PropertyType.Birthdate), this)); this.XPersonalListBox.Items.Add(new PersonalProperyShower( new PersonalProperty("Адрес", DataSaver.CurrentUser.Position, PropertyType.Address), this)); foreach (Contact contact in DataSaver.CurrentUser.Contacts) { _lastContactIndex = XPersonalListBox.Items.Count + 1; this.XPersonalListBox.Items.Add(new PersonalProperyShower( new PersonalProperty(contact.Type, contact.Value, PropertyType.Contact), this)); } CAddContactButton = new Button(); CAddContactButton.FontSize = 18; CAddContactButton.Content = "Добавить контакт"; CAddContactButton.Click += CAddContactButton_Click; XPersonalListBox.Items.Add(CAddContactButton); XAvatarImage.MouseLeftButtonDown += XAvatarImage_MouseLeftButtonDown; XPersonalListBox.KeyDown += XPersonalListBox_KeyDown; //===initialize manager's corner int num = DataBaseInterface.GetNumNewMessages(DataSaver.UId, DataSaver.PasswordHash); if (num > 0) { XNumNewMessages.Text = "(" + num + ")"; } }
public PWriteMessageForm() { this.InitializeComponent(); contacts = DataBaseInterface.GetContacts(DataSaver.UId, DataSaver.PasswordHash); }
void XResumeCode_OnProperyChanged(string name, object value) { DataBaseInterface.SetUserResume(DataSaver.UId, DataSaver.PasswordHash); MessageBox.Show("Резюме успешно сохранено"); }