public EnvelopeDetailsForm(Form1 _form1, int id)
 {
     InitializeComponent();
     form1 = _form1;
     envelope = form1.payDay.GetEnvelope(id);
     history = envelope.GetFullHistory();
     PopulateInfo();
 }
Exemplo n.º 2
0
 // Checks whether there's space, then adds Envelope and payOut
 // at [envCount] and increases envCount by 1
 public bool AddEnvelope(Envelope env, double pay)
 {
     if (envCount >= envCap)
     {
         bool denied = true;
         //AddSpace(envCap);
         MessageBox.Show("Sorry, but I've only figured out \nhow to cram 16 envelopes into this space. \nPlease check back in the next version :)");
         return denied;
     }
     else
     {
         bool denied = false;
         envelopes[envCount] = env;
         payOuts[envCount] = pay;
         envCount++;
         return denied;
     }
 }
Exemplo n.º 3
0
 // Passes the values in the textboxes to Form1's payDay to construct a new envelope
 private void newEnvButton_Click(object sender, EventArgs e)
 {
     string name = nameBox.Text;
     double balance = double.Parse(balanceBox.Text);
     Envelope newEnv = new Envelope(name, balance);
     double payOut = double.Parse(payOutBox.Text);     
                        
     // Run AddEnvelope and check if it was allowed to via "denied"
     bool denied = form1.payDay.AddEnvelope(newEnv, payOut);   
     if (denied == false)
     {
         form1.ShowNextEnvButton(form1.GetNextEnv());
         form1.SetNextEnv(form1.GetNextEnv() + 1);
         double bal = 0;
         // Update Form1's expense labels
         form1.SetIntoEnvelopeLabel(Convert.ToString(payOut));
         bal += double.Parse(form1.GetPayDayAmountLabel());
         bal -= double.Parse(form1.GetExpenseLabel());
         bal -= double.Parse(form1.GetIntoEnvelopeLabel());
         form1.SetPayDayBalanceLabel(Convert.ToString(bal));
     }
     this.Close();                     
 }
Exemplo n.º 4
0
 // Setters
 public void SetEnvelope(Envelope env, int id)
 {
     envelopes[id] = env;
 }