Esempio n. 1
0
        // Submits the ticket to the database.
        private void btnSubmitTicket_Click(object sender, EventArgs e)
        {
            if (rtxFaultDescription.Text == "")
            {
                MessageBox.Show("No description for the problem was provided!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                string clientID = cmbClient.SelectedValue.ToString();

                string fault = rtxFaultDescription.Text;

                int typeOfServiceID = int.Parse(cmbTypeOfService.SelectedValue.ToString().Substring(0, cmbTypeOfService.SelectedValue.ToString().IndexOf('-')));

                int technicianID = 0;

                if (cmbTechnician.Items.Count != 0)
                {
                    technicianID = int.Parse(cmbTechnician.SelectedValue.ToString());
                }

                int productID = int.Parse(cmbProduct.SelectedValue.ToString().Substring(0, cmbProduct.SelectedValue.ToString().IndexOf('-')));

                Ticket ticket = new Ticket(0, clientID, fault, new Service(0, productID, typeOfServiceID, technicianID), DateTime.Now, true);

                ticket.AddTicket();

                this.Hide();
                frmTechnicalSupport frmTechnicalSupport = new frmTechnicalSupport(admin);
                frmTechnicalSupport.Show();
            }
        }
Esempio n. 2
0
        public ActionResult Support()
        {
            string title = "Support";

            Load(title);
            if (postData != null)
            {
                string ticketTitle = postData.ContainsKey("title") ? Convert.ToString(postData["title"]) : "";
                int    categoryID  = postData.ContainsKey("categoryID") ? Convert.ToInt32(postData["categoryID"]) : -1;
                string comment     = postData.ContainsKey("comment") ? Convert.ToString(postData["comment"]) : "";
                int    rating      = postData.ContainsKey("rating") ? Convert.ToInt32(postData["rating"]) : -1;
                string name        = postData.ContainsKey("name") ? Convert.ToString(postData["name"]) : "";
                string email       = postData.ContainsKey("email") ? Convert.ToString(postData["email"]) : "";
                string phone       = postData.ContainsKey("phone") ? Convert.ToString(postData["phone"]) : "";
                Ticket ticket      = new Ticket(ticketTitle, categoryID, rating, comment, name, email, phone);
                ticket.AddTicket();
                return(Content("success"));
            }
            else
            {
                return(View(title));
            }
        }