Seller

xiaoxiao2021-03-06  87

Imports cyberrs2.csms.common

Imports cyberrs2.csms.dataaccess

Imports cyberrs2.csms.entity

Imports cyberrs2.csms.facade

Namespace Page.Management.Seller

'Class Name: SELLER_MT

'Purpose:

'Description:

'Builder: Stevenhuang, 10/21/2004

'MODICICICATION:

'Be Reference: N / A

'Remark:

'Version:

Public Class SELLER_MT

Inherits System.Web.ui.page

#REGON "Web Form 砞璸  ㄣ ネ  祘 祘 α"

' Web Form 砞璸  ㄣ ┮ 惠 ㊣

private subinitializecomponent ()

End Sub

Protected withevents btnnew as system.Web.ui.WebControls.ImageButton

Protected withevents btnok as system.web.ui.webcontrols.imagebutton

Protected Withevents Btncel as System.Web.ui.WebControls.ImageButton

Protected Withevents InputArea as system.web.ui.htmlcontrols.htmlGenericControl

Protected withevents txtcname as system.Web.ui.WebControls.TextBox

Protected Withevents RBTMAN As System.Web.ui.WebControls.Radiobutton

Protected Withevents RBTWOMAN As System.Web.ui.WebControls.radiobutton

Protected withevents txtMobile as system.Web.ui.WebControls.TextBox

Protected Withevents TXTemail As System.Web.ui.WebControls.TextBox

Protected Withevents txttelzone as system.Web.ui.WebControls.TextBox

Protected withevents txttelno as system.Web.ui.WebControls.TextBox

Protected Withevents Txttelsubno as system.Web.ui.WebControls.TextBox

Protected withevents ddlcompanyname as system.Web.ui.WebControls.dropdownList

Protected withevents ddlqrycompanyname as system.Web.ui.WebControls.dropdownList

Protected withevents txtsale as system.Web.ui.WebControls.textbox

Protected withevents rbtsalescode as system.Web.ui.WebControls.RadiobuttonProtected withevents rbtsausname as system.Web.ui.WebControls.Radiobutton

Protected withevents btnqry as system.Web.ui.WebControls.ImageButton

Protected Withevents DTGSellers as system.Web.ui.WebControls.DataGrid

Protected Withevents DataGridArea as system.web.ui.htmlcontrols.htmlGenericControl

'猔 猔:  箇  伫  琌 Web Form 砞璸  ㄣ 璶   ヘ 

'づ づ  埃 ┪ ┪ ウ  

Private DesignerPlaceHolderDeclaration as System.Object

Private sub page_init (byval sender as system.object, byval e as system.eventargs) Handles mybase.init

'Codegen:  Web Form 砞璸  ㄣ ┮ 惠  よ 猭 ㊣

'づ づ ㄏノ祘 α α 绁絪 胯 э э

InitializeComponent ()

End Sub

#End region

Private Sub Page_Load (Byvale AS System.Object, Byval E AS System.Eventargs) Handles MyBase.Load

' 硂 硂  伫ㄏノ  祘 α 绁 绁 ﹍ て  

'Make the page expire immediately

Response.cache.setcacheability (httpcacheability.nocache)

IF not ispostback.

If Authorization.Pass (me) = false kil

'Authorization Faled

Page.Response.Redirect ("login.aspx")

Else

'Authorization SUCCESS

'Company_Name DataBind ()

DataSourceGenerator.SetDelegatedataDataSource (me.ddlqrycompanyname.Items)

DataSourceGenerator.SetDelegatedataDataSource (me.ddlcompanyname.Items)

'Set Edit Area

SELECT CASE Page.Request.QueryString ("Action")

Case "show"

Showdata (Page.Request.QueryString ("ID"))

'Set readonly

SetPageState (false)

Case Else

InputArea.visible = false

End SELECT

END IF

Else

END IF

End Sub

'Refresh the DataGrid's Data

Private sub DataGridbind (optional byval pageIndex as int32 = 0)

DIM SELLERACCESS AS New Biz_SELLERFACADE

DIM SELLERS AS New Biz_SELLERCOLLECTION

DataSourceGenerator.SetDelegatedataDataSource (me.ddlcompanyname.Items) 'ViewState = query

If ViewState.Item ("Seller_Status") = "query" then

Dim Str As String

SELLERACCESS.GETALLSELLERS (SELLERS)

