// /////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // STEP2 - SUMMARY
        //
        // ////////////////////////////////////////////////////////////////////////
        // STEP2 - SUMMARY - METHODS
        //
        private void StepSummaryIn()
        {
            // Set instruction
            Label instruction = (Label)this.Master.FindControl("lblInstruction");
            instruction.Text = "Summary";

            // Initialize summary
            FlCatalystsAdd flCatalystsAddForSummary = new FlCatalystsAdd(flCatalystsAddTDS);
            tbxSummary.Text = flCatalystsAddForSummary.GetSummary();
        }
        // ////////////////////////////////////////////////////////////////////////
        // STEP1 - BEGIN - METHODS
        //
        private void StepBeginIn()
        {
            // Set instruction
            Label instruction = (Label)this.Master.FindControl("lblInstruction");
            instruction.Text = "Please provide catalysts information";

            // Load
            FlCatalystsAdd model = new FlCatalystsAdd(flCatalystsAddTDS);
            model.LoadAll(Int32.Parse(hdfCompanyId.Value));

            // Store tables
            Session["flCatalystsAdd"] = flCatalystsAddTDS.FlCatalystsAdd;
            Session["flCatalystsAddTDS"] = flCatalystsAddTDS;
        }
        private void Save()
        {
            // save to database
            DB.Open();
            DB.BeginTransaction();
            try
            {
                FlCatalystsAdd model = new FlCatalystsAdd(flCatalystsAddTDS);
                model.Save(Int32.Parse(hdfCompanyId.Value));

                DB.CommitTransaction();
            }
            catch (Exception ex)
            {
                DB.RollbackTransaction();

                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }
        }
        private void GrdCatalystsAdd()
        {
            if (ValidateCatalystsFooter())
            {
                Page.Validate("dataFooter");
                if (Page.IsValid)
                {
                    string name = ((TextBox)grdCatalysts.FooterRow.FindControl("tbxNameFooter")).Text.Trim();
                    decimal defaultPercentageByWeight = -1;
                    if (((TextBox)grdCatalysts.FooterRow.FindControl("tbxDefaultPercentageByWeightFooter")).Text.Trim() != "")
                    {
                        if ((Validator.IsValidDecimal(((TextBox)grdCatalysts.FooterRow.FindControl("tbxDefaultPercentageByWeightFooter")).Text.Trim())))
                        {
                            defaultPercentageByWeight = decimal.Round(decimal.Parse(((TextBox)grdCatalysts.FooterRow.FindControl("tbxDefaultPercentageByWeightFooter")).Text.Trim()), 2);
                        }
                    }

                    int companyId = Int32.Parse(hdfCompanyId.Value);
                    bool inDatabase = false;
                    bool deleted = false;

                    FlCatalystsAdd model = new FlCatalystsAdd(flCatalystsAddTDS);
                    model.Insert(name, defaultPercentageByWeight,deleted, companyId, inDatabase);

                    Session.Remove("flCatalystsAddDummy");
                    Session["flCatalystsAddTDS"] = flCatalystsAddTDS;
                    Session["flCatalystsAdd"] = flCatalystsAddTDS.FlCatalystsAdd;

                    grdCatalysts.DataBind();
                    grdCatalysts.PageIndex = grdCatalysts.PageCount - 1;
                }
            }
        }
        protected void grdCatalysts_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Page.Validate("dataEdit");
            if (Page.IsValid)
            {
                int catalystId = (int)e.Keys["CatalystID"];
                int companyId = Int32.Parse(hdfCompanyId.Value);

                string name = ((TextBox)grdCatalysts.Rows[e.RowIndex].Cells[1].FindControl("tbxNameEdit")).Text.Trim();

                decimal defaultPercentageByWeight = -1;
                if (((TextBox)grdCatalysts.Rows[e.RowIndex].Cells[2].FindControl("tbxDefaultPercentageByWeightEdit")).Text.Trim() != "")
                {
                    if ((Validator.IsValidDecimal(((TextBox)grdCatalysts.Rows[e.RowIndex].Cells[2].FindControl("tbxDefaultPercentageByWeightEdit")).Text.Trim())))
                    {
                        defaultPercentageByWeight = decimal.Round(decimal.Parse(((TextBox)grdCatalysts.Rows[e.RowIndex].Cells[2].FindControl("tbxDefaultPercentageByWeightEdit")).Text.Trim()), 3);
                    }
                }

                FlCatalystsAdd model = new FlCatalystsAdd(flCatalystsAddTDS);
                model.Update(catalystId, name, defaultPercentageByWeight);

                // Store dataset
                Session["flCatalystsAddTDS"] = flCatalystsAddTDS;
                Session["flatSectionJlCommentDetails"] = flCatalystsAddTDS.FlCatalystsAdd;
            }
            else
            {
                e.Cancel = true;
            }
        }
        protected void grdCatalysts_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            // Catalysts Gridview, if the gridview is edition mode
            if (grdCatalysts.EditIndex >= 0)
            {
                grdCatalysts.UpdateRow(grdCatalysts.EditIndex, true);
            }

            //Delete catalysts
            int catalystId = (int)e.Keys["CatalystID"];
            int companyId = Int32.Parse(hdfCompanyId.Value);

            // Delete catalysts
            FlCatalystsAdd model = new FlCatalystsAdd(flCatalystsAddTDS);
            model.Delete(catalystId, companyId);

            // Store dataset
            Session["flCatalystsAddTDS"] = flCatalystsAddTDS;

            grdCatalysts.DataBind();
        }