Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Run_OnClick()
- {
- StartActionTimer();
- }
- public void Stop_OnClick()
- {
- StopActionTimer();
- }
- public bool StartActionTimer()
- {
- if (Action.StartTimer())
- {
- LetsGo.Tag = DateTime.Now;
- SRETimer.Enabled = true;
- Stop.Enabled = true;
- Start.Enabled = false;
- }
- else if (Action.CheckRMSActionStatus() == ActionStatus.Running)
- {
- MessageBox.Show("You have an action running. You must stop this action to continue.")
- ActionStop stop = new ActionStop(Action.CurrentAction.ActionID);
- if (stop.ShowDialog() == DialogResult.OK && stop.CurrentData.Save())
- {
- return StartActionTimer();
- }
- }
- return Stop.Enabled;
- }
- public void StopActionTimer()
- {
- Action.StopTimer();
- SRETimer.Enabled = false;
- lblTime.Visible = false;
- lblTime.Tag = null;
- Stop.Enabled = false;
- Start.Enabled = true;
- }
- public void DoAdd()
- {
- if (Action.CheckDBActionStatus() == ActionStatus.Timer || StartActionTimer())
- {
- //continue with the add stuff
- }
- }
- public void DoEdit()
- {
- if (Action.CheckDBActionStatus() == ActionStatus.Timer || StartActionTimer())
- {
- //continue with the edit stuff
- }
- }
- public void DoSave()
- {
- UpdateData();
- currentProject.Validate();
- if (txtActionSummary.Trim().Length == 0)
- {
- currentProject.ErrorList.Add(new Error("ActionSummary", "You need this"));
- }
- if (txtActionNotes.Trim().Length == 0)
- {
- currentProject.ErrorList.Add(new Error("ActionNotes", "You need this"));
- }
- if (currentProject.ErrorList.Count > 0)
- {
- SetErrors(currentProject.ErrorList);
- }
- else
- {
- if(currentProject.Save())
- {
- Action action = new Action();
- action.ProjectID = currentProject.ProjectID;
- action.MenuID = currentProject.MenuID;
- action.Description = txtActionNotes.Text;
- action.Summary = txtActionSummary.Text;
- action.StartTime = DateTime.Now;
- if (lblTime.Tag != null && lblTime.Tag is DateTime)
- {
- action.StartTime = (DateTime)lblTime.Tag;
- }
- action.StopTime = DateTime.Now;
- if (!action.Validate() || !action.Save())
- {
- MessageBox.Show("Error saving action");
- }
- }
- else
- {
- MessageBox.Show("Error saving project")
- }
- StopActionTimer();
- }
- }
Add Comment
Please, Sign In to add comment