private void BindResultTKNL()
    {
        SaveSolutionService plangpservice = new SaveSolutionService();
        DataTable           tbl           = new DataTable();

        tbl = plangpservice.GetSaveSolution(ReportId);
        rptResultTKNL.DataSource = tbl;
        rptResultTKNL.DataBind();
    }
    protected void rptResultTKNL_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName.Equals("delete"))
        {
            LinkButton btnDelete = (LinkButton)e.CommandSource;
            btnDelete.Visible = AllowEdit;
            SaveSolution        rpt    = new SaveSolution();
            SaveSolutionService rptbso = new SaveSolutionService();
            if (rptbso.Delete(int.Parse(((LinkButton)e.CommandSource).CommandArgument)) > 0)
            {
                BindResultTKNL();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Không xóa được. Vui lòng thử lại.');", true);
            }
        }
        else if (e.CommandName.Equals("edit"))
        {
            LinkButton btnEdit = (LinkButton)e.CommandSource;
            btnEdit.Visible = AllowEdit;
            SaveSolution        rpt    = new SaveSolution();
            SaveSolutionService rptbso = new SaveSolutionService();
            rpt         = rptbso.FindByKey(int.Parse(((LinkButton)e.CommandSource).CommandArgument));
            hdnId.Value = rpt.Id.ToString();
            if (rpt.Budget > 0)
            {
                txtBudget.Text = rpt.Budget.ToString();
            }
            if (rpt.Quantity > 0)
            {
                txtQuantity.Text = rpt.Quantity.ToString();
            }
            if (rpt.TimeExecuted > 0)
            {
                txtTimeExecuted.Text = rpt.TimeExecuted.ToString();
            }
            if (rpt.FuelId > 0)
            {
                ddlFuelType.SelectedValue = rpt.FuelId.ToString();
                BindMeasurement();
                if (rpt.MeasurementFuelId > 0)
                {
                    ddlMeasure.SelectedValue = rpt.MeasurementFuelId.ToString();
                }
            }
            if (rpt.SolutionId > 0)
            {
                ddlSolution.SelectedValue = rpt.SolutionId.ToString();
            }

            ScriptManager.RegisterStartupScript(this, GetType(), "showgpkh", "ShowDialogSaveSolution();", true);
        }
    }
    public void btnSaveAddPlan_Click(object sender, EventArgs e)
    {
        SaveSolutionService saveSolutionService = new SaveSolutionService();
        SaveSolution        plantknl            = new SaveSolution();

        plantknl.EnterpriseId = memVal.OrgId;
        if (ddlFuelType.SelectedIndex > 0)
        {
            plantknl.FuelId = Convert.ToInt32(ddlFuelType.SelectedValue);
        }
        if (ddlMeasure.SelectedIndex > 0)
        {
            plantknl.MeasurementFuelId = Convert.ToInt32(ddlMeasure.SelectedValue);
        }
        if (ddlSolution.SelectedIndex > 0)
        {
            plantknl.SolutionId = Convert.ToInt32(ddlSolution.SelectedValue);
        }
        plantknl.Quantity      = Convert.ToDecimal(txtQuantity.Text.Trim());
        plantknl.Budget        = Convert.ToDecimal(txtBudget.Text.Trim());
        plantknl.TimeExecuted  = Convert.ToDecimal(txtTimeExecuted.Text.Trim());
        plantknl.AuditReportId = ReportId;
        if (hdnId.Value != "" && Convert.ToInt32(hdnId.Value) > 0)
        {
            plantknl.Id = Convert.ToInt32(hdnId.Value);
            if (saveSolutionService.Update(plantknl) != null)
            {
                BindResultTKNL();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "message", "alert('Cập nhật không thành công. Vui lòng thử lại!');", true);
                ScriptManager.RegisterStartupScript(this, GetType(), "showgpkh", "ShowDialogSaveSolution();", true);
            }
        }
        else
        {
            int i = saveSolutionService.Insert(plantknl);
            if (i > 0)
            {
                BindResultTKNL();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "message", "alert('Thêm mới kê hoạch không thành công. Vui lòng thử lại!');", true);
                ScriptManager.RegisterStartupScript(this, GetType(), "showgpkh", "ShowDialogAddSaveSolution();", true);
            }
        }
    }