Главная страница

Бакалаврская. Павлов Д.С._ПИбд-1402а. Разработка информационной системы по работе с клиентами организации (на примере ооо стаффджет)


Скачать 2.45 Mb.
НазваниеРазработка информационной системы по работе с клиентами организации (на примере ооо стаффджет)
АнкорБакалаврская
Дата02.04.2023
Размер2.45 Mb.
Формат файлаpdf
Имя файлаПавлов Д.С._ПИбд-1402а.pdf
ТипДокументы
#1030918
страница4 из 4
1   2   3   4
ПРИЛОЖЕНИЕ А
Фрагмент исходного кода namespace JobService
{ interface IAccessDB
{ void AddMeToDB(); void DeleteMeFromDB(); void UpdateMeInDB(); void InitializeMe(int id);
}
} namespace JobService
{ class Applicant : IAccessDB
{ public Applicant(int id, frmApplicants ALF_Form)
{
ALF = ALF_Form;
InitializeMe(id);
}
// форма данных private frmApplicant DataForm;
// форма списка работодателей private frmApplicants ALF;
// Данные соискателя public string FirstName, SecondName, Furname; public string City, WishHolidayMonth, Phone, Sex, Status; public int ID, ID_Edu, ID_Spec, ID_Agent; public byte Children, Expierence; public DateTime BirthDate, ProcessDate; public int WishSalary; public bool PrivateVihicle, ReadyToMove, PCKnowledge;
// -----------------------------------------
// Операции пользователя
// -----------------------------------------
#region "User Operations" public void Update()
{

68
DataForm = new frmApplicant();
FillForm();
DataForm.ShowDialog(); if (DataForm.DialogResult == System.Windows.Forms.DialogResult.OK)
{
GetValues();
UpdateMeInDB();
DataForm.Dispose();
}
}
// ----------------------------------------- public void Add()
{
DataForm = new frmApplicant();
FillForm();
DataForm.ShowDialog(); if (DataForm.DialogResult == System.Windows.Forms.DialogResult.OK)
{
GetValues();
AddMeToDB();
DataForm.Dispose();
}
}
// ----------------------------------------- public void Delete()
{ if (System.Windows.Forms.MessageBox.Show("Удалить соискателя \"" +
SecondName + " " + FirstName + " " + Furname + "\"?", "Удаление данных",
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Question)
==
System.Windows.Forms.DialogResult.Yes)
{
DeleteMeFromDB();
}
}
// ----------------------------------------- public short GetEducationLevel() // узнать уровень образования в числовом эквиваленте
{
DBDataSetTableAdapters.EDUCATIONTYPESTableAdapter ETTAdapter;
ETTAdapter = new DBDataSetTableAdapters.EDUCATIONTYPESTableAdapter();
DBDataSet.EDUCATIONTYPESDataTable ETDT = ETTAdapter.GetDataByID(ID_Edu); if (ETDT.Count > 0)
{ object[] RowArray = ETDT.Rows[0].ItemArray; return (short)RowArray[2];

69
} else return 0;
}
#endregion
// -----------------------------------------
// Форма данных
// -----------------------------------------
#region "Data Form"
// заполнение формы
// ----------------------------------------- private void FillForm()
{
DataForm.txtSecondName.Text = SecondName;
DataForm.txtName.Text = FirstName;
DataForm.txtFurName.Text = Furname;
DataForm.txtCity.Text = City;
DataForm.txtPhone.Text = Phone;
DataForm.cmbSex.Text = Sex;
DataForm.cmbWishHolidayMonth.Text = WishHolidayMonth;
DataForm.txtChildren.Text = Children.ToString();
DataForm.txtExpierence.Text = Expierence.ToString();
DataForm.cmbEducation.SelectedValue = ID_Edu;
DataForm.cmbSpeciality.SelectedValue = ID_Spec;
DataForm.cmbAgent.SelectedValue = ID_Agent;
DataForm.cmbStatus.Text = Status;
DataForm.dtpBirthDate.Value = BirthDate;
DataForm.txtWishSalary.Text = WishSalary.ToString();
DataForm.chkPrivateVehicle.Checked = PrivateVihicle;
DataForm.chkReadyToMove.Checked = ReadyToMove;
DataForm.chkPCKnowledge.Checked = PCKnowledge;
}
// взять значения из формы
// ----------------------------------------- private void GetValues()
{
SecondName = DataForm.txtSecondName.Text;
FirstName = DataForm.txtName.Text;
Furname = DataForm.txtFurName.Text;
City = DataForm.txtCity.Text;
Phone = DataForm.txtPhone.Text;
Sex = DataForm.cmbSex.Text;
Status = DataForm.cmbStatus.Text.Trim();
WishHolidayMonth = DataForm.cmbWishHolidayMonth.Text;

70 bool cb1 = byte.TryParse(DataForm.txtChildren.Text, out Children); bool cb2 = byte.TryParse(DataForm.txtExpierence.Text, out Expierence);
ID_Edu = (int)DataForm.cmbEducation.SelectedValue;
ID_Spec = (int)DataForm.cmbSpeciality.SelectedValue;
ID_Agent = (int)DataForm.cmbAgent.SelectedValue;
BirthDate = DataForm.dtpBirthDate.Value; bool cb3 = Int32.TryParse(DataForm.txtWishSalary.Text, out WishSalary);
PrivateVihicle = DataForm.chkPrivateVehicle.Checked;
ReadyToMove = DataForm.chkReadyToMove.Checked;
PCKnowledge = DataForm.chkPCKnowledge.Checked;
}
#endregion
// -----------------------------------------
// Реализация интерфейса к БД
// -----------------------------------------
#region "Interface Realization" public void InitializeMe(int id)
{
ID = id; if (ID == 0)
{
SecondName = "Фамилия";
FirstName = "Имя";
Furname = "Отчество";
City = "Москва";
Phone = "";
Sex = "муж.";
WishHolidayMonth = "Январь";
Children = 0;
Expierence = 0;
ID_Edu = 0;
ID_Spec = 0;
ID_Agent = 0;
BirthDate = DateTime.Now;
WishSalary = 10000;
PrivateVihicle = false;
ReadyToMove = false;
PCKnowledge = false;
} else
{
DBDataSetTableAdapters.APPLICANTSTableAdapter ATAdapter;
ATAdapter = new DBDataSetTableAdapters.APPLICANTSTableAdapter();

71
DBDataSet.APPLICANTSDataTable ADT = ATAdapter.GetDataByID(ID); if (ADT.Count > 0)
{ object[] RowArray = ADT.Rows[0].ItemArray;
SecondName = (string)RowArray[1];
FirstName = (string)RowArray[2];
Furname = (string)RowArray[3];
City = (string)RowArray[4];
BirthDate = (DateTime)RowArray[5];
Sex = (string)RowArray[6];
ID_Edu = (int)RowArray[7];
ID_Spec = (int)RowArray[8];
Expierence = (byte)RowArray[9];
WishSalary = (int)RowArray[10];
ReadyToMove = (bool)RowArray[11];
PrivateVihicle = (bool)RowArray[12];
PCKnowledge = (bool)RowArray[13];
WishHolidayMonth = (string)RowArray[14];
Children = (byte)RowArray[15];
Phone = (string)RowArray[16];
ID_Agent = (int)RowArray[17];
Status = (string)RowArray[18];
ProcessDate = (DateTime)RowArray[19];
}
}
}
// ----------------------------------------- public void AddMeToDB()
{
DBDataSetTableAdapters.APPLICANTSTableAdapter ATAdapter;
ATAdapter = new DBDataSetTableAdapters.APPLICANTSTableAdapter();
ATAdapter.InsertQuery(SecondName,
FirstName,
Furname,
City,
BirthDate,
Sex,
ID_Edu,
ID_Spec,
Expierence,
WishSalary,
ReadyToMove,
PrivateVihicle,
PCKnowledge,
WishHolidayMonth,

72
Children,
Phone,
ID_Agent,
Status,
ProcessDate);
ALF.dBDataSet.AcceptChanges();
ATAdapter.Dispose();
}
// ----------------------------------------- public void DeleteMeFromDB()
{
DBDataSetTableAdapters.APPLICANTSTableAdapter ATAdapter;
ATAdapter = new DBDataSetTableAdapters.APPLICANTSTableAdapter();
ATAdapter.DeleteQuery(ID);
ALF.dBDataSet.AcceptChanges();
ATAdapter.Dispose();
}
// ----------------------------------------- public void UpdateMeInDB()
{
DBDataSetTableAdapters.APPLICANTSTableAdapter ATAdapter;
ATAdapter = new DBDataSetTableAdapters.APPLICANTSTableAdapter();
ATAdapter.UpdateQuery(SecondName,
FirstName,
Furname,
City,
BirthDate,
Sex,
ID_Edu,
ID_Spec,
Expierence,
WishSalary,
ReadyToMove,
PrivateVihicle,
PCKnowledge,
WishHolidayMonth,
Children,
Phone,
ID_Agent,
Status,
ProcessDate,
ID);
ALF.dBDataSet.AcceptChanges();
ATAdapter.Dispose();
}

73
#endregion
}
}
1   2   3   4


написать администратору сайта