Пример #1
0
 public void GetSalesHistory()
 {
     DataManager dataManager = new DataManager(connectionString);
     string customerID = GetSelectedCustomer();
     salesHistoryTable = dataManager.GetSalesHistory(customerID);
     SalesHistoryGrid.DataSource = salesHistoryTable;
 }
Пример #2
0
        public void AddNewStatus()
        {
            DataManager dataManager = new DataManager(connectionString);
            string newStatus = GetNewStatus();

            if(newStatus != string.Empty)
            {
                dataManager.InsertProductStatus(newStatus);
                MessageBox.Show(string.Format("You Have Just Added: {0}",newStatus));
                this.Close();
            }
        }
Пример #3
0
        public void AddNewPrimeCat()
        {
            DataManager dataManager = new DataManager(connectionString);
            string newPrimeCat = GetNewPrimeCat();

            if(newPrimeCat != string.Empty)
            {
                dataManager.InsertPrimeCategory(newPrimeCat);
                MessageBox.Show(string.Format("You Have Just Added: {0}",newPrimeCat));
                this.Close();
            }
        }
Пример #4
0
 public void MakeAccountInactive()
 {
     DataManager dataManager = new DataManager(connectionString);
     string customerID = GetSelectedCustomer();
     if (customerID != string.Empty)
     {
         dataManager.UpdateToInactiveStatus(customerID);
     }
     else
     {
         MessageBox.Show("No customer has been selected");
     }
 }
Пример #5
0
        public void ApplyPaymentCharge(string pawnID)
        {
            DataManager dataManager = new DataManager(connectionString);
            double financeChargePercent = Convert.ToDouble(GetFinanceCharge());
            double newBalance;
            double financeCharge;

            double principalAmount = dataManager.GetMaxPaymentPrincipal(pawnID);

            financeCharge = principalAmount * financeChargePercent;
            newBalance = principalAmount + financeCharge;

            dataManager.UpdatePawnChargesTable(pawnID, DateTime.Today, financeCharge.ToString(),
                principalAmount.ToString(), newBalance.ToString());
        }
Пример #6
0
        public void AddPaymentToTransaction()
        {
            DataManager dataManager = new DataManager(connectionString);
            string transactionID = TransIDTextBox.Text;
            string paymentDate = DateTime.Today.ToShortDateString();
            double paymentAmount = Convert.ToDouble(PaymentTextBox.Text);
            double newPrincipal;
            if (currentPrincipal == 0)
            {
                newPrincipal = principal - paymentAmount;
            }
            else
            {
                newPrincipal = currentPrincipal - paymentAmount;
            }

            dataManager.InsertNewPayment(transactionID, paymentDate, paymentAmount.ToString(), newPrincipal.ToString());

            if (newPrincipal == 0)
            {
                dataManager.UpdatePawnToClosed(transactionID);
            }
        }
Пример #7
0
 public void GetAllTypesTransactionID()
 {
     DataManager dataManager = new DataManager(connectionString);
     allTypesTransactionIdList = dataManager.GetAllTypesPawnTransactionID();
 }
Пример #8
0
 public void GetAllLayawayData()
 {
     DataManager dataManager = new DataManager(connectionString);
     allLayawayDataDictionary = dataManager.GetAllLayawayData();
 }
Пример #9
0
        public void CreatePawn()
        {
            double financeCharge = CreateFinanceCharge();
            double principal = Convert.ToDouble(PrincipalTextBox.Text);
            double totalAmount = principal + financeCharge;

            string transactionID = poNumber;
            string customerID = GetSelectedCustomerID();
            string productDesc = ProductDescTextBox.Text;
            string principalAmount = totalAmount.ToString();
            string pawnDate = GetDate();
            string status = "Open";
            string defaultedDate = "1/1/1900";
            string defaultDate = GetDefaultDate();

            DataManager dataManager = new DataManager(connectionString);
            dataManager.InsertPawn(transactionID,customerID,productDesc,principalAmount,
                                   pawnDate,status,defaultedDate,defaultDate);
        }
Пример #10
0
 public void LoadPrimaryDataGrid()
 {
     DataManager dataManager = new DataManager(connectionString);
     primeCatTable = dataManager.GetPrimaryCategories();
     PrimeCatGridView.DataSource = primeCatTable;
 }
