private void btnSave2_Click(object sender, EventArgs e)
        {
            WorkingExperience we = new WorkingExperience();

            we.address = we_address.Text;
            we.award = we_award.Text;
            we.contact = we_contact.Text;
            we.department = we_department.Text;
            we.email = we_department.Text;
            we.institute = we_institute.Text;

            if (we_occupation_relevant.Checked) { we.occupation_relevant = true; }
            else { we.occupation_relevant = false; }

            we.resign_reason = we_resign_reason.Text;
            we.responsibility = we_responsibility.Text;
            we.telephone = we_telephone.Text;
            we.setDate_from(we_date_from_date.Value.Date);
            we.setDate_to(we_date_to_date.Value.Date);
            we.setDate_perma(we_date_perma_date.Value.Date);

            bool status = WorkingExperienceHandler.addWorkingExperience(we);

            if (status)
            {
                MessageBox.Show("Working experience details added successfully...!");
                //btnSave4.Enabled = true;
                //btnSave5.Enabled = true;
            }
            else { MessageBox.Show("Failed to add working experience details...!"); }
        }
예제 #2
0
        public void updateWorkingExperience()
        {
            WorkingExperience we = new WorkingExperience();

            we.we_id = this.we_id;
            we.address = this.we_address.Text;
            we.award = this.we_award.Text;
            we.contact = this.we_contact.Text;
            we.department = this.we_department.Text;
            we.email = this.we_department.Text;
            we.institute = this.we_institute.Text;

            if (this.we_occupation_relevant.Checked) { we.occupation_relevant = true; }
            else { we.occupation_relevant = false; }

            we.resign_reason = this.we_resign_reason.Text;
            we.responsibility = this.we_responsibility.Text;
            we.telephone = this.we_telephone.Text;
            we.setDate_from(this.we_date_from_date.Value.Date);
            we.setDate_to(this.we_date_to_date.Value.Date);
            we.setDate_perma(this.we_date_perma_date.Value.Date);

            bool state = WorkingExperienceHandler.updateWorkingExperience(we);

            Console.Write(state + "\n");
        }
        public static WorkingExperience getWorkingExperience()
        {
            //try
            //{

            DBConnector dbcon = new DBConnector();

            if (dbcon.openConnection())
            {

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "SELECT * FROM working_experience WHERE employee_idemployee=" + Employee.employee_id;
                cmd.Connection = dbcon.connection;

                MySqlDataReader reader = cmd.ExecuteReader();

                WorkingExperience we = null;

                if (reader.Read())
                {
                    we = new WorkingExperience();

                    we.we_id = int.Parse(reader["idworking_experience"].ToString());
                    we.address = reader["address"].ToString();
                    we.award = reader["award"].ToString();
                    we.contact = reader["contact"].ToString();
                    we.department = reader["department"].ToString();
                    we.email = reader["email"].ToString();
                    we.institute = reader["institute"].ToString();
                    we.resign_reason = reader["resign_reason"].ToString();
                    we.responsibility = reader["responsibility"].ToString();
                    we.telephone = reader["telephone"].ToString();

                    if (reader["occupation_relevant"].ToString() == "True") { we.occupation_relevant = true; }
                    else { we.occupation_relevant = false; }

                    we.setDate_from(Convert.ToDateTime(reader["date_from"]));
                    we.setDate_to(Convert.ToDateTime(reader["date_to"]));
                    we.setDate_perma(Convert.ToDateTime(reader["date_perma"]));

                }

                reader.Close();

                dbcon.closeConnection();

                return we;
            }
            else
            {

                return null;
            }

            //}
            //catch (MySqlException e)
            //{
            //int errorcode = e.Number;
            //return null;
            //}
        }