示例#1
0
        private void Button_Click_Add(object sender, RoutedEventArgs e)
        {
            string   massage     = "";
            Employee newEmployee = new Employee();

            newEmployee.FirstName = First_Name.Text;
            newEmployee.LastName  = Last_Name.Text;
            newEmployee.StartDate = StartDate.SelectedDate.Value.Date.ToLongDateString();
            if (!string.IsNullOrEmpty(Salary.Text))
            {
                newEmployee.Salary = Convert.ToInt32(Salary.Text);
            }
            else
            {
                newEmployee.Salary = 0;
            }
            validitor.Check(newEmployee);
            if (!validitor.IsValid())
            {
                foreach (var error in validitor.Erorrs)
                {
                    massage = string.Join(" and ", validitor.Erorrs);
                }
                MessageBox.Show(massage);
            }
            else
            {
                repo.Add(newEmployee);
            }
            this.EmployeeList.ItemsSource = repo.GetAll();
            First_Name.Clear();
            Last_Name.Clear();
            Salary.Clear();
        }
 private void button1_Click(object sender, EventArgs e) ///This is what is going to be outputted into the output file
 {
     if (First_Name.Text == "" | Last_Name.Text == "" | Genre.Text == "" | FilmBox.Text == "" | SR.Text == "" | Rows.Text == "" | Seats.Text == "")
     {
         MessageBox.Show("Please complete all sections", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error); /// Error Box
     }
     else
     {
         using (System.IO.StreamWriter file =
                    new System.IO.StreamWriter(@"H:\app\booking.txt", true))                                                                                                                                                                                                                                 /// Change this location to somewhere on your own computer or it wont work.
         {
             file.WriteLine("First Name\r\n " + First_Name.Text + "\r\n\r\nLastName\r\n" + Last_Name.Text + "\r\n\r\nFilm\r\n" + FilmBox.Text + "\r\n\r\nSpecial Requirements\r\n" + SR.Text + "\r\n\r\nRows\r\n" + Rows.Text + "\r\n\r\nSeats\r\n" + Seats.Text + "\r\n\r\n_____________________\r\n\r\n"); /// This is how the message is formatted in the output file
         }
         First_Name.Clear();
         Last_Name.Clear();
         Genre.SelectedIndex = -1;
         FilmBox.Items.Clear();
         SR.Items.Clear();
         Rows.Items.Clear();
         Seats.Items.Clear(); ///Upon submit button being clicked it clears all of the boxes
     }
 }
示例#3
0
        public void credential()
        {
            if (Flag == true)
            {
                if (UserType.Equals("Admin"))
                {
                    frmMain main = new frmMain();

                    main.Access_Control = UserType.ToString();
                    main.First_Name     = First_Name.ToString();
                    main.Last_Name      = Last_Name.ToString();

                    main.AccessGrant();
                    main.Show();
                    this.Hide();
                }

                else if (UserType.Equals("Teacher"))
                {
                    frmMain main = new frmMain();

                    main.Access_Control = "Teacher";

                    main.Access_Control = UserType.ToString();
                    main.First_Name     = First_Name.ToString();
                    main.Last_Name      = Last_Name.ToString();
                    main.Teacher_Id     = Teacher_Id.ToString();

                    main.AccessGrant();

                    main.btnTeacher.Visible = false;
                    main.button10.Visible   = false;
                    main.button3.Visible    = false;
                    main.button1.Visible    = false;

                    main.Show();
                    this.Hide();
                }
                else
                {
                    string message = "Erorr";
                    string title   = "GOC_INFO_SYS";

                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    DialogResult      result  = MessageBox.Show(message, title, buttons, MessageBoxIcon.Error);

                    if (result == DialogResult.OK)
                    {
                        Flag = false;
                        return;
                    }
                }
            }
            else
            {
                string message = "User not existing";
                string title   = "GOC_INFO_SYS";

                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result  = MessageBox.Show(message, title, buttons, MessageBoxIcon.Error);

                if (result == DialogResult.OK)
                {
                    return;
                }
            }
        }
