Beispiel #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Shift           shift       = new Shift();
            ShiftEditDialog shiftDialog = new ShiftEditDialog(_schedule.ScheduleKey, shift);

            if (DialogResult.OK == shiftDialog.ShowDialog())
            {
                ShiftView.AddNewRow();
                DataRow newRow = ShiftView.GetDataRow(ShiftView.FocusedRowHandle);
                newRow[CAL_SHIFT.FIELD_SHIFT_KEY]  = shift.ShiftKey;
                newRow[CAL_SHIFT.FIELD_SHIFT_NAME] = shift.ShiftName;
                newRow[CAL_SHIFT.FIELD_START_TIME] = shift.StartTime;
                newRow[CAL_SHIFT.FIELD_END_TIME]   = shift.EndTime;
                newRow[CAL_SHIFT.FIELD_OVER_DAY]   = shift.OverDay;
                newRow.EndEdit();
                ShiftView.UpdateCurrentRow();
                ShiftView.ShowEditor();
            }
        }
Beispiel #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            int rowHandle = 0;

            if (ShiftView.FocusedRowHandle < 0)
            {
                MessageService.ShowMessage("${res:FanHai.Hemera.Addin.SelectRemaind}", "${res:Global.SystemInfo}");
            }
            else
            {
                rowHandle = ShiftView.FocusedRowHandle;
                Shift shift = new Shift();
                shift.ShiftKey = this.ShiftView.GetRowCellValue(rowHandle, shift_key).ToString();
                ShiftEditDialog shiftDialog = new ShiftEditDialog(_schedule.ScheduleKey, shift);
                if (DialogResult.OK == shiftDialog.ShowDialog())
                {
                    ShiftView.SetRowCellValue(rowHandle, shift_name, shift.ShiftName);
                    ShiftView.SetRowCellValue(rowHandle, start_time, shift.StartTime);
                    ShiftView.SetRowCellValue(rowHandle, end_time, shift.EndTime);
                    ShiftView.SetRowCellValue(rowHandle, over_day, shift.OverDay);
                }
            }
        }