コード例 #1
0
        //submit close of ticket.
        private void button1_Click(object sender, EventArgs e)
        {
            using (TicketsDBDataContext dbContext = new TicketsDBDataContext())
            {
                Ticketer closer = dbContext.Ticketers.SingleOrDefault(X => X.ID2 == useselected);
                closer.Notes += textBox2.Text;
                if (textBox1.Text == "" || textBox4.Text == "" || textBox5.Text == "")
                {
                    MessageBox.Show("Please fill in all details to close the ticket", "Status update unsuccessful",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    closer.Dresolve   = label10.Text;
                    closer.Resolver   = username.Text;
                    closer.Remail     = textBox4.Text;
                    closer.Rphone     = textBox5.Text;
                    closer.Resolution = textBox1.Text;
                    closer.Status     = 'C';
                    bool isadmin = false;
                    if (closer.IssueType == "IT-Update" || closer.IssueType == "IT-New PC" ||
                        closer.IssueType == "IT-Permissions" || closer.IssueType == "IT-Destroy" ||
                        closer.IssueType == "IT-Phone" || closer.IssueType == "IT-Security" ||
                        closer.IssueType == "IT-Tablet" || closer.IssueType == "IT-User" ||
                        closer.IssueType == "IT-Update" || closer.IssueType == "IT-Other" ||
                        closer.IssueType == "IT-ODI")
                    {
                        isadmin = true;
                    }

                    sendemail(useselected, closer.Temail, dbContext, isadmin);
                    MessageBox.Show("Update Successful");
                    this.Close();
                }
            }
        }
コード例 #2
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();
                    }
                }
            }
        }
コード例 #3
0
 partial void DeleteTicketer(Ticketer instance);
コード例 #4
0
 partial void UpdateTicketer(Ticketer instance);
コード例 #5
0
 partial void InsertTicketer(Ticketer instance);
