Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveDynamicColumnClick(object sender, DirectEventArgs e)
        {
            try
            {
                //Update status schedule create new timeSheet
                var scheduler = SchedulerController.GetByName(SchedulerName);
                if (scheduler != null)
                {
                    scheduler.Status = SchedulerStatus.Ready;
                    var symbol = string.Empty;
                    foreach (var itemRow in chkSelectionModelSymbol.SelectedRows)
                    {
                        symbol += "," + itemRow.RecordID;
                    }

                    if (!string.IsNullOrEmpty(symbol))
                    {
                        scheduler.Arguments = "-column {0} -symbol {1} -payrollId {2}".FormatWith(hdfColumnCode.Text, symbol.TrimStart(','), Convert.ToInt32(hdfPayrollId.Text));

                        SchedulerController.Update(scheduler);
                    }
                }

                //close window
                wdDynamicColumn.Hide();
                hdfColumnCode.Reset();
                cbxColumnCode.Reset();
                hdfPayrollId.Reset();
                cboPayroll.Reset();
                chkSelectionModelSymbol.ClearSelections();
            }
            catch (Exception exception)
            {
                Dialog.Alert(exception.Message);
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Delete_Click(object sender, DirectEventArgs e)
        {
            if (!string.IsNullOrEmpty(hdfChoseMonth.Text) && !string.IsNullOrEmpty(hdfChoseYear.Text))
            {
                if (!string.IsNullOrEmpty(hdfGroupWorkShiftId.Text))
                {
                    var groupWorkShiftId = Convert.ToInt32(hdfGroupWorkShiftId.Text);

                    //get all detail workShift
                    var order        = " [StartDate] ASC ";
                    var lstWorkShift =
                        TimeSheetWorkShiftController.GetAll(null, false, groupWorkShiftId, null, null, null, null, Convert.ToInt32(hdfChoseMonth.Text), Convert.ToInt32(hdfChoseYear.Text), order, null);

                    var listWorkShiftIds = lstWorkShift.Select(ws => ws.Id).ToList();
                    if (listWorkShiftIds.Count > 0)
                    {
                        TimeSheetEventController.DeleteByCondition(listWorkShiftIds, null, null, null, TimeSheetAdjustmentType.Default);
                    }

                    //Update status schedule create new timeSheet
                    var scheduler = SchedulerController.GetByName(Constant.SchedulerTimeSheet);
                    if (scheduler != null)
                    {
                        scheduler.Status    = SchedulerStatus.Ready;
                        scheduler.Arguments = "-m {0} -y {1} -groupWorkShiftId {2}".FormatWith(hdfChoseMonth.Text, hdfChoseYear.Text, hdfGroupWorkShiftId.Text);
                        //update
                        SchedulerController.Update(scheduler);
                    }
                }

                hdfGroupWorkShiftId.Reset();
                wdWindow.Hide();
                //reload
                gpScheduler.Reload();
            }
        }