123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- $PBExportHeader$w_set_email_move.srw
- forward
- global type w_set_email_move from window
- end type
- type st_2 from statictext within w_set_email_move
- end type
- type st_1 from statictext within w_set_email_move
- end type
- type cb_2 from commandbutton within w_set_email_move
- end type
- type cb_1 from commandbutton within w_set_email_move
- end type
- type ddlb_1 from dropdownlistbox within w_set_email_move
- end type
- type s_box from structure within w_set_email_move
- end type
- end forward
- type s_box from structure
- long boxid
- long parentid
- string boxname
- end type
- global type w_set_email_move from window
- integer width = 1353
- integer height = 416
- boolean titlebar = true
- string title = "设置收件分类"
- boolean controlmenu = true
- windowtype windowtype = response!
- long backcolor = 67108864
- string icon = "AppIcon!"
- boolean center = true
- st_2 st_2
- st_1 st_1
- cb_2 cb_2
- cb_1 cb_1
- ddlb_1 ddlb_1
- end type
- global w_set_email_move w_set_email_move
- type variables
- private:
- s_box ss_box[]
- public:
- s_edit_index_tran ss_tran
- boolean bool_existence=false
- long ll_ex_boxid
- string ls_ex_filter,ls_ex_boxname
- end variables
- forward prototypes
- public function integer wf_init_file ()
- public function string of_globalreplace (string as_source, string as_old, string as_new)
- end prototypes
- public function integer wf_init_file ();
- //游标读收费项目
- //String arry_sql[]
- Integer i
- String ls_boxname,ls_b_string
- DECLARE readitem_sql CURSOR FOR
- SELECT boxid,parentid,boxname
- FROM u_email_box
- WHERE mailid = :ss_tran.b_long AND boxtype = '新邮箱' AND parentid <> 0
- Using sqlca;
-
- OPEN readitem_sql;
- i++
- FETCH readitem_sql Into :ss_box[i].boxid,:ss_box[i].parentid,:ss_box[i].boxname;
- DO WHILE sqlca.SQLCode = 0
- i++
- FETCH readitem_sql Into :ss_box[i].boxid,:ss_box[i].parentid,:ss_box[i].boxname;
- LOOP
- CLOSE readitem_sql;
- FOR i = 1 To UpperBound(ss_box) - 1
- SELECT boxname
- INTO :ls_boxname
- FROM u_email_box
- WHERE boxid = :ss_box[i].parentid
- Using sqlca;
-
- IF ls_boxname = "收件箱" THEN
- ddlb_1.AddItem (ss_box[i].boxname)
- ls_boxname = ""
- END IF
-
- NEXT
- ls_boxname = ""
- ls_b_string = "%" + ss_tran.b_string + "%"
- SELECT boxname,boxid,filter
- INTO :ls_boxname,:ll_ex_boxid,:ls_ex_filter
- FROM u_email_box
- WHERE mailid = :ss_tran.b_long AND filter LIKE : ls_b_string
- Using sqlca;
-
- IF ls_boxname <> "" THEN
- ddlb_1.Text = ls_boxname
- ls_ex_boxname = ls_boxname
- bool_existence = True
- END IF
- RETURN 1
- end function
- public function string of_globalreplace (string as_source, string as_old, string as_new);long ll_oldlen, ll_newlen, ll_pos
- as_source=trim(as_source)
- as_old=trim(as_old)
- ll_pos = Pos(as_source,as_old)
- IF ll_pos > 0 Then
- ll_oldlen = Len(as_old)
- ll_newlen = Len(as_new)
- DO WHILE ll_pos > 0
- as_source = Replace(as_source,ll_pos,ll_oldlen,as_new)
- ll_pos = Pos(as_source,as_old,ll_pos + ll_newlen)
- LOOP
- END IF
- RETURN as_source
- end function
- on w_set_email_move.create
- this.st_2=create st_2
- this.st_1=create st_1
- this.cb_2=create cb_2
- this.cb_1=create cb_1
- this.ddlb_1=create ddlb_1
- this.Control[]={this.st_2,&
- this.st_1,&
- this.cb_2,&
- this.cb_1,&
- this.ddlb_1}
- end on
- on w_set_email_move.destroy
- destroy(this.st_2)
- destroy(this.st_1)
- destroy(this.cb_2)
- destroy(this.cb_1)
- destroy(this.ddlb_1)
- end on
- event open;
- ss_tran = message.powerobjectparm
- st_2.text=ss_tran.b_string
- wf_init_file()
- //messagebox(string(ss_tran.b_long),ss_tran.b_string)
- end event
- type st_2 from statictext within w_set_email_move
- integer x = 46
- integer y = 8
- integer width = 1253
- integer height = 84
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 67108864
- boolean focusrectangle = false
- end type
- type st_1 from statictext within w_set_email_move
- integer x = 46
- integer y = 96
- integer width = 512
- integer height = 84
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 67108864
- string text = "请选择收件文件夹"
- boolean focusrectangle = false
- end type
- type cb_2 from commandbutton within w_set_email_move
- integer x = 791
- integer y = 200
- integer width = 402
- integer height = 104
- integer taborder = 30
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- string text = "取消"
- end type
- event clicked;close(parent)
- end event
- type cb_1 from commandbutton within w_set_email_move
- integer x = 123
- integer y = 204
- integer width = 402
- integer height = 104
- integer taborder = 20
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- string text = "确定"
- end type
- event clicked;String ls_boxname,ls_sqlstring,ls_sqlstring_check,ls_sqlstring_old,ls_sqlstring_old1,ls_sqlstring_new
- Integer i,j, L1,L2,ll_boxid,ll_parentid
- ls_sqlstring = "update u_email_msg set boxid=#new_boxid# where (sendaddress in ( #3s#3e )) and mailtype ='收件'and boxid=#old_boxid#"
- IF Trim(ddlb_1.Text) = "" THEN
- MessageBox("提示","请选择文件夹")
- RETURN
- END IF
- ls_boxname = Trim(ddlb_1.Text)
- IF bool_existence = True And ls_ex_boxname = ls_boxname THEN
- MessageBox("成功","保存规则成功")
- Close(Parent)
- RETURN
- END IF
- IF bool_existence = True And ls_ex_boxname <> ls_boxname THEN //替换原来的邮箱
- Long ll_tmp1,ll_tmp2
- String ls_tmp
- IF MessageBox ("询问","是否确定要替换文件夹!!!由" + ls_ex_boxname +"转为" + ls_boxname,Question!,YesNo! ) = 2 THEN
-
- RETURN
- END IF
- FOR j = 1 To 100
- ll_tmp1 = Pos(ls_ex_filter,"'" + ss_tran.b_string + "'")
- // MessageBox("",String(ll_tmp))
- IF ll_tmp1 <> 0 THEN
- FOR i = ll_tmp1 To 1 Step -1
- IF Mid(ls_ex_filter,i,1) = "," THEN
- ll_tmp2 = i
- EXIT
- END IF
- NEXT //i
- IF ll_tmp2 <> 0 THEN
- ls_tmp = Mid(ls_ex_filter,ll_tmp2 , ll_tmp1 - ll_tmp2 )
- // MessageBox("",String(ls_tmp))
- // MessageBox("",String(ls_ex_filter))
- ls_ex_filter = of_globalreplace(ls_ex_filter, ls_tmp + "'" + ss_tran.b_string + "'" ,"")
- ELSE
- ls_ex_filter = of_globalreplace(ls_ex_filter, ss_tran.b_string ,"")
- END IF
-
- END IF
- NEXT //j
- // MessageBox("",String(ls_ex_filter))
- UPDATE u_email_box Set Filter = :ls_ex_filter,if_Filter = 1 Where boxid = :ll_ex_boxid Using sqlca;
- IF sqlca.SQLCode <> 0 THEN
- MessageBox("错误" , "保存规则失败~n"+sqlca.SQLErrText)
- GOTO ext
- END IF
- END IF
- //更新替换后的邮箱
- FOR i = 1 To UpperBound(ss_box) - 1
- IF ss_box[i].boxname = ls_boxname THEN
- ll_boxid = ss_box[i].boxid
- ll_parentid = ss_box[i].parentid
- EXIT
- END IF
- NEXT
- SELECT Filter Into :ls_sqlstring_check From u_email_box Where boxid = :ll_boxid Using sqlca;
- IF IsNull(ls_sqlstring_check) Or ls_sqlstring_check = "" Or Pos(ls_sqlstring_check,"#3s") <= 0 THEN
- ls_sqlstring_check = ls_sqlstring
- END IF
- L1 = Pos(ls_sqlstring_check,"#3s")
- L2 = Pos(ls_sqlstring_check,"#3e")
- ls_sqlstring_old = Mid(ls_sqlstring_check,L1 + 3 ,L2 - L1 - 3)
- IF Trim(ls_sqlstring_old) = "" THEN
- ls_sqlstring_new = "#3s'" + ss_tran.b_string + "'#3e"
- ls_sqlstring_check = of_globalreplace(ls_sqlstring_check,"#3s" + ls_sqlstring_old + "#3e",ls_sqlstring_new)
- ELSE
- ls_sqlstring_old1 = ls_sqlstring_old
- ls_sqlstring_old = of_globalreplace(ls_sqlstring_old,"sendaddress in"," ")
- ls_sqlstring_old = of_globalreplace(ls_sqlstring_old,"("," ")
- ls_sqlstring_old = of_globalreplace(ls_sqlstring_old,")"," ")
- ls_sqlstring_old = Trim(ls_sqlstring_old)
- ls_sqlstring_new = ls_sqlstring_old + " , " + "'" + ss_tran.b_string + "'"
- ls_sqlstring_check = of_globalreplace(ls_sqlstring_check, ls_sqlstring_old ,ls_sqlstring_new)
- END IF
- ls_sqlstring_check = of_globalreplace(ls_sqlstring_check, Char(13) + Char(10) ,"")
- ls_sqlstring_check = of_globalreplace(ls_sqlstring_check, "#new_boxid#" ,String(ll_boxid))
- ls_sqlstring_check = of_globalreplace(ls_sqlstring_check, "#old_boxid#" ,String(ll_parentid))
- UPDATE u_email_box Set Filter = :ls_sqlstring_check ,if_Filter = 1 Where boxid = :ll_boxid Using sqlca;
- IF sqlca.SQLCode <> 0 THEN
- MessageBox("错误" , "保存规则失败~n"+sqlca.SQLErrText)
- GOTO ext
- END IF
- COMMIT;
- MessageBox("成功","保存规则成功")
- Close(Parent)
- ext:
- end event
- type ddlb_1 from dropdownlistbox within w_set_email_move
- integer x = 617
- integer y = 96
- integer width = 608
- integer height = 700
- integer taborder = 10
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- boolean autohscroll = true
- boolean hscrollbar = true
- boolean vscrollbar = true
- borderstyle borderstyle = stylelowered!
- end type
|