77777

xiaoxiao2021-03-06  61

Imports CyberRS2.APS.BusinessFacadeImports CyberRS2.APS.ModelImports CyberRS2.APS.SysCommonImports cyberrs2.APS.BusinessFacade.HolidayFacade Public Class ManageHolidaySet Inherits System.Web.UI.Page Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar Protected WithEvents TD1 As System.Web.UI.HtmlControls.HtmlTableCell Protected WithEvents TD2 As System.Web.UI.HtmlControls.HtmlTableCell Protected WithEvents TD3 As System.Web.UI.HtmlControls.HtmlTableCell Protected WithEvents TD4 As System.Web.UI.HtmlControls.HtmlTableCell Protected WithEvents ddlYear As System.Web.UI.WebControls.DropDownList Protected WithEvents ddlMonth As System.Web.UI.WebControls.DropDownList Protected WithEvents btn_sure1 As System.Web.UI.WebControls.ImageButton Protected WithEvents btn_dfhdset1 As System.Web.UI.WebControls. ImageButton protected withevents btn_restore1 as system.Web.ui.WebControls.ImageButton #Region "Web Form Designer Generated Code" This call is required for web form designer. Private Sub InitializeComponent () End Sub Private Sub Page_Init (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method is called the Web Form Designer Required 'Don't modify it using the code editor.

InitializeComponent () End Sub #End Region Private holiday As String = "" Dim defarray () As String Private dt As New DataTable () Dim flag As Integer Private Sub Page_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mybase.load 'Place the initialization page here UM INTYEAR AS INTEGER DIM INTMONTBACK THENINTYEAR = now.Year () intmonth = now.mont ()' '' '' '' ' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '''X = Me.ddlyear.items.indexof (Me.ddlyear.Items. FindByValue (intYear.tostring)) me.ddlmonth.selectedIndIndex = me.ddlmonth.items.indexof (me.ddlmonth.Items.FindByvalue (intmonth.tostring)) '' '' '' '' '' '' '' ' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' Declare Datacolumn and DataRow Variables. Dim MyDatacolumn As Datacolumn Dim MyDatarow AS Datarow 'Create New Datacolumn, SET DATATY PE, columnname and add to datatable. mydatacolumn = new datacolumn () mydatacolumn.DataType = system.type.gettype ("system.string") mydatacolumn.columnname = "year"

dt.Columns.Add (myDataColumn) 'Create second column. myDataColumn = New DataColumn () myDataColumn.DataType = Type.GetType ( "System.String") myDataColumn.ColumnName = "Month" dt.Columns.Add (myDataColumn)' Create three column. myDataColumn = New DataColumn () myDataColumn.DataType = Type.GetType ( "System.String") myDataColumn.ColumnName = "Day" dt.Columns.Add (myDataColumn) 'Create four column. myDataColumn = New DataColumn () myDataColumn .DATATYPE = type.gettype ("system.string") mydatacolumn.columnname = "flag" dt.columns.add (myDataColumn) 'Defines a session session ("selectDays") = DT' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' 'End if me.calendar1.selectedDate = Nothing end sub private sub page_prender (Byval e AS Object, ByVal e as system .Eventargs) Handles mybase.prender DT = ctype (Session ("SelectDays"), DATATABLE) '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ''

'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' 'Only realizes if not me.calendar1.selectedDate = Nothing Then when clicking on the date on the calendar DT.NEWROW AS DATAROW AS DT.NEWROW DIM Eachrow AS DATAROW 'Query Sess, whether the date already exists in the session, if the record is deleted; not adding this record in dt.rows' has this Remove it if Eachrow.Item (0) = me.calendar1.selecteddddate.Year and easy.Item (1) = me.calendar1.selectedDate.Mont and easy.item (2) = me.calendar1.selectedDate.day THEN Dt.Rows.Remove ("selectDays") = dt flag = 0 exit sub end if next 'does not have this record to add it new.item (0) = me.calendar1.selectedDate.year new.Item ( 1) = me.calendar1.selectedDate.month newrow.Item (2) = me.calendar1.selectedDate.day Dt.Rows.add (newrow) session ("selectdays") = DT FLAG = 0 end if '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '

