$PBExportHeader$w_email_cloud.srw forward global type w_email_cloud from window end type type cb_3 from commandbutton within w_email_cloud end type type cb_2 from commandbutton within w_email_cloud end type type cb_1 from commandbutton within w_email_cloud end type type dw_1 from datawindow within w_email_cloud end type type s_email_cloudmx from structure within w_email_cloud end type end forward type s_email_cloudmx from structure string name string url end type global type w_email_cloud from window integer width = 2647 integer height = 852 boolean titlebar = true string title = "云盘附件" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true cb_3 cb_3 cb_2 cb_2 cb_1 cb_1 dw_1 dw_1 end type global w_email_cloud w_email_cloud type variables boolean dw_edit_mode Long it_MXBT = 0 private: s_email_cloudmx ss_email_cloudmx[] s_email_cloudmx sss_email_cloudmx end variables forward prototypes public subroutine wf_lock_child () public subroutine wf_face () public function integer acceptmx (string arg_name, string arg_url, ref string arg_msg) public function integer save (ref string arg_msg) end prototypes public subroutine wf_lock_child ();integer LS_INT IF dw_edit_mode THEN FOR LS_INT=1 TO 4 dw_1.SetTabOrder (LS_INT,LS_INT*10 ) dw_1.SetTabOrder (LS_INT,LS_INT*10 ) NEXT ELSE FOR LS_INT=1 TO 50 dw_1.SetTabOrder (LS_INT, 0) dw_1.SetTabOrder (LS_INT, 0) NEXT END IF end subroutine public subroutine wf_face ();IF dw_edit_mode THEN cb_2.Text = "保存" cb_1.Enabled = True cb_3.Enabled = True ELSE cb_2.Text = "修改" cb_1.Enabled = False cb_3.Enabled = False END IF end subroutine public function integer acceptmx (string arg_name, string arg_url, ref string arg_msg);Int rslt = 1 Long cnt = 0,LS_i,ls_j IF IsNull(arg_name) THEN arg_name = '' IF IsNull(arg_url) THEN arg_url = '' IF Trim(arg_name) = '' THEN rslt = 0 arG_MSG = '名称不能为空' GOTO ext END IF IF Trim(arg_url) = '' THEN rslt = 0 arG_MSG = '地址不能为空' GOTO ext END IF //写入内容 it_mxbt++ ss_email_cloudmx[it_mxbt].name = arg_name ss_email_cloudmx[it_mxbt].url = arg_url ext: IF rslt = 0 THEN it_mxbt = 0 END IF Return(rslt) end function public function integer save (ref string arg_msg);Integer rslt = 1,cnt = 0,i,j,k DateTime server_dt Long ll_billid String ls_sccode DELETE From u_email_cloud; IF sqlca.SQLCode <> 0 THEN rslt = 0 arG_MSG = "删除旧有明细操作失败"+"~n"+sqlca.SQLErrText ROLLBACK Using sqlca; GOTO ext END IF FOR i = 1 To it_mxbt ll_billid = f_sys_scidentity(0,"u_email_cloud","id",arG_MSG,True,id_sqlca) //数据commit事务) IF ll_billid <= 0 THEN rslt = 0 GOTO ext END IF INSERT INTO u_email_cloud ( id, name, url) VALUES (:ll_billid, :ss_email_cloudmx[i].name, :ss_email_cloudmx[i].url ) Using sqlca; IF sqlca.SQLCode <> 0 THEN ll_billid = 0 //还原billID rslt = 0 arG_MSG = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText ROLLBACK Using sqlca; GOTO ext END IF NEXT ext: // IF rslt = 0 THEN it_mxbt = 0 ROLLBACK Using sqlca; ELSEIF rslt = 1 THEN COMMIT Using sqlca; END IF Return(rslt) end function on w_email_cloud.create this.cb_3=create cb_3 this.cb_2=create cb_2 this.cb_1=create cb_1 this.dw_1=create dw_1 this.Control[]={this.cb_3,& this.cb_2,& this.cb_1,& this.dw_1} end on on w_email_cloud.destroy destroy(this.cb_3) destroy(this.cb_2) destroy(this.cb_1) destroy(this.dw_1) end on event open;dw_1.SetTransObject(sqlca) wf_face() dw_1.retrieve() end event event close;closewithreturn(this, sss_email_cloudmx) end event type cb_3 from commandbutton within w_email_cloud integer x = 1701 integer y = 640 integer width = 457 integer height = 116 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "删行" end type event clicked;long ll_row ll_row=dw_1.getrow() if ll_row<=0 then return dw_1.deleterow(ll_row) end event type cb_2 from commandbutton within w_email_cloud integer x = 667 integer y = 640 integer width = 457 integer height = 116 integer taborder = 30 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "保存" end type event clicked;Integer i String arg_msg IF dw_edit_mode THEN dw_1.AcceptText() FOR i = 1 To dw_1.RowCount() // IF dw_1.Object.Name[i] <> "" THEN IF acceptmx(dw_1.Object.Name[i],& dw_1.Object.url[i],& arg_msg) = 0 THEN MessageBox('Error!',arg_msg) RETURN END IF // END IF NEXT IF Save(arg_msg) = 0 THEN MessageBox('Error!',arg_msg) RETURN END IF MessageBox(publ_operator,'保存操作成功!') END IF dw_edit_mode = Not dw_edit_mode wf_lock_child() wf_face() end event type cb_1 from commandbutton within w_email_cloud integer x = 1179 integer y = 640 integer width = 457 integer height = 116 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "增行" end type event clicked;dw_1.insertrow(0) end event type dw_1 from datawindow within w_email_cloud integer x = 5 integer y = 8 integer width = 2624 integer height = 592 integer taborder = 10 string title = "none" string dataobject = "dw_fj_cloud" boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked;THIS.SelectRow(0,FALSE) THIS.SelectRow(row,TRUE) end event event doubleclicked;sss_email_cloudmx.name=dw_1.object.name[row] sss_email_cloudmx.url=dw_1.object.url[row] close(parent) end event