private void btnEdit_Click(object sender, EventArgs e) { frmAttributeProperties frm = new frmAttributeProperties(); if (this.lsvAttributes.SelectedItems[0].Tag as IAzManAttribute <IAzManAuthorization> != null) { IAzManAttribute <IAzManAuthorization> attr = this.lsvAttributes.SelectedItems[0].Tag as IAzManAttribute <IAzManAuthorization>; frm.key = attr.Key; frm.value = attr.Value; } else //if (this.lsvAttributes.SelectedItems[0].Tag as KeyValuePair<string, string>) { KeyValuePair <string, string> attr = (KeyValuePair <string, string>) this.lsvAttributes.SelectedItems[0].Tag; frm.key = attr.Key; frm.value = attr.Value; } DialogResult dr = frm.ShowDialog(this); if (dr == DialogResult.OK) { if (this.lsvAttributes.SelectedItems[0].Tag as IAzManAttribute <IAzManAuthorization> != null) { IAzManAttribute <IAzManAuthorization> attr = this.lsvAttributes.SelectedItems[0].Tag as IAzManAttribute <IAzManAuthorization>; KeyValuePair <string, string> keyValueToEdit = new KeyValuePair <string, string>(attr.Key, frm.value); this.attributesToUpdate.Add(keyValueToEdit); this.lsvAttributes.SelectedItems[0].SubItems[1].Text = keyValueToEdit.Value; this.lsvAttributes.SelectedItems[0].Tag = keyValueToEdit; this.lsvAttributes.Focus(); } else //if (this.lsvAttributes.SelectedItems[0].Tag as KeyValuePair<string, string>) { KeyValuePair <string, string> attr = this.FindAttribute(this.attributesToUpdate, frm.key); if (attr.Key == null) { attr = this.FindAttribute(this.attributesToAdd, frm.key); } KeyValuePair <string, string> newAttr = new KeyValuePair <string, string>(attr.Key, frm.value); this.attributesToUpdate.Remove(attr); this.attributesToUpdate.Add(newAttr); this.lsvAttributes.SelectedItems[0].SubItems[1].Text = newAttr.Value; this.lsvAttributes.SelectedItems[0].Tag = newAttr; this.lsvAttributes.Focus(); } this.modified = true; this.btnApply.Enabled = true; } this.HourGlass(false); }
private void btnAdd_Click(object sender, EventArgs e) { frmAttributeProperties frm = new frmAttributeProperties(); DialogResult dr = frm.ShowDialog(this); if (dr == DialogResult.OK) { KeyValuePair <string, string> keyValueToRemove = this.FindAttribute(this.attributesToRemove, frm.key); KeyValuePair <string, string> keyValue1 = this.FindAttribute(this.attributesToAdd, frm.key); IAzManAttribute <IAzManAuthorization> authorizationAttribute = this.FindAttribute(this.authorization.GetAttributes(), frm.key); if (keyValueToRemove.Key == null && keyValue1.Key == null && authorizationAttribute == null) { KeyValuePair <string, string> keyValueTaAdd = new KeyValuePair <string, string>(frm.key, frm.value); this.attributesToAdd.Add(keyValueTaAdd); ListViewItem lvi = this.CreateAuthorizationAttributeListViewItem(keyValueTaAdd); this.lsvAttributes.Items.Add(lvi); lvi.Selected = true; this.modified = true; } else { if (keyValueToRemove.Key == null) { this.ShowError(Globalization.MultilanguageResource.GetString("frmApplicationAttributes_Msg10"), Globalization.MultilanguageResource.GetString("frmApplicationAttributes_Tit10")); return; } else { this.ShowError(Globalization.MultilanguageResource.GetString("frmApplicationAttributes_Msg20"), Globalization.MultilanguageResource.GetString("frmApplicationAttributes_Tit20")); return; } } this.modified = true; this.btnApply.Enabled = true; this.lsvAttributes.Focus(); } this.HourGlass(false); }
private void btnAdd_Click(object sender, EventArgs e) { frmAttributeProperties frm = new frmAttributeProperties(); DialogResult dr = frm.ShowDialog(this); if (dr == DialogResult.OK) { KeyValuePair<string, string> keyValueToRemove = this.FindAttribute(this.attributesToRemove, frm.key); KeyValuePair<string, string> keyValue1 = this.FindAttribute(this.attributesToAdd, frm.key); IAzManAttribute<IAzManStore> storeAttribute = this.FindAttribute(this.store.GetAttributes(), frm.key); if (keyValueToRemove.Key == null && keyValue1.Key == null && storeAttribute == null) { KeyValuePair<string, string> keyValueTaAdd = new KeyValuePair<string, string>(frm.key, frm.value); this.attributesToAdd.Add(keyValueTaAdd); ListViewItem lvi = this.CreateStoreAttributeListViewItem(keyValueTaAdd); this.lsvAttributes.Items.Add(lvi); lvi.Selected = true; this.modified = true; } else { if (keyValueToRemove.Key == null) { this.ShowError(Globalization.MultilanguageResource.GetString("frmApplicationAttributes_Msg10"), Globalization.MultilanguageResource.GetString("frmApplicationAttributes_Tit10")); return; } else { this.ShowError(Globalization.MultilanguageResource.GetString("frmApplicationAttributes_Msg20"), Globalization.MultilanguageResource.GetString("frmApplicationAttributes_Tit20")); return; } } this.modified = true; this.btnApply.Enabled = true; this.lsvAttributes.Focus(); } this.HourGlass(false); }
private void btnEdit_Click(object sender, EventArgs e) { frmAttributeProperties frm = new frmAttributeProperties(); if (this.lsvAttributes.SelectedItems[0].Tag as IAzManAttribute<IAzManStore> != null) { IAzManAttribute<IAzManStore> attr = this.lsvAttributes.SelectedItems[0].Tag as IAzManAttribute<IAzManStore>; frm.key = attr.Key; frm.value = attr.Value; } else //if (this.lsvAttributes.SelectedItems[0].Tag as KeyValuePair<string, string>) { KeyValuePair<string, string> attr = (KeyValuePair<string, string>)this.lsvAttributes.SelectedItems[0].Tag; frm.key = attr.Key; frm.value = attr.Value; } DialogResult dr = frm.ShowDialog(this); if (dr == DialogResult.OK) { if (this.lsvAttributes.SelectedItems[0].Tag as IAzManAttribute<IAzManStore> != null) { IAzManAttribute<IAzManStore> attr = this.lsvAttributes.SelectedItems[0].Tag as IAzManAttribute<IAzManStore>; KeyValuePair<string, string> keyValueToEdit = new KeyValuePair<string, string>(attr.Key, frm.value); this.attributesToUpdate.Add(keyValueToEdit); this.lsvAttributes.SelectedItems[0].SubItems[1].Text = keyValueToEdit.Value; this.lsvAttributes.SelectedItems[0].Tag = keyValueToEdit; this.lsvAttributes.Focus(); } else //if (this.lsvAttributes.SelectedItems[0].Tag as KeyValuePair<string, string>) { KeyValuePair<string, string> attr = this.FindAttribute(this.attributesToUpdate, frm.key); if (attr.Key == null) attr = this.FindAttribute(this.attributesToAdd, frm.key); KeyValuePair<string, string> newAttr = new KeyValuePair<string, string>(attr.Key, frm.value); this.attributesToUpdate.Remove(attr); this.attributesToUpdate.Add(newAttr); this.lsvAttributes.SelectedItems[0].SubItems[1].Text = newAttr.Value; this.lsvAttributes.SelectedItems[0].Tag = newAttr; this.lsvAttributes.Focus(); } this.modified = true; this.btnApply.Enabled = true; } this.HourGlass(false); }