Пример #11
0
        public void CreateSalesTransaction()
        {
            if (!CheckData())
            {
                string customerID = CustomerIDTextBox.Text;
                string saleDate = GetSalesDate();
                string invoiceNumber = "S" + CreateInvoiceNumber();
                Dictionary<int, double> soldProducts = GetSalesInformation();
                DataManager dataManager = new DataManager(connectionString);
                foreach (KeyValuePair<int, double> pair in soldProducts)
                {
                    dataManager.SaveSaleData(customerID, pair.Key.ToString(), pair.Value.ToString(), saleDate, invoiceNumber);
                    dataManager.UpdateProductStatus(pair.Key.ToString(), saleDate);
                }

                string totalSale = TotalLabel.Text;
                string salesTax = TaxLabel.Text;
                string grandTotal = GrandTotalLabel.Text;
                dataManager.SaveInvoiceData(invoiceNumber, totalSale, salesTax, saleDate, customerID, grandTotal);
                SalesInvoice salesInvoice = new SalesInvoice();
                salesInvoice.InvoiceNumberValue = invoiceNumber;
                salesInvoice.CustomerIDValue = customerID;
                salesInvoice.InvoiceDollarValue = invoiceNumber;
                salesInvoice.Show();
            }
            else
            {
                MessageBox.Show("Either the customer ID is blank, you did not select a product, or there is no total");
            }
        }
Пример #12
0
 public void GetSinglePawnData()
 {
     DataManager dataManager = new DataManager(connectionString);
     singlePawnDataDictionary = dataManager.GetSinglePawnData();
 }
Пример #13
0
 public double GetCurrentPrincipal()
 {
     DataManager dataManager = new DataManager(connectionString);
     string transactionID = TransIDTextBox.Text;
     double currentPrincipal = dataManager.GetCurrentPrincipal(transactionID);
     return currentPrincipal;
 }
Пример #14
0
        public void LoadTransactionData()
        {
            DataManager dataManager = new DataManager(connectionString);
            pawnInfoData = dataManager.GetPawnTransactions();

            PawnDataGrid.DataSource = pawnInfoData;
        }
Пример #15
0
        public void IncreaseDefaultDate()
        {
            DataManager dataManager = new DataManager(connectionString);
            DateTime oldDate = DateTime.MinValue;
            DateTime newDefaultDate;
            string pawnID = TransIDTextBox.Text;

            for (int i = 0; i < pawnInfoData.Rows.Count; i++)
            {
                oldDate = Convert.ToDateTime(pawnInfoData.Rows[i]["DefaultDate"]);
            }

            newDefaultDate = oldDate.AddDays(30);

            dataManager.UpdateDefaultDate(pawnID, newDefaultDate.ToString());
        }
Пример #16
0
        public void GetTransactionDetails()
        {
            string transactionID = TransIDTextBox.Text;
            DataTable pawnDetailTable = new DataTable();
            DataManager dataManager = new DataManager(connectionString);
            pawnDetailTable = dataManager.GetPawnDetails(transactionID);

            string productDesc = pawnDetailTable.Rows[0]["ProductDescription"].ToString();
            ProdDescLabel.Text = productDesc;

            string status = pawnDetailTable.Rows[0]["Status"].ToString();
            PawnStatusLabel.Text = status;

            string pawnDate = Convert.ToDateTime(pawnDetailTable.Rows[0]["PawnDate"]).ToShortDateString();
            PawnDateLabel.Text = pawnDate;

            principal = Convert.ToInt32(pawnDetailTable.Rows[0]["PrincipalAmount"]);
            string principalAmount = string.Format("{0:C}", principal);
            PrincipalAmountLabel.Text = principalAmount;

            currentPrincipal = GetCurrentPrincipal();
            if (currentPrincipal == 0)
            {
                CurrentPrincipalLabel.Text = principalAmount;
            }
            else
            {
                string newPrincipal = string.Format("{0:C}", currentPrincipal);
                CurrentPrincipalLabel.Text = newPrincipal;
            }
        }
Пример #17
0
 public void GetPawnPaymentData()
 {
     DataManager dataManager = new DataManager(connectionString);
     string transactionID = TransIDTextBox.Text;
     pawnPaymentTable = dataManager.GetPawnPaymentHistory(transactionID);
     PaymentHistoryDataGrid.DataSource = pawnPaymentTable;
 }
Пример #18
0
 public void GetChargedPawnId()
 {
     DataManager dataManager = new DataManager(connectionString);
     chargedPawnIdList = dataManager.GetChargedPawnId();
 }
Пример #19
0
 public void GetPaymentPawnTransactionID()
 {
     DataManager dataManager = new DataManager(connectionString);
     paymentTransactionIdList = dataManager.GetPaymentPawnTransactionID();
 }
Пример #20
0
 public void GetCustomerData()
 {
     DataManager dataManager = new DataManager(connectionString);
     customerDataTable = dataManager.ChangeAccountStatusInformation();
     StatusGridView.DataSource = customerDataTable;
 }
Пример #21
0
        public void SetPawnToDefault(string pawnID)
        {
            DataManager dataManager = new DataManager(connectionString);

            string dateDefaulted = DateTime.Today.ToShortDateString();

            dataManager.UpdatePawnToDefault(pawnID, dateDefaulted);
        }
Пример #22
0
 public void GetCustomerData()
 {
     DataManager dataManager = new DataManager(connectionString);
     customerInfoTable = dataManager.GetCustomerInformation();
     CustomerGridView.DataSource = customerInfoTable;
 }
