public void GetSalesHistory() { DataManager dataManager = new DataManager(connectionString); string customerID = GetSelectedCustomer(); salesHistoryTable = dataManager.GetSalesHistory(customerID); SalesHistoryGrid.DataSource = salesHistoryTable; }
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(); } }
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(); } }
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"); } }
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()); }
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); } }
public void GetAllTypesTransactionID() { DataManager dataManager = new DataManager(connectionString); allTypesTransactionIdList = dataManager.GetAllTypesPawnTransactionID(); }
public void GetAllLayawayData() { DataManager dataManager = new DataManager(connectionString); allLayawayDataDictionary = dataManager.GetAllLayawayData(); }
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); }
public void LoadPrimaryDataGrid() { DataManager dataManager = new DataManager(connectionString); primeCatTable = dataManager.GetPrimaryCategories(); PrimeCatGridView.DataSource = primeCatTable; }
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"); } }
public void GetSinglePawnData() { DataManager dataManager = new DataManager(connectionString); singlePawnDataDictionary = dataManager.GetSinglePawnData(); }
public double GetCurrentPrincipal() { DataManager dataManager = new DataManager(connectionString); string transactionID = TransIDTextBox.Text; double currentPrincipal = dataManager.GetCurrentPrincipal(transactionID); return currentPrincipal; }
public void LoadTransactionData() { DataManager dataManager = new DataManager(connectionString); pawnInfoData = dataManager.GetPawnTransactions(); PawnDataGrid.DataSource = pawnInfoData; }
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()); }
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; } }
public void GetPawnPaymentData() { DataManager dataManager = new DataManager(connectionString); string transactionID = TransIDTextBox.Text; pawnPaymentTable = dataManager.GetPawnPaymentHistory(transactionID); PaymentHistoryDataGrid.DataSource = pawnPaymentTable; }
public void GetChargedPawnId() { DataManager dataManager = new DataManager(connectionString); chargedPawnIdList = dataManager.GetChargedPawnId(); }
public void GetPaymentPawnTransactionID() { DataManager dataManager = new DataManager(connectionString); paymentTransactionIdList = dataManager.GetPaymentPawnTransactionID(); }
public void GetCustomerData() { DataManager dataManager = new DataManager(connectionString); customerDataTable = dataManager.ChangeAccountStatusInformation(); StatusGridView.DataSource = customerDataTable; }
public void SetPawnToDefault(string pawnID) { DataManager dataManager = new DataManager(connectionString); string dateDefaulted = DateTime.Today.ToShortDateString(); dataManager.UpdatePawnToDefault(pawnID, dateDefaulted); }
public void GetCustomerData() { DataManager dataManager = new DataManager(connectionString); customerInfoTable = dataManager.GetCustomerInformation(); CustomerGridView.DataSource = customerInfoTable; }
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); }
public void GetAllInventory() { DataManager dataManager = new DataManager(connectionString); allInventoryTable = dataManager.GetAllInventory(); ProductsGridView.DataSource = allInventoryTable; }
public void GetSecondaryCategories() { DataManager dataManager = new DataManager(connectionString); SecCatTable = dataManager.GetSecondaryCategories(); SecCatGridView.DataSource = SecCatTable; }
public void GetInvoiceData() { DataManager dataManager = new DataManager(connectionString); invoiceDataTable = dataManager.GetReprintInvoiceData(); InvoiceGridView.DataSource = invoiceDataTable; }
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); }
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); } } } } }
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); } } } }
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); }