Дипломная работа: Автоматизация учета рабочего времени сотрудников компании ОАО "ЭХМЗ им.Н.Д.Зелинского"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
77
{
if (this.timeUchDataSet1.Sotr.Rows.Count == 0) return;
this.tabTableAdapter1.FillByMonth(this.timeUchDataSet1.Tab, Mnt);
int i = 0;
foreach (DataRow aRow in this.timeUchDataSet1.Sotr.Rows)
{
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells[0].Value = aRow["FIO"].ToString();
dataGridView1.Rows[i].Cells[1].Value = aRow["ID"].ToString();
i++;
}
int idRow = -1;
foreach (DataRow aRow in this.timeUchDataSet1.Tab.Rows)
{
for (int j = 0; j < dataGridView1.RowCount-1; j++)
{
if (dataGridView1.Rows[j].Cells[1].Value.ToString() ==
aRow["IDsotr"].ToString())
{
idRow = j;
break;
}
}
if (idRow > -1)
{
DateTime d = Convert.ToDateTime(aRow["dt"].ToString());
int dS = d.Day;
(dataGridView1.Rows[idRow].Cells[dS + 1] as
DataGridViewComboBoxCell).Value = Convert.ToInt32(aRow["IDob"].ToString());
idRow = -1;
78
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: данная строка кода позволяет загрузить данные в таблицу
"timeUchDataSet1.Ob". При необходимости она может быть перемещена или
удалена.
this.obTableAdapter.Fill(this.timeUchDataSet1.Ob);
DateTime CurrDate = DateTime.Now;
toolStripComboBox1.SelectedIndex = CurrDate.Month - 1;
sotrTableAdapter1.Fill(timeUchDataSet1.Sotr);
LoadTree();
}
private void Form1_Activated(object sender, EventArgs e)
{
dataGridView1.RowCount = 0;
LoadTab(toolStripComboBox1.SelectedIndex + 1);
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (treeView1.SelectedNode.Name != "0")
sotrTableAdapter1.FillByOtd(timeUchDataSet1.Sotr,
Convert.ToInt32(treeView1.SelectedNode.Name));
else sotrTableAdapter1.Fill(timeUchDataSet1.Sotr);
dataGridView1.RowCount = 1;
LoadTab(toolStripComboBox1.SelectedIndex + 1);
}
79
private void dataGridView1_CellEndEdit(object sender,
DataGridViewCellEventArgs e)
{
DateTime CurrDate = DateTime.Now;
DateTime dt = new
DateTime(CurrDate.Year,toolStripComboBox1.SelectedIndex + 1,e.ColumnIndex-1);
tabTableAdapter1.InsertQueryTab(Convert.ToInt32(dataGridView1[1,
e.RowIndex].Value), dt, Convert.ToInt32(dataGridView1[e.ColumnIndex,
e.RowIndex].Value));
}
private void dataGridView1_DataError(object sender,
DataGridViewDataErrorEventArgs e)
{
}
private void сотрудникиToolStripMenuItem_Click(object sender,
EventArgs e)
{
Sotr f1 = new Sotr();
f1.Show();
}
private void обозначенияToolStripMenuItem_Click(object sender,
EventArgs e)
{
Ob f1 = new Ob();
f1.Show();
}
80
private void должностиToolStripMenuItem_Click(object sender,
EventArgs e)
{
Dolg f1 = new Dolg();
f1.Show();
}
private void отделыToolStripMenuItem_Click(object sender, EventArgs e)
{
Otd f1 = new Otd();
f1.Show();
}
private void dsjlToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void больничныйЛистToolStripMenuItem_Click(object sender,
EventArgs e)
{
bl f1 = new bl();
f1.Show();
}
private void приказыToolStripMenuItem_Click(object sender, EventArgs
e)
{
Prik f1 = new Prik();
f1.Show();
}
81
private void актыToolStripMenuItem_Click(object sender, EventArgs e)
{
Akt f1 = new Akt();
f1.Show();
}
private void оПрограммеToolStripMenuItem_Click(object sender,
EventArgs e)
{
AboutBox1 f1 = new AboutBox1();
f1.Show();
}
private void
табельУчетаРабочегоВремениToolStripMenuItem_Click(object sender, EventArgs e)
{
var wordApp = new Microsoft.Office.Interop.Word.Application();
wordApp.Visible = false;
var wordDocument =
wordApp.Documents.Open(Application.StartupPath + "/tmpl/T12.docx");
Object missing = Type.Missing;
Microsoft.Office.Interop.Word.Find find = wordApp.Selection.Find;
find.Text = "$DT$";
DateTime CurrDate = DateTime.Now;
find.Replacement.Text = CurrDate.ToString();
Object wrap =
Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue;
Object replace =
Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll;
find.Execute(FindText: Type.Missing,
MatchCase: false,
MatchWholeWord: false,
Источник: https://baza.diplomsite.ru/previewfile/2430