Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Add_wds_hrs add_wds_hrs = new Add_wds_hrs();

            this.Hide();
            add_wds_hrs.Show();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            Add_wds_hrs add_wds_hrs = new Add_wds_hrs();


            add_wds_hrs.button3.Enabled = true;
            add_wds_hrs.button5.Enabled = false;
            this.Hide();
            add_wds_hrs.Show();
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string colName = dataGridView1.Columns[e.ColumnIndex].Name;

            if (colName == "colEdit")
            {
                Add_wds_hrs add_wds_hrs = new Add_wds_hrs();


                add_wds_hrs.button3.Enabled     = false;
                add_wds_hrs.button5.Enabled     = true;
                add_wds_hrs.numericUpDown1.Text = _No_of_working_days;
                //add_wds_hrs.checkBox1.Text= _Working_days;

                add_wds_hrs.numericUpDown2.Text = _Working_hrs_per_day;
                add_wds_hrs.numericUpDown3.Text = _Working_Mins_per_day;
                this.Hide();
                add_wds_hrs.Show();
            }
            else if (colName == "colDelete")

            {
                if (MessageBox.Show("Are you sure you want to delete this record ?", "Delete Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ;
                }
                {
                    cn.Open();
                    cm = new MySqlCommand("delete from working_ds_and_hrs_table where No_of_working_days like'" + _No_of_working_days + "' ", cn);
                    cm.ExecuteNonQuery();
                    cn.Close();
                    MessageBox.Show("Record has been Successfully deleted !", "Deleted Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadRecords();
                }
            }
        }