Esempio n. 1
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            try
            {
                database = new CustomerDatabase();
                database.LoadDatabaseFromCsvDecrypted(txbFilenameLoad.Text, txbPasswordLoad.Text);

                //Print

                dgvDisplay.Rows.Clear();
                foreach (var elem in database.Customers)
                {
                    dgvDisplay.Rows.Add(elem.CustomerNumber.ToString(), elem.LastName.ToString(), elem.FirstName.ToString(), elem.Mail.ToString(), elem.LastChange.ToString(), elem.BankBalance.ToString());
                }
                txbFilenameLoad.Text    = "";
                txbPasswordLoad.Text    = "";
                btnEdit.Enabled         = true;
                btnPay.Enabled          = true;
                groupBox3.Enabled       = true;
                groupBox2.Enabled       = true;
                btnLoad.Enabled         = false;
                txbPasswordLoad.Enabled = false;
                MessageBox.Show(LangResources.MassegeBoxLoad);
            }
            catch (Exception er)
            {
                MessageBox.Show(Localization.getString(er.Message));
                txbFilenameLoad.Text = "";
                txbPasswordLoad.Text = "";
            }
        }
Esempio n. 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                int number = (Convert.ToInt32(txbNumber.Text));

                if (databaseIn.Count - 1 < number || number < 0)
                {
                    throw new InvalidDataException(Localization.getString("FrmPayNoCustomer"));
                }
                else
                {
                    if (radioButton1.Checked == true)//Inpayment
                    {
                        databaseIn.ChangeBankBalance(number, databaseIn.Customers.ElementAt(number).BankBalance + Convert.ToDouble(txbAmmount.Text.Replace(',', '.')));
                    }
                    if (radioButton2.Checked == true)//Outpayment
                    {
                        databaseIn.ChangeBankBalance(number, databaseIn.Customers.ElementAt(number).BankBalance - Convert.ToDouble(txbAmmount.Text.Replace(',', '.')));
                    }
                }


                databaseOut = databaseIn;

                this.Close();
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
                txbAmmount.Text = "";
                txbNumber.Text  = "";
            }
        }
Esempio n. 3
0
        public Form1()
        {
            InitializeComponent();

            database = new CustomerDatabase();

            //Call Form Welcome

            FormWelcome fWel = new FormWelcome();

            fWel.ShowDialog();
            database = fWel.databaseOut;

            if (database.Count > 0)
            {
                btnEdit.Enabled   = true;
                btnPay.Enabled    = true;
                groupBox3.Enabled = true;
                groupBox2.Enabled = true;

                //Print
                foreach (var elem in database.Customers)
                {
                    dgvDisplay.Rows.Add(elem.CustomerNumber.ToString(), elem.LastName.ToString(), elem.FirstName.ToString(), elem.Mail.ToString(), elem.LastChange.ToString(), elem.BankBalance.ToString());
                }
                txbSearch.Focus();
            }
            //call set language method
            SetLanguage();
        }
Esempio n. 4
0
        public void DoesWriteSomethingToStream()
        {
            var db = new CustomerDatabase();

            db.People.Add(TestPerson);
            Assert.AreNotEqual(0, (db.TargetConnection.Stream as System.IO.MemoryStream).Length);
        }
Esempio n. 5
0
 private void FormWelcome_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!startpressed)
     {
         databaseOut = new CustomerDatabase();
         Application.Exit();
     }
 }
Esempio n. 6
0
        public void CanAddItem()
        {
            var db = new CustomerDatabase();

            db.People.Add(TestPerson);
            Assert.AreEqual(1, db.People.Count());
            Assert.AreEqual(1, db.People.Single().RowVersion);
            Assert.AreNotEqual(Guid.Empty, db.People.Single().RowGuid);
            db.SaveChanges();
            Assert.AreEqual(1, db.People.Count());
            Assert.AreEqual(TestPerson.FirstName, db.People.Single().FirstName);
        }
 protected async override void OnAppearing()
 {
     base.OnAppearing();
     using (CustomerDatabase customerDatabase = new CustomerDatabase())
     {
         List <Customer> customerList = (await customerDatabase.GetAllCustomerAsync());
         foreach (Customer customer in customerList)
         {
             _selectCustomerPicker.Items.Add(customer.CustomerName);
         }
     }
 }