'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ': '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' "'' '' '' '' '1.1 page Imports When this month does not set the holiday this month, use the default settings, the session is empty; otherwise use the record in the database, session Record in the database '2.1 When DropDownList changes, it needs to be realized.

When the newly selected month does not set the holiday, use the default settings, the session is constant; otherwise use the record in the database, add the records in the database, such as session, 'Get the current display monthly set IF me.calendar1.selectedDate = Nothing Then Dim selstr As String Dim dtHoliday As DataTable selstr = "select * from sys_holiday where year = '" & Me.ddlYear.SelectedItem.Value & "' and month = '" & Me.ddlMonth.SelectedItem.Value & "'" dtHoliday = HolidayFacade.getMonthholiday (Selstr) DT = CType (Selection ("SelectDays"), DataTable) 'if me.Ismonthchange = TRUE TEN' If there is no holiday setting in the database if DTHOLIDAY.ROWS.COUNT = 0 Then 'gets the default Holiday Settings ', for example, 5,6 holidayfacade.getdefholidy (Holiday)' Generates arrays in the string DEFARRAY = Split (Holiday, ") Flag = 1 End if if Dtholiday.Rows.count <> 0 The IF DT. Rows.count <> DTHOLIDAY.ROWS.COUNT THEN 'If there is a holiday setting in the database, add a holiday in the database to the session. Dim Eachrow As DataRow for Each Eachrow in Dtholiday.Rows () DT.ImportRow (Eachrow) Next Session ("SelectDays") = DT Flag = 0 else session ("selectdays") = DT flag =

0 End If End If End If End Sub Private Sub Calendar1_DayRender (ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender 'If the date is not a day of the month, the date is disabled Enabled, isselectable if me.calendar1.visibledate <> Nothing kilnness.date.mont <> me.calendar1.visibledate.month Then E.DAY.Isselectable = false E.Cell.Nabled = false END IF ELSE IF e.day.date.month <> me.calendar1.todaysdate.montimen e.DAY.InseeLectable = false E.Cell.Enabled = false end if endiff = false end if Endiff.Enabled = false end if Endiff.Enabled = CType ( Session ("SelectDays"), DataTable) 'If there is no holiday setting in the database, get the default holiday setting if flag = 1 THEN DIM STR AS STRING for Each Str in Me.Defarray IF E.DAY.DATE.DAYOFWEEK = Integer.Parse (STR) THEN E.Cell.Forecolor = System.drawing. Color.Red '' first puts the date of the default holiday set in session variables' DIM Newrow as DataRow = DT.NEWROW 'NEWROW.ITEM (0) = E.day.date.Year' newrow.Item (1) = E.day.date.month 'new.datem (2) = e.day.date.day' dt.importrow ("selectDays") = dt end if next 'If there is a holiday setting in the database Record, read the value in session elseif flag = 0 THEN DIM I AS INTEGER DT = CTYPE (Selection ("SelectDays"), DataTable) for i =

0 to dt.Rows.count - 1 if e.day.date.year = dt.Rows.item (i) .Item (0) and e.day.date.month = dt.rows.Item (i) .Item (1) And e.day.date.day = dt.Rows.Item (i) .Item (2) TEN E.Cell.ForeColor = system.drawing.color.red end if next endiff.color.red end if next end c End sub private sub calendar1_selectionchanged ( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged End Sub Private Sub btn_sure1_Click (ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btn_sure1.Click dt = CType ( Session ( "SelectDays"), DataTable) Dim content As String Dim myMsgCode As New CyberRS2.APS.BusinessFacade.MsgCodeFacade () If Integer.Parse (HolidayFacade.ModifyHoliday (dt)) = 1 Then content = myMsgCode.GetMsg ( "MUF11001" Webuiconfig.currentLanguage) Page.RegisterStartupScript (","