/// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Delete(object sender, DirectEventArgs e)
        {
            var param = e.ExtraParams["Id"];

            // parse id
            if (!int.TryParse(param, out var id) || id <= 0)
            {
                // parse error, show error
                Dialog.ShowError("Có lỗi xảy ra trong quá trình xử lý");
                return;
            }
            // delete timeSheetReport
            TimeSheetReportController.Delete(id);

            // delete timeSheetEmployeeReport
            var timeSheetEmployeeReports = TimeSheetEmployeeReportController.GetAll(null, null, null, id, null, null);

            if (timeSheetEmployeeReports != null)
            {
                foreach (var timeSheetEmployeeReport in timeSheetEmployeeReports)
                {
                    TimeSheetEmployeeReportController.Delete(timeSheetEmployeeReport.Id);
                }
            }
            //reload
            gridTimeSheetList.Reload();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!ExtNet.IsAjaxRequest)
            {
                hdfTimeSheetReportId.Text = Request.QueryString["id"];
                hdfTypeTimeSheet.Text     = Constant.TimesheetTypeTimeSheet;
                hdfDepartments.Text       = string.Join(",", CurrentUser.Departments.Select(d => d.Id));
                if (!string.IsNullOrEmpty(hdfTimeSheetReportId.Text))
                {
                    // get time sheet report
                    _timeSheetReport = TimeSheetReportController.GetById(Convert.ToInt32(hdfTimeSheetReportId.Text));
                    if (_timeSheetReport != null)
                    {
                        // set title for grid
                        gridTimeSheet.Title = _timeSheetReport.Name;
                        // set start date
                        if (_timeSheetReport.StartDate != null)
                        {
                            dfFromDateSearch.MinDate      = (DateTime)_timeSheetReport.StartDate;
                            dfToDateSearch.MinDate        = (DateTime)_timeSheetReport.StartDate;
                            dfFromDateSearch.SelectedDate = (DateTime)_timeSheetReport.StartDate;
                            hdfStartDate.Text             = _timeSheetReport.StartDate.ToString();
                        }
                        // set end date
                        if (_timeSheetReport.EndDate != null)
                        {
                            dfToDateSearch.MinDate      = (DateTime)_timeSheetReport.EndDate;
                            dfToDateSearch.MaxDate      = (DateTime)_timeSheetReport.EndDate;
                            dfToDateSearch.SelectedDate = (DateTime)_timeSheetReport.EndDate;
                            hdfEndDate.Text             = _timeSheetReport.EndDate.ToString();
                        }

                        ReloadGrid();
                    }

                    var timeSheetEmployeeReports = TimeSheetEmployeeReportController.GetAll(null, null, null,
                                                                                            Convert.ToInt32(hdfTimeSheetReportId.Text), null, null);
                    if (timeSheetEmployeeReports != null)
                    {
                        hdfRecordIds.Text = string.Join(",", timeSheetEmployeeReports.Select(tser => tser.RecordId));
                    }
                }

                // init department
                storeDepartment.DataSource = CurrentUser.DepartmentsTree;
                storeDepartment.DataBind();

                // generate dynamic column by day
                AddDayColumnToGrid(dfFromDateSearch.SelectedDate, dfToDateSearch.SelectedDate);
            }
        }