public frmInfoWorkOut(CWorkOut info) { InitializeComponent(); workOut = info; lblWorkOutType.Text = workOut.WorkOutType; lblDescription.Text = workOut.WorkOutQty.ToString() + " " + workOut.WorkOutUnit + " @ " + workOut.Location; timer.Interval = 10000; timer.Start(); timer.Tick += Timer_Tick; }
private void btnAdd_Click(object sender, EventArgs e) { bool CanAddFlag = true; if (CanAddFlag) { CWorkOut newWorkOut = new CWorkOut(); newWorkOut.TagTime = curDate; newWorkOut.WorkOutType = txtWorkOutName.Text; newWorkOut.WorkOutQty = Convert.ToDouble(txtQty.Text); newWorkOut.WorkOutUnit = txtUnit.Text; newWorkOut.Location = txtLocation.Text; G.glb.lstWorkOut.Add(newWorkOut); DrawLog(); Dispose(); } }
public void CallInfoWorkOut(CWorkOut info) { frmInfoWorkOut frmInfoWorkOut = new frmInfoWorkOut(info); frmInfoWorkOut.Show(); }
public void DrawEventController( PictureBox picMap, DateTime date, List <CEvent> events, List <CWorkOut> workOuts, List <CMedicine> medicines, List <CTransaction> transactions, List <CTransaction> budgets, List <CNote> notes) { int left = picMap.Width - 27 > 0 ? picMap.Width - 27 : 0; List <PictureBox> lstPicEvent = new List <PictureBox>(); List <CEvent> lstEvent = events.FindAll(o => o.TagTime.Date == date).ToList(); List <CWorkOut> lstWorkOut = workOuts.FindAll(o => o.TagTime.Date == date).ToList(); List <CMedicine> lstMedicine = medicines.FindAll(o => o.TagTime.Date == date).ToList(); List <CTransaction> lstTransaction = transactions.FindAll(o => o.TagTime.Date == date).ToList(); List <CTransaction> lstBudget = budgets.FindAll(o => o.TagTime.Date == date).ToList(); List <CNote> lstNote = notes.FindAll(o => o.TagTime.Date == date).ToList(); int acc = 0; for (int i = 0; i < lstEvent.Count; i++) { lstPicEvent.Add(new PictureBox()); CEvent eve = lstEvent[i]; if (lstEvent[i].EventState == EEventState.LogEvent) { lstPicEvent[i].Image = icon.iconEvent; } else if (lstEvent[i].EventState == EEventState.Succeed) { lstPicEvent[i].Image = icon.iconSucceedEvent; } else { lstPicEvent[i].Image = icon.iconFailedEvent; } lstPicEvent[i].Top = i * 30 + 3; lstPicEvent[i].Left = left; lstPicEvent[i].Width = 24; lstPicEvent[i].Height = 24; lstPicEvent[i].Click += (e, a) => CallInfoEvent(eve); picMap.Controls.Add(lstPicEvent[i]); } acc = acc + lstEvent.Count; for (int i = 0; i < lstWorkOut.Count; i++) { lstPicEvent.Add(new PictureBox()); CWorkOut workOut = lstWorkOut[i]; lstPicEvent[i + acc].Image = icon.iconFitness; lstPicEvent[i + acc].Top = (i + acc) * 30 + 3; lstPicEvent[i + acc].Left = left; lstPicEvent[i + acc].Width = 24; lstPicEvent[i + acc].Height = 24; lstPicEvent[i + acc].Click += (e, a) => CallInfoWorkOut(workOut); picMap.Controls.Add(lstPicEvent[i + acc]); } acc = acc + lstWorkOut.Count; for (int i = 0; i < lstMedicine.Count; i++) { lstPicEvent.Add(new PictureBox()); CMedicine medicine = lstMedicine[i]; lstPicEvent[i + acc].Image = icon.iconHealth; lstPicEvent[i + acc].Top = (i + acc) * 30 + 3; lstPicEvent[i + acc].Left = left; lstPicEvent[i + acc].Width = 24; lstPicEvent[i + acc].Height = 24; lstPicEvent[i + acc].Click += (e, a) => CallInfoMedicine(medicine); picMap.Controls.Add(lstPicEvent[i + acc]); } acc = acc + lstMedicine.Count; for (int i = 0; i < lstTransaction.Count; i++) { lstPicEvent.Add(new PictureBox()); CTransaction transaction = lstTransaction[i]; EMoneyFlowState MoneyFlowState = lstTransaction[i].IconType; switch (MoneyFlowState) { case EMoneyFlowState.WithinSystem: lstPicEvent[i + acc].Image = icon.iconMoneyWithin; break; case EMoneyFlowState.FlowIn: lstPicEvent[i + acc].Image = icon.iconMoneyIn; break; case EMoneyFlowState.FlowOut: lstPicEvent[i + acc].Image = icon.iconMoneyOut; break; default: break; } lstPicEvent[i + acc].Top = (i + acc) * 30 + 3; lstPicEvent[i + acc].Left = left; lstPicEvent[i + acc].Width = 24; lstPicEvent[i + acc].Height = 24; lstPicEvent[i + acc].Click += (e, a) => CallInfoTransaction(transaction); picMap.Controls.Add(lstPicEvent[i + acc]); } acc = acc + lstTransaction.Count; for (int i = 0; i < lstBudget.Count; i++) { lstPicEvent.Add(new PictureBox()); CTransaction transactionDue = lstBudget[i]; EMoneyFlowState MoneyFlowState = lstBudget[i].IconType; switch (MoneyFlowState) { case EMoneyFlowState.WithinSystem: lstPicEvent[i + acc].Image = icon.iconTransactionDueWithin; break; case EMoneyFlowState.FlowIn: lstPicEvent[i + acc].Image = icon.iconTransactionDueIn; break; case EMoneyFlowState.FlowOut: lstPicEvent[i + acc].Image = icon.iconTransactionDueOut; break; default: break; } lstPicEvent[i + acc].Top = (i + acc) * 30 + 3; lstPicEvent[i + acc].Left = left; lstPicEvent[i + acc].Width = 24; lstPicEvent[i + acc].Height = 24; lstPicEvent[i + acc].Click += (e, a) => CallInfoBudget(transactionDue); picMap.Controls.Add(lstPicEvent[i + acc]); } acc = acc + lstBudget.Count; for (int i = 0; i < lstNote.Count; i++) { lstPicEvent.Add(new PictureBox()); CNote note = lstNote[i]; if (lstNote[i].FinishedNote) { if (lstNote[i].LiteratureTitle != "") { lstPicEvent[i + acc].Image = icon.iconLiterature; } else { lstPicEvent[i + acc].Image = icon.iconNote; } } else { lstPicEvent[i + acc].Image = icon.iconWorkingNote; } lstPicEvent[i + acc].Top = (i + acc) * 30 + 3; lstPicEvent[i + acc].Left = left; lstPicEvent[i + acc].Width = 24; lstPicEvent[i + acc].Height = 24; lstPicEvent[i + acc].Click += (e, a) => CallInfoNote(note); picMap.Controls.Add(lstPicEvent[i + acc]); } acc = acc + lstNote.Count; }