private void Generate()
        {
            mReport1 master = (mReport1)this.Master;

            // Get Data
            JlLiningPlanTDS jlLiningPlanTDS = (JlLiningPlanTDS)Session["jlLiningPlanTDS"];
            JlLiningPlan jlLiningPlan = new JlLiningPlan();
            jlLiningPlan.ProcessForReport(jlLiningPlanTDS);

            // ... set properties to master page
            master.Data = jlLiningPlan.Data;
            master.Table = jlLiningPlan.TableName;

            // Get report
            if (jlLiningPlan.Table.Rows.Count > 0)
            {
                master.Report = new JlLiningPlanReport();

                // ... for client
                int companyId = Int32.Parse(Session["companyID"].ToString());
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value);
                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                master.SetParameter("Client", companiesGateway.GetName(currentClientId));

                // ... for project
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value);
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                master.SetParameter("Project", projectGateway.GetProjectNumber(currentProjectId));

                int loginId = Convert.ToInt32(Session["loginID"]);

                LoginGateway loginGateway = new LoginGateway();
                loginGateway.LoadByLoginId(loginId, companyId);
                string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId);
                master.SetParameter("User", user.Trim());
            }
        }
        private void PostPageChanges()
        {
            JlLiningPlan jlLiningPlan = new JlLiningPlan(jlLiningPlanTDS);

            foreach (GridViewRow row in grdLiningPlan.Rows)
            {
                // Update section-setups
                int assetId = int.Parse(((HiddenField)row.FindControl("hdfAssetId")).Value);
                int companyId = int.Parse(((HiddenField)row.FindControl("hdfCompanyId")).Value);
                DateTime? date_ = null; if (((RadDatePicker)row.FindControl("tkrdpDate_")).SelectedDate.HasValue) date_ = ((RadDatePicker)row.FindControl("tkrdpDate_")).SelectedDate.Value;
                string flusher = ((DropDownList)row.FindControl("ddlFlusher")).SelectedValue;
                string flusherMN = ((DropDownList)row.FindControl("ddlFlusherMN")).SelectedValue;
                string liner = ((DropDownList)row.FindControl("ddlLiner")).SelectedValue;
                string linerMN = ((DropDownList)row.FindControl("ddlLinerMN")).SelectedValue;
                string rotator = ((DropDownList)row.FindControl("ddlRotator")).SelectedValue;
                string rotatorMN = ((DropDownList)row.FindControl("ddlRotatorMN")).SelectedValue;
                string compressor = ((DropDownList)row.FindControl("ddlCompressor")).SelectedValue;
                string compressorMN = ((DropDownList)row.FindControl("ddlCompressorMN")).SelectedValue;
                string selected = ((DropDownList)row.FindControl("ddlSelected")).SelectedValue;
                string flowOrderId = ((TextBox)row.FindControl("tbxFlowOrderId")).Text.Trim();

                // Update comments
                int workId = Int32.Parse(((HiddenField)row.FindControl("hdfWorkID")).Value.Trim());

                WorkJunctionLiningSectionGateway workJunctionLiningSectionGateway = new WorkJunctionLiningSectionGateway();
                workJunctionLiningSectionGateway.LoadByWorkId(workId, companyId);
                string trafficControlDetails = workJunctionLiningSectionGateway.GetTrafficControlDetails(workId);
                string standardByPassComments = workJunctionLiningSectionGateway.GetStandardBypassComments(workId);

                // Update fields
                jlLiningPlan.UpdateForReport(assetId, companyId, date_, flusher, flusherMN, liner, linerMN, rotator, rotatorMN, compressor, compressorMN, selected, flowOrderId, standardByPassComments, trafficControlDetails);
            }

            // Store datasets
            Session["jlLiningPlanTDS"] = jlLiningPlanTDS;
        }