Пример #1
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (listViewTimers.SelectedItems.Count == 0)
                {
                    MessageBox.Show("You have not selected an item.");
                    return;
                }

                NewTimer dlg = new NewTimer();

                ListViewItem itm = listViewTimers.SelectedItems[0];

                TimerType selected = (TimerType)itm.Tag;

                dlg.m_pmoNum = selected.pmo_num;
                dlg.m_desc   = selected.desc;

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    //itm.Text = dlg.m_pmoNum;
                    //itm.SubItems[0].Text = dlg.m_desc;

                    string sql = string.Format("UPDATE [timer_types] SET description = '{0}' where pmo_number = '{1}'", dlg.m_desc, dlg.m_pmoNum);
                    LocalSqllite.ExecSQLCommand(sql);

                    PopulateList();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Пример #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            try
            {
                NewTimer dlg = new NewTimer();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = dlg.m_pmoNum;
                    item.SubItems.Add(dlg.m_desc);

                    listViewTimers.Items.Add(item);

                    string sql = string.Format("INSERT INTO [timer_types] (pmo_number, description) VALUES ('{0}', '{1}')", dlg.m_pmoNum, dlg.m_desc);
                    LocalSqllite.ExecSQLCommand(sql);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Пример #3
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            try
            {
                NewTimer dlg = new NewTimer();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = dlg.m_pmoNum;
                    item.SubItems.Add(dlg.m_desc);

                    listViewTimers.Items.Add(item);

                    string sql = string.Format("INSERT INTO [timer_types] (pmo_number, description) VALUES ('{0}', '{1}')", dlg.m_pmoNum, dlg.m_desc);
                    LocalSqllite.ExecSQLCommand(sql);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Пример #4
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (listViewTimers.SelectedItems.Count == 0)
                {
                    MessageBox.Show("You have not selected an item.");
                    return;
                }

                NewTimer dlg = new NewTimer();

                ListViewItem itm = listViewTimers.SelectedItems[0];

                TimerType selected = (TimerType)itm.Tag;

                dlg.m_pmoNum = selected.pmo_num;
                dlg.m_desc = selected.desc;

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    //itm.Text = dlg.m_pmoNum;
                    //itm.SubItems[0].Text = dlg.m_desc;

                    string sql = string.Format("UPDATE [timer_types] SET description = '{0}' where pmo_number = '{1}'", dlg.m_desc, dlg.m_pmoNum);
                    LocalSqllite.ExecSQLCommand(sql);

                    PopulateList();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }