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

            // Get Data
            PlLiningPlanTDS prLiningPlanTDS = (PlLiningPlanTDS)Session["prLiningPlanTDS"];
            PrLiningPlan prLiningPlan = new PrLiningPlan();
            prLiningPlan.ProcessForReport(prLiningPlanTDS);

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

            // Get report
            if (prLiningPlan.Table.Rows.Count > 0)
            {
                master.Report = new PrLiningPlanReport();
                int loginId = Convert.ToInt32(Session["loginID"]);
                int companyId = Convert.ToInt32(Session["companyID"]);

                LoginGateway loginGateway = new LoginGateway();
                loginGateway.LoadByLoginId(loginId, companyId);
                string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId);
                master.SetParameter("User", user.Trim());

                master.SetParameter("name", Request.QueryString["name"]);
            }
        }
        private void PostPageChanges()
        {
            PrLiningPlan prLiningPlan = new PrLiningPlan(prLiningPlanTDS);

            // Update repair-setups
            foreach (GridViewRow row in grdLiningPlan.Rows)
            {
                int workId = int.Parse(((HiddenField)row.FindControl("hdfWorkId")).Value);
                string repairPointId = ((HiddenField)row.FindControl("hdfRepairPointId")).Value;
                DateTime? date_ = null; if (((TextBox)row.FindControl("tbxDate_")).Text.Trim() != "") date_ = DateTime.Parse(((TextBox)row.FindControl("tbxDate_")).Text.Trim());
                string selected = ((DropDownList)row.FindControl("ddlSelected")).SelectedValue;
                string liner = ((DropDownList)row.FindControl("ddlLinerTruck")).SelectedValue;
                string linerMN = ((DropDownList)row.FindControl("ddlLinerMN")).SelectedValue;
                string video = ((DropDownList)row.FindControl("ddlVideoTruck")).SelectedValue;
                string videoMN = ((DropDownList)row.FindControl("ddlVideoMN")).SelectedValue;

                prLiningPlan.UpdateForReport(workId, repairPointId, date_, selected, liner, linerMN, video, videoMN);
            }

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