public static WorkstationDetails getWorkstationDetails() { //try //{ DBConnector dbcon = new DBConnector(); if (dbcon.openConnection()) { MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "SELECT * FROM workstation_details WHERE employee_idemployee=" + Employee.employee_id; cmd.Connection = dbcon.connection; MySqlDataReader reader = cmd.ExecuteReader(); Console.Write(Employee.employee_id + "\n"); WorkstationDetails wd = null; if (reader.Read()) { wd = new WorkstationDetails(); wd.ws_id = int.Parse(reader["idworkstation_details"].ToString()); wd.division = reader["division"].ToString(); wd.post = reader["post"].ToString(); wd.power = reader["power"].ToString(); wd.rank = reader["rank"].ToString(); wd.responsibility = reader["responsibility"].ToString(); wd.salary_station = reader["salary_station"].ToString(); wd.setDate_of_post(Convert.ToDateTime(reader["date_of_post"])); } reader.Close(); dbcon.closeConnection(); return wd; } else { return null; } //} //catch (MySqlException e) //{ //int errorcode = e.Number; //return null; //} }
public void updateWorkstation() { WorkstationDetails wd = new WorkstationDetails(); wd.ws_id = this.ws_id; wd.division = this.wsd_division.Text; wd.post = this.wsd_post.Text; wd.power = this.wsd_power.Text; wd.rank = this.wsd_rank.Text; wd.responsibility = this.wsd_responsibility.Text; wd.salary_station = this.wsd_salary_station.Text; wd.setDate_of_post(this.wsd_date_of_post_date.Value.Date); bool state = WorkstationDetailsHandler.updateWorkstationDetails(wd); Console.Write(state + "\n"); }
private void btnSave5_Click(object sender, EventArgs e) { //Save Workstation details WorkstationDetails wd = new WorkstationDetails(); wd.division = wsd_division.Text; wd.post = wsd_post.Text; wd.power = wsd_power.Text; wd.rank = wsd_rank.Text; wd.responsibility = wsd_responsibility.Text; wd.salary_station = wsd_salary_station.Text; wd.setDate_of_post(wsd_date_of_post_date.Value.Date); bool status = WorkstationDetailsHandler.addWorkstationDetails(wd); if (status) { MessageBox.Show("Workstation details added successfully...!"); btnNext.Enabled = true; } else { MessageBox.Show("Failed to add workstation details...!"); } }