Normal
It makes a new database field called Genre_USEREDIT__ and inserts the genre in there. You can see in the configuration the row turns blue in colour. Now if you restart the config, you can see it shows you Genre instead of Genre_USEREDIT__.I can see how it got broken:[code]private void AddPropertyBindingSource(string FieldPrettyName, string FieldName, string FieldValue, bool CanModify, DataGridViewContentAlignment TextAlign) { int id = -1; bool userEdited = false; // are we a user_edited item? if so replace the orig entry if (FieldName.EndsWith(DBTable.cUserEditPostFix)) { // except if the content is empty, then we just dont display it if (string.IsNullOrEmpty(FieldValue)) return; string origFieldName = FieldName.Replace(DBTable.cUserEditPostFix, ""); for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (dataGridView1.Rows[i].Cells[1].Tag as string == origFieldName) { id = i; userEdited = true; break; } } } if (id < 0) { DataGridViewRow dataGridDetailRow = new DataGridViewRow(); DataGridViewTextBoxCell cFieldName; if ((FieldName == DBOnlineSeries.cLanguage) && (DBOption.GetOptions(DBOption.cOverrideLanguage))) { dataGridDetailRow = new DataGridViewRow(); cFieldName = new DataGridViewTextBoxCell(); DataGridViewComboBoxCell cbCell = new DataGridViewComboBoxCell(); // First Column (Name) cFieldName.Value = FieldPrettyName; cFieldName.Style.BackColor = System.Drawing.SystemColors.Control; dataGridDetailRow.Cells.Add(cFieldName); cFieldName.ReadOnly = true; // Second Column (Value) if (onlineLanguages.Count == 0) { onlineLanguages.AddRange(new GetLanguages().languages); } foreach (Language lang in onlineLanguages) { cbCell.Items.Add(lang.language); } Language selectedLang = onlineLanguages.Find(x => x.abbreviation.Contains(FieldValue)); for (int i = 0; i < cbCell.Items.Count; i++) { string s = cbCell.Items[i].ToString(); if (cbCell.Items[i].ToString() == selectedLang.language) { cbCell.Value = cbCell.Items[i]; } } cbCell.Tag = FieldName; dataGridDetailRow.Cells.Add(cbCell); cbCell.ReadOnly = false; // Add the row to the DataGridView dataGridView1.Rows.Add(dataGridDetailRow); } else { cFieldName = new DataGridViewTextBoxCell(); DataGridViewTextBoxCell cFieldValue = new DataGridViewTextBoxCell(); if (FieldName == DBEpisode.cAudioLanguage) FieldPrettyName = GetAudioLanguageDisplayName(FieldValue); // First Column (Name) cFieldName.Value = FieldPrettyName; cFieldName.Style.BackColor = System.Drawing.SystemColors.Control; dataGridDetailRow.Cells.Add(cFieldName); cFieldName.ReadOnly = true; cFieldValue.Value = FieldValue; cFieldValue.Tag = FieldName; dataGridDetailRow.Cells.Add(cFieldValue); if (!CanModify) { cFieldValue.ReadOnly = true; cFieldValue.Style.BackColor = System.Drawing.SystemColors.Control; } if (userEdited) { cFieldValue.Style.ForeColor = System.Drawing.SystemColors.HotTrack; } cFieldValue.Style.Alignment = TextAlign; // Add the rows to the DataGridView dataGridView1.Rows.Add(dataGridDetailRow); } } }[/code]When there is a user edit, the id is > 0, therefore it gets to the condition "if (id < 0)" and then exits the method.
It makes a new database field called Genre_USEREDIT__ and inserts the genre in there. You can see in the configuration the row turns blue in colour. Now if you restart the config, you can see it shows you Genre instead of Genre_USEREDIT__.
I can see how it got broken:
[code]
private void AddPropertyBindingSource(string FieldPrettyName, string FieldName, string FieldValue, bool CanModify, DataGridViewContentAlignment TextAlign)
{
int id = -1;
bool userEdited = false;
// are we a user_edited item? if so replace the orig entry
if (FieldName.EndsWith(DBTable.cUserEditPostFix))
// except if the content is empty, then we just dont display it
if (string.IsNullOrEmpty(FieldValue)) return;
string origFieldName = FieldName.Replace(DBTable.cUserEditPostFix, "");
for (int i = 0; i < dataGridView1.Rows.Count; i++)
if (dataGridView1.Rows[i].Cells[1].Tag as string == origFieldName)
id = i;
userEdited = true;
break;
}
if (id < 0)
DataGridViewRow dataGridDetailRow = new DataGridViewRow();
DataGridViewTextBoxCell cFieldName;
if ((FieldName == DBOnlineSeries.cLanguage) && (DBOption.GetOptions(DBOption.cOverrideLanguage)))
dataGridDetailRow = new DataGridViewRow();
cFieldName = new DataGridViewTextBoxCell();
DataGridViewComboBoxCell cbCell = new DataGridViewComboBoxCell();
// First Column (Name)
cFieldName.Value = FieldPrettyName;
cFieldName.Style.BackColor = System.Drawing.SystemColors.Control;
dataGridDetailRow.Cells.Add(cFieldName);
cFieldName.ReadOnly = true;
// Second Column (Value)
if (onlineLanguages.Count == 0)
onlineLanguages.AddRange(new GetLanguages().languages);
foreach (Language lang in onlineLanguages)
cbCell.Items.Add(lang.language);
Language selectedLang = onlineLanguages.Find(x => x.abbreviation.Contains(FieldValue));
for (int i = 0; i < cbCell.Items.Count; i++)
string s = cbCell.Items[i].ToString();
if (cbCell.Items[i].ToString() == selectedLang.language)
cbCell.Value = cbCell.Items[i];
cbCell.Tag = FieldName;
dataGridDetailRow.Cells.Add(cbCell);
cbCell.ReadOnly = false;
// Add the row to the DataGridView
dataGridView1.Rows.Add(dataGridDetailRow);
else
DataGridViewTextBoxCell cFieldValue = new DataGridViewTextBoxCell();
if (FieldName == DBEpisode.cAudioLanguage)
FieldPrettyName = GetAudioLanguageDisplayName(FieldValue);
cFieldValue.Value = FieldValue;
cFieldValue.Tag = FieldName;
dataGridDetailRow.Cells.Add(cFieldValue);
if (!CanModify)
cFieldValue.ReadOnly = true;
cFieldValue.Style.BackColor = System.Drawing.SystemColors.Control;
if (userEdited)
cFieldValue.Style.ForeColor = System.Drawing.SystemColors.HotTrack;
cFieldValue.Style.Alignment = TextAlign;
// Add the rows to the DataGridView
[/code]
When there is a user edit, the id is > 0, therefore it gets to the condition "if (id < 0)" and then exits the method.