public bool AddMap(string name, int paragraph, DocFieldDataType type) { if (!map.ContainsValue(name)) { map.Add(paragraph, name); mapTypes.Add(paragraph, type); UpdateMapInfo(); return true; } else { if (Overwrite(name)) { //remove old mapping var removeIndex = map.First(x => x.Value == name).Key; map.Remove(removeIndex); mapTypes.Remove(removeIndex); map.Add(paragraph, name); mapTypes.Add(paragraph, type); UpdateMapInfo(); return true; } return false; } }
public bool EditMap(string name, int index, DocFieldDataType type) { if (map[index] != name && map.ContainsValue(name)) { if (Overwrite(name)) { var removeIndex = map.First(x => x.Value == name).Key; map.Remove(removeIndex); mapTypes.Remove(removeIndex); map[index] = name; mapTypes[index] = type; UpdateMapInfo(); return true; } return false; } else { map[index] = name; mapTypes[index] = type; UpdateMapInfo(); return true; } }
private void loadType(DocFieldDataType type) { var buttons = new RadioButton[6] { rbCurrency, rbDate, rbList, rbNum, rbText, rbYesNo }; for (int i = 0; i < buttons.Length; i++) { buttons[i].Checked = (buttons[i].Tag.ToString() == type.ToString()); } }
private void rb_Click(object sender, EventArgs e) { this.type = (DocFieldDataType)Enum.Parse(typeof(DocFieldDataType), ((RadioButton)sender).Tag.ToString()); }