示例#4
0
 public override string ToString()
 {
     return(base.ToString() + ": " + ID.ToString() + " " + Prefix.ToString() + " " + Last_Name.ToString() + " " + First_Name.ToString() + " " + Middle_initial.ToString() + " " + Permit_Num.ToString() +
            " " + Assistant_First_Name.ToString() + " " + Assistant_Last_Name.ToString() + " " + Active.ToString() + " " + Notes.ToString() + " " + Address.Line1.ToString() + " " +
            Address.Line2.ToString() + " " + Address.City.ToString() + " " + Address.State.ToString() + " " + Address.Zip.ToString() + " " + Org.Org_Name + " " + Org.Org_Type + " " +
            Org.Title + " P:" + Email.Personal_Email + " B:" + Email.Business_Email + " A:" + Email.Assistant_Email + " P:" + Phone.Personal_Phone + " B:" + Phone.Business_Phone + " A:" + Phone.Assistant_Phone);
 }
示例#5
0
        private int CompareTo(Client client)
        {
            if (client == null)
            {
                return(asc * 1);
            }
            switch (sortBy)
            {
            case SortBy.Org_Title:
                if (client.Primary_Organization.Title == null || client.Primary_Organization.Title.Trim() == "")
                {
                    return(asc * -1);
                }
                if (Primary_Organization.Title == null || Primary_Organization.Title.Trim() == "")
                {
                    return(asc * 1);
                }
                if (Primary_Organization.Title == client.Primary_Organization.Title)
                {
                    return(asc * Last_Name.CompareTo(Last_Name));
                }
                return(asc * Primary_Organization.Title.CompareTo(client.Primary_Organization.Title));

            case SortBy.Org_Name:
                if (client.Primary_Organization.Org_Name == null)
                {
                    return(asc * -1);
                }
                if (Primary_Organization.Org_Name == null)
                {
                    return(asc * 1);
                }
                if (Primary_Organization.Org_Name == client.Primary_Organization.Org_Name)
                {
                    return(asc * Last_Name.CompareTo(Last_Name));
                }
                return(asc * Primary_Organization.Org_Name.CompareTo(client.Primary_Organization.Org_Name));

            case SortBy.Business_Phone:
                if (client.Phone.Business_Phone == null)
                {
                    return(asc * -1);
                }
                if (Phone.Business_Phone == null)
                {
                    return(asc * 1);
                }
                if (Phone.Business_Phone == client.Phone.Business_Phone)
                {
                    return(asc * Last_Name.CompareTo(Last_Name));
                }
                return(asc * Phone.Business_Phone.CompareTo(client.Phone.Business_Phone));

            case SortBy.Business_Email:
                if (client.Email.Business_Email == null)
                {
                    return(asc * -1);
                }
                if (Email.Business_Email == null)
                {
                    return(asc * 1);
                }
                if (Email.Business_Email == client.Email.Business_Email)
                {
                    return(asc * Last_Name.CompareTo(client.Last_Name));
                }
                return(asc * Email.Business_Email.CompareTo(client.Email.Business_Email));

            case SortBy.First_Name:
                if (client.First_Name == null)
                {
                    return(asc * -1);
                }
                if (First_Name == null)
                {
                    return(asc * 1);
                }
                if (First_Name == client.First_Name)
                {
                    return(asc * this.Last_Name.CompareTo(client.Last_Name));
                }
                return(asc * First_Name.CompareTo(client.First_Name));

            case SortBy.Last_Name:
            default:
                if (client.Last_Name == null)
                {
                    return(asc * -1);
                }
                if (Last_Name == null)
                {
                    return(asc * 1);
                }
                if (Last_Name == client.Last_Name)
                {
                    return(asc * this.First_Name.CompareTo(client.First_Name));
                }
                return(asc * Last_Name.CompareTo(client.Last_Name));
            }
        }