Click here to Skip to main content
15,881,559 members
Home / Discussions / C#
   

C#

 
GeneralRe: advanced settings Pin
SledgeHammer018-Apr-13 11:16
SledgeHammer018-Apr-13 11:16 
GeneralRe: advanced settings Pin
bfis1081378-Apr-13 18:22
bfis1081378-Apr-13 18:22 
GeneralRe: advanced settings Pin
SledgeHammer018-Apr-13 18:33
SledgeHammer018-Apr-13 18:33 
GeneralRe: advanced settings Pin
bfis1081378-Apr-13 18:45
bfis1081378-Apr-13 18:45 
GeneralRe: advanced settings Pin
SledgeHammer018-Apr-13 18:48
SledgeHammer018-Apr-13 18:48 
GeneralRe: advanced settings Pin
bfis1081378-Apr-13 18:51
bfis1081378-Apr-13 18:51 
GeneralRe: advanced settings Pin
SledgeHammer018-Apr-13 19:08
SledgeHammer018-Apr-13 19:08 
GeneralRe: advanced settings Pin
bfis1081378-Apr-13 21:16
bfis1081378-Apr-13 21:16 
I didn't have a company but I added it and it didn't help. I will just put the code for the class and the nested class. Also as I noted before I never touched the app.config file so if I do need to make changes to that then I would need to know how to do that.

Here is the Accounts class
C#
[Serializable]
    public class Accounts
    {
        public Accounts()
        {
            List = new List<Account>();
        }

        public List<Account> List { get; set; }
        
        
        public decimal TotalBalance()
        {
            decimal balance = 0;
            foreach (Account a in List)
            {
                balance += a.Balance;
            }
            return balance;
        }

        public decimal TotalEquity()
        {
            decimal equity = 0;
            foreach (Account a in List)
            {
                equity += a.Equity;
            }
            return equity;
        }
    }


And here is the Account class
C#
[Serializable]
    public class Account
    {
        public Account(string path)
        {
            Path = path;
            Initialize();
        }

        private bool Initialize()
        {
            using (FileStream fs = new FileStream(Path, FileMode.Open, FileAccess.Read))
            {
                using (StreamReader reader = new StreamReader(fs))
                {
                    while (!reader.EndOfStream)
                    {
                        var line = reader.ReadLine();
                        var values = line.Split(',');
                        Broker = values[0];
                        Name = values[1];
                        AccountNumber = values[2];
                        Balance = decimal.Parse(values[3]);
                        Equity = decimal.Parse(values[4]);
                        break;
                    }
                }
            }
            return true;
        }

        public bool Update()
        {
            using (FileStream fs = new FileStream(Path, FileMode.Open, FileAccess.Read))
            {
                using (StreamReader reader = new StreamReader(fs))
                {
                    while (!reader.EndOfStream)
                    {
                        var line = reader.ReadLine();
                        var values = line.Split(',');
                        Balance = decimal.Parse(values[3]);
                        Equity = decimal.Parse(values[4]);
                        break;
                    }
                }
            }
            return true;
        }
        private string Path;
        public string Broker { get; set; }
        public string Name { get; set; }
        public string AccountNumber { get; set; }
        public decimal Balance { get; set; }
        public decimal Equity { get; set; }
    }

AnswerRe: advanced settings Pin
Alan N9-Apr-13 1:54
Alan N9-Apr-13 1:54 
GeneralRe: advanced settings Pin
bfis1081379-Apr-13 2:03
bfis1081379-Apr-13 2:03 
GeneralRe: advanced settings Pin
Alan N9-Apr-13 2:31
Alan N9-Apr-13 2:31 
GeneralRe: advanced settings Pin
bfis1081378-Apr-13 21:47
bfis1081378-Apr-13 21:47 
Questioncrystal report problem remove one row Pin
mhd.sbt8-Apr-13 8:30
mhd.sbt8-Apr-13 8:30 
AnswerRe: crystal report problem remove one row Pin
Sivaraman Dhamodharan8-Apr-13 17:29
Sivaraman Dhamodharan8-Apr-13 17:29 
GeneralRe: crystal report problem remove one row Pin
Member 99567779-Apr-13 0:19
Member 99567779-Apr-13 0:19 
Questionwhere can i find flow free puzzle game Pin
GREG_DORIANcod8-Apr-13 6:14
professionalGREG_DORIANcod8-Apr-13 6:14 
AnswerRe: where can i find flow free puzzle game Pin
NotPolitcallyCorrect8-Apr-13 7:16
NotPolitcallyCorrect8-Apr-13 7:16 
QuestionC# and attachments Pin
annex457-Apr-13 4:09
annex457-Apr-13 4:09 
AnswerRe: C# and attachments Pin
Dave Kreskowiak7-Apr-13 4:56
mveDave Kreskowiak7-Apr-13 4:56 
AnswerRe: C# and attachments Pin
BobJanova8-Apr-13 1:29
BobJanova8-Apr-13 1:29 
AnswerRe: C# and attachments Pin
Manfred Rudolf Bihy8-Apr-13 1:56
professionalManfred Rudolf Bihy8-Apr-13 1:56 
AnswerRe: C# and attachments Pin
Jason Gleim8-Apr-13 3:46
professionalJason Gleim8-Apr-13 3:46 
Questiondetect sound Pin
saynasystem7-Apr-13 1:54
saynasystem7-Apr-13 1:54 
AnswerRe: detect sound Pin
NotPolitcallyCorrect7-Apr-13 2:19
NotPolitcallyCorrect7-Apr-13 2:19 
GeneralRe: detect sound Pin
Manfred Rudolf Bihy8-Apr-13 1:59
professionalManfred Rudolf Bihy8-Apr-13 1:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.