If me.ddlqrycompanyname.selectedIndex <> 0 THEN

Str = "Company_NAME = '" & me.ddlqrycompanyname.selectedItem.text & "'"

END IF

If me.rtsalescode.checked = true and me.txtsale.text <> "" "" "

IF str <> "" "

Str & = "and pk_salescode = '" & me.txtsale.text & "'"

Else

Str = "pk_salescode = '" & me.txtsale.text & "'"

END IF

Elseif me.rtsalesname.checked = true and me.txtsale.text <> "" "

IF str <> "" "

Str & = "and seller_cname = '" & me.txtsale.text & "'"

Else

Str = "SELLER_CNAME = '" & me.txtsale.text & "'"

END IF

END IF

SELLERS.DEFAULTVIEW.ROWFILTER = STR

Me.dgsellers.DataSource = SELLERS.DEFAULTVIEW

Me.dgsellers.currentPageIndex = PageIndex

ViewState.Add ("PageIndex", PageIndex)

Me.dtgsellers.Database

Session.Add ("Sellers", SELLERS)

END IF

'ViewState = view

If ViewState.Item ("Seller_Status") = "show" then

SELLERS = session.item ("sellers")

Me.dtgsellers.DataSource = SELLERS

Me.dgsellers.currentPageIndex = PageIndex

ViewState.Add ("PageIndex", PageIndex)

Me.dtgsellers.Database

END IF

'ViewState = add

If ViewState.Item ("Seller_Status") = "Seller_Status") = "Edit" or viewState.Item ("Seller_Status") = "delete" TENSELLERACCESS.GETALLSELLERS (SELLERS)

Me.dtgsellers.DataSource = SELLERS

Me.dgsellers.currentPageIndex = PageIndex

ViewState.Add ("PageIndex", PageIndex)

Me.dtgsellers.Database

END IF

'If dtgsellers.datasource is nothing then

'Me.datagridarea.visible = false

'End if

End Sub

'Show Data in Page According to the Given Salescode

Private Sub showdata (Byval ID as string)

DIM SELLERACCESS AS New Biz_SELLERFACADE

DIM SELLER AS New Biz_SELLER

DIM CompanyAccess as new biz_companyfacade

DIM Company AS New Biz_company

ViewState.Item ("Seller_Status") = "show"

Me.DataGridbind ()

SELLER.PK_SALESCODE = ID

SELLERACCESS.Getaseller (SELLER)

DataSourceGenerator.setSelectedIndex (me.ddlcompanyname, SELLER.FK_COMPANY_ID)

'Save Seller Into Session (when Edit Need)

Session.Add ("Seller", SELLER)

With Seller

Me.txtcname.text = SELLER.SELLER_CNAME

If Seller.Gender = 0 THEN

Me. RBTman.checked = true

Else

Me.rtwoman.checked = true

END IF

Me.txtTelzone.text = SELLER.TELEPHONE_ZONE

Me.txtTelno.text = SELLER.TELEPHONE_NO

Me.txtTelsubno.text = SELLER.TELEPHONE_EXTNO

Me.txtMobile.Text = SELLER.MOBILE

Me.txTemail.Text = SELLER.EMAIL

End with

InputArea.visible = TRUE

End Sub

#Region "Button"

Private sub btnnew_click (byvalgend, byval e as system.Web.ui.ImageClickeventargs) handles btnnew.click

'Clear

Me.txtcname.text = ""

Me.ddlcompanyname.selectedIndex = 0

ME.RBTMAN.CHECKED = true.rtwoman.checked = false

Me.txtTelzone.text = ""

Me.txtTelno.text = ""

Me.txtTelsubno.text = ""

Me.txtMobile.Text = ""

Me.txTemail.Text = ""

SetPagestate (TRUE)

InputArea.visible = TRUE

ViewState.Item ("Seller_Status") = "add"

End Sub

PRIVATE SUB BTNCANCEL_CLICK (Byval e as system.Object, byval e as system.Web.ui.ImageClickeventargs) Handles Btncel.click

InputArea.visible = false

End Sub

Private sub btnok_click (byval sender as system.object, byval e as system.Web.ui.ImageClicKeventargs) Handles btnok.click

DIM SELLER AS BIZ_SELLER

DIM SELLERACCESS AS New Biz_SELLERFACADE

If ViewState.Item ("Seller_Status") = "Edit" Then

