private void btnShiftPattern_Click(object sender, System.EventArgs e) { const string METHOD_NAME = THIS + ".btnShiftPattern_Click()"; try { ShiftPattern frmShiftPattern = new ShiftPattern(); frmShiftPattern.ShowDialog(this); } catch (PCSException ex) { PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error); try { Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } catch (Exception ex) { PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error); try { Logger.LogMessage(ex, METHOD_NAME, Level.ERROR); } catch { PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error); } } }
private void CreateNewShiftPatterns(ShiftModel model) { int daysInPattern = model.DaysInPattern.Value; //Default Start Time: 00:00:00 and EndTime: 23:59:59 TimeSpan startTime = new TimeSpan(0, 0, 0); TimeSpan endTime = new TimeSpan(23, 59, 59); for (int i = 0; i < daysInPattern; i++) { var shiftPattern = new ShiftPattern { Sequence = i + 1, ShiftId = model.Id, StartTime = DateTime.Now + startTime, EndTime = DateTime.Now + endTime }; this._shiftPatternRepository.Insert(shiftPattern); } this._dbContext.SaveChanges(); }
public Transmission() { configuration = new ShifterTableConfiguration(ShifterTableConfigurationDefault.PeakRpm, Main.Drivetrain, 20, 0); LoadShiftPattern("up_1thr", "normal"); LoadShiftPattern("up_0thr", "normal"); LoadShiftPattern("down_1thr", "normal"); LoadShiftPattern("down_0thr", "normal"); // Add power shift pattern var powerShiftPattern = new ShiftPattern(); powerShiftPattern.Frames.Add(new ShiftPatternFrame(0, 1, false, false, true)); powerShiftPattern.Frames.Add(new ShiftPatternFrame(0, 1, false, false, false)); powerShiftPattern.Frames.Add(new ShiftPatternFrame(0, 1, false, false, true)); powerShiftPattern.Frames.Add(new ShiftPatternFrame(1, 0.5, true, false, true)); powerShiftPattern.Frames.Add(new ShiftPatternFrame(1, 0.5, true, false, true)); ShiftPatterns.Add("PowerShift", powerShiftPattern); // Initialize all shfiting stuff. Shift(0, 1, "up_1thr"); Enabled = true; IsShifting = false; }