예제 #1
0
        public void Add()
        {
            const string title       = "Add new Loan Product";
            const string message     = "Please enter a description";
            var          inputWindow = new InputWindow(message, title);

            if (inputWindow.ShowDialog() == true)
            {
                var input = inputWindow.InputText;
                if (string.IsNullOrEmpty(input))
                {
                    MessageWindow.ShowAlertMessage("Please specify a Loan Product Name");
                    return;
                }
                var newLoanProduct = LoanProduct.WhereTitleIs(input);
                if (newLoanProduct != null)
                {
                    MessageWindow.ShowAlertMessage(input + "already exists");
                    return;
                }

                var editView = new EditLoanProductView(input);
                if (editView.ShowDialog() == true)
                {
                    newLoanProduct = new LoanProduct();
                    newLoanProduct.Find(editView.CurrentItem.ID);
                    _lookup.Add(newLoanProduct);
                    _viewModel.Collection.Add(newLoanProduct);
                }
            }
        }
예제 #2
0
        internal static LoanProductCollection CollectAll()
        {
            var dataTable  = DatabaseController.ExecuteSelectQuery("SELECT * FROM " + TABLE_NAME + " ORDER BY `Name`");
            var collection = new LoanProductCollection();

            foreach (DataRow dataRow in dataTable.Rows)
            {
                var item = new LoanProduct();
                item.SetPropertiesFromDataRow(dataRow);
                collection.Add(item);
            }
            return(collection);
        }