protected void btnDelete_Click(object sender, EventArgs e)
        {
            PostPageChanges();

            int ruleId = GetRuleId();

            if (ruleId > 0)
            {
                ServiceInformationBasicInformation serviceInformationBasicInformation = new ServiceInformationBasicInformation();
                serviceInformationBasicInformation.LoadInProgressByRuleId(ruleId, int.Parse(hdfCompanyId.Value));

                if (serviceInformationBasicInformation.Table.Rows.Count > 0)
                {
                    cvSelection.ErrorMessage = "The checklist rule have pending service requests, please complete them before delete checklist.";
                    cvSelection.IsValid = false;
                }
                else
                {
                    // Redirect
                    string url = "./checklist_rules_delete.aspx?source_page=checklist_rules_navigator.aspx&rule_id=" + ruleId;
                    Response.Redirect(url);
                }
            }
            else
            {
                cvSelection.ErrorMessage = "Please select one checklist rule.";
                cvSelection.IsValid = false;
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // Set active toolbar
            mForm6 master = (mForm6)this.Master;
            master.ActiveToolbar = "FleetManagement";

            int ruleId = Int32.Parse(hdfRuleId.Value);

            foreach (int categoryId in arrayCategoriesSelected)
            {
                // Mark selected units
                RuleCategoryUnitsGateway ruleCategoryUnitsGateway = new RuleCategoryUnitsGateway();

                if (cbxlUnitsSelected.Items.Count > 0)
                {
                    foreach (ListItem lst in cbxlUnitsSelected.Items)
                    {
                        if (ruleCategoryUnitsGateway.IsUsedInRuleCategoryUnits(ruleId, categoryId, Int32.Parse(lst.Value)))
                        {
                            lst.Selected = true;
                        }
                    }
                }
            }

            ServiceInformationBasicInformation serviceInformationBasicInformation = new ServiceInformationBasicInformation();
            serviceInformationBasicInformation.LoadInProgressByRuleId(ruleId, int.Parse(hdfCompanyId.Value));

            if (serviceInformationBasicInformation.Table.Rows.Count > 0)
            {
                tkrmTop.Items[1].Visible = false;
            }
        }