private void buttonTestJournal_Click(object sender, EventArgs e) { ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), userName, "ТЕСТ ЖУРНАЛ КЛИК"); ArrayList readed = ActionRegistrator.readRecord(); MessageBox.Show(readed[0].ToString() + readed[1].ToString() + readed[2].ToString()); }
private void createUser() { UserCreate userCreate = new UserCreate(); userCreate.ShowDialog(); if (userCreate.success) { ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), userName, userCreate.userName); UsersManager.addUser(userCreate.userName, userCreate.password, userCreate.userType); } }
//--------------------------------------------------------------------------------Tasks editing private void button_AddTask_Click(object sender, EventArgs e) { AddTask addTask = new AddTask(); addTask.ShowDialog(); if (addTask.success()) { ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), userName, addTask.resultName); this.addTask(addTask.resultDate, addTask.resultName, addTask.description); savedInstanceManager.addTask(addTask.resultDate, addTask.resultName, addTask.description); } }
//--------------------------------------------------------------------------------Points editing private void button_AddPoint_Click(object sender, EventArgs e) { var points = getDataPointCollection(0); InputBox inputBox = points.Count != 0 ? new InputBox(points.Last().XValue, points.Last().YValues.Last()) : new InputBox(0, 0); inputBox.ShowDialog(); if (inputBox.success()) { points.Add(new DataPoint(inputBox.result[0], inputBox.result[1])); ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), userName, inputBox.result[0].ToString() + inputBox.result[1].ToString()); savedInstanceManager.addPoint(tabPane.SelectedIndex, inputBox.result[0], inputBox.result[1], 0); } }
private void button_DeleteTask_Click(object sender, EventArgs e) { if (checkedListBox_Tasks.SelectedIndex != -1) { DeleteAcceptor deleteAcceptor = new DeleteAcceptor(); deleteAcceptor.ShowDialog(); int index = checkedListBox_Tasks.SelectedIndex; if (deleteAcceptor.success()) { ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), userName, checkedListBox_Tasks.Items[index].ToString()); checkedListBox_Tasks.Items.RemoveAt(index); listView1.Items.RemoveAt(index); descriptions.RemoveAt(index); savedInstanceManager.deleteTask(index); } } }
public Login() { InitializeComponent(); if (!File.Exists(PATH_TO_SHA1)) { userType = 4; ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), "Первичный запуск", "-"); Hide(); return; } if (File.Exists(PATH_TO_USESRS)) { comboBox1.Items.AddRange(getUsersString()); } }
//-----------------------------------------------------------------------Testing private void button_CheckSecureSystem_Click(object sender, EventArgs e) { ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), userName, "ЧЕК СЕКЬЮР СИСТЕМ КЛИК"); using (FileStream fs = new FileStream(PATH_TO_SHA1, FileMode.Open)) { byte[] byteBufferAllFile = new byte[fs.Length]; fs.Read(byteBufferAllFile, 0, byteBufferAllFile.Length); byte[] byteBufferType = new byte[4]; byte[] byteBufferSHA1 = new byte[20]; int count = 0; do { Array.Copy(byteBufferAllFile, count * 24, byteBufferType, 0, 4); Array.Copy(byteBufferAllFile, count * 24 + 4, byteBufferSHA1, 0, 20); byte[] SHA1 = Secure.ComputeHmacsha1(Encoding.UTF8.GetBytes(textBox_passwordCheck.Text), Encoding.UTF8.GetBytes(textBox_userNameCheck.Text + "HELIOSONE")); if (SHA1.SequenceEqual(byteBufferSHA1)) { if (byteBufferType[3] == 1) { textBox_userType.Text = "ADMIN"; } else { if (byteBufferType[3] == 2) { textBox_userType.Text = "SYSTEM"; } else { textBox_userType.Text = "USER"; } } } count++; } while (count < fs.Length / 24); } }
private void button_ChangeTask_Click(object sender, EventArgs e) { if (checkedListBox_Tasks.SelectedIndex != -1) { ChangeTask changeTask = new ChangeTask(); changeTask.ShowDialog(); if (changeTask.success()) { ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), userName, changeTask.resultName); int index = checkedListBox_Tasks.SelectedIndex; checkedListBox_Tasks.Items.RemoveAt(index); checkedListBox_Tasks.Items.Insert(index, changeTask.resultName); listView1.Items.RemoveAt(index); listView1.Items.Insert(index, changeTask.resultDate.ToString().Substring(0, 16)); notificationManager.addTask(changeTask.resultDate, changeTask.description, changeTask.resultName); savedInstanceManager.deleteTask(index); savedInstanceManager.addTask(changeTask.resultDate, changeTask.resultName, descriptions[index].ToString(), index); } } }
private void buttonLogin_Click(object sender, EventArgs e) { using (FileStream fs = new FileStream(PATH_TO_SHA1, FileMode.Open)) { byte[] byteBufferAllFile = new byte[fs.Length]; fs.Read(byteBufferAllFile, 0, byteBufferAllFile.Length); byte[] byteBufferType = new byte[4]; byte[] byteBufferSHA1 = new byte[20]; int count = 0; do { Array.Copy(byteBufferAllFile, count * 24, byteBufferType, 0, 4); Array.Copy(byteBufferAllFile, count * 24 + 4, byteBufferSHA1, 0, 20); byte[] SHA1 = Secure.ComputeHmacsha1(Encoding.UTF8.GetBytes(textBox_password.Text), Encoding.UTF8.GetBytes(comboBox1.Text + "HELIOSONE")); if (SHA1.SequenceEqual(byteBufferSHA1)) { if (byteBufferType[3] == 0) { userName = comboBox1.Text; userType = 0; break; } if (byteBufferType[3] == 1) { userName = comboBox1.Text; userType = 1; break; } if (byteBufferType[3] == 2) { userName = comboBox1.Text; userType = 2; break; } } else { userType = -1; } count++; } while (count < fs.Length / 24); } if (userType != -1) { ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), userName, "-"); Hide(); } else { userName = (userName == null || userName == "") ? "Неизвестно" : userName; MessageBox.Show("Неверные имя пользователя или пароль", "", MessageBoxButtons.OK, MessageBoxIcon.Stop); ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), userName, "Неудачная попытка входа."); } }