Beispiel #1
0
        //save as
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog save = new SaveFileDialog();
                save.Filter = "Spreadsheet|*.csv";
                save.ShowDialog();

                string path      = save.FileName.ToString();
                string delimiter = ",";

                //string builder
                StringBuilder sb = new StringBuilder();


                //header
                string[] hrow = new string[] { "TicketID", "Ticketor", "Date Ticket Created", "Ticketor Email", "Ticketor Phone number", "Device ID", "Supported by CNS IT:", "Assigned To:", "Issue", "Resolver", "Resolver Email", "Resolver Phone Number", "Resolution", "Date Resolved", "Priority", "Issue Type", "Status", "Additional Notes" };
                sb.AppendLine(string.Join(delimiter, hrow));

                TicketsDBDataContext db = new TicketsDBDataContext();
                var r = from p in db.Ticketers
                        where p.ID2 == CaseID
                        select p;

                foreach (var x in r)
                {
                    string issue      = "";
                    string resolution = "";
                    string notes      = "";
                    if (x.Issue != null)
                    {
                        issue = Regex.Replace(x.Issue, @"\r\n?|\n|\t|,", String.Empty);
                    }
                    if (x.Resolution != null)
                    {
                        resolution = String.Join("", x.Resolution.Where(c => c != '\n' && c != '\r' && c != '\t' && c != ','));
                    }
                    if (x.Notes != null)
                    {
                        notes = String.Join("", x.Notes.Where(c => c != '\n' && c != '\r' && c != '\t' && c != ','));
                    }

                    //new row
                    string[] row = new string[] { x.ID2.ToString(), x.Ticketor, x.Dissue, x.Temail, x.Tphone, x.DeviceID, x.Supported.ToString(), x.Assigned, issue, x.Resolver, x.Remail, x.Rphone, resolution, x.Dresolve, x.Priority.ToString(), x.IssueType, x.Status.ToString(), notes };
                    sb.AppendLine(string.Join(delimiter, row));
                }
                //saves rows to file
                File.WriteAllText(path, sb.ToString(), Encoding.UTF8);
            }
            catch
            { }
        }
Beispiel #2
0
 private void sendemail(long ticket, string eto, TicketsDBDataContext dbContext, bool isadmin)
 {
     if (isadmin == false)
     {
         try
         {
             email ClosedTicket = new email();
             ClosedTicket.sendemail("Your IT Ticket has been closed.", "Thank you for patiently waiting while we worked to resolve your issue.\r\n\r\nYour resolved ticket ID is: " + ticket + "\r\n\r\nThank you,\r\nYour IT Support Team", ticket.ToString(), eto.ToString());
             try
             {
                 dbContext.SubmitChanges();
                 this.Close();
             }
             catch
             {
                 MessageBox.Show("Unable to close ticket. No server connection available");
             }
             this.Close();
         }
         catch
         {
             MessageBox.Show("User email address. not valid. Changes made, no email sent.");
             dbContext.SubmitChanges();
             this.Close();
         }
     }
     else
     {
         try
         {
             try
             {
                 dbContext.SubmitChanges();
                 this.Close();
             }
             catch
             {
                 MessageBox.Show("Unable to close ticket. No server connection available");
             }
             this.Close();
         }
         catch
         {
             MessageBox.Show("User email address. not valid. Changes made, no email sent.");
             dbContext.SubmitChanges();
             this.Close();
         }
     }
 }
        //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();
                }
            }
        }
Beispiel #4
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();
                    }
                }
            }
        }
