Ejemplo n.º 1
0
        public Eval_Dashboards()
        {
            InitializeComponent();
            Edit_Panel.Hide();
            try
            {
                SqlCommand cm = new SqlCommand("Select Id, Name, TotalMarks, TotalWeightage From Evaluation ", conn);

                dr = cm.ExecuteReader();
                while (dr.Read())
                {
                    int n = dataGridView1.Rows.Add();
                    dataGridView1.Rows[n].Cells[0].Value = (int)dr.GetValue(0);
                    dataGridView1.Rows[n].Cells[1].Value = dr.GetString(1);
                    dataGridView1.Rows[n].Cells[2].Value = dr.GetValue(2);
                    dataGridView1.Rows[n].Cells[3].Value = dr.GetValue(3);
                }
                ;
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public ManageProject()
        {
            InitializeComponent();

            Edit_Panel.Hide();
            try
            {
                SqlCommand    cm = new SqlCommand("Select Id, Title, Description From Project ", conn);
                SqlDataReader dr;
                dr = cm.ExecuteReader();
                while (dr.Read())
                {
                    int n = dataGridView1.Rows.Add();
                    dataGridView1.Rows[n].Cells[0].Value = (int)dr.GetValue(0);
                    dataGridView1.Rows[n].Cells[1].Value = dr.GetString(1);
                    dataGridView1.Rows[n].Cells[2].Value = dr.GetString(2);
                }
                ;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            conn.Close();
        }
        public ManageAdviser()
        {
            InitializeComponent();
            Edit_Panel.Hide();
            try
            {
                SqlCommand cm = new SqlCommand("Select P.Id, P.FirstName, P.LastName, P.Contact, P.Email, P.DateofBirth, P.Gender, S.Designation, S.Salary from Person P Inner join Advisor S on P.Id = S.Id ", conn);
                dr = cm.ExecuteReader();
                while (dr.Read())
                {
                    int n = dataGridView1.Rows.Add();
                    dataGridView1.Rows[n].Cells[0].Value = (int)dr.GetValue(0);
                    dataGridView1.Rows[n].Cells[1].Value = dr.GetString(1);
                    dataGridView1.Rows[n].Cells[2].Value = dr.GetString(2);
                    dataGridView1.Rows[n].Cells[3].Value = dr.GetValue(3);
                    dataGridView1.Rows[n].Cells[4].Value = dr.GetValue(4);
                    dataGridView1.Rows[n].Cells[5].Value = dr.GetValue(5);
                    //dataGridView1.Rows[n].Cells[6].Value = dr.GetValue(6);

                    if (Convert.ToInt16(dr.GetValue(6)) == 1)
                    {
                        dataGridView1.Rows[n].Cells[6].Value = "Male";
                    }
                    else
                    {
                        dataGridView1.Rows[n].Cells[6].Value = "Female";
                    }
                    // dataGridView1.Rows[n].Cells[7].Value = dr.GetString(7);

                    if (Convert.ToInt16(dr.GetValue(7)) == 6)
                    {
                        dataGridView1.Rows[n].Cells[8].Value = "Professor";
                    }
                    if (Convert.ToInt16(dr.GetValue(7)) == 7)
                    {
                        dataGridView1.Rows[n].Cells[8].Value = "Associate Professor";
                    }
                    if (Convert.ToInt16(dr.GetValue(7)) == 8)
                    {
                        dataGridView1.Rows[n].Cells[8].Value = "Assisstant Professor";
                    }
                    if (Convert.ToInt16(dr.GetValue(7)) == 9)
                    {
                        dataGridView1.Rows[n].Cells[8].Value = "Lecturer";
                    }
                    if (Convert.ToInt16(dr.GetValue(7)) == 10)
                    {
                        dataGridView1.Rows[n].Cells[8].Value = "Industry Professional";
                    }

                    dataGridView1.Rows[n].Cells[7].Value = (Decimal)dr.GetValue(8);
                }
                ;
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 4
0
        private void Submit_Click(object sender, EventArgs e)
        {
            Evaluation C1 = new Evaluation();

            C1.set_Name(nametxt.Text);
            C1.set_Total_Marks(markstxt.Text);
            C1.set_Total_Weitage(Weightaetxt.Text);
            if ((C1.Get_Name() != null) && (C1.Get_Total_Marks() != 0) && (C1.Get_Total_Weitage() != 0))
            {
                try
                {
                    conn.Open();
                    int        ID       = Convert.ToInt32(textBox1.Text);
                    string     cmd2     = String.Format("UPDATE Evaluation SET Name = @Name, TotalMarks=@TotalMarks, TotalWeightage=@TotalWeightage Where Id = @Id ");
                    SqlCommand command2 = new SqlCommand(cmd2, conn);
                    command2.Parameters.Add(new SqlParameter("@Id", ID));

                    command2.Parameters.Add(new SqlParameter("@TotalWeightage", SqlDbType.Int));
                    command2.Parameters["@TotalWeightage"].Value = C1.Get_Total_Weitage();
                    command2.Parameters.Add(new SqlParameter("@Name", SqlDbType.VarChar));
                    command2.Parameters["@Name"].Value = C1.Get_Name();
                    command2.Parameters.Add(new SqlParameter("@TotalMarks", SqlDbType.Int));
                    command2.Parameters["@TotalMarks"].Value = C1.Get_Total_Marks();


                    int rows2 = command2.ExecuteNonQuery();
                    if (rows2 != 0)
                    {
                        MessageBox.Show("Evaluations Details Updated");

                        Edit_Panel.Hide();
                        this.Hide();
                        Eval_Dashboards D = new Eval_Dashboards();
                        D.Show();
                    }
                    conn.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Invalid Data!." +
                                "Please Enter Valid Data");
            }
        }
        private void Submit_Click(object sender, EventArgs e)
        {
            Project C1 = new Project();

            C1.set_Description(DescriptionTxt.Text);
            C1.set_Title(TitleTxt.Text);
            if ((C1.Get_Description() != null) && (C1.Get_Title() != null))
            {
                try
                {
                    conn.Open();
                    int        ID       = Convert.ToInt32(textBox1.Text);
                    string     cmd2     = String.Format("UPDATE Project SET Description = @Description, Title=@Title Where Id = @Id ");
                    SqlCommand command2 = new SqlCommand(cmd2, conn);
                    command2.Parameters.Add(new SqlParameter("@Id", ID));

                    command2.Parameters.Add(new SqlParameter("@Description", SqlDbType.VarChar));
                    command2.Parameters["@Description"].Value = C1.Get_Description();
                    command2.Parameters.Add(new SqlParameter("@Title", SqlDbType.VarChar));
                    command2.Parameters["@Title"].Value = C1.Get_Title();


                    int rows2 = command2.ExecuteNonQuery();
                    if (rows2 != 0)
                    {
                        MessageBox.Show("Project Details Updated");

                        Edit_Panel.Hide();
                        this.Close();
                        //ManageProject o = new ManageProject();
                        ManageProject D = new ManageProject();
                        D.Show();
                    }
                    conn.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Invalid Data!." +
                                "Please Enter Valid Data");
                conn.Close();
            }
        }
Ejemplo n.º 6
0
        public Dashboard()
        {
            InitializeComponent();
            Edit_Panel.Hide();
            try
            {
                SqlCommand cm = new SqlCommand("Select P.Id, P.FirstName, P.LastName, P.Contact, P.Email, P.DateofBirth, P.Gender, S.RegistrationNo from Person P Inner join Student S on P.Id = S.Id ", conn);
                dr = cm.ExecuteReader();
                while (dr.Read())
                {
                    int n = dataGridView1.Rows.Add();
                    dataGridView1.Rows[n].Cells[0].Value = (int)dr.GetValue(0);
                    dataGridView1.Rows[n].Cells[1].Value = dr.GetString(1);
                    dataGridView1.Rows[n].Cells[2].Value = dr.GetString(2);
                    dataGridView1.Rows[n].Cells[3].Value = dr.GetValue(3);
                    dataGridView1.Rows[n].Cells[4].Value = dr.GetValue(4);
                    dataGridView1.Rows[n].Cells[5].Value = dr.GetValue(5);

                    if ((int)dr.GetValue(6) == 1)
                    {
                        dataGridView1.Rows[n].Cells[6].Value = "Male";
                    }
                    else
                    {
                        dataGridView1.Rows[n].Cells[6].Value = "Female";
                    }
                    dataGridView1.Rows[n].Cells[7].Value = dr.GetString(7);
                }
                ;
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void button2_Click(object sender, EventArgs e)
 {
     Edit_Panel.Hide();
 }
Ejemplo n.º 8
0
        private void Submit_Click(object sender, EventArgs e)
        {
            try
            {
                string value     = "";
                bool   isChecked = radioButton1.Checked;
                if (isChecked)
                {
                    value = radioButton1.Text;
                }
                else
                {
                    value = radioButton2.Text;
                }

                Student C1 = new Student();
                C1.set_First_Name(FirstName.Text);
                C1.set_Reg_No(registrationtxt.Text);
                C1.set_Last_Name(Last_Name.Text);
                C1.set_Contact(ContactTextBox.Text);
                C1.set_Email(EmailTxtBox.Text);
                C1.set_Gender(value);
                C1.set_DOB(dateTimePicker1.Value);
                bool a = false;
                bool b = false;
                bool c = false;
                bool d = false;
                bool f = false;
                bool g = false;
                bool h = false;
                if (C1.Get_First_Name() == null)
                {
                    a = true;
                }
                if (C1.Get_Reg_No() == null)
                {
                    b = true;
                }
                if (C1.Get_Last_Name() == null)
                {
                    c = true;
                }
                if (C1.Get_Contact() == null)
                {
                    d = true;
                }
                if (C1.Get_Email() == null)
                {
                    f = true;
                }
                if (C1.Get_Gender() == null)
                {
                    g = true;
                }
                if (C1.Get_DOB() == null)
                {
                    h = true;
                }

                if (a == true || b == true || c == true || d == true || f == true || g == true || h == true)
                {
                    MessageBox.Show("Invalid Data!." +
                                    "Please Enter Valid Data");
                }
                else
                {
                    conn.Open();
                    string     ab      = "GENDER";
                    string     cmd     = String.Format("SELECT Id FROM dbo.Lookup WHERE Category = @Category and Value=@Value");
                    SqlCommand command = new SqlCommand(cmd, conn);
                    command.Parameters.Add(new SqlParameter("@Category", ab));
                    command.Parameters.Add(new SqlParameter("@Value", value));
                    int id = (int)command.ExecuteScalar();

                    //String cmd1 = String.Format("INSERT INTO Person(FirstName, LastName, Contact, Email, DateofBirth, Gender) values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')", C1.Get_First_Name(), C1.Get_Last_Name(), C1.Get_Contact(), C1.Get_Email(), C1.Get_DOB(), id);
                    String     cmd1     = String.Format("UPDATE Person SET FirstName = @FirstName, LastName = @LastName, Contact=@Contact, Email=@Email, DateofBirth=@DateofBirth, Gender=@Gender  Where Id = @Id");
                    SqlCommand command1 = new SqlCommand(cmd1, conn);
                    command1.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.VarChar));
                    command1.Parameters["@FirstName"].Value = C1.Get_First_Name();

                    command1.Parameters.Add(new SqlParameter("@LastName", SqlDbType.VarChar));
                    command1.Parameters["@LastName"].Value = C1.Get_Last_Name();

                    command1.Parameters.Add(new SqlParameter("@Contact", SqlDbType.VarChar));
                    command1.Parameters["@Contact"].Value = C1.Get_Contact();

                    command1.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar));
                    command1.Parameters["@Email"].Value = C1.Get_Email();

                    command1.Parameters.Add(new SqlParameter("@DateofBirth", SqlDbType.DateTime));
                    command1.Parameters["@DateofBirth"].Value = C1.Get_DOB();

                    command1.Parameters.Add(new SqlParameter("@Gender", id));
                    //command.Parameters["@conditionName"].Value = C1.Get_First_Name();
                    int ID = Convert.ToInt32(textBox1.Text);
                    command1.Parameters.Add(new SqlParameter("@Id", ID));


                    int rows = command1.ExecuteNonQuery();

                    string     cmd2     = String.Format("UPDATE Student SET RegistrationNo = @RegistrationNo Where Id = @Id ");
                    SqlCommand command2 = new SqlCommand(cmd2, conn);
                    command2.Parameters.Add(new SqlParameter("@Id", ID));
                    command2.Parameters.Add(new SqlParameter("@RegistrationNo", SqlDbType.VarChar));
                    command2.Parameters["@RegistrationNo"].Value = C1.Get_Reg_No();


                    int rows2 = command2.ExecuteNonQuery();

                    if (rows != 0 && rows2 != 0)
                    {
                        MessageBox.Show("Data Updated Succesfully");
                        Cancel_Click(sender, e);
                        Edit_Panel.Hide();
                        this.Close();
                        Dashboard D = new Dashboard();
                        D.Show();
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void Submit_Click(object sender, EventArgs e)
        {
            try
            {
                string value     = "";
                bool   isChecked = radioButton1.Checked;
                if (isChecked)
                {
                    value = radioButton1.Text;
                }
                else
                {
                    value = radioButton2.Text;
                }

                Adviser C1 = new Adviser();
                C1.set_First_Name(FirstName.Text);
                C1.set_Salary(registrationtxt.Text);
                C1.set_Last_Name(Last_Name.Text);
                C1.set_Contact(ContactTextBox.Text);
                C1.set_Email(EmailTxtBox.Text);
                C1.set_Gender(value);
                C1.set_DOB(dateTimePicker1.Value);
                C1.set_Designation(advisercombo.Text);
                bool a = false;
                bool b = false;
                bool c = false;
                bool d = false;
                bool f = false;
                bool g = false;
                bool h = false;
                bool i = false;
                if (C1.Get_First_Name() == null)
                {
                    a = true;
                }
                if (C1.Get_Salary() == Decimal.Zero)
                {
                    b = true;
                }
                if (C1.Get_Last_Name() == null)
                {
                    c = true;
                }
                if (C1.Get_Contact() == null)
                {
                    d = true;
                }
                if (C1.Get_Email() == null)
                {
                    f = true;
                }
                if (C1.Get_Gender() == null)
                {
                    g = true;
                }
                if (C1.Get_DOB() == null)
                {
                    h = true;
                }
                if (C1.Get_Designation() == null)
                {
                    i = true;
                }

                if (a == true || b == true || c == true || d == true || f == true || g == true || h == true)
                {
                    MessageBox.Show("Invalid Data!." +
                                    "Please Enter Valid Data");
                }
                else
                {
                    //int id8 = Convert.ToInt32(dataGridView1.Rows[t].Cells["Id"].Value);
                    conn.Open();
                    string     ab      = "GENDER";
                    string     cmd     = String.Format("SELECT Id FROM dbo.Lookup WHERE Category = @Category and Value=@Value");
                    SqlCommand command = new SqlCommand(cmd, conn);
                    command.Parameters.Add(new SqlParameter("@Category", ab));
                    command.Parameters.Add(new SqlParameter("@Value", value));
                    int id = (int)command.ExecuteScalar();

                    //String cmd1 = String.Format("INSERT INTO Person(FirstName, LastName, Contact, Email, DateofBirth, Gender) values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')", C1.Get_First_Name(), C1.Get_Last_Name(), C1.Get_Contact(), C1.Get_Email(), C1.Get_DOB(), id);
                    String     cmd1     = String.Format("UPDATE Person SET FirstName = @FirstName, LastName = @LastName, Contact=@Contact, Email=@Email, DateofBirth=@DateofBirth, Gender=@Gender  Where Id = @Id");
                    SqlCommand command1 = new SqlCommand(cmd1, conn);
                    command1.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.VarChar));
                    command1.Parameters["@FirstName"].Value = C1.Get_First_Name();

                    command1.Parameters.Add(new SqlParameter("@LastName", SqlDbType.VarChar));
                    command1.Parameters["@LastName"].Value = C1.Get_Last_Name();

                    command1.Parameters.Add(new SqlParameter("@Contact", SqlDbType.VarChar));
                    command1.Parameters["@Contact"].Value = C1.Get_Contact();

                    command1.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar));
                    command1.Parameters["@Email"].Value = C1.Get_Email();

                    command1.Parameters.Add(new SqlParameter("@DateofBirth", SqlDbType.DateTime));
                    command1.Parameters["@DateofBirth"].Value = C1.Get_DOB();

                    command1.Parameters.Add(new SqlParameter("@Gender", id));
                    //command.Parameters["@conditionName"].Value = C1.Get_First_Name();
                    int ID = Convert.ToInt32(textBox1.Text);
                    command1.Parameters.Add(new SqlParameter("@Id", ID));


                    int rows = command1.ExecuteNonQuery();

                    string     cd       = "DESIGNATION";
                    string     cmd4     = String.Format("SELECT Id FROM dbo.Lookup WHERE Category = @Category and Value=@Value");
                    SqlCommand command4 = new SqlCommand(cmd4, conn);
                    command4.Parameters.Add(new SqlParameter("@Category", cd));
                    command4.Parameters.Add(new SqlParameter("@Value", advisercombo.Text));
                    int id_lookup = (int)command4.ExecuteScalar();

                    string     cmd2     = String.Format("UPDATE Advisor SET Designation = @Designation, Salary=@Salary Where Id = @Id ");
                    SqlCommand command2 = new SqlCommand(cmd2, conn);
                    command2.Parameters.Add(new SqlParameter("@Id", ID));
                    command2.Parameters.Add(new SqlParameter("@Designation", SqlDbType.Int));
                    command2.Parameters["@Designation"].Value = id_lookup;

                    command2.Parameters.Add(new SqlParameter("@Salary", SqlDbType.Decimal));
                    command2.Parameters["@Salary"].Value = C1.Get_Salary();


                    int rows2 = command2.ExecuteNonQuery();

                    if (rows != 0 && rows2 != 0)
                    {
                        MessageBox.Show("Data Updated Succesfully");
                        Edit_Panel.Hide();
                        this.Close();
                        ManageAdviser r = new ManageAdviser();
                        r.Show();
                    }
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }