Пример #1
0
        private void btn_itemupd_Click(object sender, EventArgs e)
        {
            if (cbo_employee.SelectedIndex == -1)
            {
                MessageBox.Show("Please select an employee.");
                cbo_employee.DroppedDown = true;
                return;
            }
            if (isEmp != cbo_employee.SelectedValue.ToString() && isBtnGo)
            {
                MessageBox.Show("Invalid selection of employee.");
                return;
            }

            try
            {
                int    r      = dgv_list.CurrentRow.Index;
                String status = dgv_list["status", r].Value.ToString();

                if (dgv_list.Rows.Count > 1 && !String.IsNullOrEmpty(status))
                {
                    update_log = true;

                    try
                    {
                        String work_date = dgv_list["work_date", r].Value.ToString();
                        String time_log  = dgv_list["time_log", r].Value.ToString();

                        old_date = work_date;
                        old_logs = time_log;

                        t_addLogs add = new t_addLogs(this);
                        add.set_log(work_date, time_log, status);
                        add.ShowDialog();
                    }
                    catch { }
                }
                else
                {
                    MessageBox.Show("No batch time selected.");
                }
            }
            catch
            {
                MessageBox.Show("No batch time selected.");
            }
        }
Пример #2
0
        private void btn_itemadd_Click(object sender, EventArgs e)
        {
            if (cbo_employee.SelectedIndex == -1)
            {
                MessageBox.Show("Please select an employee.");
                cbo_employee.DroppedDown = true;
                return;
            }
            if (isEmp != cbo_employee.SelectedValue.ToString() && isBtnGo)
            {
                MessageBox.Show("Invalid selection of employee.");
                return;
            }

            update_log = false;
            isnew      = true;
            t_addLogs add = new t_addLogs(this);

            add.ShowDialog();
        }