// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_PROJECTS_REVENUE_VIEW"]) && Convert.ToBoolean(Session["sgLFS_PROJECTS_REVENUE_EDIT"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["ref_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in revenue_summary.aspx"); } // Tag Page hdfCompanyId.Value = Session["companyID"].ToString(); hdfCurrentProjectId.Value = Request.QueryString["project_id"]; hdfCurrentRefId.Value = Request.QueryString["ref_id"]; // If coming from int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); int projectId = Int32.Parse(hdfCurrentProjectId.Value); int refId = Int32.Parse(hdfCurrentRefId.Value); // ... revenue_navigator2.aspx, revenue_add.aspx if ((Request.QueryString["source_page"] == "revenue_navigator2.aspx") || (Request.QueryString["source_page"] == "revenue_add.aspx")) { StoreNavigatorState(); ViewState["update"] = "yes"; // ... ... Set initial tab revenueInformationTDS = new RevenueInformationTDS(); RevenueInformationBasicInformation revenueInformationBasicInformationForEdit = new RevenueInformationBasicInformation(revenueInformationTDS); revenueInformationBasicInformationForEdit.LoadByProjectIdRefId(projectId, refId, companyId); // Store dataset Session["revenueInformationTDS"] = revenueInformationTDS; } // ... revenue_delete.aspx or revenue_edit.aspx if ((Request.QueryString["source_page"] == "revenue_delete.aspx") || (Request.QueryString["source_page"] == "revenue_edit.aspx")) { StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; // Restore dataset revenueInformationTDS = (RevenueInformationTDS)Session["revenueInformationTDS"]; } // ... Data for current revenue LoadData(); // Databind Page.DataBind(); } else { // Restore datasets revenueInformationTDS = (RevenueInformationTDS)Session["revenueInformationTDS"]; } }
/// <summary> /// InitData /// </summary> protected override void InitData() { _data = new RevenueInformationTDS(); }
// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_PROJECTS_REVENUE_VIEW"]) && Convert.ToBoolean(Session["sgLFS_PROJECTS_REVENUE_DELETE"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["ref_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in revenue_delete.aspx"); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); hdfCurrentProjectId.Value = Request.QueryString["project_id"]; hdfCurrentRefId.Value = Request.QueryString["ref_id"]; // ... for team member title int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); int projectId = Int32.Parse(hdfCurrentProjectId.Value); int refId = Int32.Parse(hdfCurrentRefId.Value); RevenueInformationBasicInformationGateway revenueInformationBasicInformationGatewayForTitle = new RevenueInformationBasicInformationGateway(); revenueInformationBasicInformationGatewayForTitle.LoadByProjectIdRefId(projectId, refId, companyId); decimal revenue = decimal.Round(revenueInformationBasicInformationGatewayForTitle.GetRevenue(projectId, refId), 2); string money = ""; if (revenueInformationBasicInformationGatewayForTitle.GetCountryId(projectId, refId) == 1) // Canada { money = " (CAD)"; } else { money = " (USD)"; } lblTitleRevenue.Text = "Revenue: " + revenue + money + " (" + revenueInformationBasicInformationGatewayForTitle.GetDate(projectId, refId).ToShortDateString() + ")"; // If coming from // ... revenue_navigator2.aspx if (Request.QueryString["source_page"] == "revenue_navigator2.aspx") { revenueInformationTDS = new RevenueInformationTDS(); RevenueInformationBasicInformation revenueInformationBasicInformationForEdit = new RevenueInformationBasicInformation(revenueInformationTDS); revenueInformationBasicInformationForEdit.LoadByProjectIdRefId(projectId, refId, companyId); StoreNavigatorState(); ViewState["update"] = "no"; // Store dataset Session["revenueInformationTDS"] = revenueInformationTDS; } // ... revenue_summary.aspx if (Request.QueryString["source_page"] == "revenue_summary.aspx") { StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; // Restore dataset revenueInformationTDS = (RevenueInformationTDS)Session["revenueInformationTDS"]; } } else { // Restore dataset revenueInformationTDS = (RevenueInformationTDS)Session["revenueInformationTDS"]; } }