Ejemplo n.º 1
0
        /// <summary>
        /// 判断“钱是花掉了还是赚了” (资金是用贷方流向借方)
        ///
        /// </summary>
        /// <param name="DebitAccountType">借方科目</param>
        /// <param name="CreditAccountType">贷方科目</param>
        /// <returns></returns>
        public EMoneyFlowState MoneyInOrOut(EAccountType DebitAccountType, EAccountType CreditAccountType)
        {
            EMoneyFlowState ret = EMoneyFlowState.WithinSystem;

            // 若资金从Income类科目流入至Asset类转化为资产,资金为流入
            if (CreditAccountType == EAccountType.Income && DebitAccountType != EAccountType.Expense)
            {
                ret = EMoneyFlowState.FlowIn;
            }
            else if (CreditAccountType != EAccountType.Income && DebitAccountType == EAccountType.Expense)
            {
                ret = EMoneyFlowState.FlowOut;
            }
            return(ret);
        }
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;
        }