this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EmployesForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "Сотрудники";
this.Shown += new System.EventHandler(this.EmployesForm_Shown);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EmployesForm_FormClosing);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.employeeAction.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.TextBox txtSurname;
private System.Windows.Forms.TextBox txtPatronymic;
private System.Windows.Forms.TextBox txtPlacementDate;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txtBirthDate;
private System.Windows.Forms.TextBox txtPassport;
private System.Windows.Forms.TextBox txtPhone;
private System.Windows.Forms.ListView lstEmploys;
private System.Windows.Forms.CheckBox showActive;
private System.Windows.Forms.ColumnHeader columnName;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox txtFired;
private System.Windows.Forms.ContextMenuStrip employeeAction;
private System.Windows.Forms.ToolStripMenuItem добавитьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem уволитьToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem устроитьНаToolStripMenuItem;
private CustomizedImage employeeImage;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.ComboBox cmbPost;
private System.Windows.Forms.ToolStripMenuItem сменитьУчетныеДанныеToolStripMenuItem;
}
================================================================
namespace MentalHospital
{
public partial class EmployesForm : Form
{
Dictionary<int, DbEmployee> _allEmploys = new Dictionary<int, DbEmployee>();
DbEmployee[] _allDrawingEmploys = null;
List<DbPost> _allPosts = new List<DbPost>();
public EmployesForm()
{
InitializeComponent();
RefreshData();
}
public void RefreshData()
{
lstEmploys.BeginUpdate();
try
{
_previouslySelectedEmployee = null;
_allEmploys = DbHelper.AdminGetEmploys(showActive.Checked);
_allPosts = DbHelper.AdminGetAllPostsList();
lstEmploys.VirtualListSize = _allEmploys.Count;
_allDrawingEmploys = new DbEmployee[_allEmploys.Count];
_allEmploys.Values.CopyTo(_allDrawingEmploys, 0);
}
finally
{
lstEmploys.EndUpdate();
}
cmbPost.DataSource = _allPosts;
}
private void lstEmploys_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
{
DbEmployee entry = _allDrawingEmploys[e.ItemIndex];
e.Item = new ListViewItem(entry.Surname + " " + entry.Name + " " + entry.Patronymic);
if (entry.FiredDate != null) e.Item.ForeColor = Color.Gray;
}
private int GetPostIndex(int postId)
{
int counter = -1;
foreach (DbPost post in _allPosts)
{
counter++;
if (post.Id != postId) continue;
return counter;
}
return -1;
}
DbEmployee _previouslySelectedEmployee = null;
private void PromptForSave()
{
if (lstEmploys.SelectedIndices.Count < 1) return;
try
{
//DbEmployee employee = _allDrawingEmploys[lstEmploys.SelectedIndices[0]];
if (_previouslySelectedEmployee == null) return;
if (txtName.Text != _previouslySelectedEmployee.Name
|| txtSurname.Text != _previouslySelectedEmployee.Surname
|| txtPatronymic.Text != (_previouslySelectedEmployee.Patronymic == null ? "" : _previouslySelectedEmployee.Patronymic)
|| txtPassport.Text != _previouslySelectedEmployee.Passport
|| txtPhone.Text != _previouslySelectedEmployee.Phone
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.