private void LoginButton_Click(object sender, EventArgs e)
        {
            CodeHogEntities hogEntities = new CodeHogEntities();
            string          email       = emailTextBox.Text;
            string          pass        = passwordTextBox.Text;
            var             query       = hogEntities.Users.Where(s => s.Email == email);

            if (query.FirstOrDefault() != null)
            {
                User temp = query.FirstOrDefault();
                if (temp.Password == pass)
                {
                    MainMenu menu = new MainMenu();
                    menu.SetUser(temp.UserID, temp.Username, temp.RoleID);
                    menu.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Failed login.");
                }
            }
            else
            {
                MessageBox.Show("Login Failed: Please Check Email and Password");
            }
        }
        //------------------------------ Constructor ------------------------------//

        public MainMenu()
        {
            InitializeComponent();

            codeHogEntities = new CodeHogEntities();

            ApplyFilterToDataGrid();
        }
 public DependenciesMenu(string ticketID, CodeHogEntities currentCodeHogEntities)
 {
     InitializeComponent();
     codeHogEntities    = currentCodeHogEntities;
     ticketIDLabel.Text = ticketID;
     tempID             = Convert.ToInt32(ticketIDLabel.Text);                                                     //this is only used to compare. See line below(if there is a better way please change it)
     dependencyDataGridView.DataSource = codeHogEntities.Dependencies.Where(x => (x.TicketID == tempID)).ToList(); //display related ticketID
 }
예제 #4
0
        public Menus()
        {
            InitializeComponent();
            codeHogEntities = new CodeHogEntities();
            CurrentSort     = Convert.ToBoolean(ChosenSort.TicketSort);

            ApplyFilterToDataGrid();
        }
        public UserManagementMenu(UserLogin currentUser)
        {
            InitializeComponent();

            codeHogEntities = new CodeHogEntities();

            user = currentUser;

            BindUserList();

            roleComboBox.SelectedIndex = 0;
        }
예제 #6
0
        private int userIDNum;           //the ID number of the current user

        public AddNote(int tickNum, string userName, CodeHogEntities currentCodeHogEntities)
        {
            //setup
            InitializeComponent();
            codeHogEntities = currentCodeHogEntities;
            ticketNumber    = tickNum;
            userN           = userName;

            //set the title component labels to the correct text
            //set menu components
            ticketNumPrintLabel.Text = ticketNumber.ToString(); //ticket Number label
            usernamePrintLabel.Text  = userN;                   //username label
        }
예제 #7
0
        private int chosenPriority;      //New priority for ticket, as chosen by user

        public ChangePriority(int ticketNum, CodeHogEntities currentCodeHogEntities, UserLogin currentUser)
        {
            //setup
            InitializeComponent();
            codeHogEntities = currentCodeHogEntities;
            ticketNumber    = ticketNum;

            //set menu components
            ticketNumPrintLabel.Text = ticketNum.ToString(); //ticket Number label
            usernamePrintLabel.Text  = currentUser.Name;     //username label

            //set default radial button to the ticket's current priority
            foreach (var ticket in codeHogEntities.Tickets) //find the current ticket in the DB
            {
                if (ticket.TicketID == ticketNumber)        //if the ticket in the DB is the ticket we are looking for
                {
                    //Radio Button and default selection setup, based on existing priority within the ticket
                    switch (ticket.TicketPriority)
                    {
                    case 1:
                        radioButton1.Checked = true;
                        chosenPriority       = 1;
                        break;

                    case 2:
                        radioButton2.Checked = true;
                        chosenPriority       = 2;
                        break;

                    case 3:
                        radioButton3.Checked = true;
                        chosenPriority       = 3;
                        break;

                    case 4:
                        radioButton4.Checked = true;
                        chosenPriority       = 4;
                        break;

                    case 5:
                        radioButton5.Checked = true;
                        chosenPriority       = 5;
                        break;
                    }
                }
            }
        }
예제 #8
0
 public DeleteTicketMenu()
 {
     InitializeComponent();
     codeHogEntities = new CodeHogEntities();
     //ticketIDLabel.Text =
 }
 public DeleteTicketMenu(string ticketID)
 {
     InitializeComponent();
     codeHogEntities    = new CodeHogEntities();
     ticketIDLabel.Text = ticketID;
 }
예제 #10
0
        private void ButtonNewTicket_Click(object sender, EventArgs e)
        {
            //Prioerity Checking
            int Pri = -1;

            if (RadioPri1.Checked)
            {
                Pri = 1;
            }
            else if (RadioPri2.Checked)
            {
                Pri = 2;
            }
            else if (RadioPri3.Checked)
            {
                Pri = 3;
            }
            else if (RadioPri4.Checked)
            {
                Pri = 4;
            }
            else if (RadioPri5.Checked)
            {
                Pri = 5;
            }

            //Checking if all the required fileds are tehere
            if (TextName.TextLength == 0 || TextDesc.TextLength == 0 || Pri == -1)
            {
                MessageBox.Show("Bro this is empty");
            }
            else
            {
                //Setting up the database.
                var Database = new CodeHogEntities();



                //Reporter should be the person who logs in UserId. Just putting a placeholder here for future referecne.
                int Reporter  = 1;
                var NewTicket = new Ticket()
                {
                    TicketArchiveStatus = false,
                    TicketStatus        = 0,
                    TicketReporter      = Reporter,

                    TicketDescription = TextDesc.Text,
                    TicketName        = TextName.Text,
                    TicketPriority    = Pri,
                };
                Database.Tickets.Add(NewTicket);
                Database.SaveChanges();
                // Dependcies checking

                //Gettingt he piramary ticket ID
                var    query   = Database.Tickets.Where(s => s.TicketID == NewTicket.TicketID);
                Ticket Ticketp = query.FirstOrDefault <Ticket>();


                //Create a new dependecny, and add it to database
                foreach (DataGridViewRow temp in dataGridView1.SelectedRows)
                {
                    int ticketidrow = Int32.Parse(temp.Cells[0].Value.ToString());
                    query = Database.Tickets.Where(s => s.TicketID == ticketidrow);
                    Dependency dependency = new Dependency()
                    {
                        DependentTicketID = query.FirstOrDefault <Ticket>().TicketID,
                        TicketID          = Ticketp.TicketID
                    };
                    Console.WriteLine("OOps" + dependency.DependencyID + "\tFUCK" + dependency.TicketID);
                    Database.Dependencies.Add(dependency);
                    Database.SaveChanges();
                }
                //query = Database.Dependencies.Where(s => s.DependentTicketID == );
                //NewTicket.Dependencies=
                dataGridView1.Refresh();

                // This is the default values of a newly created ticket.
                //var wow=Database.Database.ExecuteSqlCommand("FROM * SELECT *");
            }
        }