//LOAD RECORD DICTIONARY MINUS EXPIRED RECORDS public void LoadRecordDictionary(DataSet dataSet) { var dsTable = dataSet.Tables[0]; var count = dataSet.Tables[0].Rows.Count; RecordDictionary.Clear(); for (int i = 0; i < count; i++) { RecordViewModel recordViewModel = new RecordViewModel() { Id = (int)dsTable.Rows[i]["PasswordId"], Password = dsTable.Rows[i]["PasswordPassword"].ToString(), UserId = dsTable.Rows[i]["PasswordUserId"].ToString(), Site = dsTable.Rows[i]["PasswordSite"].ToString(), Misc = dsTable.Rows[i]["PasswordMisc"].ToString() }; RecordDictionary.Add(i, new RecordViewModel { Id = recordViewModel.Id, Password = recordViewModel.Password, UserId = recordViewModel.UserId, Site = recordViewModel.Site, Misc = recordViewModel.Misc }); } }
private void cmb2ndFormProgramOrSite_SelectedIndexChanged(object sender, EventArgs e) { RecordIndex = cmb2ndFormProgramOrSite.SelectedIndex; if (RecordDictionary.Count == 0) { return; } var record = RecordDictionary.ElementAt(RecordIndex); var value = record.Value; txt2ndFormProgramSite.Text = value.Site; txt2ndFormUserId.Text = value.UserId; txt2ndFormPassword.Text = value.Password; txt2ndFormMisc.Text = value.Misc; RecordId = value.Id; }
private void btn2ndFormDelete_Click(object sender, EventArgs e) { RecordIndex = cmb2ndFormProgramOrSite.SelectedIndex; var record = RecordDictionary.ElementAt(RecordIndex); var value = record.Value; var question = "Delete Record for '" + value.Site + "'?"; DialogResult result = MessageBox.Show(question, "Open SZMe", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { DeleteRecord(); Reset(); ReloadRecordAndComboBox(); } }
//SET RECORD ID private void SetRecordId() { //GET INDEX FOR COMBOBOX var comboBoxIndex = cmb2ndFormProgramOrSite.SelectedIndex; //GET RECORD MATCHING SELECTED COMBO BOX INDEX var record = RecordDictionary.ElementAt(comboBoxIndex); if (RecordDictionary.Count <= 1) { RecordId = 0; return; } //GET RECORD ID RecordId = record.Value.Id; }
private void btn2ndFormEdit_Click(object sender, EventArgs e) { RecordIndex = cmb2ndFormProgramOrSite.SelectedIndex; var record = RecordDictionary.ElementAt(RecordIndex); var value = record.Value; var question = "Edit Record for '" + value.Site + "'?"; DialogResult result = MessageBox.Show(question, "Open SZMe", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { cmb2ndFormProgramOrSite.Enabled = false; EnableAllButtons(); EnableAllTextBoxes(); EnableClipboardButtons(); btn2ndFormNew.Enabled = false; btn2ndFormDelete.Enabled = false; RemovePasswordChar(); } }