Пример #23
0
        public void SaveInventoryItem()
        {
            string productID = ProductIDTextBox.Text;
            string productDesc = ProductDescTextBox.Text;
            string purchasePrice = PriceTextBox.Text;
            string primeCategory = GetSelectedPrimeCategory();
            string secondaryCategory = GetSelectedSecCategory();
            string productStatus = "Available";
            string serialNumber = SerialNumberTextBox.Text;
            string saleDate = "1/1/1990";

            DataManager dataManager = new DataManager(connectionString);
            dataManager.InsertInventoryItem(productID,productDesc,purchasePrice,primeCategory,
                                            secondaryCategory,productStatus,serialNumber,saleDate);
        }
Пример #24
0
 public void GetAllInventory()
 {
     DataManager dataManager = new DataManager(connectionString);
     allInventoryTable = dataManager.GetAllInventory();
     ProductsGridView.DataSource = allInventoryTable;
 }
Пример #25
0
 public void GetSecondaryCategories()
 {
     DataManager dataManager = new DataManager(connectionString);
     SecCatTable = dataManager.GetSecondaryCategories();
     SecCatGridView.DataSource = SecCatTable;
 }
Пример #26
0
 public void GetInvoiceData()
 {
     DataManager dataManager = new DataManager(connectionString);
     invoiceDataTable = dataManager.GetReprintInvoiceData();
     InvoiceGridView.DataSource = invoiceDataTable;
 }
Пример #27
0
        public void SavePurchaseItem()
        {
            string productID = ProductIDTextBox.Text;
            string productDesc = ProductDescTextBox.Text;
            string purchasePrice = PriceTextBox.Text;
            string primeCategory = GetSelectedPrimeCategory();
            string secondaryCategory = GetSelectedSecCategory();
            string customerID = GetSelectedCustomerID();
            string purchaseDate = GetDate();

            DataManager dataManager = new DataManager(connectionString);
            dataManager.InsertPurchaseItem(productID,productDesc,purchasePrice,primeCategory,
                                           secondaryCategory,customerID,purchaseDate,poNumber);
        }
Пример #28
0
        public void CheckMaxDate()
        {
            DataManager dataManager = new DataManager(connectionString);

            foreach (string pawnID in allTypesTransactionIdList)
            {
                dateDictionary = dataManager.GetAllTypesMaxDate(pawnID);
                DateTime maxDate;

                foreach (KeyValuePair<string, DateTime> pair in dateDictionary)
                {
                    maxDate = pair.Value;
                    DateTime today = DateTime.Today;
                    TimeSpan diffDays = today - maxDate;
                    double loanDays = diffDays.TotalDays;
                    string typeTest = pair.Key.Substring(0, 10);

                    if (typeTest == "PaymentDat")
                    {
                        if (loanDays >= 31)
                        {
                            ApplyPaymentCharge(pawnID);
                        }
                    }

                    if (typeTest == "ChargeDate")
                    {
                        if (loanDays >= 31)
                        {
                            ApplyChargedFinanceCharge(pawnID);
                        }
                    }
                }
            }
        }
Пример #29
0
        public void CheckMaxPaymentDate()
        {
            DataManager dataManager = new DataManager(connectionString);

            if (paymentTransactionIdList.Count >= 1)
            {
                foreach (string pawnID in paymentTransactionIdList)
                {
                    DateTime chargeDate = dataManager.GetMaxPaymentDate(pawnID);
                    DateTime today = DateTime.Today;
                    TimeSpan diffDays = today - chargeDate;
                    double loanDays = diffDays.TotalDays;

                    if (loanDays >= 31)
                    {
                        ApplyPaymentCharge(pawnID);
                    }
                }
            }
        }
Пример #30
0
        public void SaveNewCustomer()
        {
            string customerNumber = LicenseNumTextBox.Text;
            string customerID = customerNumber.Substring(1, 9);
            string firstName = FirstNameTextBox.Text;
            string lastName = LastNameTextBox.Text;
            string middle = MiddleTextBox.Text;
            string address = AddressTextBox.Text;
            string city = CityTextBox.Text;
            string state = StateTextBox.Text;
            string zipCode = ZipCodeTextBox.Text;
            string phoneNumber = PhoneNumTextBox.Text;
            string secondPhoneNumber = SecondaryPhoneTextBox.Text;
            string licenseNumber = LicenseNumTextBox.Text;
            string entryDate = DateTime.Now.ToString("d");
            string accountStatus = "Active";

            DataManager saveCustomer = new DataManager(connectionString);

            saveCustomer.SaveCustomerData(customerID, firstName, lastName, middle, address, city,
                                          state, zipCode, phoneNumber, secondPhoneNumber, licenseNumber,
                                          entryDate, accountStatus);
        }