protected void Page_Load(object sender, EventArgs e) { //Collects current method and page for error tracking string method = "Page_Load"; Session["currPage"] = "SettingsHomePage.aspx"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { //checks if the user has logged in if (Session["currentUser"] == null) { //Go back to Login to log in Response.Redirect("LoginPage.aspx", false); } else { CU = (CurrentUser)Session["currentUser"]; lblCurrentDate.Text = DateTime.Today.ToString("dd/MMM/yy"); if (txtDate.Text == "") { txtDate.Text = DateTime.Today.ToString("dd/MMM/yy"); } //Checks if the user is an Admin if (CU.employee.intJobID != 0) { BtnAddNewEmployee.Enabled = false; BtnLoadItems.Enabled = false; } if (!IsPostBack) { DdlProvince.DataSource = LM.CallReturnProvinceDropDown(0, objPageDetails); DdlProvince.DataBind(); DdlProvince.SelectedValue = CU.location.intProvinceID.ToString(); DdlTax.DataSource = TM.GatherTaxListFromDateAndProvince(CU.location.intProvinceID, Convert.ToDateTime(lblCurrentDate.Text), objPageDetails); DdlTax.DataBind(); } } } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }
//Still need to account for a duplicate item being added protected void Page_Load(object sender, EventArgs e) { //Collects current method and page for error tracking string method = "Page_Load"; Session["currPage"] = "SalesCart.aspx"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { //checks if the user has logged in if (Session["currentUser"] == null) { //Go back to Login to log in Response.Redirect("LoginPage.aspx", false); } else { CU = (CurrentUser)Session["currentUser"]; lblInvalidQty.Visible = false; if (!Page.IsPostBack) { txtSearch.Focus(); //Set name in text box Invoice invoice = new Invoice(); if (Request.QueryString["invoice"].ToString() == "-10") { Invoice newInvoice = new Invoice { varInvoiceNumber = IM.CallReturnNextInvoiceNumberForNewInvoice(CU, objPageDetails), intInvoiceSubNumber = 1, customer = CM.CallReturnCustomer(Convert.ToInt32(Request.QueryString["customer"].ToString()), objPageDetails)[0], employee = CU.employee, location = CU.location, fltGovernmentTaxAmount = 0, fltProvincialTaxAmount = 0, fltLiquorTaxAmount = 0, bitIsShipping = false, //newInvoice.bitChargeGST = true; //newInvoice.bitChargePST = true; //newInvoice.bitChargeLCT = true; intTransactionTypeID = 1, varAdditionalInformation = "" }; invoice = IM.CallCreateInitialTotalsForTable(newInvoice, objPageDetails)[0]; var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString()); nameValues.Set("customer", invoice.customer.intCustomerID.ToString()); nameValues.Set("invoice", invoice.intInvoiceID.ToString()); Response.Redirect(Request.Url.AbsolutePath + "?" + nameValues, false); } else { invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"].ToString()), objPageDetails)[0]; } DdlShippingProvince.DataSource = LM.CallReturnProvinceDropDown(invoice.location.intCountryID, objPageDetails); DdlShippingProvince.SelectedValue = invoice.intShippingProvinceID.ToString(); DdlShippingProvince.DataBind(); txtCustomer.Text = invoice.customer.varFirstName + " " + invoice.customer.varLastName; lblDateDisplay.Text = DateTime.Today.ToString("dd/MMM/yy"); lblInvoiceNumberDisplay.Text = invoice.varInvoiceNumber + "-" + invoice.intInvoiceSubNumber; //change to gather the items from table GrdCartItems.DataSource = invoice.invoiceItems; GrdCartItems.DataBind(); if (invoice.bitIsShipping) { RdbShipping.Checked = true; DdlShippingProvince.Visible = true; DdlShippingProvince.Enabled = true; } else { RdbInStorePurchase.Checked = true; DdlShippingProvince.Visible = false; DdlShippingProvince.Enabled = false; } txtShippingAmount.Text = invoice.fltShippingCharges.ToString(); lblSubtotalDisplay.Text = invoice.fltSubTotal.ToString("C"); Session["currentInvoice"] = invoice; } } } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }
protected void Page_Load(object sender, EventArgs e) { //Collects current method and page for error tracking string method = "Page_Load"; Session["currPage"] = "CustomerAddNew.aspx"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { //checks if the user has logged in if (Session["currentUser"] == null) { //Go back to Login to log in Response.Redirect("LoginPage.aspx", false); } else { CU = (CurrentUser)Session["currentUser"]; //Checks for a Customer Key if (Convert.ToInt32(Request.QueryString["customer"].ToString()) != -10) { if (!IsPostBack) { //Create customer class and fill page with all info based in the customer number Customer customer = CM.CallReturnCustomerWithInvoiceList(Convert.ToInt32(Request.QueryString["customer"].ToString()), objPageDetails)[0]; txtFirstName.Text = customer.varFirstName.ToString(); txtLastName.Text = customer.varLastName.ToString(); txtPrimaryAddress.Text = customer.varAddress.ToString(); txtSecondaryAddress.Text = customer.secondaryAddress.ToString(); txtPrimaryPhoneNumber.Text = customer.varContactNumber.ToString(); txtSecondaryPhoneNumber.Text = customer.secondaryPhoneNumber.ToString(); txtEmail.Text = customer.varEmailAddress.ToString(); txtCity.Text = customer.varCityName.ToString(); DdlCountry.DataSource = LM.CallReturnCountryDropDown(objPageDetails); DdlCountry.DataBind(); DdlCountry.SelectedValue = customer.intCountryID.ToString(); ddlProvince.DataSource = LM.CallReturnProvinceDropDown(customer.intCountryID, objPageDetails); ddlProvince.SelectedValue = customer.intProvinceID.ToString(); ddlProvince.DataBind(); txtPostalCode.Text = customer.varPostalCode.ToString(); chkEmailList.Checked = customer.bitSendMarketing; //Binds invoice list to the grid view GrdInvoiceSelection.DataSource = customer.invoices; GrdInvoiceSelection.DataBind(); } } else { //no cust number if (!IsPostBack) { DdlCountry.DataSource = LM.CallReturnCountryDropDown(objPageDetails); DdlCountry.DataBind(); DdlCountry.SelectedValue = CU.location.intCountryID.ToString(); ddlProvince.DataSource = LM.CallReturnProvinceDropDown(0, objPageDetails); ddlProvince.DataBind(); } //Displays text boxes instead of label for customer creation info txtFirstName.Enabled = true; txtLastName.Enabled = true; txtPrimaryAddress.Enabled = true; txtSecondaryAddress.Enabled = true; txtPrimaryPhoneNumber.Enabled = true; txtSecondaryPhoneNumber.Enabled = true; txtEmail.Enabled = true; txtCity.Enabled = true; ddlProvince.Enabled = true; DdlCountry.Enabled = true; chkEmailList.Enabled = true; txtPostalCode.Enabled = true; //hides and displays the proper buttons for access BtnSaveCustomer.Visible = false; BtnAddCustomer.Visible = true; pnlDefaultButton.DefaultButton = "btnAddCustomer"; BtnEditCustomer.Visible = false; BtnStartSale.Visible = false; BtnCancel.Visible = false; BtnBackToSearch.Visible = true; } } } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }
//private static Employee employee; protected void Page_Load(object sender, EventArgs e) { //Collects current method and page for error tracking string method = "Page_Load"; Session["currPage"] = "EmployeeAddNew.aspx"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { //checks if the user has logged in if (Session["currentUser"] == null) { //Go back to Login to log in Response.Redirect("LoginPage.aspx", false); } else { CU = (CurrentUser)Session["currentUser"]; if (CU.employee.intJobID != 0) { //If user is not an admin then disable the edit employee button BtnEditEmployee.Enabled = false; } //Check to see if an employee was selected if (Convert.ToInt32(Request.QueryString["employee"].ToString()) != -10) { if (!IsPostBack) { //Create an employee class Employee employee = EM.CallReturnEmployee(Convert.ToInt32(Request.QueryString["employee"].ToString()), objPageDetails)[0]; //Fill asll lables with current selected employee info txtFirstName.Text = employee.varFirstName.ToString(); txtLastName.Text = employee.varLastName.ToString(); ddlJob.DataSource = EM.CallReturnJobPosition(objPageDetails); ddlJob.DataBind(); ddlJob.SelectedValue = employee.intJobID.ToString(); ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails); ddlLocation.DataBind(); ddlLocation.SelectedValue = employee.location.intLocationID.ToString(); txtEmail.Text = employee.varEmailAddress.ToString(); txtPrimaryPhoneNumber.Text = employee.varContactNumber.ToString(); txtSecondaryPhoneNumber.Text = employee.secondaryContactNumber.ToString(); txtPrimaryAddress.Text = employee.varAddress.ToString(); txtSecondaryAddress.Text = employee.secondaryAddress.ToString(); txtCity.Text = employee.varCityName.ToString(); txtPostalCode.Text = employee.varPostalCode.ToString(); ddlProvince.SelectedValue = employee.intProvinceID.ToString(); DdlCountry.SelectedValue = employee.intCountryID.ToString(); DdlCountry.DataSource = LM.CallReturnCountryDropDown(objPageDetails); DdlCountry.DataBind(); ddlProvince.DataSource = LM.CallReturnProvinceDropDown(employee.intCountryID, objPageDetails); ddlProvince.DataBind(); } } else { if (!IsPostBack) { ddlJob.DataSource = EM.CallReturnJobPosition(objPageDetails); ddlJob.DataBind(); ddlJob.SelectedValue = CU.employee.intJobID.ToString(); ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails); ddlLocation.DataBind(); ddlLocation.SelectedValue = CU.location.intLocationID.ToString(); DdlCountry.DataSource = LM.CallReturnCountryDropDown(objPageDetails); DdlCountry.DataBind(); DdlCountry.SelectedValue = CU.location.intCountryID.ToString(); ddlProvince.DataSource = LM.CallReturnProvinceDropDown(0, objPageDetails); ddlProvince.DataBind(); ddlProvince.SelectedValue = CU.location.intProvinceID.ToString(); } //With no employee selected display text boxes and drop downs to add employee txtFirstName.Enabled = true; txtLastName.Enabled = true; ddlJob.Enabled = true; ddlLocation.Enabled = true; txtEmail.Enabled = true; txtPrimaryPhoneNumber.Enabled = true; txtSecondaryPhoneNumber.Enabled = true; txtPrimaryAddress.Enabled = true; txtSecondaryAddress.Enabled = true; txtCity.Enabled = true; txtPostalCode.Enabled = true; ddlProvince.Enabled = true; DdlCountry.Enabled = true; //hides and displays the proper buttons for access BtnSaveEmployee.Visible = false; BtnAddEmployee.Visible = true; pnlDefaultButton.DefaultButton = "btnAddEmployee"; BtnEditEmployee.Visible = false; BtnCancel.Visible = false; BtnBackToSearch.Visible = true; } } } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }