protected void buttonSubmitBudget_Click(object sender, EventArgs e) { //create some kind of function to determine if budget already exists //using some kind of session variable, then either update or add on that UserBudgetPlan UserBudgetPlan = new UserBudgetPlan(); UserBudgetPlan.budgetEntertainment = decimal.Parse(BoxExpenseDebtRepayment.Text); UserBudgetPlan.BudgetPlanActive = true; UserBudgetPlan.IncomeAmount = decimal.Parse(BoxWagesIncome.Text); UserBudgetPlan.budgetHousing = decimal.Parse(BoxExpenseHousing.Text); UserBudgetPlan.budgetUtilities = decimal.Parse(BoxExpenseUtilities.Text); UserBudgetPlan.budgetPhone = decimal.Parse(BoxExpensePhone.Text); UserBudgetPlan.budgetTV = decimal.Parse(BoxExpenseTV.Text); UserBudgetPlan.budgetInternet = decimal.Parse(BoxExpenseInternet.Text); UserBudgetPlan.budgetGroceries = decimal.Parse(BoxExpenseGroceries.Text); UserBudgetPlan.budgetFood = decimal.Parse(BoxExpenseFood.Text); UserBudgetPlan.budgetGas = decimal.Parse(BoxExpenseGas.Text); UserBudgetPlan.budgetFamilyExpenses = decimal.Parse(BoxExpenseFamily.Text); UserBudgetPlan.budgetPersonalCare = decimal.Parse(BoxExpenseHygiene.Text); UserBudgetPlan.budgetPets = decimal.Parse(BoxExpensePets.Text); UserBudgetPlan.budgetEntertainment = decimal.Parse(BoxExpenseEntertainment.Text); UserBudgetPlan.budgetInsurance = decimal.Parse(BoxExpenseInsurance.Text); UserBudgetPlan.budgetDebtRepayment = decimal.Parse(BoxExpenseDebtRepayment.Text); UserBudgetPlan.budgetPropertyTax = decimal.Parse(BoxExpensePropertyTax.Text); UserBudgetPlan.budgetEmergencyFund = decimal.Parse(BoxExpenseEmergencyFund.Text); UserBudgetPlan.budgetRetirementSavings = decimal.Parse(BoxExpenseRetirement.Text); UserBudgetPlan.budgetCollegeSavings = decimal.Parse(BoxExpenseCollegeSavings.Text); UserBudgetPlan.budgetGoal = decimal.Parse(BoxExpenseGoals.Text); UserBudgetPlan.budgetGifts = decimal.Parse(BoxExpenseGifts.Text); UserBudgetPlan.budgetOther = decimal.Parse(BoxExpenseOther.Text); ReceiptDataAccessClass.CreateNewBudgetPlan(UserBudgetPlan); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your Budget Plan has been successfully updated!')", true); }
protected void GridviewBind() { DataSet AllPayments = ReceiptDataAccessClass.LoadTenderTypesOwnedbyUser(ReceiptConstants.UserProvCode); ownedPaymentsGridview.DataSource = AllPayments; ownedPaymentsGridview.DataBind(); }
protected void ownedPaymentsGridview_RowCommand(object sender, GridViewCommandEventArgs e) { int PTIDOfSelectedPayment = int.Parse(e.CommandArgument.ToString()); ReceiptDataAccessClass.DeleteUserPayment(ReceiptConstants.UserProvCode, PTIDOfSelectedPayment); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", ReceiptConstants.DeleteShownPaymentMessage.ToString()); GridviewBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BoxValuePTID.DataSource = ReceiptDataAccessClass.LoadTenderTypes(ReceiptConstants.UserProvCode); BoxValuePTID.DataBind(); GridviewBind(); } }
public void OnConfirm(object sender, EventArgs e) { //Create delete receipt and the functionality to delete any associated products ReceiptDataAccessClass.DeleteReceiptAndReceiptsProducts(Request.QueryString["ManageReceipt"].ToString(), ReceiptConstants.UserProvCode); //make sure to add a message that receipt has been deleted ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Receipt has been successfully deleted!')", true); //then redirect to the profile page Response.Redirect("Profile.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!Request.IsAuthenticated) { Response.Redirect("Account/Login.aspx"); } if (Session["CheckedInStatus"] == null) { Session["CheckedInStatus"] = "CheckIn"; } ReceiptHyperLink.NavigateUrl = "NewEntry"; ProductHyperLink.NavigateUrl = "NewProductEntry"; PaymentHyperLink.NavigateUrl = "NewPayment"; profileName.Text = User.Identity.Name.ToString(); if (Session["CheckedInStatus"].ToString() == "CheckIn") { // Session["UserBudgetPlan"] = ReceiptDataAccessClass.LoadBudgetPlan(ReceiptConstants.UserProvCode); Session["CheckedInStatus"] = "BudgetLoaded"; } // ReceiptDataAccessClass.GetBudgetUsageForMonth(ReceiptConstants.UserProvCode, ReceiptConstants.beginMonth, ReceiptConstants.endMonth); UserStatistics Ustats = ReceiptDataAccessClass.GetUserStatistics(ReceiptConstants.UserProvCode, ReceiptConstants.beginMonth, ReceiptConstants.endMonth); if (Ustats != null) { profileCurrentMonth.Text = GetCurrentMonth(DateTime.Now.Month); profileCurrentSpent.Text = Ustats.TotalAmountSpentforCurrentMonth; profilePreviousSpent.Text = Ustats.TotalAmountSpentforPreviousMonth; profileMostSpentPlace.Text = Ustats.VenueSpentMostCurrentMonth; profileMostamountNumber.Text = Ustats.VenueSpentMostAmountCurrentMonth; profilePercentageChange.Text = Ustats.PercentageDisplay; ProfileMostSpentURL.HRef = Ustats.VenueSpentMostUrlLink; profileTopCategoryName.Text = Ustats.TopCategoryCurrentMonth; profileTopCategoryMonthAmount.Text = Ustats.TopCategoryAmountSpentCurrentMonth; } if (!IsPostBack) { GridviewBind(); } if (IsPostBack) { ReceiptTableGridview.DataSource = Session["cachedProfile"]; } if (ReceiptTableGridview.Rows.Count < 1) { noInformationLabel.Visible = true; } }
protected void GridviewBind() { Session["cachedProfile"] = ReceiptDataAccessClass.LoadProfileReceipts(ReceiptConstants.UserProvCode, 12); ReceiptTableGridview.DataSource = Session["cachedProfile"]; ReceiptTableGridview.DataBind(); if (Session["cachedProfile"] != null) { ReceiptTableGridview.UseAccessibleHeader = true; ReceiptTableGridview.HeaderRow.TableSection = TableRowSection.TableHeader; } }
protected void submitPaymentButton_Click(object sender, EventArgs e) { PaymentForm newPayment = new PaymentForm(); newPayment.description = BoxDescriptionOfPymt.Text; newPayment.UserProvCode = ReceiptConstants.UserProvCode; newPayment.typeID = int.Parse(BoxValuePTID.SelectedValue); ReceiptDataAccessClass.LogNewPayment(newPayment); BoxDescriptionOfPymt.Text = null; BoxValuePTID.SelectedIndex = 0; ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", ReceiptConstants.SubmitPaymentMessage.ToString()); GridviewBind(); }
protected void ProductsGridview_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.ToString() == "Edit") { } if (e.CommandName.ToString() == "DELETEPRODUCT") { ReceiptDataAccessClass.DeleteSpecificProductFromReceipt(ReceiptConstants.UserProvCode, int.Parse(e.CommandArgument.ToString()), Request.QueryString["EditProducts"].ToString()); GridviewBind(); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", ReceiptConstants.DeleteShownProductMessage.ToString()); } }
protected void submitFinal_Click(object sender, EventArgs e) { ReceiptItemProduct Product = new ReceiptItemProduct(); //check this logic for date Product.finalDate = DateTime.Parse(ValueSpecifiedDate.Text); Product.URCI = ValueURCI.Text; Product.RPInameOfProduct = ValueProductName.Text; Product.RPIdescriptionOfItem = ValueDescription.Text; Product.RPIquantityAmount = ValueQuantityAmount.Text; Product.RPIquantityPrice = decimal.Parse(ValueTotalPriceOfProductss.Text); ReceiptDataAccessClass.LogProduct(Product, ReceiptConstants.UserProvCode); Reset(); }
protected void updateReceipt_Click(object sender, EventArgs e) { Receipt UpdatedReceipt = new Receipt(); UpdatedReceipt.RDIcode = Request.QueryString["ManageReceipt"]; UpdatedReceipt.BarcodeOfReceipt = UpdateBoxBarcode.Text; UpdatedReceipt.totalAmountOfPurchase = decimal.Parse(UpdateBoxAmount.Text); UpdatedReceipt.venueName = UpdateBoxVenue.Text; UpdatedReceipt.finalDate = DateTime.Parse(UpdateBoxDate.Text); UpdatedReceipt.URCI = UpdateBoxURCI.Text; UpdatedReceipt.totalTaxOfTransaction = decimal.Parse(UpdateBoxTax.Text); UpdatedReceipt.CategoryType = UpdateComboBoxCategory.SelectedValue; UpdatedReceipt.PaymentDescription = UpdateComboBoxPayment.SelectedValue; UpdatedReceipt.descriptionOfPurchase = UpdateBoxDescription.Text; UpdatedReceipt.productCount = int.Parse(UpdateBoxProductCount.Text); UpdatedReceipt.ReceiptImageURLfile = ReceiptDataAccessClass.GetReceiptDetails(UpdatedReceipt.RDIcode, ReceiptConstants.UserProvCode).ReceiptImageURLfile; if (ReceiptImageFileUpload.HasFile) { //clear here, pull current receipt path and delete to prevent over kill stock of images ---------- if (!string.IsNullOrEmpty(UpdatedReceipt.ReceiptImageURLfile)) { FileInfo ReceiptImage = new FileInfo(HttpContext.Current.Server.MapPath(UpdatedReceipt.ReceiptImageURLfile)); if (ReceiptImage.Directory.Parent.Name == "ReceiptContents") { ReceiptImage.Delete(); } } string receiptImageFileName = ReceiptImageFileUpload.PostedFile.FileName; string receiptImageFileNameExtension = Path.GetExtension(receiptImageFileName); receiptImageFileName = UpdatedReceipt.RDIcode + receiptImageFileNameExtension; UpdatedReceipt.ReceiptImageURLfile = ReceiptConstants.UserFolderRepository + "/" + receiptImageFileName; string targetFolder = HttpContext.Current.Server.MapPath(ReceiptConstants.UserFolderRepository); string targetPath = Path.Combine(targetFolder, receiptImageFileName); ReceiptImageFileUpload.SaveAs(targetPath); ReceiptDataAccessClass.UpdateImage(ReceiptConstants.UserProvCode, Request.QueryString["ManageReceipt"], UpdatedReceipt.ReceiptImageURLfile); } ReceiptDataAccessClass.UpdateReceipt(ReceiptConstants.UserProvCode, Request.QueryString["ManageReceipt"].ToString(), UpdatedReceipt); ReceiptDisplayBind(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Receipt has been successfully updated!')", true); //Correct way to show receipt messages..... }
public static List <Data> GetData() { List <Data> dataList = new List <Data>(); DataTable CategorySpending = ReceiptDataAccessClass.GetCategorySpendingByMonth(ReceiptConstants.UserProvCode, ReceiptConstants.beginMonth, ReceiptConstants.endMonth); foreach (DataRow Info in CategorySpending.Rows) { dataList.Add(new Data(Info["Category_Name"].ToString(), decimal.Parse(Info["Amount_Spent"].ToString()))); } /* dataList.Add(new Data("Column 1", 100)); * dataList.Add(new Data("Column 2", 200)); * dataList.Add(new Data("Column 3", 300)); * dataList.Add(new Data("Column 4", 400)); */ return(dataList); }
protected void updateReceipt_Click(object sender, EventArgs e) { Receipt ReceiptInfo = ReceiptDataAccessClass.GetReceiptDetails(Request.QueryString["EditProducts"].ToString(), ReceiptConstants.UserProvCode); ReceiptItemProduct newItem = new ReceiptItemProduct(); newItem.RPInameOfProduct = TextBoxTNEWname.Text; newItem.RPIdescriptionOfItem = TextBoxTNEWdesc.Text; newItem.RPIproductCode = TextBoxTNEWpcode.Text; newItem.RPIquantityAmount = TextBoxTNEWquan.Text; newItem.RPIquantityPrice = decimal.Parse(TextBoxTNEWunit.Text); newItem.URCI = ReceiptInfo.URCI; newItem.finalDate = ReceiptInfo.finalDate; newItem.RDIcode = ReceiptInfo.RDIcode; ReceiptDataAccessClass.LogProduct(newItem, ReceiptConstants.UserProvCode); GridviewBind(); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", ReceiptConstants.SubmitProductMessage.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!Request.IsAuthenticated) { Response.Redirect("Account/Login.aspx"); } if (!IsPostBack) { ValuePTID.DataSource = ReceiptDataAccessClass.LoadPaymentTypes(ReceiptConstants.UserProvCode); ValuePTID.DataBind(); } if (ValuePTID.Items.Count < 1) { PaymentForm newPayment = new PaymentForm(); newPayment.description = "Cash"; newPayment.typeID = 10; newPayment.UserProvCode = ReceiptConstants.UserProvCode; ReceiptDataAccessClass.LogNewPayment(newPayment); } ListBoxDiv.Visible = false; if (Request["__EVENTARGUMENT"] != null && Request["__EVENTARGUMENT"] == "move") { int idx = listBoxReceiptProducts.SelectedIndex; ListItem item = listBoxReceiptProducts.SelectedItem; listBoxReceiptProducts.Items.Remove(item); ReceiptConstants.CurrentCollectionOfProducts.RemoveAt(idx); listBoxReceiptProducts.SelectedIndex = -1; } listBoxReceiptProducts.Attributes.Add("ondblclick", ClientScript.GetPostBackEventReference(listBoxReceiptProducts, "move")); }
protected void submit_Click(object sender, EventArgs e) { #region Attach Receipt Data Receipt newReceipt = new Receipt(); newReceipt.CollectionOfItems = new System.Collections.ObjectModel.Collection <ReceiptItemProduct>(); newReceipt.venueName = ValueVenue.Text; newReceipt.timeOfPurchase = DateTime.Parse(ValueTOP.Text).ToShortTimeString(); newReceipt.datePurchased = DateTime.Parse(ValueDOP.Text).ToShortDateString(); newReceipt.finalDate = DateTime.Parse(newReceipt.datePurchased + " " + newReceipt.timeOfPurchase); newReceipt.dateReceiptEntered = DateTime.Now; newReceipt.totalAmountOfPurchase = decimal.Parse(ValueTransactionAmount.Text); newReceipt.CategoryType = ValueSelectedCategory.Text; newReceipt.descriptionOfPurchase = ValueDescription.Text; newReceipt.userProviderKey = ReceiptConstants.UserProvCode; newReceipt.totalTaxOfTransaction = decimal.Parse(ValueTaxes.Text); newReceipt.productCount = int.Parse(ValueProductCount.Text); newReceipt.PTID = int.Parse(ValuePTID.Text); newReceipt.BarcodeOfReceipt = ValueBarcode.Text; newReceipt.FRuserID = User.Identity.Name.ToString(); newReceipt.ReceiptImageURLfile = ReceiptConstants.DefaultImage; if (string.IsNullOrEmpty(ValueURCI.Text)) { newReceipt.URCI = ReceiptDataAccessClass.DetermineUniqueCode(ReceiptConstants.UserProvCode, newReceipt.venueName); } else { newReceipt.URCI = ValueURCI.Text; } int MonthForRDI = newReceipt.finalDate.Month; int YearForRDI = newReceipt.finalDate.Year; int DayForRDI = newReceipt.finalDate.Day; int TimeForRDI = newReceipt.finalDate.Hour; int MilForRDI = DateTime.Now.Millisecond; int MinforRDI = newReceipt.finalDate.Minute; int CurrentHourTimeForRDI = int.Parse(DateTime.UtcNow.Hour.ToString()); int CurrentMinTimeForRDI = int.Parse(DateTime.UtcNow.Minute.ToString()); int CurrentSecTimeForRDI = int.Parse(DateTime.UtcNow.Second.ToString()); foreach (ReceiptItemProduct item in ReceiptConstants.CurrentCollectionOfProducts) { newReceipt.CollectionOfItems.Add(item); } newReceipt.RDIcode = YearForRDI.ToString() + MonthForRDI.ToString() + DayForRDI.ToString() + TimeForRDI.ToString() + MilForRDI.ToString() + MinforRDI.ToString() + CurrentHourTimeForRDI.ToString() + CurrentMinTimeForRDI.ToString() + CurrentSecTimeForRDI.ToString() + "A"; if (string.IsNullOrEmpty(newReceipt.totalTaxOfTransaction.ToString())) { newReceipt.totalTaxOfTransaction = 0.00m; } #endregion //Image Directory Assignment if (!Directory.Exists(Server.MapPath(ReceiptConstants.UserFolderRepository))) { Directory.CreateDirectory(Server.MapPath(ReceiptConstants.UserFolderRepository)); } if (ReceiptImageFileUpload.HasFile) { string receiptImageFileName = ReceiptImageFileUpload.PostedFile.FileName; string receiptImageFileNameExtension = Path.GetExtension(receiptImageFileName); receiptImageFileName = newReceipt.RDIcode + receiptImageFileNameExtension; newReceipt.ReceiptImageURLfile = ReceiptConstants.UserFolderRepository + "/" + receiptImageFileName; string targetFolder = HttpContext.Current.Server.MapPath(ReceiptConstants.UserFolderRepository); string targetPath = Path.Combine(targetFolder, receiptImageFileName); ReceiptImageFileUpload.SaveAs(targetPath); } DB.LogReceipt(newReceipt); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Receipt has been successfully Submitted!')", true); Reset(); }
protected void ReceiptDisplayBind() { UpdateComboBoxPayment.DataSource = ReceiptDataAccessClass.LoadPaymentTypes(ReceiptConstants.UserProvCode); UpdateComboBoxCategory.DataSource = ReceiptDataAccessClass.LoadCategoryTypes(); UpdateComboBoxPayment.DataBind(); UpdateComboBoxCategory.DataBind(); Receipt Display = ReceiptDataAccessClass.GetReceiptAndProductDetails(Request.QueryString["ManageReceipt"].ToString()); TitleVenue.Text = Display.venueName; cellAmountSpent.Text = Display.totalAmountOfPurchase.ToString("C2"); cellDateOfReceipt.Text = Display.finalDate.ToString(); cellURCI.Text = Display.URCI; URCIlabelUpdate.Text = Display.URCI; cellDescription.Text = Display.descriptionOfPurchase; cellCategory.Text = Display.CategoryType.ToString(); cellReceiptBarcode.Text = Display.BarcodeOfReceipt; cellPayment.Text = Display.PaymentDescription; cellProductCount.Text = Display.productCount.ToString(); celltaxOfTheTransacction.Text = Display.totalTaxOfTransaction.ToString("C2"); cellDateModified.Text = Display.dateModified.ToString(); ReceiptImagePath.ImageUrl = Display.ReceiptImageURLfile; ReceiptImagePath.AlternateText = "Receipt Image of: " + Display.URCI; //for the updating the receipt item fields ListItem selectedPayment = new ListItem(); selectedPayment.Value = UpdateComboBoxPayment.Items.FindByText(Display.PaymentDescription).Value; selectedPayment.Text = Display.PaymentDescription; ListItem selectedCategory = new ListItem(); selectedCategory.Value = UpdateComboBoxCategory.Items.FindByText(Display.CategoryType).Value; selectedCategory.Text = Display.CategoryType; UpdateBoxAmount.Text = Display.totalAmountOfPurchase.ToString("C2").Trim('$'); UpdateBoxBarcode.Text = Display.BarcodeOfReceipt; UpdateBoxDate.Text = Display.finalDate.ToString(); UpdateBoxProductCount.Text = Display.productCount.ToString(); UpdateBoxDescription.Text = Display.descriptionOfPurchase; UpdateComboBoxCategory.SelectedIndex = UpdateComboBoxCategory.Items.IndexOf(selectedCategory); UpdateComboBoxPayment.SelectedIndex = UpdateComboBoxPayment.Items.IndexOf(selectedPayment); UpdateBoxTax.Text = Display.totalTaxOfTransaction.ToString("C2").Trim('$'); UpdateBoxURCI.Text = Display.URCI; UpdateBoxVenue.Text = Display.venueName; // ReceiptImage.ImageUrl = @"C:\Users\KTM4362\Pictures\120.jpg"; //make sre to change--------------- if (Display.CollectionOfItems.Count > 0) { LineItemsProducts.Visible = false; // dropdownProducts.SelectedIndex = 0; // dropdownProducts.DataSource = Display.CollectionOfItems; //dropdownProducts.DataBind(); //dropdownProducts.Text = Display.CollectionOfItems[dropdownProducts.SelectedItem].RPInameOfProduct; //dropdownProducts.Text = Display.CollectionOfItems[dropdownProducts.SelectedIndex].RPInameOfProduct; foreach (ReceiptItemProduct RPI in Display.CollectionOfItems) { TableCell productName = new TableCell(); TableCell productDescription = new TableCell(); TableCell productBarcode = new TableCell(); TableCell productQuantity = new TableCell(); TableCell productUnitPrice = new TableCell(); productName.Text = RPI.RPInameOfProduct; productDescription.Text = RPI.RPIdescriptionOfItem; productBarcode.Text = RPI.RPIproductCode; productQuantity.Text = RPI.RPIquantityAmount.ToString(); productUnitPrice.Text = RPI.RPIquantityPrice.ToString("C2"); TableRow ProductDisplayRow = new TableRow(); ProductDisplayRow.Cells.Add(productName); ProductDisplayRow.Cells.Add(productDescription); ProductDisplayRow.Cells.Add(productQuantity); ProductDisplayRow.Cells.Add(productUnitPrice); ProductDisplayRow.Cells.Add(productBarcode); ReceiptItemsTable.Rows.Add(ProductDisplayRow); } } else { LineItemsVisibility.Visible = false; LineItemsProducts.Visible = true; } }
protected void GridviewBind() { Session["cachedProducts"] = ReceiptDataAccessClass.LoadReceiptProducts(ReceiptConstants.UserProvCode, Request.QueryString["EditProducts"].ToString()); ProductsGridview.DataSource = Session["cachedProducts"]; ProductsGridview.DataBind(); }