管家婆家庭記賬軟件_第1頁
管家婆家庭記賬軟件_第2頁
管家婆家庭記賬軟件_第3頁
管家婆家庭記賬軟件_第4頁
管家婆家庭記賬軟件_第5頁
已閱讀5頁,還剩12頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

當用戶點擊AddLedgerController框上的“確定”按鈕時會調(diào)方法,所以我們需要在這能幾乎與2.4.3中相同!SortService#querySortNameByParent()方法,查詢出該父分類下所*publicclassAddLedgerControllerOperationLedgerDialogprivateSortServicesortService=newpublicAddLedgerController(JDialogdialog)}publicvoidchangeParent()Stringparentthis.parentBox.getSelectedItem().toString();if(parent.equals("-請選擇-")){ObjectsortItems請選擇}elseList<Object>nameItemssortService.querySnameByParent(parent);nameItems.add(0,"-請選擇-");}}…}Ledgersnamesid,snamesidDAOService層編寫代碼;調(diào)用關閉框publicpublicclassAddLedgerControllerOperationLedgerDialogpublicvoidconfirm()Stringparent=if(parent.equals("-請選擇-")){JOptionPane.showMessageDialog(this收/支\"不能為空!");}Stringsname=if(sname.equals("-請選擇-")){JOptionPane.showMessageDialog(this分類\"不能為空!");}Stringaccount=if(account.isEmpty()),"\"}}doublemoney=trymoney=}catch(NumberFormatExceptione){JOptionPane.showMessageDialog(this賬戶\"不能為空!");}Stringcreatetime=createtimeTxt.getText();Stringdesc=ldescTxt.getText();Ledgerledger=newLedger();}}ledgersidsname,sortpublicpublicclassLedgerServicepublicpublicvoidaddLedger(Ledgerledger)*獲取到該對象的Stringsname=snamesortDaointsid= }sname參數(shù)就是返回值@throwspublicintgetIdBySname(Stringsname)throwsStringsql="selectsidfromgjp_sortwheresname=?";Object[]params={sname};*****//tryreturn(int)qr.query(sql,newScalarHandler(),}catch(SQLExceptione)thrownew}}publicpublicclassLedgerDaopublicvoidaddLedger(Ledgerledger)Stringsql="INSERTINTOgjp_ledger(parent,sid,account,money,createtime,ldesc)VALUES(?,?,?,?,?,?)";Object[]paramstryqr.update(sql,}catch(SQLExceptione)thrownew}}}}修改框標publicpublicclassAddLedgerControllerOperationLedgerDialogpublicAddLedgerController(JDialogdialog)}}Ledger對象中,并傳遞給對話框類,接下來框類要顯示Ledger在表單中,再接下來用戶對表單數(shù)據(jù)進行編輯,再因為框要顯示用戶選中的表格數(shù)據(jù),所以要修改EditLedgerController類的構造器LedgerpublicpublicclassEditLedgerControllerOperationLedgerDialogprivateLedgerpublicEditLedgerController(JDialogdialog,Ledgerledger)this.tableLedger=ledger;moneyTxt.setText(tableLedger.getMoney()+"");}}LedgerrowLedger創(chuàng)建編輯賬務框,并傳遞Ledger對象publicpublicclassLedgerMngControllerLedgerMngDialogpublicvoideditLedger()introw=if(row<0),"}Ledgerledger=this.getLedgerByTableRow(row);if(ledger==null){,"}newEditLedgerController(this,}}}changeParent():在父分類改變時更新子分類下拉列表,這個方法可以直接tableLedger對象中即可;ledgerServicepublicclassEditLedgerControllerpublicclassEditLedgerControllerOperationLedgerDialogpublicvoidconfirm()Stringparent=if(parent.equals("-請選擇-")){JOptionPane.showMessageDialog(this收/支\"不能為空!");}Stringsname=if(sname.equals("-請選擇-")){JOptionPane.showMessageDialog(this分類\"不能為空!");}Stringaccount=if(account.isEmpty()),"\"}doublemoney=trymoney=}catch(NumberFormatExceptione),"\"}Stringcreatetime=Stringdesc=}}}Ledger@throwspublicvoideditLedger(Ledgerledger)throwsSQLException*獲取到該對象的Stringsname=snamesortDaointsid= 通過dao}Ledger*publicvoideditLedger(LedgerStringsql="updategjp_ledgersetparent=?,money=?,sid=?,account=?,createTime=?,ldesc=?wherelid=?";Object[]paramsqr.update(sql,}catch((SQLExceptione)thrownew}}時我們需要獲取用戶點擊的行號,再通過行號獲取對象,最后調(diào)用 Ledgerrow00說明用戶沒有選中表格數(shù)據(jù),這時我們要彈rowLedgerLedgernullnull說明用戶選中的是空行,這時我們要調(diào)用 publicpublicclassLedgerMngControllerLedgerMngDialogpublicvoid edger()introw=if(row<0),"}Ledgerledger=this.getLedgerByTableRow(row);if(ledger==null){,"}intmJOptionPane.showConfirmDialog(nullif(m==JOptionPane.OK_OPTION)*2.調(diào)用 *3對表格數(shù)據(jù)進行刷新(調(diào)用條件查詢方法}}}賬務表中的記錄與分類表中的記錄是有關聯(lián)的,例如某條賬務記錄關聯(lián)了“收入”分類,如果這時我們刪除了“收入”分類,那么這條賬務還繼續(xù)關聯(lián)“收入”就不;publicvoidpublicvoiddeleteSort()introw=this.sortDataTable.getSelectedRow();if(row<0){,"}Sortsort=this.getSortByTableRow(row);if(sort==null){,

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論