Ejemplo n.º 1
0
        public void InitWindowTimeSheet(string day, string recordId)
        {
            var startDate = ConvertUtils.GetStartDayOfMonth();

            if (DateTime.TryParse(day, out var date))
            {
                hdfStartDateEmployee.Text = date.ToString("dd/MM/yyyy");
                hdfEndDateEmployee.Text   = date.ToString("dd/MM/yyyy");
                cbxDay.Text = date.ToString("dd/MM/yyyy");
                startDate   = date;
            }

            _timeSheetReport = TimeSheetReportController.GetById(Convert.ToInt32(hdfTimeSheetReportId.Text));
            if (_timeSheetReport != null)
            {
                var timeSheet = TimeSheetController.GetTimeSheet(Convert.ToInt32(recordId), startDate, startDate);
                if (timeSheet != null)
                {
                    txtTimeLogs.Text = timeSheet.TimeLogs;
                }
            }
            if (_timeSheetReport.Status == TimeSheetStatus.Locked)
            {
                return;
            }
            gridUpdateTimeSheet.Reload();
            btnDeleteUpdateTimeSheet.Disabled = true;
            wdUpdateTimeSheet.Show();
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Mở bảng công
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnUnlockTimeSheetReportClick(object sender, DirectEventArgs e)
 {
     try
     {
         _timeSheetReport        = TimeSheetReportController.GetById(Convert.ToInt32(hdfTimeSheetReportId.Text));
         _timeSheetReport.Status = TimeSheetStatus.Active;
         TimeSheetReportController.Update(_timeSheetReport);
         ReloadGrid();
     }
     catch (Exception ex)
     {
         Dialog.ShowError(ex.Message);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        private void Update()
        {
            var timeSheetReportModel = TimeSheetReportController.GetById(Convert.ToInt32(hdfTimeSheetReportId.Text));

            if (timeSheetReportModel != null)
            {
                timeSheetReportModel.EditedBy   = CurrentUser.User.UserName;
                timeSheetReportModel.EditedDate = DateTime.Now;
                //edit data
                EditData(timeSheetReportModel);
            }

            TimeSheetReportController.Update(timeSheetReportModel);
            Dialog.ShowNotification("Lưu thành công");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Init setting window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InitWindow(object sender, DirectEventArgs e)
        {
            var param = e.ExtraParams["Id"];

            if (!int.TryParse(param, out var id))
            {
                return;
            }
            if (id > 0)
            {
                // edit
                wdTimeSheet.Title         = @"Sửa bảng chấm công";
                wdTimeSheet.Icon          = Icon.Pencil;
                EmployeeGrid.Disabled     = true;
                cbDepartmentList.Disabled = true;
                btnUpdate.Show();
                btnUpdateNew.Hide();
            }
            else
            {
                // insert
                wdTimeSheet.Title = @"Thêm mới bảng chấm công";
                wdTimeSheet.Icon  = Icon.Add;
                txtName.Reset();
                EmployeeGrid.Disabled     = false;
                cbDepartmentList.Disabled = false;
                btnUpdate.Hide();
                btnUpdateNew.Show();
            }
            hdfTimeSheetReportId.Text = id.ToString();
            if (id > 0)
            {
                var result = TimeSheetReportController.GetById(Convert.ToInt32(hdfTimeSheetReportId.Text));
                if (result != null)
                {
                    txtName.Text = result.Name;
                    dfFromDate.SetValue(result.StartDate);
                    dfToDate.SetValue(result.EndDate);
                }
            }
            // show window
            wdTimeSheet.Show();
        }