Update() public static method

public static Update ( bool dbconOpened, EncoderSQL, es ) : void
dbconOpened bool
es EncoderSQL,
return void
    protected void on_show_repetitions_row_edit_apply(object o, EventArgs args)
    {
        int        curveID = genericWinESR.TreeviewSelectedUniqueID;
        EncoderSQL eSQL    = (EncoderSQL)SqliteEncoder.Select(
            false, curveID, 0, 0, encoderGI,
            -1, "", EncoderSQL.Eccons.ALL,
            false, true)[0];

        //if changed comment, update SQL, and update treeview
        //first remove conflictive characters
        string comment = Util.RemoveTildeAndColonAndDot(genericWinESR.EntryEditRow);

        if (comment != eSQL.description)
        {
            eSQL.description = comment;
            SqliteEncoder.Update(false, eSQL);

            //update treeview
            genericWinESR.on_edit_selected_done_update_treeview();
        }

        //if changed person, proceed
        LogB.Information("new person: " + genericWinESR.GetComboSelected);
        int newPersonID = Util.FetchID(genericWinESR.GetComboSelected);

        if (newPersonID != currentPerson.UniqueID)
        {
            EncoderSQL eSQLChangedPerson = eSQL.ChangePerson(genericWinESR.GetComboSelected);
            SqliteEncoder.Update(false, eSQLChangedPerson);

            genericWinESR.RemoveSelectedRow();
        }

        genericWinESR.ShowEditRow(false);
    }
Exemplo n.º 2
0
    public static int UpdateTransaction(ArrayList data, string [] checkboxes)
    {
        int count       = 0;
        int countActive = 0;

        LogB.SQL("Starting transaction");
        Sqlite.Open();

        using (SqliteTransaction tr = dbcon.BeginTransaction())
        {
            using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
            {
                dbcmdTr.Transaction = tr;

                foreach (EncoderSQL eSQL in data)
                {
                    if (count < checkboxes.Length && eSQL.status != checkboxes[count])
                    {
                        eSQL.status = checkboxes[count];

                        SqliteEncoder.Update(true, eSQL, dbcmdTr);
                    }

                    count++;

                    if (eSQL.status == "active")
                    {
                        countActive++;
                    }
                }
            }
            tr.Commit();
        }

        Sqlite.Close();
        LogB.SQL("Ended transaction");
        return(countActive);
    }