Разработка системы управления персоналом

Автор работы: Пользователь скрыл имя, 04 Апреля 2014 в 23:36, дипломная работа

Краткое описание

Цель разработки и внедрения АСУ - улучшение качества управления системами различных видов, которое достигается[1]
своевременным предоставлением с помощью АСУ полной и достоверной информации управленческому персоналу для принятия решений;
применением математических методов и моделей для принятия оптимальных решений.
Кроме того, внедрение АСУ обычно приводит к совершенствованию организационных структур и методов управления, более гибкой регламентации документооборота и процедур управления, упорядочению использования и создания нормативов, совершенствованию организации предприятия.

Вложенные файлы: 1 файл

Diplom_russ.doc

— 4.14 Мб (Скачать файл)

        }

 

        private void FillPersonal(dsPersonal.DepartmentsRow department)

        {

            taPersonal.FillByDepartment(dsPersonal.Personal, department.ID);

            foreach (var departmentsRow in department.GetDepartmentsRows())

            {

                FillPersonal(departmentsRow);

            }

        }

        private void TvDepartmentsSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)

        {

            if (CurrentDepartment == null) return;

            dsPersonal.WorkHistory.Clear();

            dsPersonal.Personal.Clear();

            FillPersonal(CurrentDepartment);

            foreach (var person in dsPersonal.Personal)

            {

                taWorkHistory.FillByPersonal(dsPersonal.WorkHistory,person.ID);

            }

            SetStatus();

        }

        private void SaveChanges()

        {

            taPersonal.Update(dsPersonal.Personal);

            taWorkHistory.Update(dsPersonal.WorkHistory);

        }

        private void SetStatus()

        {

            foreach (dsPersonal.PersonalRow personalRow in dsPersonal.Personal.Rows)

            {

                personalRow._NeedAttestation =

                    taAttestations.GetNeedAttestation(DateTime.Now.AddYears(-2), personalRow.ID) == 0;

                personalRow._IsInTrip = taTrips.GetTrips(personalRow.ID, DateTime.Now) > 0;

                personalRow._IsInVocation = taVocations.GetVocations(personalRow.ID, DateTime.Now) > 0;

            }

        }

        private void BtnAddClick(object sender, RoutedEventArgs e)

        {

            var editcontrol = new PersonalEdit(dsPersonal, 0) { sd = SaveChanges };

            EditDialog.Add(editcontrol);

            FillPersonal(CurrentDepartment);

            SetStatus();

        }

        private void BtnEditClick(object sender, RoutedEventArgs e)

        {

            if (tvDepartments.SelectedItem == null) return;

            var editcontrol = new PersonalEdit(dsPersonal, CurrentPersonal.ID) { sd = SaveChanges };

            EditDialog.Edit(editcontrol);

            FillPersonal(CurrentDepartment);

            SetStatus();

        }

 

        private void BtnDeleteClick(object sender, RoutedEventArgs e)

        {

            if (lbPersonal.SelectedItem == null) return;

            if (MessageBox.Show(

                Properties.Resources.SDelete,

                Properties.Resources.SDeleteConfirm,

                MessageBoxButton.YesNo,

                MessageBoxImage.Question,

                MessageBoxResult.Yes) != MessageBoxResult.Yes) return;

            ((DataRowView)personalviewsource.View.CurrentItem).Row.Delete();

            SaveChanges();

            FillPersonal(CurrentDepartment);

            SetStatus();

        }

        private void BtnRefreshClick(object sender, RoutedEventArgs e)

        {

            if (CurrentDepartment == null) return;

            dsPersonal.WorkHistory.Clear();

            dsPersonal.Personal.Clear();

            FillPersonal(CurrentDepartment);

            foreach (var person in dsPersonal.Personal)

            {

                taWorkHistory.FillByPersonal(dsPersonal.WorkHistory, person.ID);

            }

            SetStatus();

        }

        private void MiAttestationsClick(object sender, RoutedEventArgs e)

        {

            if (!ModulesOpen.CheckModule(ModuleNames.Attestations))

            {

                var window = new Client(ModuleNames.Attestations) {Title = "Аттестации"};

                window.MainGrid.Children.Add(new Attestations.AttestationsControl());

                window.ShowDialog();

            }

        }

        private void MiCandidatesClick(object sender, RoutedEventArgs e)

        {

            if (!ModulesOpen.CheckModule(ModuleNames.Candidates))

            {

                var window = new Client(ModuleNames.Candidates) { Title = "Кандидаты  на работу" };

                window.MainGrid.Children.Add(new Candidates.CandidatesControl());

                window.ShowDialog();

            }

        }

        private void MiTripsClick(object sender, RoutedEventArgs e)

        {

            if (!ModulesOpen.CheckModule(ModuleNames.Trips))

            {

                var window = new Client(ModuleNames.Trips) { Title = "Командировки" };

                window.MainGrid.Children.Add(new BussinessTrips.TripsControl());

                window.ShowDialog();

            }

        }

        private void MiVocationsClick(object sender, RoutedEventArgs e)

        {

            if (!ModulesOpen.CheckModule(ModuleNames.Vocations))

            {

                var window = new Client(ModuleNames.Vocations) { Title = "Отпуска" };

                window.MainGrid.Children.Add(new Vocations.VocationsControl());

                window.ShowDialog();

            }

        }

        private void BtnFindClick(object sender, RoutedEventArgs e)

        {

            SearchWindow.Find(personalviewsource, "FullName");

        }

        private void MiPersonalJournalClick(object sender, RoutedEventArgs e)

        {

            ReportsControl.ShowCustom(ReportIndexes.ReportIndex.PersonalJournal);

        }

        private void MiSinglePersonalClick(object sender, RoutedEventArgs e)

        {

            ReportsControl.ShowCustom(ReportIndexes.ReportIndex.SinglePerson);

        }

    }

}

 

Файл PersonalEdit.xaml.cs

 

using System;

using System.Collections.Generic;

using System.Data;

using System.IO;

using System.Linq;

using System.Text;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Forms;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;

using Tools.Classes;

using TextBox = System.Windows.Controls.TextBox;

 

namespace Personal.Personal

{

    public partial class PersonalEdit : EditControl

    {

        private readonly dsPersonal dsPersonal;

        private dsPersonal journalDs;

        private readonly CollectionViewSource personalviewsource;

        private readonly CollectionViewSource positionsviewsource;

        private readonly CollectionViewSource ranksviewsource;

        private readonly CollectionViewSource jobTypesviewsource;

        private readonly CollectionViewSource educationTypesviewsource;

        private MemoryStream imageMemoryStream;

        public dsPersonal.PersonalRow CurrentRow

        {

            get { return (dsPersonal.PersonalRow)((DataRowView)personalviewsource.View.CurrentItem).Row; }

        }

        public PersonalEdit(dsPersonal ds, int currentId)

        {

            InitializeComponent();

            journalDs = ds;

            dsPersonal = ((dsPersonal)(FindResource("dsPersonal")));

            dsPersonal.Merge(ds);

            personalviewsource = ((CollectionViewSource)(FindResource("personalViewSource")));

            positionsviewsource = ((CollectionViewSource)(FindResource("positionsViewSource")));

            ranksviewsource = ((CollectionViewSource)(FindResource("ranksViewSource")));

            jobTypesviewsource = ((CollectionViewSource)(FindResource("educationTypesViewSource")));

            educationTypesviewsource = ((CollectionViewSource)(FindResource("jobTypesViewSource")));

            if (currentId != 0)

            personalviewsource.View.MoveCurrentToPosition(dsPersonal.Personal.FindByID(currentId).GetRowPosition());

            dtbDepartment.Init();

            if (currentId == 0) return;

            var row = (dsPersonal.Personal.FindByID(currentId));

            if (!row.Isid_DepartmentNull())

                dtbDepartment.SelectedValue = row.id_Department;

        }

        public override void Revert()

        {

            CurrentRow.RejectChanges();

        }

        public override bool Add()

        {

            var row = dsPersonal.Personal.NewPersonalRow();

            dsPersonal.Personal.AddPersonalRow(row);

            personalviewsource.View.MoveCurrentToLast();

            return true;

        }

        public override void RemoveLastRow()

        {

            CurrentRow.Delete();

        }

        public override void SaveChanges()

