public GovernmentID RetrieveGovernmentID(string employeeID)
        {
            GovernmentID temp = new GovernmentID();

            try
            {
                _dbOp.DBConnect();
                MySqlCommand cmd = _dbOp._dbConn.CreateCommand();
                cmd.CommandText = @"SELECT * FROM GovernmentID " + "WHERE EmployeeID = @EmployeeID";
                cmd.Parameters.AddWithValue("@EmployeeID", EmployeeID);
                MySqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    EmployeeID = (string)reader.GetValue(0);
                    TIN        = (string)reader.GetValue(1);
                    SSS        = (string)reader.GetValue(2);
                    PAGIBIG    = (string)reader.GetValue(3);
                    PhilHealth = (string)reader.GetValue(4);

                    temp = new GovernmentID(employeeID,
                                            TIN,
                                            SSS,
                                            PAGIBIG,
                                            PhilHealth);
                }
                reader.Close();
                _dbOp.DBClose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return(temp);
        }
        public void InsertGovernmentID(GovernmentID governmentID)
        {
            try
            {
                _dbOp.DBConnect();
                MySqlCommand cmd = _dbOp._dbConn.CreateCommand();

                cmd.CommandText = @"INSERT INTO GovernmentID(EmployeeID,
                                                             TIN,
                                                             SSS,
                                                             PAGIBIG,
                                                             PhilHealth)

                                                       VALUE(@EmployeeID,
                                                             @TIN,
                                                             @SSS,
                                                             @PAGIBIG,
                                                             @PhilHealth)";
                cmd.Parameters.AddWithValue("@EmployeeID", EmployeeID);
                cmd.Parameters.AddWithValue("@TIN", TIN);
                cmd.Parameters.AddWithValue("@SSS", SSS);
                cmd.Parameters.AddWithValue("@PAGIBIG", PAGIBIG);
                cmd.Parameters.AddWithValue("@PhilHealth", PhilHealth);

                cmd.ExecuteNonQuery();
                MessageBox.Show("New Employee Government ID has been saved!");
                _dbOp.DBClose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        public void UpdateGovernmentID(GovernmentID governmentID)
        {
            try
            {
                _dbOp.DBConnect();
                MySqlCommand cmd = _dbOp._dbConn.CreateCommand();
                cmd.CommandText = @"UPDATE GovernmentID SET EmployeeID = @EmployeeID,
                                                            TIN = @TIN,
                                                            SSS = @SSS,
                                                            PAGIBIG = @PAGIBIG,
                                                            PhilHealth = @PhilHealth" + " WHERE EmployeeID = @EmployeeID";

                cmd.Parameters.AddWithValue("@EmployeeID", EmployeeID);
                cmd.Parameters.AddWithValue("@TIN", TIN);
                cmd.Parameters.AddWithValue("@SSS", SSS);
                cmd.Parameters.AddWithValue("@PAGIBIG", PAGIBIG);
                cmd.Parameters.AddWithValue("@PhilHealth", PhilHealth);

                cmd.ExecuteNonQuery();
                MessageBox.Show("Update Employee Government ID has been saved!");
                _dbOp.DBClose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 public void LoadGovernmentID(string employeeID)
 {
     _governmentID = _governmentID.RetrieveGovernmentID(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());
                }
            }
        }