Пример #1
0
        //submit new ticket
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("User MUST select a ticket type", "Error, invalid selection",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (!textBox2.Text.ToString().Contains("@") || !textBox2.Text.ToString().Contains(".com"))
                {
                    MessageBox.Show("Please Enter a Valid email address");
                }
                else if (!textBox2.Text.ToString().Contains("cnscares.com"))
                {
                    MessageBox.Show("Please use your CNS email. No other email address can be accepted.");
                }
                else
                {
                    Random rnd = new Random();

                    DateTime mountain     = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Mountain Standard Time"));
                    long     ticketnumber = long.Parse(mountain.ToString("MMddyyyyhhmm") + rnd.Next(1, 1000).ToString());
                    string   ticketor     = "";
                    string   tphone       = "";
                    string   temail       = "";
                    string   dissue       = "";
                    string   issue        = "";
                    char     status       = 'P';
                    string   Device       = "";
                    ticketor = username.Text;
                    tphone   = textBox3.Text;
                    temail   = textBox2.Text;
                    dissue   = label5.Text;
                    if (label8.Text == "Fax")
                    {
                        issue = "Type of issue: " + label8.Text + "\r\n\r\nIncoming or Outgoing Fax: " + textBox4.Text +
                                "\r\n\r\nError Provided: " + textBox5.Text + "\r\n\r\nMore Details: \r\n" + textBox1.Text;
                    }
                    else if (label8.Text == "Kinnser Password" || label8.Text == "AD")
                    {
                        issue = "Type of issue: " + label8.Text + "\r\n\r\nName of Agent: " + textBox4.Text +
                                "\r\n\r\nUsername of Agent: " + textBox5.Text + "\r\n\r\nBest way to contact: " +
                                textBox6.Text + "\r\n\r\nContact Information: " + textBox7.Text + "\r\n\r\nMore Details: \r\n"
                                + textBox1.Text;
                    }
                    else if (label8.Text == "Printer-Scanner")
                    {
                        issue = "Type of issue: " + label8.Text + "\r\n\r\nOwner of Printer-Scanner: " + textBox4.Text +
                                "\r\n\r\nPreviously completed Steps: " + textBox5.Text + "\r\n\r\nMore Details: \r\n" + textBox1.Text;
                    }
                    else if (label8.Text == "Email" || label8.Text == "Laptop" || label8.Text == "Desktop" ||
                             label8.Text == "Tablet")
                    {
                        if (label8.Text == "Laptop" || label8.Text == "Desktop")
                        {
                            Device = textBox5.Text;
                        }
                        issue = "Type of issue: " + label8.Text + "\r\n\r\nError: " + textBox4.Text +
                                "\r\n\r\nMore Details: \r\n" + textBox1.Text;
                    }
                    else if (label8.Text == "Phone")
                    {
                        issue = "Type of issue: " + label8.Text + "\r\n\r\nType of Phone: " + textBox4.Text +
                                "\r\n\r\nErrors: " + textBox5.Text + "\r\n\r\nMore Details: \r\n" + textBox1.Text;
                    }
                    else if (label8.Text == "CRM Dynamics 365")
                    {
                        issue       = "Type of issue: D365\r\n\r\nError: " + textBox4.Text + "\r\n\r\nMore Details: \r\n" + textBox1.Text;
                        label8.Text = "D365";
                    }
                    else
                    {
                        issue = textBox1.Text;
                    }
                    if (label8.Text != "Kinnser")
                    {
                        if (label8.Text == "Kinnser Password")
                        {
                            label8.Text = "Kinnser";
                        }
                        string notes = "";
                        if (Someoneelse.Checked)
                        {
                            string           domainName = "192.168.10.5";
                            PrincipalContext ctx        = new PrincipalContext(ContextType.Domain, domainName);

                            UserPrincipal user = UserPrincipal.FindByIdentity(ctx, comboBox2.Text);

                            if (user != null)
                            {
                                notes   += "Ticket was created by: " + ticketor + "\r\nFor: CNS\\" + user.SamAccountName + "\r\n\r\n";
                                ticketor = "CNS\\" + user.SamAccountName;
                            }
                            else
                            {
                                MessageBox.Show("Error! No selection made that is in the server!");
                            }
                        }
                        using (TicketsDBDataContext dbContext = new TicketsDBDataContext())
                        {
                            Ticketer test = new Ticketer
                            {
                                ID2       = ticketnumber,
                                Ticketor  = ticketor,
                                Tphone    = tphone,
                                Temail    = temail,
                                Dissue    = dissue,
                                Issue     = issue,
                                Status    = status,
                                DeviceID  = Device,
                                IssueType = label8.Text,
                                Resolver  = null,
                                Priority  = 'P',
                                Supported = true,
                                Assigned  = "It Support",
                                Notes     = notes
                            };
                            dbContext.Ticketers.InsertOnSubmit(test);
                            bool submitsuccess = false;
                            if (label8.Text == "Tablet" && textBox5.Text == "")
                            {
                                MessageBox.Show("A contact phone number is required");
                            }
                            else
                            {
                                try
                                {
                                    dbContext.SubmitChanges();
                                    submitsuccess = true;
                                }
                                catch
                                {
                                    submitsuccess = false;
                                    MessageBox.Show("Unable to create a new ticket. No server connection available. Please check VPN and internet connections");
                                    _owner.Close();
                                }


                                if (submitsuccess == true)
                                {
                                    //emailcode here
                                    try
                                    {
                                        //standard email for a D365 ticket
                                        if (label8.Text == "D365")
                                        {
                                            email D365email = new email();
                                            D365email.sendemail("A new D365 IT Ticket has been placed.", "A new IT ticket for D365 related issues has been created. please review the details of this ticket in the CNS IT ticketing system.\r\n\r\nTicket ID: " + ticketnumber + "\r\nType of issue: D365", ticketnumber.ToString(), "*****@*****.**");
                                        }

                                        //Standard email for a new ticket.
                                        email NewTicket = new email();
                                        NewTicket.sendemail("Your IT ticket has been created.", "Thank you for creating your IT ticket using the CNS IT ticketing system.\r\n\r\nThe ticket ID is: " + ticketnumber + "\r\nThe type of issue is: " + label8.Text + "\r\n\r\nThis issue will be resolved as quickly as possible. Please allow 10 minutes for the IT team to see this new ticket.\r\n\r\nThank you,\r\nYour IT Support Team\r\n\r\n", ticketnumber.ToString(), textBox2.Text.ToString());

                                        MessageBox.Show("Your ticket is submited. The ID is: " + ticketnumber, "Ticket Creation Successful!",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    }
                                    catch (Exception ex)
                                    {
                                        MessageBox.Show("Unable to send email(s).\r\n\r\n Error: \r\n" + ex.ToString());
                                    }
                                    this.Close();
                                }
                                else
                                {
                                    this.Close();
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Sorry, this is not a supported ticket type.");
                        this.Close();
                    }
                }
            }
        }
Пример #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            using (EquipReDataContext dbContext = new EquipReDataContext())
            {
                try
                {
                    EquipmentReturn submitchanges = dbContext.EquipmentReturns.SingleOrDefault(X => X.IDText.Contains(RID));

                    //notes
                    if (textBox3.Text != "" && submitchanges.AdditionalNotes == "")
                    {
                        submitchanges.AdditionalNotes += username + " (" + DateTime.Now.ToString() + "): " + textBox3.Text;
                    }
                    else if (textBox3.Text != "" && submitchanges.AdditionalNotes != "" && submitchanges.AdditionalNotes != textBox2.Text)
                    {
                        submitchanges.AdditionalNotes += "\r\n\r\n" + username + " (" + DateTime.Now.ToString() + "): " + textBox3.Text;
                    }


                    submitchanges.TicketStatus = 'F';

                    //level of priority
                    if (comboBox1.SelectedIndex == 0)
                    {
                        submitchanges.Priority = 'H';
                    }
                    if (comboBox1.SelectedIndex == 1)
                    {
                        submitchanges.Priority = 'M';
                    }
                    if (comboBox1.SelectedIndex == 2)
                    {
                        submitchanges.Priority = 'L';
                    }

                    if (submitchanges.AdditionalNotes == textBox3.Text || (textBox3.Text == "" && submitchanges.AdditionalNotes == "") || textBox3.Text == "")
                    {
                        MessageBox.Show("Error! Enter all details before continuing");
                    }
                    else
                    {
                        //Status
                        if (radioButton1.Checked == true)
                        {
                            submitchanges.TicketStatus = 'O';
                        }
                        if (radioButton2.Checked == true)
                        {
                            email ReturnClosed = new email();
                            ReturnClosed.sendemail("Return Ticket Closed", "This is a notice that a ticket for equipment returns has been closed. \r\n\r\nDevice ID: " + submitchanges.TagID + "\r\nPhone Number Called: " + submitchanges.Phone_Number + "\r\nDevice Assigned to: " + submitchanges.Assignee, submitchanges.IDText, "*****@*****.**");
                            submitchanges.TicketStatus = 'C';
                        }
                        if (radioButton3.Checked == true)
                        {
                            submitchanges.TicketStatus = 'P';
                        }
                        if (radioButton4.Checked == true)
                        {
                            submitchanges.TicketStatus = 'F';
                        }

                        dbContext.SubmitChanges();
                        this.Close();
                    }
                }
                catch
                {
                    MessageBox.Show("Error Submiting Data. Please contact your Network Administrator or IT team.");
                }
            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if ((comboBox1.SelectedIndex == 4 && textBox2.Text == "") || textBox1.Text == "" || textBox3.Text == "")
            {
                MessageBox.Show("Please enter details in all fields");
            }
            else
            {
                using (EquipReDataContext dbContext = new EquipReDataContext())
                {
                    DateTime blank = new DateTime(1990, 1, 1, 0, 0, 0);

                    Random rnd = new Random();
                    string ID  = "E" + long.Parse(DateTime.Now.ToString("MMddyyyyhhmm") + rnd.Next(1, 1000).ToString());

                    string reasons = "";
                    if (textBox2.Text != "")
                    {
                        reasons = comboBox1.Text + ": " + textBox2.Text;
                    }
                    else
                    {
                        reasons = comboBox1.Text;
                    }
                    EquipmentReturn returns = new EquipmentReturn()
                    {
                        Id                  = long.Parse(DateTime.Now.ToString("MMddyyyyhhmm") + rnd.Next(1, 1000).ToString()),
                        IDText              = ID,
                        FirstContactPerson  = "None",
                        SecondContactPerson = "None",
                        ThirdContactperson  = "None",
                        EscalationAgent     = "None",
                        EscalationStatus    = false,

                        FirstContactDate  = blank,
                        SecondContactDate = blank,
                        ThirdContactDate  = blank,
                        EscalationDate    = blank,
                        Notes             = "Device Assigned to: " + textBox3.Text + "\r\n",
                        TicketStatus      = 'P',
                        Priority          = 'L',
                        Phone_Number      = "000-000-0000",

                        Assignee = textBox3.Text,

                        Ticketor    = username,
                        DateCreated = DateTime.Now,
                        Reason      = reasons,
                        TagID       = textBox1.Text
                    };
                    dbContext.EquipmentReturns.InsertOnSubmit(returns);
                    try
                    {
                        dbContext.SubmitChanges();
                    }
                    catch (Exception r)
                    {
                        MessageBox.Show("Error, unable to save to database. Check connection\r\n\r\n" + r.ToString());
                    }
                    email ReturnSetup = new email();
                    ReturnSetup.sendemail("Return Ticket Created.", "A new Return ticket has been created.Please review this in the IT ticketing system for further information.\r\nThe ticket ID is: " + ID + "\r\nEquipmentID: " + textBox1.Text + "Assigned to: " + textBox3.Text, ID, "*****@*****.**");

                    this.Close();
                }
            }
        }