//Add counter to record how many times each report gets viewed. protected void Page_Load(object sender, EventArgs e) { //Collects current method and page for error tracking string method = "Page_Load"; Session["currPage"] = "ReportsHomePage"; 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 (!IsPostBack) { //Sets the calendar and text boxes start and end dates CalStartDate.SelectedDate = DateTime.Today; CalEndDate.SelectedDate = DateTime.Today; ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails); ddlLocation.DataBind(); ddlLocation.SelectedValue = CU.location.intLocationID.ToString(); } if (CU.employee.intJobID != 0) { //User is not an admin lblReport.Text = "You are not authorized to view reports"; lblReport.Visible = true; lblReport.ForeColor = System.Drawing.Color.Red; //Disables buttons BtnCashOutReport.Visible = false; pnlDefaultButton.Visible = false; } } } //Exception catch catch (ThreadAbortException) { } 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"] = "HomePage.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 (!IsPostBack) { ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails); ddlLocation.DataBind(); ddlLocation.SelectedValue = CU.location.intLocationID.ToString(); } //Checks user for admin status if (CU.employee.intJobID == 0) { lbluser.Visible = true; ddlLocation.Enabled = true; } //populate gridview with todays sales GrdSameDaySales.DataSource = R.CallGetInvoiceBySaleDate(DateTime.Today, DateTime.Today, Convert.ToInt32(ddlLocation.SelectedValue), objPageDetails); GrdSameDaySales.DataBind(); MergeRows(GrdSameDaySales); } } //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"] = "InvoiceSearch.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 (!IsPostBack) { //Sets the calendar and text boxes start and end dates CalStartDate.SelectedDate = DateTime.Today; CalEndDate.SelectedDate = DateTime.Today; ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails); ddlLocation.DataBind(); ddlLocation.SelectedValue = CU.location.intLocationID.ToString(); } } } //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"] = "InventoryAddNew.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 item button BtnEditItem.Enabled = false; } //Check to see if an item was selected if (Convert.ToInt32(Request.QueryString["inventory"].ToString()) != -10) { if (!IsPostBack) { ItemChangeTracking tempItem = new ItemChangeTracking(); //Grabs a list of objects that match the sku in query string. There should only ever be 1 that is returned List <Object> o = IDU.CallReturnListOfObjectsFromThreeTablesForInventoryAddNew(Convert.ToInt32(Request.QueryString["inventory"].ToString()), objPageDetails, DateTime.Now, CU.location.intProvinceID); ddlBrand.DataSource = IM.CallReturnDropDownForBrand(objPageDetails); ddlBrand.DataBind(); ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails); ddlLocation.DataBind(); ddlType.DataSource = IM.CallReturnDropDownForItemType(objPageDetails); ddlType.DataBind(); ddlModel.DataSource = IM.CallReturnDropDownForModel(objPageDetails); ddlModel.DataBind(); if (o[0] is Clubs) { //When a club, pass class and populate DropDowns and TextBoxes Clubs club = o[0] as Clubs; ddlType.SelectedValue = club.intItemTypeID.ToString(); lblSKUDisplay.Text = club.varSku.ToString(); txtCost.Text = club.fltCost.ToString(); ddlBrand.SelectedValue = club.intBrandID.ToString(); txtPrice.Text = club.fltPrice.ToString(); txtQuantity.Text = club.intQuantity.ToString(); ddlLocation.SelectedValue = club.intLocationID.ToString(); txtClubType.Text = club.varTypeOfClub.ToString(); ddlModel.SelectedValue = club.intModelID.ToString(); txtShaft.Text = club.varShaftType.ToString(); txtNumberofClubs.Text = club.varNumberOfClubs.ToString(); txtClubSpec.Text = club.varClubSpecification.ToString(); txtShaftSpec.Text = club.varShaftSpecification.ToString(); txtShaftFlex.Text = club.varShaftFlexability.ToString(); txtDexterity.Text = club.varClubDexterity.ToString(); chkUsed.Checked = club.bitIsUsedProduct; txtComments.Text = club.varAdditionalInformation.ToString(); GrdInventoryTaxes.DataSource = club.lstTaxTypePerInventoryItem; GrdInventoryTaxes.DataBind(); tempItem.intInventoryID = club.intInventoryID; tempItem.fltOriginalCost = club.fltCost; tempItem.fltOriginalPrice = club.fltPrice; tempItem.intOriginalQuantity = club.intQuantity; tempItem.varOriginalDescription = "Location ID: " + club.intLocationID.ToString() + "; Brand ID: " + club.intBrandID.ToString() + "; Model ID: " + club.intModelID.ToString() + "; Club Type: " + club.varTypeOfClub.ToString() + "; Shaft: " + club.varShaftType.ToString() + "; Number of Clubs: " + club.varNumberOfClubs.ToString() + "; Club Spec: " + club.varClubSpecification.ToString() + "; Shaft Spec: " + club.varShaftSpecification.ToString() + "; Shaft Flex: " + club.varShaftFlexability.ToString() + "; Dexterity: " + club.varClubDexterity.ToString() + "; Used: " + club.bitIsUsedProduct.ToString() + "; Comments: " + club.varAdditionalInformation.ToString(); } else if (o[0] is Accessories) { //When accessories, pass class and populate DropDowns and TextBoxes Accessories accessory = o[0] as Accessories; ddlType.SelectedValue = accessory.intItemTypeID.ToString(); lblSKUDisplay.Text = accessory.varSku.ToString(); txtCost.Text = accessory.fltCost.ToString(); ddlBrand.SelectedValue = accessory.intBrandID.ToString(); txtPrice.Text = accessory.fltPrice.ToString(); txtQuantity.Text = accessory.intQuantity.ToString(); ddlLocation.SelectedValue = accessory.intLocationID.ToString(); lblClubType.Text = "Accessory Type:"; txtClubType.Text = accessory.varTypeOfAccessory.ToString(); lblNumberofClubs.Text = "Size:"; txtNumberofClubs.Text = accessory.varSize.ToString(); ddlModel.SelectedValue = accessory.intModelID.ToString(); lblShaft.Text = "Colour:"; txtShaft.Text = accessory.varColour.ToString(); txtComments.Text = accessory.varAdditionalInformation.ToString(); lblClubSpec.Visible = false; txtClubSpec.Visible = false; lblShaftSpec.Visible = false; txtShaftSpec.Visible = false; lblShaftFlex.Visible = false; txtShaftFlex.Visible = false; lblDexterity.Visible = false; txtDexterity.Visible = false; chkUsed.Visible = false; GrdInventoryTaxes.DataSource = accessory.lstTaxTypePerInventoryItem; GrdInventoryTaxes.DataBind(); tempItem.intInventoryID = accessory.intInventoryID; tempItem.fltOriginalCost = accessory.fltCost; tempItem.fltOriginalPrice = accessory.fltPrice; tempItem.intOriginalQuantity = accessory.intQuantity; tempItem.varOriginalDescription = "Location ID: " + accessory.intLocationID.ToString() + "; Brand ID: " + accessory.intBrandID.ToString() + "; Model ID: " + accessory.intModelID.ToString() + "; Size: " + accessory.varSize.ToString() + "; Colour: " + accessory.varColour.ToString() + "; Accessory Type: " + accessory.varTypeOfAccessory.ToString() + "; Comments: " + accessory.varAdditionalInformation.ToString(); } else if (o[0] is Clothing) { //When clothing, pass class and populate DropDowns and TextBoxes Clothing clothing = o[0] as Clothing; ddlType.SelectedValue = clothing.intItemTypeID.ToString(); lblSKUDisplay.Text = clothing.varSku.ToString(); txtCost.Text = clothing.fltCost.ToString(); ddlBrand.SelectedValue = clothing.intBrandID.ToString(); txtPrice.Text = clothing.fltPrice.ToString(); txtQuantity.Text = clothing.intQuantity.ToString(); ddlLocation.SelectedValue = clothing.intLocationID.ToString(); txtComments.Text = clothing.varAdditionalInformation.ToString(); lblNumberofClubs.Text = "Size:"; txtNumberofClubs.Text = clothing.varSize.ToString(); lblModel.Visible = false; ddlModel.Visible = false; lblShaft.Text = "Colour:"; txtShaft.Text = clothing.varColour.ToString(); lblShaftFlex.Visible = false; txtShaftFlex.Visible = false; lblClubSpec.Text = "Gender:"; txtClubSpec.Text = clothing.varGender.ToString(); lblClubType.Text = "Style:"; txtClubType.Text = clothing.varStyle.ToString(); lblShaftSpec.Visible = false; txtShaftSpec.Visible = false; lblDexterity.Visible = false; txtDexterity.Visible = false; chkUsed.Visible = false; GrdInventoryTaxes.DataSource = clothing.lstTaxTypePerInventoryItem; GrdInventoryTaxes.DataBind(); tempItem.intInventoryID = clothing.intInventoryID; tempItem.fltOriginalCost = clothing.fltCost; tempItem.fltOriginalPrice = clothing.fltPrice; tempItem.intOriginalQuantity = clothing.intQuantity; tempItem.varOriginalDescription = "Location ID: " + clothing.intLocationID.ToString() + "; Brand ID: " + clothing.intBrandID.ToString() + "; Size: " + clothing.varSize.ToString() + "; Colour: " + clothing.varColour.ToString() + "; Gender: " + clothing.varGender.ToString() + "; Style: " + clothing.varStyle.ToString() + "; Comments: " + clothing.varAdditionalInformation.ToString(); } BtnCreateSimilar.Visible = true; changeItem = tempItem; Session["changer"] = changeItem; } } else { //When no item was selected display drop downs and text boxes ddlType.Enabled = true; txtCost.Enabled = true; ddlBrand.Enabled = true; txtPrice.Enabled = true; txtQuantity.Enabled = true; ddlLocation.Enabled = true; txtClubType.Enabled = true; txtShaft.Enabled = true; txtComments.Enabled = true; BtnCreateSimilar.Visible = false; if (!IsPostBack) { ddlBrand.DataSource = IM.CallReturnDropDownForBrand(objPageDetails); ddlBrand.DataBind(); ddlLocation.DataSource = LM.CallReturnLocationDropDown(objPageDetails); ddlLocation.DataBind(); ddlType.DataSource = IM.CallReturnDropDownForItemType(objPageDetails); ddlType.DataBind(); ddlModel.DataSource = IM.CallReturnDropDownForModel(objPageDetails); ddlModel.DataBind(); ddlLocation.SelectedValue = CU.location.intLocationID.ToString(); ddlType.SelectedValue = "1"; ddlModel.Enabled = true; txtNumberofClubs.Enabled = true; txtClubSpec.Enabled = true; txtShaftSpec.Enabled = true; txtShaftFlex.Enabled = true; txtDexterity.Enabled = true; chkUsed.Enabled = true; } else { //Clubs if (Convert.ToInt32(ddlType.SelectedValue) == 1) { //adjust labels displaying for clubs lblClubType.Text = "Club Type:"; lblModel.Visible = true; ddlModel.Visible = true; ddlModel.Enabled = true; lblShaft.Text = "Shaft:"; lblNumberofClubs.Text = "Number of Clubs:"; lblNumberofClubs.Visible = true; txtNumberofClubs.Visible = true; txtNumberofClubs.Enabled = true; lblClubSpec.Text = "Club Spec:"; lblClubSpec.Visible = true; txtClubSpec.Visible = true; txtClubSpec.Enabled = true; lblShaftSpec.Visible = true; txtShaftSpec.Visible = true; txtShaftSpec.Enabled = true; lblShaftFlex.Text = "Shaft Flex:"; lblShaftFlex.Visible = true; txtShaftFlex.Visible = true; txtShaftFlex.Enabled = true; lblDexterity.Visible = true; txtDexterity.Visible = true; txtDexterity.Enabled = true; chkUsed.Visible = true; chkUsed.Enabled = true; } //Accessories else if (Convert.ToInt32(ddlType.SelectedValue) == 2) { //adjust labels displaying for accessories lblNumberofClubs.Text = "Size:"; lblModel.Visible = true; ddlModel.Visible = true; ddlModel.Enabled = true; lblShaft.Text = "Colour:"; lblClubType.Text = "Accessory Type:"; lblNumberofClubs.Visible = true; txtNumberofClubs.Visible = true; txtNumberofClubs.Enabled = true; lblClubSpec.Visible = false; txtClubSpec.Visible = false; txtClubSpec.Enabled = false; lblShaftSpec.Visible = false; txtShaftSpec.Visible = false; txtShaftSpec.Enabled = false; lblShaftFlex.Visible = false; txtShaftFlex.Visible = false; txtShaftFlex.Enabled = false; lblDexterity.Visible = false; txtDexterity.Visible = false; txtDexterity.Enabled = false; chkUsed.Visible = false; chkUsed.Enabled = false; } //Clothing else if (Convert.ToInt32(ddlType.SelectedValue) == 3) { //adjust labels displaying for clubs lblNumberofClubs.Text = "Size:"; lblModel.Visible = false; ddlModel.Visible = false; ddlModel.Enabled = false; lblShaft.Text = "Colour:"; lblNumberofClubs.Visible = true; txtNumberofClubs.Visible = true; txtNumberofClubs.Enabled = true; lblClubSpec.Text = "Gender:"; lblClubSpec.Visible = true; txtClubSpec.Visible = true; txtClubSpec.Enabled = true; lblShaftSpec.Visible = false; txtShaftSpec.Visible = false; txtShaftSpec.Enabled = false; lblClubType.Text = "Style:"; lblShaftFlex.Visible = false; txtShaftFlex.Visible = false; txtShaftFlex.Enabled = false; lblDexterity.Visible = false; txtDexterity.Visible = false; txtDexterity.Enabled = false; chkUsed.Visible = false; chkUsed.Enabled = false; } } //hides and displays the proper buttons for access BtnSaveItem.Visible = false; BtnAddItem.Visible = true; pnlDefaultButton.DefaultButton = "btnAddItem"; BtnEditItem.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); } }
//double profitMargin; //int profitMarginCount = 0; protected void Page_Load(object sender, EventArgs e) { //Collects current method and page for error tracking string method = "Page_Load"; Session["currPage"] = "ReportsStoreStats"; 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 Server.Transfer("LoginPage.aspx", false); } else { if (!Page.IsPostBack) { CU = (CurrentUser)Session["currentUser"]; //Gathering the start and end dates object[] passing = (object[])Session["reportInfo"]; DateTime[] reportDates = (DateTime[])passing[0]; DateTime startDate = reportDates[0]; DateTime endDate = reportDates[1]; int locationID = Convert.ToInt32(passing[1]); int timeFrame = Convert.ToInt32(passing[2]); Calendar calStartDate = (Calendar)CustomExtensions.CallFindControlRecursive(Master, "CalStartDate"); calStartDate.SelectedDate = startDate; Calendar calEndDate = (Calendar)CustomExtensions.CallFindControlRecursive(Master, "CalEndDate"); calEndDate.SelectedDate = endDate; DropDownList ddlDatePeriod = (DropDownList)CustomExtensions.CallFindControlRecursive(Master, "ddlDatePeriod"); ddlDatePeriod.SelectedValue = timeFrame.ToString(); DropDownList ddlLocation = (DropDownList)CustomExtensions.CallFindControlRecursive(Master, "ddlLocation"); DataTable dt = LM.CallReturnLocationDropDown(objPageDetails); dt.Rows.Add(99, "All Locations"); ddlLocation.DataSource = dt; ddlLocation.DataBind(); ddlLocation.SelectedValue = locationID.ToString(); //Builds string to display in label if (startDate == endDate) { lblDates.Text = "Store stats on: " + startDate.ToString("dd/MMM/yy"); //+ " for " + LM.ReturnLocationName(locationID, objPageDetails); } else { lblDates.Text = "Store stats on: " + startDate.ToString("dd/MMM/yy") + " to " + endDate.ToString("dd/MMM/yy"); //+ " for " + LM.ReturnLocationName(locationID, objPageDetails); } //Binding the gridview DataTable stats = R.CallReturnStoreStats(startDate, endDate, timeFrame, locationID, objPageDetails); GrdStats.DataSource = stats; GrdStats.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); } }
//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); } }