public void UpdateCPosition(CPosition cPosition) { try { _dbOp.DBConnect(); MySqlCommand cmd = _dbOp._dbConn.CreateCommand(); cmd.CommandText = @"UPDATE CPosition SET EmployeeID = @EmployeeID, Position = @Position, Department = @Department, Branch = @Branch, Head = @Head, StartDate = StartDate"; cmd.Parameters.AddWithValue("@EmployeeID", cPosition.EmployeeID); cmd.Parameters.AddWithValue("@Position", cPosition.Position); cmd.Parameters.AddWithValue("@Department", cPosition.Department); cmd.Parameters.AddWithValue("@Branch", cPosition.Branch); cmd.Parameters.AddWithValue("@Head", cPosition.Head); cmd.Parameters.AddWithValue("@StartDate", cPosition.StartDate); cmd.ExecuteNonQuery(); MessageBox.Show("Update Employee Position has been saved!"); _dbOp.DBClose(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void ShowData(string employeeID) { _basicInfo = _basicInfo.RetrieveBasicInfo(employeeID); employeeIDTB.Text = _basicInfo.EmployeeID; firstNameTB.Text = _basicInfo.FirstName; middleNameTB.Text = _basicInfo.MiddleName; lastNameTB.Text = _basicInfo.LastName; dobDTP.Value = _basicInfo.DOB; genderTB.Text = _basicInfo.Gender; maritalStatusTB.Text = _basicInfo.MaritalStatus; nationalityTB.Text = _basicInfo.Nationality; currentAddressTB.Text = _basicInfo.CurrentAddress; permanentAddressTB.Text = _basicInfo.PermanentAddress; picturePB.Image = Image.FromFile(_basicInfo.Picture.ToString()); _contactInfo = _contactInfo.RetrieveContactInfo(employeeID); employeeIDTB.Text = _contactInfo.EmployeeID; globeTB.Text = _contactInfo.Globe; smartTB.Text = _contactInfo.Smart; emailTB.Text = _contactInfo.Email; _governmentID = _governmentID.RetrieveGovernmentID(employeeID); employeeIDTB.Text = _governmentID.EmployeeID; tinTB.Text = _governmentID.TIN; sssTB.Text = _governmentID.SSS; pagibigTB.Text = _governmentID.PAGIBIG; philhealthTB.Text = _governmentID.PhilHealth; _cPosition = _cPosition.RetrieveCPosition(employeeID); employeeIDTB.Text = _cPosition.EmployeeID; positionTB.Text = detailsPositionTB.Text = _cPosition.Position; departmentTB.Text = detailsDepartmentTB.Text = _cPosition.Department; branchCB.Text = _cPosition.Branch; headTB.Text = _cPosition.Head; startDateDTP.Value = _cPosition.StartDate; _education = _education.RetrieveEducation(employeeID); employeeIDTB.Text = _education.EmployeeID; graduateTB.Text = _education.EduAttainment; collegeTB.Text = _education.College; seniorHighTB.Text = _education.SeniorHigh; juniorHighTB.Text = _education.JuniorHigh; elementaryTB.Text = _education.Elementary; LoadBasicInfo(_employeeID); LoadContactInfo(_employeeID); LoadGovernmentID(_employeeID); LoadCPosition(_employeeID); LoadEducation(_employeeID); }
public List <CPosition> RetrieveCPositionList() { List <CPosition> cPositionList = new List <CPosition>(); try { _dbOp.DBConnect(); MySqlCommand cmd = _dbOp._dbConn.CreateCommand(); cmd.CommandText = @"SELECT * FROM CPosition"; MySqlDataReader reader = cmd.ExecuteReader(); CPosition temp = new CPosition(); while (reader.Read()) { EmployeeID = (string)reader.GetValue(0); Position = (string)reader.GetValue(1); Department = (string)reader.GetValue(2); Branch = (string)reader.GetValue(3); Head = (string)reader.GetValue(4); StartDate = (DateTime)reader.GetValue(5); temp = new CPosition(EmployeeID, Position, Department, Branch, Head, StartDate); cPositionList.Add(temp); } reader.Close(); _dbOp.DBClose(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } return(cPositionList); }
public CPosition RetrieveCPosition(string employeeID) { CPosition temp = new CPosition(); try { _dbOp.DBConnect(); MySqlCommand cmd = _dbOp._dbConn.CreateCommand(); cmd.CommandText = @"SELECT * FROM CPosition " + "WHERE EmployeeID = @EmployeeID"; cmd.Parameters.AddWithValue("@EmployeeID", EmployeeID); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { EmployeeID = (string)reader.GetValue(0); Position = (string)reader.GetValue(1); Department = (string)reader.GetValue(2); Branch = (string)reader.GetValue(3); Head = (string)reader.GetValue(4); StartDate = (DateTime)reader.GetValue(5); temp = new CPosition(employeeID, Position, Department, Branch, Head, StartDate); } reader.Close(); _dbOp.DBClose(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } return(temp); }
public void InsertCPosition(CPosition cPosition) { try { _dbOp.DBConnect(); MySqlCommand cmd = _dbOp._dbConn.CreateCommand(); cmd.CommandText = @"INSERT INTO CPosition(EmployeeID, Position, Department, Branch, Head, StartDate) VALUE(@EmployeeID, @Position, @Department, @Branch, @Head, @StartDate)"; cmd.Parameters.AddWithValue("@EmployeeID", cPosition.EmployeeID); cmd.Parameters.AddWithValue("@Position", cPosition.Position); cmd.Parameters.AddWithValue("@Department", cPosition.Department); cmd.Parameters.AddWithValue("@Branch", cPosition.Branch); cmd.Parameters.AddWithValue("@Head", cPosition.Head); cmd.Parameters.AddWithValue("@StartDate", cPosition.StartDate); cmd.ExecuteNonQuery(); MessageBox.Show("New Employee Position has been saved!"); _dbOp.DBClose(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void editB_Click(object sender, EventArgs e) { switch (editB.Text) { case "Edit": editB.Text = "Save"; EmployeeEnable(); break; case "Save": if (_firstName != firstNameTB.Text || _middleName != middleNameTB.Text || _lastName != lastNameTB.Text || _dob != dobDTP.Value || _gender != genderTB.Text || _maritalStatus != maritalStatusTB.Text || _nationality != nationalityTB.Text || _currentAddress != currentAddressTB.Text || _permanentAddress != permanentAddressTB.Text || // _globe != int.Parse(globeTB.Text.Trim()) || // _smart != int.Parse(smartTB.Text.Trim()) || _email != emailTB.Text || _tin != tinTB.Text || _sss != sssTB.Text || _pagibig != pagibigTB.Text || _philHealth != philhealthTB.Text || _position != positionTB.Text || _position != detailsPositionTB.Text || _department != departmentTB.Text || _department != detailsDepartmentTB.Text || _branch != detailsBranchTB.Text || _head != headTB.Text || _startDate != startDateDTP.Value || _graduate != graduateTB.Text || _college != collegeTB.Text || _seniorHigh != seniorHighTB.Text || _juniorHigh != juniorHighTB.Text || _elementary != elementaryTB.Text) { _basicInfo = new BasicInfo(_basicInfo.EmployeeID, firstNameTB.Text, middleNameTB.Text, lastNameTB.Text, dobDTP.Value, genderTB.Text, maritalStatusTB.Text, nationalityTB.Text, currentAddressTB.Text, permanentAddressTB.Text, byte.Parse(picturePB.Image.ToString())); /* _contactInfo = new ContactInfo(_contactInfo.EmployeeID, * // int.Parse(globeTB.Text.Trim()), * // int.Parse(smartTB.Text.Trim()), * emailTB.Text);*/ _governmentID = new GovernmentID(_governmentID.EmployeeID, tinTB.Text, sssTB.Text, pagibigTB.Text, philhealthTB.Text); _cPosition = new CPosition(_cPosition.EmployeeID, positionTB.Text, departmentTB.Text, branchCB.Text, headTB.Text, startDateDTP.Value); _education = new Education(_education.EmployeeID, graduateTB.Text, collegeTB.Text, seniorHighTB.Text, juniorHighTB.Text, elementaryTB.Text); _basicInfo.UpdateBasicInfo(_basicInfo); _contactInfo.UpdateContactInfo(_contactInfo); _governmentID.UpdateGovernmentID(_governmentID); _cPosition.UpdateCPosition(_cPosition); _education.UpdateEducation(_education); } editB.Text = "Edit"; EmployeeDisable(); break; } LoadBasicInfo(_employeeID); LoadContactInfo(_employeeID); LoadGovernmentID(_employeeID); LoadCPosition(_employeeID); LoadEducation(_employeeID); }
public void LoadCPosition(string employeeID) { _cPosition = _cPosition.RetrieveCPosition(employeeID); }
private void saveB_Click(object sender, EventArgs e) { if (Validate() == true) { FileStream fs; BinaryReader br; try { employeeID = employeeIDTB.Text.Trim(); firstName = firstNameTB.Text.Trim(); middleName = middleNameTB.Text.Trim(); lastName = lastNameTB.Text.Trim(); dob = dobDTP.Value; gender = genderCB.Text.Trim(); maritalStatus = maritalStatusCB.Text.Trim(); nationality = nationalityTB.Text.Trim(); currentAddress = currentAddressTB.Text.Trim(); permanentAddress = permanentAddressTB.Text.Trim(); //picture = byte.Parse(picturePB.Image.SaveAdd()); /* string FileName = pictureTB.Text; * byte[] Picture; * fs = new FileStream(FileName, FileMode.Open, FileAccess.Read); * br = new BinaryReader(fs); * Picture = br.ReadBytes((int)fs.Length); * br.Close(); * fs.Close();*/ globe = globeTB.Text.Trim(); smart = smartTB.Text.Trim(); email = emailTB.Text.Trim(); tin = tinTB.Text.Trim(); sss = sssTB.Text.Trim(); pagibig = pagibigTB.Text.Trim(); philhealth = philhealthTB.Text.Trim(); position = positionCB.Text.Trim(); department = departmentCB.Text.Trim(); branch = branchCB.Text.Trim(); head = headCB.Text.Trim(); startDate = startDateDTP.Value; graduate = graduateTB.Text.Trim(); college = collegeTB.Text.Trim(); seniorHigh = seniorHighTB.Text.Trim(); juniorHigh = juniorHighTB.Text.Trim(); elementary = elementaryTB.Text.TrimStart(); basicInfo = new BasicInfo(employeeID, firstName, middleName, lastName, dob, gender, maritalStatus, nationality, currentAddress, permanentAddress, picture); contactInfo = new ContactInfo(employeeID, globe, smart, email); governmentID = new GovernmentID(employeeID, tin, sss, pagibig, philhealth); cPosition = new CPosition(employeeID, position, department, branch, head, startDate); education = new Education(employeeID, graduate, college, seniorHigh, juniorHigh, elementary); basicInfo.InsertBasicInfo(basicInfo); contactInfo.InsertContactInfo(contactInfo); governmentID.InsertGovernmentID(governmentID); cPosition.InsertCPosition(cPosition); education.InsertEducation(education); Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }