Exemplo n.º 1
0
        private void cboSearchTicket_SelectedIndexChanged(object sender, EventArgs e)
        {
            cboCustomer.Items.Clear();
            //Gets the ticket.
            int tick      = Int32.Parse(cboSearchTicket.Text);
            var superTick = help.GetTicket(tick);
            //Searchs for customer ID by ticket
            int custTick = help.SearchForCust(tick);

            //Searches for Customer Name by ID.
            if (custTick >= 1)
            {
                var custName = help.GetCustomerByID(custTick);
                cboCustomer.Text = custName.Item2.ToString();
            }
            else
            {
                cboCustomer.Text = "";
            }
            //Searches for employee ID by ticket
            int empTick = help.SearchForEmp(tick);

            if (empTick >= 1)
            {
                var empUName = help.GetEmployeeByID(empTick);
                cboUserName.Text = empUName.ToString();
            }
            else
            {
                cboUserName.Text = "";
            }
            txtTickNum.Text         = superTick.Item1.ToString();
            txtTickTitle.Text       = superTick.Item2.ToString();
            txtTickDescription.Text = superTick.Item3.ToString();
            numSeverity.Value       = superTick.Item4;
            ckbTickComplete.Checked = superTick.Item5;
            txtFixDescription.Text  = superTick.Item6.ToString();
            //Disables btnAdd
            btnAdd.Enabled = false;
            //Enables btnUpdate
            btnUpdate.Enabled = true;
            //Disables cboCustomer
            cboCustomer.Enabled = false;
            if (cboUserName.Text.ToString().Trim() != "")
            {
                cboUserName.Enabled = false;
            }
            else
            {
                cboUserName.Enabled = true;
            }
        }