Esempio n. 1
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (lastLstIndex < Ticket.ticketArray.Count)
     {
         if (lastLstIndex != -1)
         {
             Ticket.saveTicket(Ticket.ticketArray[lastLstIndex], lblID.Text, lblSubject.Text, txtNotes.Text, txtSolution.Text, txtStatus.Text, dateTimePicker1.Value);
         }
     }
     JsonController.SaveJson();
 }
Esempio n. 2
0
        private void deleteAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var test = MessageBox.Show("Are you sure you want all of your tickets deleted?", "Warning!", MessageBoxButtons.YesNo);

            if (test == DialogResult.Yes)
            {
                Ticket.ticketArray.Clear();
                JsonController.SaveJson();
                fillTicketTable();
            }
        }
Esempio n. 3
0
 public Form1()
 {
     InitializeComponent();
     JsonController.ReadJson();
     fillTicketTable();
     dateTimePicker1.Format       = DateTimePickerFormat.Custom;
     dateTimePicker1.CustomFormat = "MM/dd/yyyy hh:mm:ss tt";
     dateTimePicker1.Value        = DateTime.Now;
     if (Environment.UserName.ToLower() == "vancef")
     {
         this.BackColor = Color.ForestGreen;
     }
     changeColor();
 }
Esempio n. 4
0
        internal static void ImportJson()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title  = "Select Ticket File to Import";
            ofd.Filter = "Tickets |*.tkt";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string path = ofd.FileName;
                if (Ticket.ticketArray.Count >= 1)
                {
                    var test = MessageBox.Show("Would you like to add on to your tickets? If not I would delete all existing tickets.", "Warning!", MessageBoxButtons.YesNo);
                    if (test == DialogResult.No)
                    {
                        Properties.Settings.Default.Json = "";
                        Ticket.ticketArray.Clear();
                    }
                }
                using (StreamReader sr = new StreamReader(path))
                {
                    string line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        Properties.Settings.Default.Json += Encrypt.DecryptString(line, "Password");
                    }
                    if (Properties.Settings.Default.Json.Contains("¼") && Properties.Settings.Default.Json.Contains("µ"))
                    {
                        JsonController.ReadJson();
                    }
                    else
                    {
                        MessageBox.Show("File is corrupted!", "Error: Corruption", MessageBoxButtons.OK);
                        Properties.Settings.Default.Json = "";
                        JsonController.ReadJson();
                    }
                }
            }
        }
Esempio n. 5
0
 private void importToolStripMenuItem_Click(object sender, EventArgs e)
 {
     JsonController.ImportJson();
 }
Esempio n. 6
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     JsonController.SaveJson();
 }