Esempio n. 8
0
        public void DisableEmailing_disables_emailing()
        {
            Customer customer = CreateCustomer("Cars");

            Response response = Invoke(x => x.DisableEmailing(customer.Id));

            response.ShouldBeOk();
            using (var db = new CustomerDatabase())
            {
                db.ShouldContainCustomer(customer.Id)
                .WithEmailCampaign(EmailCampaign.None);
            }
        }
Esempio n. 9
0
        public void SyncronizesStreams()
        {
            var file     = "test.db";
            var dbSource = new CustomerDatabase(new FileStreamDatabaseConnection(file));
            var dbTarget = new CustomerDatabase(null, new FileStreamDatabaseConnection(file));

            //hook up dbTarget to dbSource
            Assert.IsTrue(dbSource.IsSource);
            Assert.IsTrue(dbTarget.IsSink);


            dbSource.People.Add(TestPerson);
            Assert.AreEqual(1, dbSource.People.Count());
            Assert.AreEqual(1, dbTarget.People.Count());
        }
Esempio n. 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                databaseIn.AddCustomer(textBox1.Text, textBox2.Text, textBox3.Text, 0.0);
                databaseOut = databaseIn;

                this.Close();
            }
            catch (Exception er)
            {
                //errorProvider1.SetError(button1, er.Message);
                errorProvider1.SetError(button1, Localization.getString(er.Message));
            }
        }
        public CustomerDatabaseCreatorTextConfig() : base()
        {
            using (FileStream fileStream = File.Open(GetAssemblyDirectory() + @"\customers.ini", FileMode.Open))
            {
                StreamReader         reader       = new StreamReader(fileStream, Encoding.Unicode);
                string               line         = null;
                Country              country      = null;
                string               customerName = null;
                IEnumerable <string> customerIds  = null;

                while ((line = reader.ReadLine()) != null)
                {
                    // new section
                    if (line.StartsWith("[") && line.EndsWith("]"))
                    {
                        string nameToken = line.Split('[', ']')[1];
                        country = ReportMappings.SupportedCountries().Where(_ => _.Name == nameToken).SingleOrDefault();
                        if (country == null)
                        {
                            country = new Country(nameToken, ReportMappings.defaultRegion, nameToken);
                        }
                    }
                    else
                    {
                        string[] tokens     = line.Split(new Char[] { '=' }, 2);
                        string   entryName  = tokens[0];
                        string   entryValue = tokens[1];

                        if (entryName == "Name")
                        {
                            customerName = entryValue;
                        }
                        else if (entryName == "Id")
                        {
                            customerIds = entryValue.Split(',');

                            if (!customerName.IsNullOrEmpty() && !customerIds.IsNullOrEmpty())
                            {
                                CustomerDatabase.Add(new Customer(country, customerName, customerIds));
                            }

                            customerName = null;
                            customerIds  = null;
                        }
                    }
                }
            }
        }
Esempio n. 12
0
        public void Promote_promotes_customer()
        {
            Customer customer     = CreateCustomer();
            var      emailGateway = new FakeEmailGateway();

            Response response = Invoke(x => x.Promote(customer.Id), emailGateway);

            response.ShouldBeOk();
            using (var db = new CustomerDatabase())
            {
                db.ShouldContainCustomer(customer.Id)
                .WithStatus(CustomerStatus.Preferred);

                emailGateway.ShouldContainNumberOfPromotionNotificationsSent(1);
            }
        }
Esempio n. 13
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                databaseIn.ChangeLastName(Int32.Parse(textBox1.Text), textBox2.Text);
                databaseIn.ChangeMail(Int32.Parse(textBox1.Text), textBox3.Text);
                databaseOut = databaseIn;

                this.Close();
            }
            catch (Exception er)
            {
                //errorProvider1.SetError(button1, er.Message);
                errorProvider1.SetError(button1, Localization.getString(er.Message));
            }
        }