Beispiel #5
0
        //print
        private void button1_Click(object sender, EventArgs e)
        {
            //data holders
            string creator    = "";
            string cemail     = "";
            string cphone     = "";
            string DC         = "";
            string stat       = "";
            string priority   = "";
            string Device     = "";
            string type       = "";
            string resolver   = "";
            string daresolv   = "";
            string eresolv    = "";
            string presolv    = "";
            string issue      = "";
            string notes      = "";
            string resolution = "";
            string supported  = "";
            string Assigned   = "";

            //load Data
            TicketsDBDataContext db = new TicketsDBDataContext();

            var r = from p in db.Ticketers
                    where p.ID2 == CaseID
                    select p;

            foreach (var x in r)
            {
                creator = x.Ticketor;
                cemail  = x.Temail;
                cphone  = x.Tphone;
                DC      = x.Dissue;
                stat    = "" + x.Status;
                if (stat == "F")
                {
                    stat = "Follow-Up";
                }
                if (stat == "C")
                {
                    stat = "Closed";
                }
                if (stat == "P")
                {
                    stat = "Pending";
                }
                if (stat == "O")
                {
                    stat = "Open";
                }
                priority = x.Priority + "";
                if (priority == "L")
                {
                    priority = "Low";
                }
                if (priority == "M")
                {
                    priority = "Medium";
                }
                if (priority == "H")
                {
                    priority = "High";
                }
                if (x.Supported)
                {
                    supported = "Issue is Supported by CNS IT";
                }
                else if (!x.Supported)
                {
                    supported = "Issue is NOT supported by CNS IT";
                }
                Device     = x.DeviceID;
                type       = x.IssueType;
                resolver   = x.Resolver;
                daresolv   = x.Dresolve;
                eresolv    = x.Remail;
                presolv    = x.Rphone;
                issue      = x.Issue;
                notes      = x.Notes;
                resolution = x.Resolution;
                Assigned   = x.Assigned;
            }

            //get a new class for printing
            PCPrint printer = new PCPrint();

            //sent font
            printer.PrinterFont = new Font("Arial", 10);
            //set text
            printer.TextToPrint  = " " + "CNS" + spacer(100, ' ') + "Ticket ID: " + CaseID + "\r\nIT Ticketing System" + "\r\n\r\n\r\n";
            printer.TextToPrint += "Creator of ticket: " + creator + "\r\n";
            printer.TextToPrint += "Creator's email: " + cemail + "\r\n";
            printer.TextToPrint += "Creator's phone Number: " + cphone + "\r\n";
            printer.TextToPrint += "Date Created: " + DC + "\r\n";
            printer.TextToPrint += "Status: " + stat + "\r\n";
            printer.TextToPrint += supported + "\r\n";
            printer.TextToPrint += "Priority: " + priority + "\r\n";
            printer.TextToPrint += "Device ID(If any): " + Device + "\r\n";
            printer.TextToPrint += "Issue Type: " + type + "\r\n";
            printer.TextToPrint += "Assigned to: " + Assigned + "\r\n";
            printer.TextToPrint += "Resolver: " + resolver + "\r\n";
            printer.TextToPrint += "Resolver email: " + eresolv + "\r\n";
            printer.TextToPrint += "Resolver phone Number: " + presolv + "\r\n";
            printer.TextToPrint += "Date Resolved: " + daresolv + "\r\n";
            printer.TextToPrint += "\r\n\r\n" + spacer(70, ' ') + "Issue:\r\n" + spacer(125, '-') + "\r\n" + issue + "\r\n" + spacer(125, '-') + "\r\n\r\n";
            printer.TextToPrint += spacer(65, ' ') + "Additional Notes:\r\n" + spacer(125, '-') + "\r\n" + notes + "\r\n" + spacer(125, '-') + "\r\n\r\n";
            printer.TextToPrint += spacer(67, ' ') + "Resolution\r\n" + spacer(125, '-') + "\r\n" + resolution;
            //print
            printer.Print();
        }
Beispiel #6
0
        //page load
        private void More_Details_Load(object sender, EventArgs e)
        {
            ID.Text        += "" + CaseID;
            label23.Visible = false;
            label22.Visible = false;
            DID             = "";
            button3.Visible = false;
            TicketsDBDataContext db = new TicketsDBDataContext();

            var r = from p in db.Ticketers
                    where p.ID2 == CaseID
                    select p;

            foreach (var x in r)
            {
                label2.Text = x.Ticketor;
                if (x.Temail == null)
                {
                    label15.Text = "None";
                }
                else
                {
                    label15.Text = x.Temail;
                }

                if (x.Tphone == null)
                {
                    label17.Text = "None";
                }
                else
                {
                    label17.Text = x.Tphone;
                }
                label4.Text = x.Dissue;
                if (x.Priority == 'H')
                {
                    label21.Text = "High";
                }
                else if (x.Priority == 'M')
                {
                    label21.Text = "Medium";
                }
                else if (x.Priority == 'L' || x.Priority == 'P')
                {
                    label21.Text = "Low";
                }

                if (x.Status == 'C')
                {
                    label10.Text = x.Resolver;
                    label19.Text = x.Remail;
                    label8.Text  = x.Rphone;
                    label12.Text = x.Dresolve;
                }
                else
                {
                    label9.Text = "Current status:";
                    if (x.Status == 'O')
                    {
                        label10.Text = "Open";
                    }
                    if (x.Status == 'P')
                    {
                        label10.Text = "Pending";
                    }
                    if (x.Status == 'C')
                    {
                        label10.Text = "Closed";
                    }
                    if (x.Status == 'F')
                    {
                        label10.Text = "Follow-Up Needed";
                    }
                    label18.Visible = false;
                    label7.Visible  = false;
                    label11.Visible = false;
                    label19.Visible = false;
                    label8.Visible  = false;
                    label12.Visible = false;
                    label22.Visible = false;
                    label23.Visible = false;
                    if (x.DeviceID != "" && x.DeviceID != null)
                    {
                        label6.Visible   = false;
                        textBox2.Visible = false;
                        button3.Visible  = true;
                        label22.Visible  = true;
                        label23.Visible  = true;
                        DID          = x.DeviceID;
                        label23.Text = x.DeviceID.ToString();
                    }
                    else
                    {
                        label22.Visible = false;
                        label23.Visible = false;
                    }
                }
                if (x.Supported)
                {
                    label24.Text = "Supported: Yes";
                }
                else
                {
                    label24.Text = "Supported: No";
                }
                textBox1.Text = x.Issue;
                textBox2.Text = x.Resolution;
                textBox3.Text = x.Notes;
            }
        }
        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();
                }
            }
        }