コード例 #6
0
        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
            {
                Random rnd          = new Random();
                long   ticketnumber = long.Parse(DateTime.Now.ToString("MMddyyyyhhmm") + rnd.Next(1, 1000).ToString());
                string ticketor     = "";
                string tphone       = "";
                string temail       = "";
                string dissue       = "";
                string issue        = "";
                char   status       = 'P';
                string Device       = "";
                string issuetype    = label8.Text;
                ticketor = username.Text;
                tphone   = textBox3.Text;
                temail   = textBox2.Text;
                dissue   = label5.Text;

                if (comboBox1.SelectedIndex == 0)
                {
                    issuetype = "IT-New PC";
                    issue     = "New Computer Setup. \r\nType of Device: " + textBox4.Text + "\r\nDevice-ID: " + textBox6.Text + "\r\nSerial Number of device: " + textBox5.Text + "\r\nDevice is Assigned to: " + textBox7.Text + "\r\n\r\nMore Details:\r\n" + textBox1.Text;
                    Device    = textBox6.Text;
                }
                else if (comboBox1.SelectedIndex == 1)
                {
                    issuetype = "IT-Permissions";
                    issue     = "Change of user permissions\r\nName of agent needing changed: " + textBox4.Text + "\r\nWhat needs changed: " + textBox5.Text;
                }
                else if (comboBox1.SelectedIndex == 2)
                {
                    issuetype = "IT-Destroy";
                    issue     = "Device Destruction. \r\nType of Device: \r\n" + textBox4.Text + "\r\nCNS-ID of Device: " + textBox5.Text + "\r\nPrevious person it was assigned to: " + textBox6.Text + "\r\n\r\nMore Details:\r\n" + textBox1.Text;
                    Device    = textBox5.Text;
                }
                else if (comboBox1.SelectedIndex == 3)
                {
                    issuetype = "IT-Phone";
                    issue     = "Phone Setup\r\nType of Device: " + textBox4.Text + "\r\nCNS-ID of device:" + textBox5.Text + "\r\nName of person it is being assigned to: " + textBox6.Text + "\r\n\r\nMore Details:\r\n" + textBox1.Text;
                    Device    = textBox5.Text;
                }
                else if (comboBox1.SelectedIndex == 4)
                {
                    issuetype = "IT-Security";
                    issue     = "Security Log Pull\r\nType of Device: " + textBox4.Text + "\r\nCNS-ID of device: " + textBox5.Text + "\r\n\r\nMore Details:\r\n" + textBox1.Text;
                    Device    = textBox5.Text;
                }
                else if (comboBox1.SelectedIndex == 5)
                {
                    issuetype = "IT-Tablet";
                    issue     = "Tablet Setup\r\nIs it being reconfigured or setup: " + textBox4.Text + "\r\nCNS-ID of device: " + textBox5.Text + "\r\n\r\nMore Details:\r\n" + textBox1.Text;
                }
                else if (comboBox1.SelectedIndex == 6)
                {
                    issuetype = "IT-User";
                    issue     = "New user Setup\r\nAgent Name: " + textBox7.Text + "\r\nAgent Title: " + textBox4.Text + "\r\nDate Agent Starts: " + textBox5.Text + "\r\nDrives Agent needs: " + textBox6.Text + "\r\n\r\nMore Details:\r\n" + textBox1.Text;
                }
                else if (comboBox1.SelectedIndex == 7)
                {
                    issuetype = "IT-Update";
                    issue     = "Update Logs Pulled from N-able" + "\r\n\r\nMore Details:\r\n" + textBox1.Text;
                }
                else if (comboBox1.SelectedIndex == 8)
                {
                    issuetype = "IT-Other";
                    issue     = "Other" + "\r\n\r\nMore Details:\r\n" + textBox1.Text;
                }
                else if (comboBox1.SelectedIndex == 9)
                {
                    issuetype = "IT-ODI";
                    issue     = "Off Duty Issue" + "\r\n\r\nMore Details:\r\n" + textBox1.Text;
                }
                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 = issuetype,
                        Resolver  = null,
                        Priority  = 'P',
                        Supported = true
                    };
                    dbContext.Ticketers.InsertOnSubmit(test);
                    try
                    {
                        dbContext.SubmitChanges();
                        MessageBox.Show("Your ticket is submited. The ID is: " + ticketnumber, "Ticket Creation Successful!",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch
                    {
                        MessageBox.Show("Unable to create a new ticket. No server connection available");
                    }
                    this.Close();
                }
            }
        }
コード例 #7
0
        //submition of update
        private void Submit(object sender, EventArgs e)
        {
            using (TicketsDBDataContext dbContext = new TicketsDBDataContext())
            {
                try
                {
                    Ticketer test = dbContext.Ticketers.SingleOrDefault(X => X.ID2 == useselected);
                    if (comboBox1.SelectedIndex != -1)
                    {
                        test.IssueType = comboBox1.Text;
                    }
                    else
                    {
                        test.IssueType = test.IssueType;
                    }
                    //New PC form commpletion
                    if (test.Notes != textBox3.Text && textBox3.Text != "")
                    {
                        test.Notes += DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt ") + username.Text + ": " + textBox3.Text + "\r\n";
                    }

                    //status update push
                    if (checkBox1.Checked)
                    {
                        test.Status   = 'O';
                        test.Assigned = System.DirectoryServices.AccountManagement.UserPrincipal.Current.DisplayName;
                        dbContext.SubmitChanges();
                        this.Close();
                        //Priority Update Push
                        if (checkBox5.Checked)
                        {
                            test.Priority = 'L';
                            dbContext.SubmitChanges();
                            _owner.LoadData();
                            Close();
                        }
                        else if (checkBox6.Checked)
                        {
                            test.Priority = 'M';
                            dbContext.SubmitChanges();
                            _owner.LoadData();
                            Close();
                        }
                        else if (checkBox7.Checked)
                        {
                            test.Priority = 'H';
                            dbContext.SubmitChanges();
                            _owner.LoadData();
                            Close();
                        }

                        //supported by IT update push
                        if (checkBox8.Checked)
                        {
                            test.Supported = true;
                            dbContext.SubmitChanges();
                            this.Close();
                        }
                        else
                        {
                            test.Supported = false;
                            dbContext.SubmitChanges();
                            this.Close();
                        }
                    }
                    else if (checkBox2.Checked)
                    {
                        test.Status = 'P';
                        dbContext.SubmitChanges();
                        this.Close();
                        //Priority Update Push
                        if (checkBox5.Checked)
                        {
                            test.Priority = 'L';
                            dbContext.SubmitChanges();
                            _owner.LoadData();
                            this.Close();
                        }
                        else if (checkBox6.Checked)
                        {
                            test.Priority = 'M';
                            dbContext.SubmitChanges();
                            _owner.LoadData();
                            this.Close();
                        }
                        else if (checkBox7.Checked)
                        {
                            test.Priority = 'H';
                            dbContext.SubmitChanges();
                            _owner.LoadData();
                            this.Close();
                        }

                        //supported by IT update push
                        if (checkBox8.Checked)
                        {
                            test.Supported = true;
                            dbContext.SubmitChanges();
                            this.Close();
                        }
                        else
                        {
                            test.Supported = false;
                            dbContext.SubmitChanges();
                            this.Close();
                        }
                    }
                    else if (checkBox3.Checked)
                    {
                        test.Status = 'C';
                        if (textBox2.Text == "" || textBox4.Text == "" || textBox5.Text == "")
                        {
                            if (test.Resolver == "")
                            {
                                MessageBox.Show("Please fill in all details to close the ticket", "Status update unsuccessful",
                                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            else
                            {
                                MessageBox.Show("Ticket Already Closed", "Status update unsuccessful",
                                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            test.Dresolve   = label10.Text;
                            test.Resolver   = username.Text;
                            test.Remail     = textBox4.Text;
                            test.Rphone     = textBox5.Text;
                            test.Resolution = textBox2.Text;

                            bool isadmin = false;
                            if (test.IssueType == "IT-Update" || test.IssueType == "IT-New PC" ||
                                test.IssueType == "IT-Permissions" || test.IssueType == "IT-Destroy" ||
                                test.IssueType == "IT-Phone" || test.IssueType == "IT-Security" ||
                                test.IssueType == "IT-Tablet" || test.IssueType == "IT-User" ||
                                test.IssueType == "IT-Update" || test.IssueType == "IT-Other" ||
                                test.IssueType == "IT-ODI")
                            {
                                isadmin = true;
                            }

                            sendemail(useselected, test.Temail, dbContext, isadmin);
                        }
                    }
                    else if (checkBox4.Checked)
                    {
                        test.Status = 'F';
                        dbContext.SubmitChanges();
                        this.Close();
                        //Priority Update Push
                        if (checkBox5.Checked)
                        {
                            test.Priority = 'L';
                            dbContext.SubmitChanges();
                            _owner.LoadData();
                            this.Close();
                        }
                        else if (checkBox6.Checked)
                        {
                            test.Priority = 'M';
                            dbContext.SubmitChanges();
                            _owner.LoadData();
                            this.Close();
                        }
                        else if (checkBox7.Checked)
                        {
                            test.Priority = 'H';
                            dbContext.SubmitChanges();
                            _owner.LoadData();
                            this.Close();
                        }

                        //supported by IT update push
                        if (checkBox8.Checked)
                        {
                            test.Supported = true;
                            dbContext.SubmitChanges();
                            this.Close();
                        }
                        else
                        {
                            test.Supported = false;
                            dbContext.SubmitChanges();
                            this.Close();
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("No server connection available. Please try again.");
                }
            }
        }