Esempio n. 14
0
        public void Create_can_create_a_customer_without_secondary_email()
        {
            var model = new CreateCustomerModel
            {
                Industry     = "Cars",
                Name         = "Johnson and Co",
                PrimaryEmail = "*****@*****.**"
            };

            Response response = Invoke(x => x.Create(model));

            response.ShouldBeOk();
            using (var db = new CustomerDatabase())
            {
                db.ShouldContainCustomer("Johnson and Co")
                .WithNoSecondaryEmail();
            }
        }
 protected override void OnAfterRender(bool firstRender)
 {
     try
     {
         //Function to check if XML file exists or not if it does exist load data into customers list if it does not exist create the document
         CustomerDatabase.LoadCustomerData(Configuration.CustomerFileLocation);
         //Function to see if Lash Data config file exists
         TreatmentDatabase.LoadLashData(Configuration.LashFileLocation, TreatmentDatabase.Treatments);
     }
     catch (Exception e)
     {
         Logger.Log("Intialisation: " + e.Message + e.StackTrace);
     }
     if (firstRender)
     {
         // Do work to load page data and set properties
     }
 }
Esempio n. 16
0
        private void btnPay_Click(object sender, EventArgs e)
        {
            FormPay fPay = new FormPay();

            fPay.databaseIn = database;
            fPay.ShowDialog();
            if (fPay.databaseOut != null)
            {
                database = fPay.databaseOut;
            }

            //Print
            dgvDisplay.Rows.Clear();
            foreach (var elem in database.Customers)
            {
                dgvDisplay.Rows.Add(elem.CustomerNumber.ToString(), elem.LastName.ToString(), elem.FirstName.ToString(), elem.Mail.ToString(), elem.LastChange.ToString(), elem.BankBalance.ToString());
            }
        }
Esempio n. 17
0
        public void Update_updates_a_customer_if_no_validation_errors()
        {
            Customer customer = CreateCustomer("Cars");
            var      model    = new UpdateCustomerModel
            {
                Id       = customer.Id,
                Industry = "Other"
            };

            Response response = Invoke(x => x.Update(model));

            response.ShouldBeOk();
            using (var db = new CustomerDatabase())
            {
                db.ShouldContainCustomer(model.Id)
                .WithIndustry("Other")
                .WithEmailCampaign(EmailCampaign.Generic);
            }
        }
        public CustomerDatabaseCreatorApplicationConfig() : base()
        {
            foreach (string customer in ConfigurationManager.AppSettings["databaseEntries"].Split('*'))
            {
                string[]      tokens    = customer.Split(';');
                List <string> listOfIDs = new List <string>();

                foreach (string customerID in tokens[2].Split(','))
                {
                    listOfIDs.Add(customerID);
                }

                Country country = ReportMappings.SupportedCountries().Where(_ => _.Name == tokens[0]).SingleOrDefault();

                if (country != null)
                {
                    CustomerDatabase.Add(new Customer(country, tokens[1], listOfIDs));
                }
            }
        }
Esempio n. 19
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FormAdd fAdd = new FormAdd();

            fAdd.databaseIn = database;
            fAdd.ShowDialog();
            if (fAdd.databaseOut != null)
            {
                database          = fAdd.databaseOut;
                btnEdit.Enabled   = true;
                btnPay.Enabled    = true;
                groupBox3.Enabled = true;
                groupBox2.Enabled = true;
            }

            //Print
            dgvDisplay.Rows.Clear();
            foreach (var elem in database.Customers)
            {
                dgvDisplay.Rows.Add(elem.CustomerNumber.ToString(), elem.LastName.ToString(), elem.FirstName.ToString(), elem.Mail.ToString(), elem.LastChange.ToString(), elem.BankBalance.ToString());
            }
        }