Beispiel #8
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.");
                }
            }
        }
Beispiel #9
0
        private void UpdateTicket_Load(object sender, EventArgs e)
        {
            if (!isadmin)
            {
                button3.Visible = false;
            }
            username.Text    = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            label10.Text     = DateTime.Now.ToString("MM-dd-yyyy h:mm tt");
            textBox2.Visible = false;
            TicketsDBDataContext db = new TicketsDBDataContext();

            label21.Text = "" + useselected;
            var r = from p in db.Ticketers
                    where p.ID2 == useselected
                    select p;

            foreach (var x in r)
            {
                label2.Text = x.Ticketor;
                if (x.Temail == null)
                {
                    label7.Text = "None";
                }
                else
                {
                    label7.Text = x.Temail;
                }

                if (x.Tphone == null)
                {
                    label8.Text = "None";
                }
                else
                {
                    label8.Text = x.Tphone;
                }
                label4.Text   = x.Dissue;
                textBox1.Text = x.Issue;
                textBox3.Text = x.Notes;
                if (x.IssueType == "AD")
                {
                    comboBox1.SelectedIndex = 0;
                }
                else if (x.IssueType == "Desktop")
                {
                    comboBox1.SelectedIndex = 1;
                }
                else if (x.IssueType == "Email")
                {
                    comboBox1.SelectedIndex = 2;
                }
                else if (x.IssueType == "Fax")
                {
                    comboBox1.SelectedIndex = 3;
                }
                else if (x.IssueType == "Kinnser")
                {
                    comboBox1.SelectedIndex = 4;
                }
                else if (x.IssueType == "Laptop")
                {
                    comboBox1.SelectedIndex = 5;
                }
                else if (x.IssueType == "Phone")
                {
                    comboBox1.SelectedIndex = 6;
                }
                else if (x.IssueType == "Printer-Scanner")
                {
                    comboBox1.SelectedIndex = 7;
                }
                else if (x.IssueType == "Other")
                {
                    comboBox1.SelectedIndex = 8;
                }
                else if (x.IssueType == "Tablet")
                {
                    comboBox1.SelectedIndex = 9;
                }
                else if (x.IssueType == "D365")
                {
                    comboBox1.SelectedIndex = 10;
                }
                else
                {
                    comboBox1.Visible = false;
                }
                if (x.Status == 'P')
                {
                    checkBox1.Checked = false;
                    checkBox2.Checked = true;
                    checkBox3.Checked = false;
                    checkBox4.Checked = false;
                }
                else if (x.Status == 'C')
                {
                    checkBox1.Checked = false;
                    checkBox2.Checked = false;
                    checkBox3.Checked = true;
                    checkBox4.Checked = false;
                    checkBox1.Enabled = false;
                    checkBox2.Enabled = false;
                    checkBox3.Enabled = false;
                    checkBox4.Enabled = false;
                    textBox3.Visible  = true;
                    textBox2.ReadOnly = false;
                    textBox4.Visible  = false;
                    textBox5.Visible  = false;
                    label15.Visible   = false;
                    label17.Visible   = false;
                }
                else if (x.Status == 'O')
                {
                    checkBox1.Checked = true;
                    checkBox2.Checked = false;
                    checkBox3.Checked = false;
                    checkBox4.Checked = false;
                }
                else if (x.Status == 'F')
                {
                    checkBox1.Checked = false;
                    checkBox2.Checked = false;
                    checkBox3.Checked = false;
                    checkBox4.Checked = true;
                }
                //priority of ticket
                if (x.Priority == 'P' || x.Priority == 'L')
                {
                    checkBox7.Checked = false;
                    checkBox6.Checked = false;
                    checkBox5.Checked = true;
                }
                else if (x.Priority == 'M')
                {
                    checkBox7.Checked = false;
                    checkBox6.Checked = true;
                    checkBox5.Checked = false;
                }
                else if (x.Priority == 'H')
                {
                    checkBox7.Checked = true;
                    checkBox6.Checked = false;
                    checkBox5.Checked = false;
                }
                //Supported by IT
                if (x.Supported == true)
                {
                    checkBox8.Checked = true;
                    checkBox9.Checked = false;
                }
                else
                {
                    checkBox8.Checked = false;
                    checkBox9.Checked = true;
                }
            }
        }