'GET SELLER DATA from Session First

SELLER = session.item ("Seller")

Else

'ViewState = "add"

'Get a new instance

SELLER = New Biz_SELLER

END IF

'Set Table Seller Property Value

With Seller

SELLER.SELLER_CNAME = Me.txtcname.text

SELLER.FK_COMPANY_ID = me.ddlcompanyname.selectedValue

If me.rtman.checked = true kil

SELLER.GENDER = 0

Else

SELLER.GENDER = 1

END IF

SELLER.TELEPHONE_ZONE = Me.txtTelzone.Text

SELLER.TELEPHONE_NO = Me.txtTelno.Text

SELLER.TELEPHONE_EXTNO = Me.txtTelsubno.text

SELLER.MOBILE = Me.txtMobile.Text

SELLER.EMAIL = Me.txTemail.Text

SELLER.FLAG = 1

If ViewState.Item ("Seller_Status") = "Edit" Then

.UPD_ID = "Steven"

If SELLERACCESS.UPDATEASELLER (SELLER) = edataaccessstate.Normal Then

Alertscript.showalert (ME, ", Alertscript.ModifySUCCESS)

Else

Alertscript.showalert (ME, ", Alertscript.Mestage.ModifyFailed) Endiff

Else

'add a new sale to the biz_seller Table

'' '' 'DIM Serialnumbercess As New CMN_SERIALNUMBERFACADE

'' '' 'DIM Serialnumber AS New CMN_SERIALNUMBER

'' '' 'SerialNumber.pk_system_id = "csms"

'' '' 'SerialNumber.pk_serial_id = "Biz_Seller"

'' '' '' Serialnumbercess.getaserialNumber (SerialNumber)

DIM SELLERS AS New Biz_SELLERCOLLECTION

SELLERACCESS.GETALLSELLERSFALGEQUAL0OR1 (SELLERS)

DIM filter as string = "fk_company_id = '" & seller.fk_company_id & "'"

DIM STRMAXSASCODE AS STRING = SELLERS.Compute ("Max (pk_salescode", filter)

.pk_salescode = strmaxsalescode.substring (0, 3) me.generetescode.substring (3, 3))

.Create_id = "steven"

'SerialNumber.Serial_Number = me.genereSalescode (SerialNumber.Serial_Number)

If SELLERACCESS.ADDaseller (SELLER) = edataaccessstate.normal dam

Alertscript.showalert (ME, ", Alertscript.Message.AddsuCcess)

Else

Alertscript.showalert (ME, ", Alertscript.Message.Addfailed)

END IF

END IF

End with

'Refresh Data

DataGridbind (ViewState.Item ("PageIndex"))

'Hide Edit Area

InputArea.visible = false

End Sub

Private sub btnqry_click (Byval e as system.Object, byval e as system.Web.ui.ImageClicKeventargs) Handles btnqry.click

'Hide Edit Area

InputArea.visible = false

ViewState.Item ("Seller_Status") = "query"

Me.DataGridbind ()

End Sub

#End region

#Region "Dategrid"

Private Sub dtgSellers_PageIndexChanged (ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dtgSellers.PageIndexChangedDataGridBind (e.NewPageIndex)

End Sub

Private sub DTGSELLERS_ITEMDATABOUND (Byval e as system.Web.ui.WebControls.DataGriditeMeventAndargs) Handles DTGSELLERS.ItemDatabase

'Ignore the colorn title

IF E.Item.ItemIndex <> -1 Then

E.Item.cells (0) .text = E.Item.itemindex 1

'Add Delete Confirm

DIM btn as imagebutton = E.Item.cells (6) .findcontrol ("btndelete")

Btn.attributes.add ("Onclick", "JavaScript: Return Confirm ('絋) 璶    盾?');")

END IF

End Sub

Private sub DTGSELLERS_EDITCOMMAND (Byval e as system.Web.ui.WebControls.DataGridCommandeventArgs) Handles DTGSELLES.EDITCOMMAND

Dim link as hyperlink = E.Item.cells (1) .FindControl ("lnkseller")

Showdata (Link.Text)

SetPagestate (TRUE)

ViewState.Item ("Seller_Status") = "Edit"

End Sub

Private sub DTGSELLERS_DELETECMMAD (Byval e as system.Web.ui.WebControls.DataGridCommandeventArgs) Handles DTGSELLERS.DELETECMMAND

DIM SELLER AS New Biz_SELLER

Dim link as hyperlink = E.Item.cells (1) .FindControl ("lnkseller")

SELLER.PK_SALESCODE = LINK.TEXT

DIM SELLERACCESS AS New Biz_SELLERFACADE

If SELLERACCESS.Removeaseller (SELLER) = edataaccessstate.Normal Then

Alertscript.showalert (ME, ", Alertscript.Message.DeletesUccess)

Else

Alertscript.showalert (ME, ", Alertscript.Message.Deletefailed)

END IF

ViewState.Item ("Seller_Status") = "delete"

'Refresh Data

DataGridbind ()

'Hide Edit Area

InputArea.visible = false

#End region

#Region "Another"

Private function generatescode (Byval Str As String) AS STRING

DIM I as integer

Dim Strsalecode As String

i = integer.parse (STR)

IF i> = 0 and i <9 kil

i = i 1

strsalecode = "00" i.toString

Elseif i> = 10 and i <99 THEN

i = i 1

strsalecode = "0" i.toString

Else

i = i 1

strsalecode = i.toString

END IF

Return strsalecode

END FUNCTION

'Set Edit Area State, Enabled or Disabled

Private sub setpagestate (Byval Editenabled as Boolean)

Me.txtcname.readonly = NOT EditNabled

Me.txtcname.cssclass = convertor.setStatecss (txtcname.cssclass, editenable)

Me.ddlcompanyname.enabled = editenabled

Me.ddlcompanyname.cssclass = convertor.SetStatecss (me.ddlcompanyname.cssclass, editenable)

ME.RBTMAN.Enabled = Editenabled

ME.RBTWOMAN.Enabled = EditNabled

Me.txtTelzone.Readonly = NOT EditNabled

Me.txtTelzone.cssClass = Convertor.SetStatecss (txttelzone.cssclass, editenable)

Me.txtTelno.readonly = not Editenabled

Me.txttelno.cssclass = convertor.setStatecss (txttelno.cssclass, editenable)

Me.txttelsubno.readonly = not editenabled

Me.txttelsubno.cssclass = convertor.setStatecss (txttelsubno.cssclass, editenable)

Me.txtMobile.readOnly = NOT EditNabled

Me.txtMobile.cssClass = Convertor.SetStatecss (txtMobile.cssclass, editenable)

Me.txtemail.readonly = not editenabled

Me.txtemail.cssclass = convertor.setStatecss (txtemail.cssclass, editenable)

Me.btnok.visible = editenabled

End Sub

Private sub rbtman_checkedchanged (Byval e as system.EventArgs) Handles RBTMAN.CHECKEDCHANGEDIF me.RBTMAN.CHECKED = TRUE THEN

ME.RBTWOMAN.CHECKED = FALSE

Else

Me.rtwoman.checked = true

END IF

End Sub

Private sub rbtwoman_checkedchanged (byvalgend) Handles RBTWOMAN.CHECKEDCHANGED CHENTARGS

If me.rtwoman.checked = true kil

ME.RBTMAN.CHECKED = FALSE

Else

Me. RBTman.checked = true

END IF

End Sub

Private sub rbtsalescode_checkedchanged (byvale) Handles RBTSASCODE.CHECKEDCHANGED

If me.rtsalescode.checked = true kil

Me.rtsalesname.checked = false

Else

ME.RBTSASAME.CHECKED = TRUE

END IF

End Sub

Private sub rbtsaSname_Checkedchanged (Byval e as system.EventArgs) Handles RBTSASNAME.CHECKEDCHANGED

If me.rtsalesname.checked = true kil

ME.RBTSASCODE.CHECKED = FALSE

Else

Me.rtsalescode.checked = true

END IF

End Sub

#End region

END CLASS

End Namespace

Public Function Getallsellersfalgequal0or1 (Byref SELLERS As Biz_Sellercollection) AS EDATAACCESSTATE

'Lili┮┮ノ綪ノ綪 (Flag <> 0)

Return SELLERS.GETCOLLECTION ("SELECT BIZ_SELLER. *, BIZ_COMPANY.COMPANY_NAME from Biz_SELLER, BIZ_COMPANY WHERE BIZ_SELLER.FK_COMPANY_ID = Biz_company.pk_company_id", Nothing)

END FUNCTION

转载请注明原文地址:https://www.9cbs.com/read-101618.html

New Post(0)