Commit c7c3e9bc authored by Xavier de Blas's avatar Xavier de Blas

encoder fixed change repetitions owner when set owner (person) changes

parent ddd81d8c
......@@ -1746,35 +1746,55 @@ public partial class ChronoJumpWindow
genericWin.ShowEditRow(true);
}
protected void on_encoder_load_signal_row_edit_apply (object o, EventArgs args) {
protected void on_encoder_load_signal_row_edit_apply (object o, EventArgs args)
{
LogB.Information("row edit apply at load signal");
int curveID = genericWin.TreeviewSelectedUniqueID;
EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, curveID, 0, 0, Constants.EncoderGI.ALL,
-1, "", EncoderSQL.Eccons.ALL, false, true)[0];
//if changed comment, update SQL, and update treeview
//1) select set
int setID = genericWin.TreeviewSelectedUniqueID;
EncoderSQL eSQL_set = (EncoderSQL) SqliteEncoder.Select(false, setID, 0, 0, Constants.EncoderGI.ALL,
-1, "", EncoderSQL.Eccons.ALL, false, true)[0];
//2) if changed comment, update SQL, and update treeview
//first remove conflictive characters
string comment = Util.RemoveTildeAndColonAndDot(genericWin.EntryEditRow);
if(comment != eSQL.description) {
eSQL.description = comment;
SqliteEncoder.Update(false, eSQL);
if(comment != eSQL_set.description)
{
eSQL_set.description = comment;
SqliteEncoder.Update(false, eSQL_set);
//update treeview
genericWin.on_edit_selected_done_update_treeview();
}
//if changed person, proceed
LogB.Information("new person: " + genericWin.GetComboSelected);
int newPersonID = Util.FetchID(genericWin.GetComboSelected);
if(newPersonID != currentPerson.UniqueID) {
EncoderSQL eSQLChangedPerson = eSQL.ChangePerson(genericWin.GetComboSelected);
//3) change the session param and the url of signal and curves (if any)
string idName = genericWin.GetComboSelected;
LogB.Information("new person: " + idName);
int newPersonID = Util.FetchID(idName);
if(newPersonID != currentPerson.UniqueID)
{
//change stuff on signal
EncoderSQL eSQLChangedPerson = eSQL_set.ChangePerson(idName);
SqliteEncoder.Update(false, eSQLChangedPerson);
genericWin.RemoveSelectedRow();
//select linkedReps (if any)
ArrayList linkedReps = SqliteEncoder.SelectSignalCurve(
false, setID, -1, -1, -1); //DBopened, signal, curve, msStart, msEnd
//change stuff on repetitions (if any)
foreach (EncoderSignalCurve esc in linkedReps)
{
EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(false, esc.curveID, 0, 0, Constants.EncoderGI.ALL,
-1, "curve", EncoderSQL.Eccons.ALL, false, true)[0];
eSQLChangedPerson = eSQL.ChangePerson(idName);
SqliteEncoder.Update(false, eSQLChangedPerson);
}
}
genericWin.ShowEditRow(false);
//TODO: make the current set on app1 unsensitive, because maybe we changed the already loaded set
}
protected void on_encoder_load_signal_row_delete_pre (object o, EventArgs args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment