Beispiel #1
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(conStr);

            con.Open();
            try
            {
                if (con.State == ConnectionState.Open)
                {
                    string     Update = "UPDATE Project SET Title = '" + Convert.ToString(txtTitle.Text) + "', Description = '" + Convert.ToString(txtDescription.Text) + "' WHERE Id = '" + ViewProject.projectid + "'";
                    SqlCommand cmd    = new SqlCommand(Update, con);
                    cmd.ExecuteNonQuery();
                }



                MessageBox.Show("Data Succesfully Updated");
                ViewProject vp = new ViewProject();
                this.Hide();
                vp.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex);
            }
        }
Beispiel #2
0
        private void linkLabel7_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ViewProject vp = new ViewProject();

            vp.Show();
            this.Hide();
        }
Beispiel #3
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            selected = dataGridView1.CurrentCell.RowIndex;
            DataGridViewRow row = dataGridView1.Rows[selected];

            if (e.ColumnIndex == 0)
            {
                Prooject p = ProjectUtile.updPro;
                projectid      = (int)row.Cells[2].Value;
                p.Title1       = row.Cells[4].Value.ToString();
                p.Description1 = row.Cells[3].Value.ToString();
                EditProject ep = new EditProject();
                this.Hide();
                ep.Show();
            }
            if (e.ColumnIndex == 1)
            {
                int          Id     = Convert.ToInt32(row.Cells[2].Value);
                string       p_name = row.Cells[4].Value.ToString();
                DialogResult res    = MessageBox.Show("Are you sure you want  to Delete " + p_name, "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (res == DialogResult.OK)
                {
                    try
                    {
                        SqlConnection con = new SqlConnection(conStr);
                        con.Open();
                        if (con.State == ConnectionState.Open)
                        {
                            string     Delete_Project = "DELETE FROM Project WHERE Id = '" + Id + "'";
                            SqlCommand sql            = new SqlCommand(Delete_Project, con);
                            sql.ExecuteNonQuery();
                        }
                        //setGrid();
                        MessageBox.Show("Succesfully Deleted");
                        this.Hide();
                        ViewProject vp = new ViewProject();
                        vp.Show();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error:" + ex);
                    }
                }
            }
        }