Esempio n. 1
0
        /// <summary>
        /// Method:     writeTags
        ///
        /// function:   Create a StreamWriter to create a text file that holds
        ///             all the information in each Work Order. Deletes any tag file
        ///             created earlier, than re-create a new text file call tags and
        ///             sorts it with all the uploaded files
        /// </summary>
        /// <param name="path"></param>
        /// <param name="order"></param>
        private void writeTags(string path, work_order order)
        {
            StreamWriter file;

            if (File.Exists(path + "\\tags.txt"))
            {
                File.Delete(path + "\\tags.txt");
            }
            file = new StreamWriter(path + "\\tags.txt");
            foreach (string tags in order.Get_wo_arr)
            {
                file.WriteLine(tags);
            }
            foreach (string tags in order.Source_link)
            {
                file.WriteLine(tags);
            }
            file.Close();
        }
Esempio n. 2
0
        /// <summary>
        /// Method:     bt_Create_New_WO_Click
        /// Function:   User click a button and create a new work order to add
        ///             into the database with new WO#, SE#, SN#, Client name,
        ///             and description of the order. Automaticaly sets the
        ///             status of the work order to inprogress.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bt_Create_New_WO_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(tb_WOnum.Text) && ("WO#" != tb_WOnum.Text) &&
                !string.IsNullOrEmpty(tb_SEnum.Text) && ("SE#" != tb_SEnum.Text) &&
                !string.IsNullOrEmpty(tb_WOnum.Text))
            {
                ListViewItem itm;
                //Clear the list view
                lv_Database.Items.Clear();
                //Creates a new workorder object
                work_order wo_item = new work_order();
                wo_item.SE_num      = Convert.ToInt32(tb_SEnum.Text);
                wo_item.WO_num      = Convert.ToInt32(tb_WOnum.Text);
                wo_item.SN_num      = tb_SNnum.Text;
                wo_item.Client_name = tb_CLname.Text;
                wo_item.WO_Date     = tb_DATE.Text;
                if (rb_Delivered.Checked)
                {
                    wo_item.state = 1;
                }
                //Adds the new created workorder object into the List<work_order>
                orderList.Add(wo_item);

                //A while loop to add each item in the List to the listview database
                int i = 0;
                while (i != orderList.Count)
                {
                    itm = new ListViewItem(orderList[i].Get_wo_arr);
                    lv_Database.Items.Add(itm);
                    i++;
                }
                //reset the textbox into the default texts
                //tb_WOnum.Text = "WO#";
                //tb_SEnum.Text = "SE#";
                //tb_SNnum.Text = "SN#";
                tb_DATE.Text = time.ToString("MMM d, yyyy");
            }
            else
            {
                MessageBox.Show("Error Invalid Value");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Method:     tempItems
        ///
        /// Function:   Create 50 random items, add to the list, and displays it into
        ///             the listview for testing purpose
        /// </summary>
        private void tempItems()
        {
            ListViewItem item;

            lv_Database.Items.Clear();
            Random rng = new Random();

            for (int i = 0; i < 50; i++)
            {
                work_order order = new work_order();
                orderList.Add(order);
                orderList[i].WO_num  = i;
                orderList[i].SE_num  = rng.Next(200);
                orderList[i].SN_num  = rng.Next(500) + " " + rng.Next(500);
                orderList[i].WO_Date = tb_DATE.Text;
                if (rb_Delivered.Checked)
                {
                    orderList[i].state = 1;
                }
                item = new ListViewItem(orderList[i].Get_wo_arr);
                lv_Database.Items.Add(item);
            }
        }