public void update(int pkey, double accountBalanec) { string update = "UPDATE [dbo].[INIT_BANK_BALANCE] SET "; update += "[ACCOUNT_BALANCE] = " + accountBalanec; update += " WHERE PKEY = " + Convert.ToString(pkey); try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update); load(); // 结转损益表插入银行存款期初数据 // 结转损益表插入银行存款期初数据 string bankName = getBankNameFromPkey(pkey); int bankID = AuxiliaryMaterial.getInctance().getAuxiliaryMaterialPkeyFromName("BASE_BANK_LIST", bankName); BankBalanceLastMonth.getInctance().delete(bankID); BankBalanceLastMonth.getInctance().insert(bankID, accountBalanec, "初始余额"); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }
private void insert(InitBankBalanceTable record) { string insert = "INSERT INTO [dbo].[INIT_BANK_BALANCE] ([BANK_ID],[ACCOUNT_BALANCE]) VALUES ("; int bankPkey = AuxiliaryMaterial.getInctance().getAuxiliaryMaterialPkeyFromName("BASE_BANK_LIST", record.bankName); insert += bankPkey + ","; insert += record.accountBalanec; insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); load(); // 结转损益表插入银行存款期初数据 BankBalanceLastMonth.getInctance().delete(bankPkey); BankBalanceLastMonth.getInctance().insert(bankPkey, record.accountBalanec, "初始余额"); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } }