示例#1
0
        private void Cancel_Click(object sender, RoutedEventArgs e)
        {
            EmployerHome eh = new EmployerHome(user);

            this.Close();
            eh.Show();
        }
示例#2
0
        private void LoginClick_Click(object sender, RoutedEventArgs e)
        {
            if (UserName.Text != "" && Password.Password.ToString() != "")
            {
                var res = (from r in dc.Users
                           where r.UserName == UserName.Text && r.Password == Password.Password.ToString()
                           select r).FirstOrDefault();

                User user = (User)res;

                if (user != null)
                {
                    if (user.UserType == "employer")
                    {
                        EmployerHome eh = new EmployerHome(user);

                        this.Close();
                        eh.Show();
                    }

                    else
                    {
                        CandidateHome ch = new CandidateHome(user);

                        this.Close();
                        ch.Show();
                    }
                }

                else
                {
                    MessageBox.Show("Incorrect username or password");
                }
            }

            else
            {
                if (UserName.Text == "" && Password.Password.ToString() == "")
                {
                    MessageBox.Show("Enter username and password");
                }

                else if (UserName.Text == "")
                {
                    MessageBox.Show("Enter username");
                }
                else
                {
                    MessageBox.Show("Enter Password");
                }
            }
        }
示例#3
0
        private void Cancel_Click(object sender, RoutedEventArgs e)
        {
            if (user.UserType == "employer")
            {
                EmployerHome eh = new EmployerHome(user);

                this.Close();
                eh.Show();
            }

            else
            {
                CandidateHome eh = new CandidateHome(user);

                this.Close();
                eh.Show();
            }
        }
示例#4
0
        private void Back_Click(object sender, RoutedEventArgs e)
        {
            CandidateHome ch;
            EmployerHome  eh;

            if (user.UserType == "candidate")
            {
                ch = new CandidateHome(user);
                this.Close();
                ch.Show();
            }

            else
            {
                eh = new EmployerHome(user);
                this.Close();
                eh.Show();
            }
        }
示例#5
0
        private void Send_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBody.Text != "")
            {
                Message newMessage = new Message()
                {
                    Sender       = user.UserId,
                    Receiver     = reciever,
                    MessageTitle = MessageTitle.Text,
                    MessageBody  = MessageBody.Text,
                    MessageTime  = System.DateTime.Now
                };

                dc.Messages.InsertOnSubmit(newMessage);

                dc.SubmitChanges();

                if (user.UserType == "employer")
                {
                    EmployerHome eh = new EmployerHome(user);

                    this.Close();
                    eh.Show();
                }

                else
                {
                    CandidateHome eh = new CandidateHome(user);

                    this.Close();
                    eh.Show();
                }
            }

            else
            {
                MessageBox.Show("Message body can't be empty");
            }
        }
示例#6
0
        private void CreateListing_Click(object sender, RoutedEventArgs e)
        {
            if (listingTitle.Text != "" && listingDescription.Text != "")
            {
                if (SelectedRequirements.IsChecked == true)
                {
                    if (Age.SelectedItem != null && Gpa.SelectedItem != null & Experience.SelectedItem != null)
                    {
                        Double age = ((ComboBoxItem)Age.SelectedItem).HiddenValue;
                        Double gpa = ((ComboBoxItem)Gpa.SelectedItem).HiddenValue;
                        Double exp = ((ComboBoxItem)Experience.SelectedItem).HiddenValue;

                        Listing listing = new Listing()
                        {
                            ListingTitle          = listingTitle.Text,
                            ListingDescription    = listingDescription.Text,
                            UserId                = user.UserId,
                            OpenToAll             = 0,
                            GpaRequirement        = gpa,
                            AgeRequirement        = age,
                            ExperienceRequirement = exp,
                            ListedDate            = System.DateTime.Now
                        };

                        dc.Listings.InsertOnSubmit(listing);
                        dc.SubmitChanges();

                        MessageBox.Show("Listing Created");
                    }

                    else
                    {
                        MessageBox.Show("Select all requirements");
                    }
                }

                else
                {
                    Listing listing = new Listing()
                    {
                        ListingTitle       = listingTitle.Text,
                        ListingDescription = listingDescription.Text,
                        UserId             = user.UserId,
                        OpenToAll          = 1,
                        ListedDate         = System.DateTime.Now
                    };

                    dc.Listings.InsertOnSubmit(listing);
                    dc.SubmitChanges();

                    EmployerHome eh = new EmployerHome(user);

                    this.Close();
                    eh.Show();
                }
            }

            else
            {
                MessageBox.Show("Listing title and description cannot be empty");
            }
        }