예제 #1
0
        private void linkLabel6_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ViewAdvisors va = new ViewAdvisors();

            this.Hide();
            va.Show();
        }
예제 #2
0
        private void cmdEditAdvisor_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(conStr);

            con.Open();
            try
            {
                if (con.State == ConnectionState.Open)
                {
                    if (con.State == ConnectionState.Open)
                    {
                        string     Update = "UPDATE Advisor SET Designation = '" + Convert.ToInt32(cmbDesignation.SelectedIndex + 6) + "', Salary = '" + Convert.ToInt32(txtsalaray.Text) + "' WHERE Id = '" + ViewAdvisors.advisor_Id + "'";
                        SqlCommand cmd    = new SqlCommand(Update, con);
                        cmd.ExecuteNonQuery();
                    }


                    txtAdvisorId.ReadOnly = false;
                }

                //setGrid();

                MessageBox.Show("Succesfully Updated");
                ViewAdvisors vd = new ViewAdvisors();
                vd.Show();
                this.Hide();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex);
            }
        }
예제 #3
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            selected = dataGridView1.CurrentCell.RowIndex;
            DataGridViewRow row = dataGridView1.Rows[selected];

            if (e.ColumnIndex == 0)
            {
                Advisors a = AdvisorUtile.updAdvisor;

                advisor_Id     = (int)row.Cells[2].Value;
                a.Salary1      = Convert.ToInt32(row.Cells[4].Value);
                a.Designation1 = (int)row.Cells[3].Value;
                if (a.Designation1 == 6)
                {
                    a.Designationstring1 = "Professor";
                }
                else if (a.Designation1 == 7)
                {
                    a.Designationstring1 = "Associate Professor";
                }
                else if (a.Designation1 == 8)
                {
                    a.Designationstring1 = "Assistant Professor";
                }
                else if (a.Designation1 == 9)
                {
                    a.Designationstring1 = "Lecturer";
                }
                else if (a.Designation1 == 10)
                {
                    a.Designationstring1 = "Industry Professional";
                }



                EditAdvisor ea = new EditAdvisor();
                this.Hide();
                ea.Show();
            }
            if (e.ColumnIndex == 1)
            {
                int Id = Convert.ToInt32(row.Cells[2].Value);
                //string advisor = row.Cells[3].Value.ToString();
                DialogResult res = MessageBox.Show("Are you sure you want  to Delete " + Id, "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (res == DialogResult.OK)
                {
                    try
                    {
                        SqlConnection con = new SqlConnection(conStr);
                        con.Open();
                        //string Delete_Project_Advisor = "DELETE FROM ProjectAdvisor WHERE Id = '" + Id + "'";
                        string Delete = "DELETE FROM Advisor WHERE Id = '" + Id + "'";
                        //if (con.State == ConnectionState.Open)
                        //{
                        //    SqlCommand cmd = new SqlCommand(Delete_Project_Advisor, con);
                        //    cmd.ExecuteNonQuery();
                        //}

                        if (con.State == ConnectionState.Open)
                        {
                            SqlCommand cmd = new SqlCommand(Delete, con);
                            cmd.ExecuteNonQuery();
                        }

                        MessageBox.Show("Succesfully Deleted");
                        this.Hide();
                        ViewAdvisors va = new ViewAdvisors();
                        va.Show();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error:" + ex);
                    }
                }
            }
        }