private void изменитьToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem selectedItem in lvUsers.SelectedItems) { var selectedItemTagAsTuple = (Tuple <int, DateTime>)selectedItem.Tag; string OldRole = selectedItem.SubItems[3].Text; var formUpdating = new fReg(fReg.FormType.Update) { UserId = selectedItemTagAsTuple.Item1, DateReg = selectedItemTagAsTuple.Item2, UserLogin = selectedItem.SubItems[0].Text, Role = selectedItem.SubItems[3].Text, UserEditingUserId = _userId, }; if (formUpdating.ShowDialog() == DialogResult.OK) { selectedItem.SubItems[0].Text = formUpdating.UserLogin; if (formUpdating.UserSalt != null) { selectedItem.SubItems[1].Text = Convert.ToBase64String(formUpdating.UserSalt); } if (formUpdating.UserPassword != null) { selectedItem.SubItems[2].Text = Convert.ToBase64String(formUpdating.UserPassword); } selectedItem.SubItems[3].Text = formUpdating.Role; selectedItem.SubItems[4].Text = formUpdating.DateReg.ToLongDateString(); selectedItem.Tag = Tuple.Create(formUpdating.UserId, formUpdating.DateReg); } } }
private void добавитьToolStripMenuItem_Click(object sender, EventArgs e) { var formRegistration = new fReg(fReg.FormType.Insert); if (formRegistration.ShowDialog() == DialogResult.OK) { var lvi = new ListViewItem(new[] { formRegistration.UserLogin, Convert.ToBase64String(formRegistration.UserSalt), Convert.ToBase64String(formRegistration.UserPassword), formRegistration.Role, formRegistration.DateReg.ToLongDateString() }) { Tag = Tuple.Create(formRegistration.UserId, formRegistration.DateReg) }; lvUsers.Items.Add(lvi); } }
private void btBeginReg_Click(object sender, EventArgs e) { fReg reg = new fReg(fReg.FormType.Registration); reg.ShowDialog(); }