對功能的一般性規(guī)定-武漢理工大學_第1頁
對功能的一般性規(guī)定-武漢理工大學_第2頁
對功能的一般性規(guī)定-武漢理工大學_第3頁
對功能的一般性規(guī)定-武漢理工大學_第4頁
對功能的一般性規(guī)定-武漢理工大學_第5頁
已閱讀5頁,還剩20頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、第第 頁第第ii頁下面的一段的意思是,如果有主子表聯(lián)動的情況下,主Grid的記錄只有一行的話,無法觸發(fā)FocusedRowChanged事件,需要手動綁定數(shù)據(jù)if(ds7ables0RowsCount=1)stringid=ds.Tables0.Rows0riDr.7bStnng();后工序反饋KLsysBLL.YC_AbnomalBillbllabnormal=newKLsys.BLLYC_AbnomalBill();Grid_FeedBack.DataSource=bll_abnormal.GetListf1BillNO=”+id+”ANDBillTypelD=2);fiGnd.FeedB

2、ack.DataBind();護異常信息KLsysBLL.YJNoWorkAbnormalbllnoworkAbnormal=newKLsys.BLL.YJNoWorkAbnormal();Grid-SCYC.Datasource=bll_noworkAbnormal.GetList(MDillNO=m+id+);Gnd_SCYC.DataBind();Grid行內UpdateGild的行內更新下面的一段的意思是,如果有主子表聯(lián)動的情況下,主Grid的記錄只有一行的話,無法觸發(fā)FocusedRowChanged事件,需要手動綁定數(shù)據(jù)protectedvoidGridViQv/_List_Row