Esempio n. 20
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                startpressed = true;
                if (rdbLoad.Checked == true)
                {
                    database.LoadDatabaseFromCsvDecrypted(txbFilename.Text, txbPassword.Text);
                    databaseOut = database;
                    this.Close();
                }
                else
                {
                    databaseOut = database;
                    this.Close();
                }

                //Store selected language
                StreamWriter strmWriter = new StreamWriter("LastLanguage.csv");
                if (rdbEnglish.Checked == true)
                {
                    strmWriter.WriteLine("ENG");
                }
                if (rdbGerman.Checked == true)
                {
                    strmWriter.WriteLine("GER");
                }
                strmWriter.Close();
            }
            catch (Exception er)
            {
                MessageBox.Show(Localization.getString(er.Message));
                startpressed     = false;
                txbFilename.Text = "";
                txbPassword.Text = "";
            }
        }
Esempio n. 21
0
        public void Create_creates_a_customer_if_no_validation_errors()
        {
            var model = new CreateCustomerModel
            {
                Industry       = "Cars",
                Name           = "Johnson and Co",
                PrimaryEmail   = "*****@*****.**",
                SecondaryEmail = "*****@*****.**"
            };

            Response response = Invoke(x => x.Create(model));

            response.ShouldBeOk();

            using (var db = new CustomerDatabase())
            {
                db.ShouldContainCustomer("Johnson and Co")
                .WithPrimaryEmail("*****@*****.**")
                .WithSecondaryEmail("*****@*****.**")
                .WithIndustry("Cars")
                .WithEmailCampaign(EmailCampaign.LatestCarModels)
                .WithStatus(CustomerStatus.Regular);
            }
        }
Esempio n. 22
0
        public CustomerDatabaseCreatorDefault() : base()
        {
            Country country = ReportMappings.SupportedCountries().Where(_ => _.Name == "Netherlands").SingleOrDefault();

            CustomerDatabase.Add(new Customer(country, "1/ARROW CENTRAL EUROPE", new List <string>()
            {
                "401331"
            }));
            CustomerDatabase.Add(new Customer(country, "VODAFONE PROCUREMENT COMPANY SARL", new List <string>()
            {
                "1213541304"
            }));
            CustomerDatabase.Add(new Customer(country, "PLIEGER B.V.", new List <string>()
            {
                "401561"
            }));
            CustomerDatabase.Add(new Customer(country, "ORACLE NEDERLAND BV", new List <string>()
            {
                "1213105725"
            }));
            CustomerDatabase.Add(new Customer(country, "CE - IT B.V.", new List <string>()
            {
                "400386"
            }));
            CustomerDatabase.Add(new Customer(country, "UPS SCS (NEDERLAND) B.V.", new List <string>()
            {
                "1213259631"
            }));
            CustomerDatabase.Add(new Customer(country, "VALEO SERVICE BENELUX B.V.", new List <string>()
            {
                "1213105834"
            }));
            CustomerDatabase.Add(new Customer(country, "Straumann BV", new List <string>()
            {
                "400499"
            }));

            country = ReportMappings.SupportedCountries().Where(_ => _.Name == "Belgium").SingleOrDefault();
            CustomerDatabase.Add(new Customer(country, "GDF SUEZ TRADING BRUSSELS", new List <string>()
            {
                "1214327535"
            }));
            CustomerDatabase.Add(new Customer(country, "ORACLE BELGIUM PAYME", new List <string>()
            {
                "1213077931"
            }));
            CustomerDatabase.Add(new Customer(country, "UPS EUROPE SPRL", new List <string>()
            {
                "1213664802"
            }));
            CustomerDatabase.Add(new Customer(country, "BASE Company n.v./s.a.", new List <string>()
            {
                "99979"
            }));
            CustomerDatabase.Add(new Customer(country, "Pfizer Manufacturing Belg", new List <string>()
            {
                "1213664655"
            }));
            CustomerDatabase.Add(new Customer(country, "SKYPE COMMUNICATIONS SARL", new List <string>()
            {
                "1214234003"
            }));
            CustomerDatabase.Add(new Customer(country, "GTECH GLOBAL SERVICES CORPORATION", new List <string>()
            {
                "101008", "100350", "100651"
            }));
            CustomerDatabase.Add(new Customer(country, "UNITED PARCEL SERVICE BELG", new List <string>()
            {
                "1213260301"
            }));
        }
 public TellerController(AccountDatabase a, CustomerDatabase c)
 {
     aDatabase = a;
     cDatabase = c;
 }
