public DepositConditionsForm(MyBank bank) { InitializeComponent(); this.bank = bank; conditionsBindingSource.DataSource = this.bank.DepositConditions; isDirty = false; }
public DepositAddingForm(MyBank bank, Customer customer) { InitializeComponent(); this.bank = bank; this.customer = customer; conditionsComboBox.DataSource = bank.DepositConditions; conditionsComboBox.DisplayMember = "InfoString"; }
/// <summary> /// Simple example for Thrower. /// </summary> private static void Main() { var bank = new MyBank(); try { // Say nothing! bank.SayHello(" "); } catch (ArgumentException ex) { // Polite people say meaningful things. Console.Error.WriteLine(ex.Message); } bank.SayHello("Good morning!"); // Everything OK! try { bank.Deposit(100); } catch (InvalidOperationException ex) { // Bank is still closed. Console.Error.WriteLine(ex.Message); } bank.Open(); try { bank.Deposit(-1000); } catch (ArgumentOutOfRangeException ex) { // Cannot deposit a negative amount. Console.Error.WriteLine(ex.Message); } try { bank.Deposit(9001M); } catch (OverNineThousandException ex) { // Cannot deposit more than 9000. Console.Error.WriteLine(ex.Message); } bank.Deposit(10); // Everything OK! Console.WriteLine("Amount: " + bank.Amount); // Send an email with current amount. bank.SendMail("*****@*****.**", "юзер@екзампл.ком", $"Your current amount is {bank.Amount}"); Console.Read(); }
public MainMenuForm(MyBank bank) { this.bank = bank; isDirty = false; InitializeComponent(); EnableCustomerButtons(false); EnableDepositButtons(false); //Bank.FillTestData(10); CustomersBindingSource.DataSource = bank.Customers; }
public CustomerInfoForm(Customer customer, MyBank bank) { InitializeComponent(); this.customer = customer; this.bank = bank; Fill(); isInputChanged = false; isDirty = false; saveButton.Enabled = false; }
public void FillData() { MyBank bank = new MyBank(); const int TEST_VALUE = 10000; bank.FillTestData(TEST_VALUE); for (int i = 0; i < TEST_VALUE; i++) { Assert.AreEqual(500.50m, bank.Customers[i].Deposits[1].Value); Assert.AreEqual($"login{i}", bank.Customers[i].Login); } }
public ConditionEditingForm( MyBank bank, DepositCondition condition, bool isCreating) { InitializeComponent(); this.bank = bank; this.condition = condition; this.isCreating = isCreating; intervalComboBox.DataSource = Enum.GetValues(typeof(AccrualsInterval)); intervalComboBox.SelectedItem = condition.Interval; percentUpDown.Value = condition.Percent; durationUpDown.Value = condition.Duration; }
public void Load() { using (Stream stream = File.OpenRead(FILE_PATH)) { BinaryFormatter serializer = new BinaryFormatter(); MyBank tmp = (MyBank)serializer.Deserialize(stream); Copy(tmp.Customers, bank.Customers); Copy(tmp.DepositConditions, bank.DepositConditions); } void Copy <T>(List <T> from, List <T> to) { to.Clear(); to.AddRange(from); } }
public MainMenuForm(MyBank bank, Customer customer) { InitializeComponent(); EnableDepositButtons(false); this.bank = bank; currentCustomer = customer; welcomeLabel.Text = "Добро пожаловать, " + customer.FullName + "!"; isLogOut = false; isDirty = false; foreach (Deposit depos in customer.Deposits) { depos.Charge(); } depositsBindingSource.DataSource = currentCustomer.Deposits; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MyBank bank = new MyBank(); try { bank.Load(); } catch (System.IO.FileNotFoundException) { DialogResult res = MessageBox.Show( "Невозможно загрузить данные приложения. Продолжить?", "", MessageBoxButtons.YesNo ); // If yes - create new MyBank, serialize and open register window // If no - close application switch (res) { case DialogResult.Yes: //bank.FillTestData(10); bank.Save(); Program.context = new ApplicationContext(new RegisterForm(bank)); break; case DialogResult.No: return; } } if (context == null) { context = new ApplicationContext(new LoginForm(bank)); } Application.Run(context); }
public Dao(MyBank bank) { this.bank = bank; }
public RegisterForm(MyBank bank) { InitializeComponent(); this.bank = bank; }
protected void Page_Load(object sender, EventArgs e) { ExData = (Exams)Session["ExamData"]; try { TestCode = ExData.ExamCode; // TestCode = "TST0041/005"; MyBank.TestCodeData = this.TestCode; DbExams = new DataBase.Exams(); DbExams.RetrieveExams(TestCode); PaperHeader.InnerText = DbExams.ExamName; string path = String.Format("C://Cosmo//Teachers/QuestionPaper/Exams/Config/{0}", DbExams.ExamData); System.Diagnostics.Debug.WriteLine("There is sec " + ExData.Sections); DropDownList SectionSelector = (DropDownList)MyBank.FindControl("SectionSelection"); ConfigFile MyConfigurations = new ConfigFile(path, ExData.Sections); ConfigFile.Sections ConfigSections = new ConfigFile.Sections(path); Secs.Add(ConfigSections.SectionCount, ConfigSections.SectionWeight, QuestionPanel); DataBase.Questions Qs = new DataBase.Questions(TestCode); if (ConfigSections.SectionCount > 1) { SectionSelector.Visible = true; } else { SectionSelector.Visible = false; } /*Retrieve Question Paper Data from DataSet and Pass it into Table*/ foreach (int Weight in ConfigSections.SectionWeight) { System.Diagnostics.Debug.WriteLine("The Ratio is: " + Weight.ToString()); } Qs.RetrieveData(); DataSet Ds = new DataSet(); Ds = Qs.DataSet; /*Instance of Table Holding Question Data for The Exam Selected*/ DataTable dt = new DataTable(); dt = Ds.Tables[0]; if (dt.Rows.Count > 0) { QuestionPanel.Style.Add(HtmlTextWriterStyle.BackgroundImage, "url(QuestionPaper/Images/CosmoPaperBackground.png)"); } foreach (DataRow Dr in dt.Rows) { List <string> ls = new List <string>(); if (Dr[3] != DBNull.Value) { ls = ((string[])Dr[3]).ToList(); } else { ls = null; } AddQuestion(Convert.ToInt32(Dr[4]), Convert.ToInt32(Dr[2]), Convert.ToInt32(Dr[0]), Dr[1].ToString(), ls, null); } } catch { Response.Redirect("Tests.aspx"); } }
public CustomerInfoFormCustomer(Customer customer, MyBank bank) : base(customer, bank) { loginLabel.Visible = false; loginTextBox.Visible = false; }
public CustomerInfoFormAdmin(Customer customer, MyBank bank) : base(customer, bank) { passwordLabel.Visible = false; passwordTextBox.Visible = false; }
public void TearDown() { bank = null; }
public void Setup() { bank = new MyBank(); }
public LoginForm(MyBank bank) { InitializeComponent(); this.bank = bank; }
/// <summary> /// Simple example for Thrower. /// </summary> private static void Main() { var bank = new MyBank(); try { // Say nothing! bank.SayHello(" "); } catch (ArgumentException ex) { // Polite people say meaningful things. Console.Error.WriteLine(ex.Message); } bank.SayHello("Good morning!"); // Everything OK! try { bank.Deposit(100); } catch (InvalidOperationException ex) { // Bank is still closed. Console.Error.WriteLine(ex.Message); } bank.Open(); try { bank.Deposit(-1000); } catch (ArgumentOutOfRangeException ex) { // Cannot deposit a negative amount. Console.Error.WriteLine(ex.Message); } try { bank.Deposit(9001M); } catch (OverNineThousandException ex) { // Cannot deposit more than 9000. Console.Error.WriteLine(ex.Message); } bank.Deposit(10); // Everything OK! Console.WriteLine("Amount: " + bank.Amount); // Send an email with current amount. bank.SendMail("*****@*****.**", "юзер@екзампл.ком", $"Your current amount is {bank.Amount}"); Console.Read(); }