        {

            if ((int)dtbDepartment.SelectedValue != -1)

                CurrentRow.id_Department = (int)dtbDepartment.SelectedValue;

           else

                CurrentRow.Setid_DepartmentNull();

 

            journalDs.Personal.Merge(dsPersonal.Personal);

            journalDs.WorkHistory.Merge(dsPersonal.WorkHistory);

            base.SaveChanges();

        }

        public override bool IsValid()

        {

            ValidateControls();

            return !Validation.GetHasError(tbFirstName) &&

                   !Validation.GetHasError(tbLastName) &&

                   !Validation.GetHasError(tbPatronimic) &&

                   !Validation.GetHasError(dpDateOfBirth) &&

                   !Validation.GetHasError(tbPhone) &&

                   !Validation.GetHasError(tbAddress) &&

                   !Validation.GetHasError(tbDocNumber) &&

                   !Validation.GetHasError(dpDocGivenDate) &&

                   !Validation.GetHasError(tbContractNumber) &&

                   !Validation.GetHasError(tbSalary);

        }

        public override void ValidateControls()

        {

            var beFirstName = BindingOperations.GetBindingExpression(tbFirstName, TextBox.TextProperty);

            if (beFirstName != null) beFirstName.UpdateSource();

            var beLastName = BindingOperations.GetBindingExpression(tbLastName, TextBox.TextProperty);

            if (beLastName != null) beLastName.UpdateSource();

            var bePatronimic = BindingOperations.GetBindingExpression(tbPatronimic, TextBox.TextProperty);

            if (bePatronimic != null) bePatronimic.UpdateSource();

            var beDateOfBirth = BindingOperations.GetBindingExpression(dpDateOfBirth, DatePicker.SelectedDateProperty);

            if (beDateOfBirth != null) beDateOfBirth.UpdateSource();

            var beAddress = BindingOperations.GetBindingExpression(tbAddress, TextBox.TextProperty);

            if (beAddress != null) beAddress.UpdateSource();

            var bePhone = BindingOperations.GetBindingExpression(tbPhone, TextBox.TextProperty);

            if (bePhone != null) bePhone.UpdateSource();

            var beBirthPlace = BindingOperations.GetBindingExpression(tbBirthPlace, TextBox.TextProperty);

            if (beBirthPlace != null) beBirthPlace.UpdateSource();

            var beDocNumber = BindingOperations.GetBindingExpression(tbDocNumber, TextBox.TextProperty);

            if (beDocNumber != null) beDocNumber.UpdateSource();

            var beDocGivenDate = BindingOperations.GetBindingExpression(dpDocGivenDate, DatePicker.SelectedDateProperty);

            if (beDocGivenDate != null) beDocGivenDate.UpdateSource();

            var beContractNumber = BindingOperations.GetBindingExpression(tbContractNumber, TextBox.TextProperty);

            if (beContractNumber != null) beContractNumber.UpdateSource();

            var beSalary = BindingOperations.GetBindingExpression(tbSalary, TextBox.TextProperty);

            if (beSalary != null) beSalary.UpdateSource();

        }

        private void BtnImageDialogClick(object sender, RoutedEventArgs e)

        {

            var dialog = new OpenFileDialog();

            if (dialog.ShowDialog() != DialogResult.OK) return;

            var fs = (FileStream)dialog.OpenFile();

            imageMemoryStream = new MemoryStream();

            for (long i = 0; i < fs.Length; i++)

                imageMemoryStream.WriteByte((byte)fs.ReadByte());

            tbImagePath.Text = dialog.FileName;

        }

        private void BtnImageApplyClick(object sender, RoutedEventArgs e)

        {

            if (imageMemoryStream == null) return;

            CurrentRow.Photo = imageMemoryStream.ToArray();

        }

    }

}

 

Файл CandidatesControl.xaml.cs

 

using System;

using System.Collections.Generic;

using System.Data;

using System.Linq;

using System.Text;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;

using Personal.dsPersonalTableAdapters;

using Reports;

using Tools.Dialogs;

using Tools.Search;

 

namespace Personal.Candidates

{

    public partial class CandidatesControl : UserControl

    {

        readonly СandidatesTableAdapter taCandidates = new СandidatesTableAdapter();

        readonly dic_SexTableAdapter taSex = new dic_SexTableAdapter();

        readonly dic_EducationTypesTableAdapter taEducationTypes = new dic_EducationTypesTableAdapter();

