Esempio n. 1
0
        private void UnassignedTicketsGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            //BOTAO DE DAR ASSIGN
            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0 && senderGrid.Columns[e.ColumnIndex].Name == "UAssignButtonColumn")
            {
                int ticketId = Int32.Parse(senderGrid.Rows[e.RowIndex].Cells[0].Value.ToString());
                if (ticketService.AssignTicketToSolver(ticketId, this.solver.id))
                {
                    notificationServiceClient.SendMessage(EventOperation.UPDATE_UNASSIGNED, new Guid(), "hey");
                    UI_UpdateAssignedTickets();
                }
            }
        }
Esempio n. 2
0
        void AnswerBtnClick(object sender, EventArgs e)
        {
            if (activeQuestion == null || answerTxt.Text == "")
            {
                return;
            }

            if (ticketService.AnswerQuestion(activeQuestion.serverQuestionId, answerTxt.Text))
            {
                DepartmentDatabaseHandler.RemoveQuestion(activeQuestion.id);
                activeQuestion          = null;
                answerBtn.Enabled       = false;
                questionTitleTxt.Text   = "";
                questionDetailsTxt.Text = "";
                notificationServiceClient.SendMessage(EventOperation.QUESTION_ANSWERED, userId, "");
                UI_UpdateList();
            }
        }
        protected void SendTicket(object sender, EventArgs e)
        {
            warningLabel.Text = "";
            string errorMsg = "";


            if (nameTextBox.Text == "")
            {
                errorMsg += "| Invalid Name |";
            }

            if (!IsEmailValid(emailTextBox.Text))
            {
                errorMsg += "| Invalid Email |";
            }

            if (TitleText.Text == "")
            {
                errorMsg += "| Invalid Problem Title |";
            }

            if (DescriptionText.Text == "")
            {
                errorMsg += "| Invalid Problem Description |";
            }

            if (errorMsg == "")
            {
                int workerID = ticketsService.AddWorker(nameTextBox.Text, emailTextBox.Text);
                if (workerID == -1)
                {
                    warningLabel.Text = "ERROR: Ticket not sent...";
                    return;
                }
                else
                {
                    LoadWorkers();
                    UpdateWorkersList();
                }



                if (ticketsService.AddTicket(TitleText.Text, DescriptionText.Text, workerID))
                {
                    warningLabel.Text = "SUCCESS: " + nameTextBox.Text + " sent a new ticket !";
                    //UpdateQuestionsListBox(workerID); //Nao esta a fazer update do direito nao sei pk...s
                    if (workersList != null)
                    {
                        if (workersList.Count > 0)
                        {
                            UpdateQuestionsListBox(workersList[0].id);
                        }
                    }
                    //UpdateQuestionsListBox(workerID); //Nao esta a fazer update do direito nao sei pk...s
                    notificationServiceClient.SendMessage(EventOperation.NEW_TICKET_ADDED, new Guid(), "");
                }
                else
                {
                    warningLabel.Text = "Ticket not sent! An Error has occurred...";
                }
            }
            else
            {
                warningLabel.Text = errorMsg;
            }
        }