Beispiel #1
0
        public void Thirdparty(AccInfo info)
        {
            AccountC acc  = new AccountC();
            Account  acc1 = acc.FindAcc(info.Requestfrom);
            Account  acc2 = acc.FindAcc(info.RequestTo);

            if (acc1.AccountNum != "0")
            {
                double am   = Convert.ToDouble(info.Amount);
                double eq   = Convert.ToDouble(acc1.Equity);
                double ba   = Convert.ToDouble(acc1.Balance);
                double deb  = Convert.ToDouble(acc1.Debt);
                double seq  = Convert.ToDouble(acc1.Sequity);
                double sba  = Convert.ToDouble(acc1.SBalance);
                double sdeb = Convert.ToDouble(acc1.Sdebt);
                seq -= am;
                if (info.Enterb)
                {
                    eq -= am;
                }
                acc1.Equity   = eq.ToString();
                acc1.Balance  = ba.ToString();
                acc1.Debt     = deb.ToString();
                acc1.Sequity  = seq.ToString();
                acc1.SBalance = sba.ToString();
                acc1.Sdebt    = sdeb.ToString();
                acc.UpdateAcc(acc1, acc1.AccountNum);
            }
            else
            {
                double am   = Convert.ToDouble(info.Amount);
                double eq   = Convert.ToDouble(acc2.Equity);
                double ba   = Convert.ToDouble(acc2.Balance);
                double deb  = Convert.ToDouble(acc2.Debt);
                double seq  = Convert.ToDouble(acc2.Sequity);
                double sba  = Convert.ToDouble(acc2.SBalance);
                double sdeb = Convert.ToDouble(acc2.Sdebt);

                seq += am;
                if (info.Enterb)
                {
                    eq += am;
                }
                acc1.Equity   = eq.ToString();
                acc1.Balance  = ba.ToString();
                acc1.Debt     = deb.ToString();
                acc1.Sequity  = seq.ToString();
                acc1.SBalance = sba.ToString();
                acc1.Sdebt    = sdeb.ToString();
                acc.UpdateAcc(acc1, acc1.AccountNum);
            }
        }
Beispiel #2
0
        public void Income(AccInfo info)
        {
            AccountC acc  = new AccountC();
            Account  acc1 = acc.FindAcc(info.RequestTo);
            double   am   = Convert.ToDouble(info.Amount);
            double   eq   = Convert.ToDouble(acc1.Equity);
            double   ba   = Convert.ToDouble(acc1.Balance);
            double   deb  = Convert.ToDouble(acc1.Debt);
            double   seq  = Convert.ToDouble(acc1.Sequity);
            double   sba  = Convert.ToDouble(acc1.SBalance);
            double   sdeb = Convert.ToDouble(acc1.Sdebt);

            seq += am;
            sba += am;
            if (info.Enterb)
            {
                eq += am;
                ba += am;
            }
            acc1.Equity   = eq.ToString();
            acc1.Balance  = ba.ToString();
            acc1.Debt     = deb.ToString();
            acc1.Sequity  = seq.ToString();
            acc1.SBalance = sba.ToString();
            acc1.Sdebt    = sdeb.ToString();
            acc.UpdateAcc(acc1, acc1.AccountNum);
        }
Beispiel #3
0
        public void Expenses(AccInfo info)
        {
            AccountC acc        = new AccountC();
            Account  acc1       = acc.FindAcc(info.Requestfrom);
            double   am         = Convert.ToDouble(info.Amount);
            double   eq         = Convert.ToDouble(acc1.Equity);
            double   ba         = Convert.ToDouble(acc1.Balance);
            double   deb        = Convert.ToDouble(acc1.Debt);
            double   seq        = Convert.ToDouble(acc1.Sequity);
            double   sba        = Convert.ToDouble(acc1.SBalance);
            double   sdeb       = Convert.ToDouble(acc1.Sdebt);
            bool     creditKind = false;

            if (acc1.Kind == "Credit")
            {
                creditKind = true;
            }
            if (!creditKind)
            {
                seq -= am;
                sba -= am;
                if (info.Enterb)
                {
                    eq -= am;
                    ba -= am;
                }
            }
            else
            {
                ba -= am;
            }

            acc1.Equity   = eq.ToString();
            acc1.Balance  = ba.ToString();
            acc1.Debt     = deb.ToString();
            acc1.Sequity  = seq.ToString();
            acc1.SBalance = sba.ToString();
            acc1.Sdebt    = sdeb.ToString();
            acc.UpdateAcc(acc1, acc1.AccountNum);
        }
Beispiel #4
0
        public void Regular(AccInfo info)
        {
            AccountC acc      = new AccountC();
            Account  acc1     = acc.FindAcc(info.Requestfrom);
            Account  acc2     = acc.FindAcc(info.RequestTo);
            bool     needDebt = true;

            if (acc1.Kind.Contains("Company") && acc2.Kind.Contains("Company"))// there is not debts betweebn company accounts
            {
                needDebt = false;
            }
            bool creditKind = false;

            if (acc2.Kind == "Credit")
            {
                creditKind = true;
            }
            #region From
            string s    = info.Amount;
            double am   = Convert.ToDouble(s);
            double eq   = Convert.ToDouble(acc1.Equity);
            double ba   = Convert.ToDouble(acc1.Balance);
            double deb  = Convert.ToDouble(acc1.Debt);
            double seq  = Convert.ToDouble(acc1.Sequity);
            double sba  = Convert.ToDouble(acc1.SBalance);
            double sdeb = Convert.ToDouble(acc1.Sdebt);
            seq -= am;
            sba -= am;
            if (needDebt)
            {
                sdeb += am;
            }
            if (info.Enterb)
            {
                eq -= am;
                ba -= am;
                if (needDebt)
                {
                    deb += am;
                }
            }
            acc1.Equity   = eq.ToString();
            acc1.Balance  = ba.ToString();
            acc1.Debt     = deb.ToString();
            acc1.Sequity  = seq.ToString();
            acc1.SBalance = sba.ToString();
            acc1.Sdebt    = sdeb.ToString();
            #endregion
            #region To
            eq   = Convert.ToDouble(acc2.Equity);
            ba   = Convert.ToDouble(acc2.Balance);
            deb  = Convert.ToDouble(acc2.Debt);
            seq  = Convert.ToDouble(acc2.Sequity);
            sba  = Convert.ToDouble(acc2.SBalance);
            sdeb = Convert.ToDouble(acc2.Sdebt);
            if (!creditKind)
            {
                seq += am;
                sba += am;
                if (needDebt)
                {
                    sdeb -= am;
                }
                if (info.Enterb)
                {
                    eq += am;
                    ba += am;
                    if (needDebt)
                    {
                        deb -= am;
                    }
                }
            }
            else
            {
                sba += am;
                if (info.Enterb)
                {
                    ba += am;
                }
            }
            acc2.Equity   = eq.ToString();
            acc2.Balance  = ba.ToString();
            acc2.Debt     = deb.ToString();
            acc2.Sequity  = seq.ToString();
            acc2.SBalance = sba.ToString();
            acc2.Sdebt    = sdeb.ToString();
            #endregion
            acc.UpdateAcc(acc1, acc1.AccountNum);
            acc.UpdateAcc(acc2, acc2.AccountNum);
        }