Esempio n. 24
0
 public TellerController(AccountDatabase a, CustomerDatabase c)
 {
     aDatabase = a;
     cDatabase = c;
 }
 public static void Saving(Customer customer1)
 {
     CustomerDatabase.AddCustomer(customer1);
 }
Esempio n. 26
0
        public FinishPage(PotentialCustomer Customer1, Transport TransportToSend, List <string> GoodsName, List <CartGoods> GoodsInCart, List <int> Piece1)
        {
            InitializeComponent();
            Piece = Piece1;

            Address Address = new Address();

            Address.Street     = Customer1.Street;
            Address.Town       = Customer1.Town;
            Address.PostNumber = int.Parse(Customer1.PostCode.ToString());
            AddressDatabase.SaveItemAsync(Address);
            DebugMethod();

            ContactInformation Contact = new ContactInformation();

            Contact.Email = Customer1.Mail;
            Contact.Phone = Customer1.Phone;
            ContactInformationDatabase.SaveItemAsync(Contact);
            DebugMethod();

            Customer Customer = new Customer();

            Customer.AddressID            = Address.AddressID;
            Customer.ContactInformationID = Contact.ContactInformationID;
            Customer.Name    = Customer1.Name;
            Customer.Surname = Customer1.Surname;
            CustomerDatabase.SaveItemAsync(Customer);
            DebugMethod();

            OrderTransport Transport = new OrderTransport();

            Transport.TypeOfTransport = TransportToSend.Name;
            Transport.Price           = TransportToSend.Price;
            OrderTransportDatabase.SaveItemAsync(Transport);
            DebugMethod();

            Random r   = new Random();
            int    rnd = r.Next();

            int TotalPrice = 0;

            for (int i = 0; i < GoodsInCart.Count; i++)
            {
                TotalPrice += GoodsInCart[i].TotalPrice;
            }

            TotalPrice += Transport.Price;
            Order Order = new Order();

            Order.CustomerID  = Customer.CustomerID;
            Order.TransportID = Transport.TransportID;

            Order.OrderNumber = rnd;
            Order.OrderPrice  = TotalPrice;
            OrderDatabase.SaveItemAsync(Order);
            DebugMethod();

            Number.Text = Order.OrderNumber.ToString();

            List <Customer> clist = new List <Customer>();

            clist = CustomerDatabase.GetItemsAsync().Result;

            for (int i = 0; i < GoodsName.Count; i++)
            {
                OrderGoods OrderGoods = new OrderGoods();
                OrderGoods.OrderID = Order.OrderID;
                Goods goods = GoodsDatabase.GetItemAsync(GoodsName[i]).Result;
                OrderGoods.GoodsQauntity = GoodsInCart[i].GoodsQauntity;
                OrderGoods.GoodsID       = goods.GoodsID;
                OrderGoodsDatabase.SaveItemAsync(OrderGoods);
                DebugMethod();
            }

            var ordergoods = OrderGoodsDatabase.GetItemsAsync().Result;
            var order      = OrderDatabase.GetItemsAsync().Result;
        }
        public AddUpdateCustomerPage(string customerName = "", string customerAddress = "", string customerMobileNumber = "")
        {
            Title = "";
            Label addNewCustomerLabel = new Label
            {
                Text = "Add New Customer",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };

            Entry customerNameEntry = new Entry
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                WidthRequest      = 400,
                Placeholder       = "Enter Enter customer name",
                Text     = customerName,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Entry))
            };

            Entry customerAddressEntry = new Entry
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                WidthRequest      = 400,
                Placeholder       = "Enter customer address",
                Text     = customerAddress,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Entry))
            };

            Entry customerMobileNumberEntry = new Entry
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                WidthRequest      = 400,
                Keyboard          = Keyboard.Telephone,
                Placeholder       = "Enter customer mobile number",
                Text     = customerMobileNumber,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Entry))
            };

            customerMobileNumberEntry.Behaviors.Add(new NumberValidationBehavior());

            Button addCustomerButton = new Button
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                WidthRequest      = 400,
                FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Button))
            };

            if (string.IsNullOrWhiteSpace(customerName))
            {
                addCustomerButton.Text = "Add Customer";
            }
            else
            {
                addCustomerButton.Text = "Update Customer";
            }
            addCustomerButton.Clicked += async(s, e) =>
            {
                if (string.IsNullOrWhiteSpace(customerNameEntry.Text))
                {
                    await DisplayAlert("Omkar Electricals", "Please enter customer name", "OK");
                }
                else if (string.IsNullOrWhiteSpace(customerAddressEntry.Text))
                {
                    await DisplayAlert("Omkar Electricals", "Please enter customer address", "OK");
                }
                else if (string.IsNullOrWhiteSpace(customerMobileNumberEntry.Text))
                {
                    await DisplayAlert("Omkar Electricals", "Please enter customer mobile number", "OK");
                }
                else if (customerMobileNumberEntry.Text.Length != 10)
                {
                    await DisplayAlert("Omkar Electricals", "Please enter valid 10 digit mobile number", "OK");
                }
                else
                {
                    //Insert customer to db
                    using (CustomerDatabase customerDatabase = new CustomerDatabase())
                    {
                        bool status = await customerDatabase.InsertOrUpdateCustomerAsync(new Customer { CustomerName = customerNameEntry.Text.Trim(), CustomerAddress = customerAddressEntry.Text.Trim(), CustomerMobileNumber = long.Parse(customerMobileNumberEntry.Text.Trim()) });

                        if (status)
                        {
                            await DisplayAlert("Omkar Electricals", "Customer record inserted successfully", "OK");

                            await Navigation.PopAsync();
                        }
                        else
                        {
                            HockeyApp.MetricsManager.TrackEvent("Something went wrong while inserting customer to database");
                            await DisplayAlert("Omkar Electricals", "Something went wrong while inserting customer to database", "OK");
                        }
                    }
                }
            };

            Content = new StackLayout
            {
                Children          = { addNewCustomerLabel, customerNameEntry, customerAddressEntry, customerMobileNumberEntry, addCustomerButton },
                Spacing           = 10,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };
        }
 public void Serialize(CustomerDatabase customers)
 {
 }
Esempio n. 29
0
 public void SetUp()
 {
     _database = new CustomerDatabase();
     _customer = null;
 }
Esempio n. 30
0
        static void Main(string[] args)
        {
            //Hallo 2

            //Customer c1 = new Customer(1,"Sepp", "Forcher", "*****@*****.**");

            CustomerDatabase testDatabase = new CustomerDatabase();

            //Console.WriteLine(c1.FirstName);
            //Console.WriteLine(c1.AccountBalance);
            //Console.WriteLine(c1.moneyIn(1000));
            //Console.WriteLine(c1.AccountBalance);
            //Console.WriteLine(c1.moneyOut(10000));
            //Console.WriteLine(c1.moneyOut(100));
            //Console.WriteLine(c1.AccountBalance);


            Console.WriteLine(testDatabase.AddCustomer("Hansi", "Hinterseer", "*****@*****.**"));
            testDatabase.AddCustomer("Hansi", "Hinterseer", "*****@*****.**");
            testDatabase.AddCustomer("Hansi", "Hinterseer", "*****@*****.**");

            foreach (Customer var in testDatabase.Customers)
            {
                Console.WriteLine(var.CustomerID + " " + var.FirstName + " " + var.LastName + " " + var.Email);
            }
            Console.WriteLine(testDatabase.Count);

            testDatabase.changeEmail("*****@*****.**", "*****@*****.**");

            foreach (Customer var in testDatabase.Customers)
            {
                Console.WriteLine(var.CustomerID + " " + var.FirstName + " " + var.LastName + " " + var.Email);
            }
            // testDatabase.changeEmail("*****@*****.**", "*****@*****.**");

            foreach (Customer var in testDatabase.Customers)
            {
                Console.WriteLine(var.CustomerID + " " + var.FirstName + " " + var.LastName + " " + var.Email);
            }

            //Console.WriteLine(testDatabase.Customers.Contains(new Customer("Hansi", "Hinterseer", "*****@*****.**")));
            //Console.WriteLine(testDatabase.Customers.Contains(c1));
            //Console.WriteLine(testDatabase.FindCustomer("Hansi","Hinterseer").ToString());



            //////////////////////////////////////////////////////////
            ///  Testing input and Output
            /// /////////////////////////////////////////////////////



            //testDatabase.StoreCSVData(@"..\..\..\CustomerData.crypt");
            //testDatabase.readStoredData(@"..\..\..\CustomerData.crypt");
            //testDatabase.StoreCSVData(@"..\..\..\CustomerData.crypt");
            //testDatabase.ReadCSVData(@"..\..\..\CustomerData.crypt");

            //////////////////////////////////////////////////////////
            ///  Testing password change
            /// /////////////////////////////////////////////////////


            //testDatabase.StoreCSVData(@"..\..\..\CustomerData.crypt");
            //testDatabase.readStoredData(@"..\..\..\CustomerData.crypt");
            //testDatabase.StoreCSVData(@"..\..\..\CustomerData.crypt");
            ////testDatabase.ReadCSVData(@"..\..\..\CustomerData.crypt");

            //Console.WriteLine("Password:  "******"..\..\..\initFile.crypt", @"..\..\..\CustomerData.crypt", "safb3f323r");
            //testDatabase.ReadPassword(@"..\..\..\initFile.crypt");

            //Console.WriteLine("Password:  "******"..\..\..\CustomerData.crypt");

            // erfolgreich


            //////////////////////////////////////////////////////////
            ///  Testing password change
            /// /////////////////////////////////////////////////////
            ///
            /// Verschlüsselt mit irgendeinem Passwort
            ///
            /// Kann nicht lesen da verschlüsselt



            //testDatabase.readStoredData(@"..\..\..\CustomerData.crypt");
            //testDatabase.StoreCSVData(@"..\..\..\CustomerData.crypt");
            ////testDatabase.ReadCSVData(@"..\..\..\CustomerData.crypt");

            //Console.WriteLine("Password:  "******"..\..\..\initFile.crypt");

            // testDatabase.readStoredData(@"..\..\..\CustomerData.crypt");
            // testDatabase.StoreCSVData(@"..\..\..\CustomerData.crypt");
            // //testDatabase.ReadCSVData(@"..\..\..\CustomerData.crypt");

            // Console.WriteLine("Password:  "******"..\..\..\initFile.crypt"));
            testDatabase.ChangePassword(@"..\..\..\initFile.crypt", @"..\..\..\CustomerData.crypt", "Passwort");
            Console.WriteLine(testDatabase.ReadPassword(@"..\..\..\initFile.crypt"));

            Console.WriteLine(System.DateTime.Now.Year + "_" + System.DateTime.Now.Month + "_" + System.DateTime.Now.Day);
        }
 /// <summary>
 /// The constructor takes handles from the databases, and adds them to the private fields.
 /// </summary>
 /// <param name="c">A handle to the customer database.</param>
 /// <param name="a">A handle to the account database.</param>
 public AtmPresenter(CustomerDatabase c, AccountDatabase a)
 {
     aDatabase = a;
     cDatabase = c;
 }
Esempio n. 32
0
        public void CanSaveEmptyDB()
        {
            var db = new CustomerDatabase();

            db.SaveChanges();
        }