Beispiel #10
0
        //Selected dates to print
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime first = new DateTime();
                first = dateTimePicker1.Value;

                DateTime second = new DateTime();
                second = dateTimePicker2.Value;

                TimeSpan duration = second - first;

                int time = (int)duration.TotalMinutes;
                if (time < 1)
                {
                    MessageBox.Show("Start date MUST be before End date");
                }
                else
                {
                    SaveFileDialog save = new SaveFileDialog();
                    save.Filter = "Spreadsheet|*.csv";
                    save.ShowDialog();

                    TicketsDBDataContext db = new TicketsDBDataContext();
                    var r = from p in db.Ticketers
                            select p;

                    string path      = save.FileName.ToString();
                    string delimiter = ",";

                    //string builder
                    StringBuilder sb = new StringBuilder();

                    //header
                    string[] hrow = new string[] { "TicketID", "Ticketor", "Date Ticket Created", "Ticketor Email", "Ticketor Phone number", "Device ID", "Supported by CNS IT", "Assigned to:", "Issue", "Resolver", "Resolver Email", "Resolver Phone Number", "Resolution", "Date Resolved", "Priority", "Issue Type", "Status", "Additional Notes" };
                    sb.AppendLine(string.Join(delimiter, hrow));

                    foreach (var x in r)
                    {
                        DateTime datedata = DateTime.Parse(x.Dissue.ToString());
                        if (datedata > first && datedata < second)
                        {
                            string issue         = "";
                            string resolution    = "";
                            string notes         = "";
                            string ticketoremail = "";
                            string ticketorphone = "";
                            string resolverphone = "";
                            string resolveremail = "";
                            if (x.Temail != null)
                            {
                                ticketoremail = Regex.Replace(x.Temail, @"\r\n?|\n|\t|,", String.Empty);
                            }
                            if (x.Tphone != null)
                            {
                                ticketorphone = Regex.Replace(x.Tphone, @"\r\n?|\n|\t|,", String.Empty);
                            }
                            if (x.Rphone != null)
                            {
                                resolverphone = Regex.Replace(x.Rphone, @"\r\n?|\n|\t|,", String.Empty);
                            }
                            if (x.Remail != null)
                            {
                                resolveremail = Regex.Replace(x.Remail, @"\r\n?|\n|\t|,", String.Empty);
                            }
                            if (x.Issue != null)
                            {
                                issue = Regex.Replace(x.Issue, @"\r\n?|\n|\t|,", String.Empty);
                            }
                            if (x.Resolution != null)
                            {
                                resolution = String.Join("", x.Resolution.Where(c => c != '\n' && c != '\r' && c != '\t' && c != ','));
                            }
                            if (x.Notes != null)
                            {
                                notes = String.Join("", x.Notes.Where(c => c != '\n' && c != '\r' && c != '\t' && c != ','));
                            }

                            //new row
                            string[] row = new string[] { x.ID2.ToString(), x.Ticketor, x.Dissue, ticketoremail, ticketorphone, x.DeviceID, x.Supported.ToString(), x.Assigned, issue, x.Resolver, resolveremail, resolverphone, resolution, x.Dresolve, x.Priority.ToString(), x.IssueType, x.Status.ToString(), notes };
                            sb.AppendLine(string.Join(delimiter, row));
                        }
                        File.WriteAllText(path, sb.ToString(), Encoding.UTF8);
                        this.Close();
                    }
                }
            }
            catch
            {
                this.Close();
            }
        }