Ejemplo n.º 1
0
 public frmInfoMedicine(CMedicine info)
 {
     InitializeComponent();
     medicine             = info;
     lblMedicineName.Text = medicine.MedicineName;
     lblDescription.Text  = "Take " + medicine.MedicineQty.ToString() + " " + medicine.MedicineUnit + " " + medicine.MedicineTime.ToString();
     timer.Interval       = 10000;
     timer.Start();
     timer.Tick += Timer_Tick;
 }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        public void CallInfoMedicine(CMedicine info)
        {
            frmInfoMedicine frmInfoMedicine = new frmInfoMedicine(info);

            frmInfoMedicine.Show();
        }
Ejemplo n.º 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            bool            CanAddFlag = true;
            EMedicineTiming medicineTiming;

            switch (cbxMedicineTiming.Text)
            {
            case "Before Breakfast":
                medicineTiming = EMedicineTiming.BeforeBreakfast;
                break;

            case "After Breakfast":
                medicineTiming = EMedicineTiming.AfterBreakfast;
                break;

            case "Before Lunch":
                medicineTiming = EMedicineTiming.BeforeLunch;
                break;

            case "After Lunch":
                medicineTiming = EMedicineTiming.AfterLunch;
                break;

            case "Before Dinner":
                medicineTiming = EMedicineTiming.BeforeDinner;
                break;

            case "After Dinner":
                medicineTiming = EMedicineTiming.AfterDinner;
                break;

            case "Before Sleep":
                medicineTiming = EMedicineTiming.BeforeSleep;
                break;

            case "When Needed":
                medicineTiming = EMedicineTiming.WhenNeeded;
                break;

            default:
                medicineTiming = EMedicineTiming.WhenNeeded;
                break;
            }
            if (G.glb.lstMedicine.Exists(o => o.TagTime == curDate && o.MedicineName == txtMedicineName.Text && o.MedicineTime == medicineTiming))
            {
                MessageBox.Show("Medicine log exists.");
                CanAddFlag = false;
            }

            if (CanAddFlag)
            {
                CMedicine newMedicine = new CMedicine();
                newMedicine.TagTime      = dtpDate.Value.Date;
                newMedicine.MedicineName = txtMedicineName.Text;
                newMedicine.MedicineQty  = Convert.ToDouble(txtMedicineQty.Text);
                newMedicine.MedicineUnit = txtMedicineUnit.Text;
                newMedicine.MedicineTime = medicineTiming;
                G.glb.lstMedicine.Add(newMedicine);
                DrawLog();
                Dispose();
            }
        }