private void displayUpdate()
        {
            CSV csv = new CSV();
            string[] stringArray = (string[])csv.Read().ToArray(typeof(string));

            // Get current date.
            DateTime thisDay = DateTime.Today;
            // Display the date in a variety of formats.
            int i = 0;
            foreach (string s in stringArray)
            {
                string[] individ = s.Split(',');
                itemName = individ[0];
                string[] temp = individ[1].Split('/');

                DateTime now = DateTime.Today;
                int age = now.Year;
                itemDoB = Convert.ToString(age - Convert.ToInt32(temp[2]));
                itemSex = individ[2];
                itemEvent = individ[3];
                itemLocation = individ[4];

                listView1.Items.Add(new ListViewItem(new string[] { itemName, itemDoB, itemEvent }));
                if (itemSex.CompareTo("M") == 0)
                {
                    listView1.Items[i].SubItems[0].BackColor = Color.LightSteelBlue;
                }
                else
                {
                    listView1.Items[i].SubItems[0].BackColor = Color.Thistle;
                }
                i++;
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure?","", MessageBoxButtons.YesNoCancel);

            if (result.ToString().CompareTo("Yes") == 0)
            {
                //gets the index's of all the selected files in the ListView1
                List<string> w = new List<string>();
                foreach (ListViewItem item in listView1.SelectedItems)
                {
                    w.Add(item.SubItems[0].Text + "/" + item.SubItems[2].Text);
                }

                //writes the CSV string to a new List using the index's of the selected items
                CSV csv = new CSV();
                csv.Delete(w);
            }
            okButtonB = true;
            foreach (ListViewItem item in listView1.Items)
            {
                item.Remove();
            }
            displayUpdate();
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            //gets the index's of all the selected files in the ListView1
             List<string> w = new List<string>();
             foreach (ListViewItem item in listView1.SelectedItems) {
                 w.Add(item.SubItems[0].Text+"/"+item.SubItems[2].Text);
             }

            //writes the CSV string to a new List using the index's of the selected items
            CSV csv = new CSV();
            string[] stringArray = (string[])csv.Read().ToArray(typeof(string));

            foreach (string itemSelectedinLV in w)
            {
                foreach (string s in stringArray)
                {
                    string[] individ = s.Split(',');
                    itemName = individ[0] + "/" + individ[3];

                    if (itemName.CompareTo(itemSelectedinLV) == 0)
                    {
                        selectedItemsR.Add(s);
                        break;
                    }
                }
            }

            oButtonB = true;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// writes the details to a CSV file to be read later
 /// </summary>
 /// <param name="myName">Athlete Name</param>
 /// <param name="myDate">Athlete DoB</param>
 /// <param name="mySex">Athlete sex</param>
 /// <param name="myEvent">Athlete event</param>
 /// <param name="newLocal">File Location</param>
 private void CSVWriter(String myName, String myDate, String mySex, String myEvent, string newLocal)
 {
     string tempEvent = myEvent.Substring(1);
     string CSVtext = myName + "," + myDate + "," + mySex + "," + tempEvent + "," + newLocal;
     CSV csv = new CSV();
     csv.Write(CSVtext);
     fileAlreadyExists = csv.fileAlreadyExists;
 }
Ejemplo n.º 5
0
        private void OP_setUpOpen()
        {
            string OP_itemName, OP_itemDoB, OP_itemSex, OP_itemEvent, OP_itemLocation;

            CSV csv = new CSV();
            string[] stringArray = (string[])csv.Read().ToArray(typeof(string));

            // Get current date.
            DateTime thisDay = DateTime.Today;
            // Display the date in a variety of formats.
            int i = 0;
            foreach (string s in stringArray)
            {
                string[] individ = s.Split(',');
                OP_itemName = individ[0];
                string[] temp = individ[1].Split('/');

                DateTime now = DateTime.Today;
                int age = now.Year;
                OP_itemDoB = Convert.ToString(age - Convert.ToInt32(temp[2]));
                OP_itemSex = individ[2];
                OP_itemEvent = individ[3];
                OP_itemLocation = individ[4];

                OPlistView1.Items.Add(new ListViewItem(new string[] { OP_itemName, OP_itemDoB, OP_itemEvent }));
                if (OP_itemSex.CompareTo("M") == 0)
                {
                    OPlistView1.Items[i].SubItems[0].BackColor = Color.LightSteelBlue;
                }
                else
                {
                    OPlistView1.Items[i].SubItems[0].BackColor = Color.Thistle;
                }
                i++;
            }

            //show DATETIMEPICKER to show the years view first
            //dateTimePicker1.Value = DateTime.Now;
        }
Ejemplo n.º 6
0
        private void OP_GetDataOffList()
        {
            string itemName;
            //gets the index's of all the selected files in the ListView1
            List<string> w = new List<string>();
            foreach (ListViewItem item in OPlistView1.SelectedItems)
            {
                w.Add(item.SubItems[0].Text + "/" + item.SubItems[2].Text);
            }

            //writes the CSV string to a new List using the index's of the selected items
            CSV csv = new CSV();
            string[] stringArray = (string[])csv.Read().ToArray(typeof(string));

            foreach (string itemSelectedinLV in w)
            {
                foreach (string s in stringArray)
                {
                    string[] individ = s.Split(',');
                    itemName = individ[0] + "/" + individ[3];

                    if (itemName.CompareTo(itemSelectedinLV) == 0)
                    {
                        OP_selectedItemsR.Add(s);
                        break;
                    }
                }
            }
        }