Update() 공개 정적인 메소드

public static Update ( bool dbconOpened, EncoderSQL, es ) : void
dbconOpened bool
es EncoderSQL,
리턴 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);
    }
예제 #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);
    }