// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_CWP_MANHOLEREHABILITATION_ADMIN"]))) { 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)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in mr_batch_add.aspx"); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); hdfUpdate.Value = "no"; Session.Remove("mrBatchVerification"); Session.Remove("mrBatchVerificationDummy"); // Load information mrBatchVerificationTDS = new MrBatchVerificationTDS(); int companyId = Int32.Parse(hdfCompanyId.Value); MrBatchVerification mrBatchVerificationForLastRow = new MrBatchVerification(); mrBatchVerificationForLastRow.LoadLastBatch(companyId); if (mrBatchVerificationForLastRow.Table.Rows.Count > 0) { MrBatchVerificationGateway mrBatchVerificationGatewayForLastRow = new MrBatchVerificationGateway(mrBatchVerificationForLastRow.Data); WorkManholeRehabilitationBatchGateway workManholeRehabilitationBatchGateway = new WorkManholeRehabilitationBatchGateway(); hdfBatchId.Value = workManholeRehabilitationBatchGateway.GetLastId(companyId).ToString(); int batchId = Int32.Parse(hdfBatchId.Value); DateTime date = mrBatchVerificationGatewayForLastRow.GetDate(batchId); hdfBatchDate.Value = date.Month.ToString() + "/" + date.Day.ToString() + "/" + date.Year.ToString(); hdfBatchDescription.Value = mrBatchVerificationGatewayForLastRow.GetDescription(batchId); } // ... Store datasets Session["mrBatchVerificationTDS"] = mrBatchVerificationTDS; Session["mrBatchVerification"] = mrBatchVerificationTDS.BatchValidation; // StepIn wizardBatch.ActiveStepIndex = 0; StepNewBatchIn(); } else { // Restore datasets mrBatchVerificationTDS = (MrBatchVerificationTDS)Session["mrBatchVerificationTDS"]; // Store Session["mrBatchVerification"] = mrBatchVerificationTDS.BatchValidation; } }
/// <summary> /// InitData /// </summary> protected override void InitData() { _data = new MrBatchVerificationTDS(); }