3、Updating(objGctsender,DevExpressWebDataASPxDataUpdatingEventArgse)(eCancel二【rue.必灰要加DevExpreSWebASPxGridVicwASPxGridViev_grid=senderasDevExpress.WebASPxGndVievzASPxGridView;_grid.CancolEditO;必惡聲加strinQkey=e.KeysO.lbStrinq()./取取更改后的值stringcustomerQuantity=eNGwVaiuesCustomQrQuantity=null?:gNo,WaluGsMC

4、ustomGrQuantityMToStringO;stringcustomerDefectQuantty二e.NewV8luesCu5tomeDefeclQu8ntrty”二二null?.e.NewValueslCustomerDefectQuantityJ.ToStnncstringcustomerOutRate=e.NewVaiuesCusiomerOuiRaie”=nui。w,eNewValuesCusiomerOulRaie”DSMing(),KLsysBLL.YJ_Machinmgbl_yj=newKLsys.BLLYJ_Machinmg();KLsys.Modol.YJJJach

5、ininamodGl_yj=nowKLsys.Modol.YJJdachiningO;獲取以前的數(shù)癌m(xJel_yi=bll_yjGetModBl(key),Jy9wfItw99UJ2八KLsys.Model.YJ_MachiningmodoLyj=newKLsys.ModelYJJu1achining();鉄取以前的數(shù)據(jù)model_yj=bii_y).Ge(Model(key),”更新麵PageValidatGIsDecimal(MM);PageValidste.lsNuniber(”);model_yjCustooerQuantity=custocnerQuantity=”mo(Jei_

6、y).CustomerQuantityConvertT0ln(32(custxnerQuantity).modeLyjCustomerDefectQuantity=customerDefectQuantity=”?model_yjCustomerDefectQuantrty:ConvQrt.lblnt32(customerDmodl_yjCustomerOutRato=customerOutRate=m?modeLyjCustomerOutRate-ConvertTbDQCimal(customerOutRatQ);bll_yj.Update(modeLyj).BindDropDown():B

7、indGndQ;._如果需要在行內實現(xiàn)DiopDowiit(見GridSimpleDemo.aspx)在需要將這一行/IJSWBVUZ54JV/ZICAIlllfdx:GridViewDataComboBoxColuninVisibtelndex=w3,*FieldName=*,CategoryTypeNameCaption二”所屬類8U名稱”Width然后在CellEditorlnitialize事件中初始化并給他綁定DataSet,protectedvoidGridViewCategory_CellEdrtorlmtialize(ob|ectsender,ASPxGndViewEditor

8、EventArgse)/命選出有Combo的列if(GridView_CatQgoryIsEditing|qColumnFieldName!=MCatQgoryNameM)return,獲取編輕列的ComboBoxASPxCcwnboBoxcombo=EditorasASPxComboBox;加邦定Edit模版里面的ComboBox數(shù)據(jù)comboTextField=”CatogoryNamo”;combo.ValueField=ID*1;comboDataSource=bILCategoryTypeGetAIIList(),combo.DataBind();然后在Updating事件中,pro

9、tectedvoidGridView_C0tegory_RowUpdating(objectsender.DevExpressWebDataASPxDataUpdatingEventArgse)e.Cancel二true,DevExpressWebASPxGridView.ASPxGridViGwgrid=senderasDevExpressWebASPxGridViewASPxGridView;grid.CancelEditO;stringkey=eKeysO.TbString(),stringnev/_TypelD二e.NewValueslCategoryNamel.TbStrmgO,/S

10、flMDropDown選擇了新的話.則值是WIuq.如果沒有選擇新的則為做tstringnGv/_CatGrogyNamG=gNev/ValuespCategoryNamGTbStringO;KLsysModei.JCSJ_Categorymodel二newKLsysModelJCSJ_Category(),model=blLCategory.Getfrlodel(key).砂靈直吳以前的值if(nev/_TypeiD1=bll_Catego(yTypGGetModel(modGlTypQlD).CatGgoryNamG)modelTypeID=new_TypelO,model.Calogor

11、yName二nGW_CatQrogyNamezbl_CategoryUpdate(modGl);BindGridO;即可oGrid刪除行刪除Gnd的數(shù)據(jù)。protectedvoidGndViev/_List_Rov/Deleting(objectsenderzDevExpress.WebData.ASPxDataDeletmgEventArgse)e.Cancel二true;stringkey=qKeys(0ToSringOnewKLsysBLL.YJMachining.DolQto(kGy);BindGndO,Grid自定義按鈕自定義按鈕用RowConmiand爭件來實現(xiàn)在前臺:事件聲明:a

12、sp:LinkButtonID=,LinkButton1r花xt二”詳細”runat二”serve廣CommandName=r,linkurr*CommmndArgument=v%;EvBl(”ID”)%/dx:GndViewDataColumn,后臺方法:protectedvoidGrKjView_List_RowCommand(objectsender,DevExpress.Web.ASPxGndView.ASPxGndViev/RowCommandEveirArgse)SetConditionO;ResponseRedirect(*Editasp/?id=weCommandArgsCom

13、mandArgumentTbStnngO).其中SetCondition就是查詢條件保持。Grid列翻譯對Grid里面列翻譯,比如1是2否一般是在Gnd的列中調用后臺的函數(shù),如事件聲明:protectedstringTanslateShift(strings)if(s.TrimO二二nAn)return”早班;if(s.TrimO二二,rBr,)return”中班,;if(s.TrimO二return”晚班:return:Grid主子表關聯(lián)主子表關聯(lián)是很常用的功能,選擇一個主表的時候,同時在頁面下方的Gnd顯示他的關聯(lián)信息。主要實現(xiàn)是FocusedRowChanged事件,同時需要修改Gild

14、的幾個屬性。事件聲明:uiviw-yinj-urydx.ASPxGndViewiDGridView_LisfClienllnstaneeName=HGridView_Lisfrunat=serverOnRowComrr|號里bleCallBacksbFalse:*eyFieldNarneJDWidth=1OO%e,AutoGenerateColumns=wFalseOnS創(chuàng)ecEionS汕ci巳cJhGri匕ViewLisiSelectionChanaerOnRewqodatmg=*GridVibw_List_R.owUpdatnlonFocusedRowChangwIGrKlViewLisC

15、FocusedRowChanged*4ssFilePath=-/AppThemes/OfficeiSettmgsEWQqMhn/iuQlhAvuHrabmPannl=Tri*Chnu/UnriTAnfatGrrnlRar=trii-/uiviuynu-uiv*vdxiASPxGridViewID二GidView_List”ClientlnstanceName=HGrid/iev/-Listwainat=,serverF,OnRov/ComrrEnableCallBacks-FalseKeyFieldName-lD11Width=,100%MAutoGenerateColumns=MFalser

16、OnSelectionChancied二GridViewListSelectionCh日naedOnRowljpdating=,Grid/iew_List_RowUpdatii|OnFocusedRowChanged=HGndViewListFocusedRowChangedMissFilePath=H/AppThemes/OfticelussPostrix=orTicezuiubiueVGottinnuhaajRrminPannl=,rTriioMahcwHcrTzcntalGcmllRaiiiTig4允許選中行,行事件走后臺。-CssPostfix=wOffice2010Blue-Sett

17、ingsBehaviorCfUmnRe5IZ6M0a6=UOntrOl|/MIOVybqcusedRow=truewProcessFocusedRowChangedOnServe二ue”ConfirmDelete二p|ie”AllowSelectByRowClick1*后臺事件:protectedvoidGridView_List_FocusedRowChanged(objectsender,EventArgse)for(inti=0;i_:、I:AI.CfL:l-J-L.AAIprivatevoidBindDQtailGrid(stringid)KLsys.BLL.YC_AbnomalBil

18、lbiLabnormal=newKLsys.BLL.YC.AbnomalBillO;GridFeedBackDataSource=bH_abnormalGetList(MBillNO=”+id+”ANDBillTypelD=2”),Gnd_FeedBack.DataBind();KLsys.BLL.YJ_NoWorkAbnormalblLnoworkAbnormal二newKLsys.BLL.YJ_NoWorKAbnormalO;Grid_SCYC.DataSource=blLnoworkAbnormalGetListCBillNO=w+id+m”);Gnd_SCYC.DataBind();跳

19、轉頁面后信息保存當你的Gnd有多頁,查詢條件也已經(jīng)選擇的情況下,點擊跳出頁面后,再跳回來,這個方法可以讓你記住你當前的信息。E1#egion查詢條件保持田protectedvoidSetCondition()Z|田protectedvoidGetQueryCondition(也protectedvoidBindGridViaSession()Q#endregionSetConditionQ是保存信息后面兩個是從Session中獲取信息,用在Page_Load函數(shù)里面。protoctodvoidSetConditionOstringuri=Request.Url.AbsoluteUn.lbLow

20、er().Split(newchart)?)0;Hashtablehtable=newHashtableO;htableAddCuri,Request.UrlAbsolutellriTbLower().Split(newchar)0);for(inti=0;iGridViewList.VisibleRowCount;i卄)_if(GridViewList.Selection.IsRowSelected(i)htablerGridView_UstJndex=i.ToString();stringkey=(object)GridView_List.GetRowValues(i,newstringI

21、D).TdString();hbbleGidView_Li5t_5electedlD”二key;break;htable.Add(”GridViGw_List_pagg:GridView_Ust.Pagelndex.lbString();if(DateEdit_WorkDateBegin.Value!=nul)hteble,DateEdrt-WorkDateBegin-valuer=Convert.7oDateTime(DateEdit_WorkDateBegin.Value.TbStnng().ToShortif(DateEdit_WorkDateEndValue匕null)htable,D

22、at9EdiLWorkDat0End-value,=ConvertToDateTinie(DateEdit_WorkDateEndValue.ToStnngO)ToShortDathtablerDropDov;n_Line_va!uel=DropDov;n_Line.Value.7oString();htable(KDropDovnJfeamNO_valueM|=DropDownJfeamNOV8lue.lbS1ring();htable”DropDown_Shift_valu3=DropDown_Shift.Value.lbStnng();SessionuriJ=htable;思路是用這個P

23、age的URL作為鍵值放到Session中,這個頁面的具體信息比如Grid的當前頁,當前選擇的行,控件的選擇的指,會放入HashTable中,然后把這個HashTable放入Session中。在Page.Load中獲取他的時候:protectedvoidGetQueryCondition()stringuri=Request.Url.AbsoluteUri.1bLowor().Split(newcharJ*?*)0,if(SessionuriJ二二null)return;Hashtablohtable=SessionuriasHashtable;if(htable.ContainsCDateE

24、drt_WorkDateBegin_value,*)DateEdit_WorkDateBeginValue=Convert.lbD型eT1me(htoblerD型eEdit_WorkD8teBegin_v8lue”TbString();if(htable.ContainsC,DateEdit-WorkDateEnd_value,)DateEdit_WorkDateEndValue=Convert.7bDateTime(htabteMDateEdit_WorkDateEnd_valueM.IbString()?if(htable.Contains(,DropDown_Lme_value,t)pr

25、otectedvoidBindGridViaS0SSion()stringuri=Request.Ur1.AbsoluteUri.TbLower().Split(newchart?)0;if(Sessionuri=null)return;Hashtablehtable二Session(unasHashtatfe;主Girdif(htableContainsC,GridView_List_page,)GndViewList.PageIndex=Convert.Tblnt32(htable,GndView_ListM.ToStnng();if(htableContainsC,GridView_Li

26、st_indexM)/GridView_ExceptionBill.FocusedRowlndex=Convert.Idlnt32(htaWe(HGndView_ExceptionBilUndexM.ToString()GndViewList.Selection.SelectRow(Convert.Iblnt32(htableuGndViev/ListjndexM.ToString();;綁定子Gridif(htabteContainsCGndViGW_List_selGctQdlD)BindDetailGrid(htablerGridView_List_setectedlDMTbString

27、O);if(htabteContainsCGndSCYCjage)Grid_SCYC.Pagelndex=Convert.7blnt32(htableMGrid_SCYC_pageM.7bString();if(htabteContamsCGnd_SCYCJndex)/GridView_ExceptionBillFocusedRowIndexConvertTblnt32(htaNe,GridView_ExceptionBillJndex,lbStringO);Grid_SCYC.SGtectionSGlectRov/(ConvQrtTblnt32(htabter,Gnd_SCYC_indGXR

28、TbStringf);if(htableContainsCGrid_FeedBack_pagen)Grid_FeedBack.PageliKiex=Convert.Iblnl32(htablerGrid_FeedBackj)ageHJ.ToString();if(htabteContains(,Grid_FGGdBackjndexM)根據(jù)URL從Session中取信息,賦給具體的控件。3.2Tree與基本控件操作凱領系統(tǒng)的Tree與基本控件操作是采用DevExpressDXpenence12.1來實現(xiàn)的。3.2.1注意事項卜拉列表使用ASPxComboBox來實現(xiàn)。局部刷新使用.NET自帶的U

29、pdatePanel實現(xiàn)。Tree結構使用ASPxTreeList實現(xiàn)貝體代碼見TieeDemo.aspx3.2.2代碼范例Tree數(shù)據(jù)綁定Tree數(shù)據(jù)的綁定往往在數(shù)據(jù)表中是以二維表的結構存儲,控件本身會自動折疊數(shù)據(jù)。如果這個Tree與別的控件有數(shù)據(jù)的聯(lián)系,則可能需要遞歸的綁定數(shù)據(jù)。參照代碼:(TieeDemo.aspx下同)】privatevoidBindTree()KLsys.BLLCSJ_Departmentdepartment=newKLsys.BLL.JCSJ_Deparlment(),DataSetds二department.GetList(H1-1w);DataViewdv二ne

30、wDataView();ds7ables0ColumnsAddCSoriCor,typeof(decimal),foreach(DataRowdrindslables0Rows)trydrrSortCor=Convert.lbDecimal(drriD,.lbString();/ds.lablesIOJ.ColumnsriD.Datalype=Type.GetType(nSystem.lnt32n);dv.lable=ds.7ables0;dv.Sort=SortColasc;Tree_Dept.DataSource=dv;Tree_Dept.DataBind();在Tree的前臺V!部門樹開

31、始一通過這兩個屬性來絕對樹的樣子。與Tree的數(shù)據(jù)關聯(lián)要想在Tie亡選擇行改變的時候,同時改變其他的控件,需要使用FocusedNodeChanged件與設置幾個屬性。、!一邙1Jf7T5ti1ILxpanoGQiiapsgACTion=su/iieniiaetvemsrocuseaioaeunangea-runciibn(5e)后臺事件,需要遞歸的獲取Nock的子NodeprotectedvoidTree_Dept_FocusedNodeChanged(objectsender,EventArgse)if(Tree_Dept.FocusedNode1=null)_Sessionrkeyl=(

32、Stnng)Tree_Dept.FocusedNodeDeptNOw;BindGridView();1A_-Jc_:ClfiprivatevoidBindGridView()StringBuildercondition二newStringBuilderO,conditionAppendf(DeptNOisnull)OR(1=1M);理縝if(thisbropDownList_WorkTypeSetectedlndex匕0&thisDropDownLisl_WorkTypeSelectedlndex-1)condrtion.AppendFomiat(MANDTypelD=M+thi5.DropD

33、ownLisl_WorkType.Setectedltem.Value.7bStnng()+elsecondition.AppendFormatCAnd1=1”);if(this.DropDownList_Grade.SelectedIndex!二0&this.DropDownLisLGrade.SelectedIndex!=-1)region根據(jù)樹形節(jié)點獲取所選部門StnngBuildersb_where=nowString8uilder();if(Sessionlkey1*!=null)(Listids=newList();idsAto(SessionPkeyLTbStringO);|ce

34、tsiiorenuepMKls,essionrkey”.lbString(),newKLsys.BLLCSJ_DepartmentOGetAllList();feblesO);Slring8uilderstr_ids=newStnngBuilder();foreach(Stringstrjdinids)strJds.Append(,MW+str.id+w,n);)Stringdeptids=strJds.fbStringO;deptids=deptidsSubstring(O,deptidsLength-1);sb_where.AppendCDeptN0in(”*deptids,”)”);KL

35、sys.BLL.JCSJ.DepartmentbILdepartment=newKLsys.BLL.JCSJ_DepartmentO;HiXHXaroriEaCd&liciQ5水a(chǎn)rqToQlrirr/XToRlacrlAl*privatevoidGetChildrenDept(Listvstingids,stringdeptid,Datalabledt_dept)DataRowrowdept=dt_deptSelect(t,ParentDeptNO=,F,+deptid+,m,);foreach(DataRow_rowdeptinrowdept)ids.AddCrowdeptt,DeptNO

36、t,.7bString();GetChildrenDept(ids,_owdept”DeptNCr/R)Sting(),dt_dept);DropDown控件DropDown控件在前臺的設置:tdstyle=*width:78pxcl8ss=%exttd憐在后臺的綁定數(shù)據(jù):jwr*2jyW2.W./圾銀KLsys.BLL.JCSJ_1eamblljeam=newKLsys.BLL.JCSJ_leam(),DataSetdsjeam=bllJeam.GetAIIListO;tliis.DropDov/nLisLleamNO.DataSource=dsjeam.this.DropDov/nLisL

37、lGamNO.10 xtFiGld=IfeamNamy;this.DropDov/nLisLleamN0ValueField=TeamNO;this.DropDov/nLisLleamN0DataBind();this.DropDownList_feamN01terns.lnsert(OrnewDevExpressWebASPxEditors.ListEditlteniCgT-r);DropDownList_TeamNOSelectedlndex=0;可在第一行加上“請選擇”這個Itenio局部刷新在前臺,(前面必須有一個ScnptManager)聲明:匚IVCIKIL/在前臺,(前面必須有一

38、個ScnptManager)聲明:匚IVCIKIL/IIIIIVIU57IILIIIIIIQIIjj-.IvContentlemplate1-1IsIsvdivid二”main-diV、v/divCIto在ContentTemplate括起來的部分里面,發(fā)生的全局方法會變成局部刷新(這個時候,后臺的彈框事件和response.wiite有關的方法均不能使用)頁面內彈框頁面內彈框使用一個runat=”server”的drv實現(xiàn),在后臺控制他的visualable屬性,通過div內部的按鈕事件將結果傳遞給其他控件。見PopDemo.aspx在前臺,(前面必須有一個ScnptManager)聲明:控

39、制人小通過css控制。7U1U舊選擇生產(chǎn)綢divclass二pop_body”A坊線:dxASPxComboBoxID=*DropOown_Line_Target_CLMrunat=*servernWidth=M141px*DropDownStyle=MDropDoasp:ButtonID=Button10Mrun戲二PorvQr”lbxt=”取消class=*inputbuttonMOnClick=ButtonBackClick*與普通的寫法無異,不過是講東西都嵌套進div中。后臺:protectedvoidButton_Back_CIick(objectsender,EventArgse)

40、口選擇生產(chǎn)線第一個函數(shù)是控制div的消失visualable=false卜面的就是函數(shù)里而具體的爭件。3.3報表打印簡單的報表打印直接使用控件自帶的ASPxGndViewExporter即町,對于復雜的打印,要在現(xiàn)有的Excel中找到模版,然后根據(jù)列將數(shù)值填進去。3.3.1注意事項打印往往是公共方法,所以應該做成static事件,放在App_Code文件夾中。332代碼范例簡單的打印利用控件自帶的打印。參照代碼:(TreeSimpleDemo.aspx下同)前臺:I冃Hii后臺的打印事件:protectedvoidBtn_Pint_Click(objectsender,EventArgse)-

41、ASPxGridViewExporter1.GridViewlD=,GridView_Category,;ASPxGid/iewExporte1.VViteXlslbResponse(”9:);復雜表單的打印首先是打印的公共方法,在App.Code的PublicPmit中,代碼如下iIIIillHipublicstaticvoidPrintXLJD(stringid.System.Web.UI.Pagepage)KLsys.BLLYC_AbnomalEmployeeblAbnormalE=newKLsys.BLL.YC_AbnomalEmployee():DataSetds二blLAbnormalE.GetAbnormalBill(id),Excel.Applic創(chuàng)ionClassMyexcel二newExcel.ApplicationCI芻ss();|IntPtrt=nev/lntPtr(f71yexcel.Hwnd),|n(p/iyexcei=nun;MessageBoxShov/(pagerEXCEL無法啟動r);return;進程句扁矗義得是為了以后可以殺掉進程,不然服務器會殘留很多Excel的進程。/傾轆st

溫馨提示

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

評論

0/150

提交評論