        readonly dic_DocumentTypesTableAdapter taDocumentTypes = new dic_DocumentTypesTableAdapter();

        readonly dic_PositionsTableAdapter taPositions = new dic_PositionsTableAdapter();

        readonly dic_RanksTableAdapter taRanks = new dic_RanksTableAdapter();

        readonly dic_JobTypesTableAdapter taJobTypes = new dic_JobTypesTableAdapter();

        readonly dic_ContractTypesTableAdapter taContractType = new dic_ContractTypesTableAdapter();

        readonly PersonalTableAdapter tapersonal  = new PersonalTableAdapter();

        readonly DepartmentsTableAdapter taDepartment = new DepartmentsTableAdapter();

        private readonly dsPersonal dsPersonal;

        private readonly CollectionViewSource candidatesViewSource;

        private bool? accepted = false;

        public dsPersonal.СandidatesRow CurrentCandidate

        {

            get { return (dsPersonal.СandidatesRow)((DataRowView)candidatesViewSource.View.CurrentItem).Row; }

        }

        public CandidatesControl()

        {

            InitializeComponent();

            candidatesViewSource = ((CollectionViewSource)(FindResource("candidatesViewSource")));

            dsPersonal = ((dsPersonal)(FindResource("dsPersonal")));

            Fill();

        }

        private void Fill()

        {

            taCandidates.Fill(dsPersonal.Сandidates);

            FillDictionaries();

        }

        private void FillDictionaries()

        {

            taSex.Fill(dsPersonal.dic_Sex);

            taEducationTypes.Fill(dsPersonal.dic_EducationTypes);

            taDocumentTypes.Fill(dsPersonal.dic_DocumentTypes);

        }

        private void SaveChanges()

        {

            taCandidates.Update(dsPersonal.Сandidates);

        }

        private void BtnAddClick(object sender, RoutedEventArgs e)

        {

            var editcontrol = new CandidatesEdit(dsPersonal, 0) { sd = SaveChanges };

            EditDialog.Add(editcontrol);

        }

 

        private void BtnEditClick(object sender, RoutedEventArgs e)

        {

            if (candidatesViewSource.View.CurrentItem == null) return;

             var editcontrol = new CandidatesEdit(dsPersonal, CurrentCandidate.ID) { sd = SaveChanges };

            EditDialog.Edit(editcontrol);

        }

        private void BtnAcceptClick(object sender, RoutedEventArgs e)

        {

            taJobTypes.Fill(dsPersonal.dic_JobTypes);

            taContractType.Fill(dsPersonal.dic_ContractTypes);

            taPositions.Fill(dsPersonal.dic_Positions);

            taRanks.Fill(dsPersonal.dic_Ranks);

            taDepartment.Fill(dsPersonal.Departments);

 

            var row = dsPersonal.Personal.NewPersonalRow();

            row.FirstName = CurrentCandidate.FirstName;

            row.LastName = CurrentCandidate.LastName;

            row.Patronimic = CurrentCandidate.Patronimic;

            row.DateOfBirth = CurrentCandidate.DateOfBirth;

            row.id_Sex = CurrentCandidate.id_Sex;

            row.id_Document = CurrentCandidate.id_Document;

            row.DocumentNumber = CurrentCandidate.DocumentNumber.ToString();

            row.DocGivenDate = CurrentCandidate.DocGivenDate;

            row.id_EducationType = CurrentCandidate.id_EducationType;

            row.Address = CurrentCandidate.Address;

            row.Phone = CurrentCandidate.Phone;

            dsPersonal.Personal.AddPersonalRow(row);

            var editcontrol = new Personal.PersonalEdit(dsPersonal, row.ID) { sd = SaveChanges };

            accepted = EditDialog.Edit(editcontrol);

            if (accepted == null || !((bool) accepted)) return;

            tapersonal.Update(dsPersonal.Personal);

            CurrentCandidate.Delete();

            SaveChanges();

            accepted = false;

        }

        private void BtnRefreshClick(object sender, RoutedEventArgs e)

        {

            Fill();

        }

        private void BtnFindClick(object sender, RoutedEventArgs e)

        {

            SearchWindow.Find(candidatesViewSource, "FullName");

        }

        private void MiCandidatesJournalClick(object sender, RoutedEventArgs e)

        {

Информация о работе Разработка системы управления персоналом