Пример #1
0
        /// <summary>
        /// UnDeleteDirect
        /// </summary>
        /// <param name="unitId">unitId</param>
        /// <param name="categoryId">categoryId</param>
        /// <param name="companyId">companyId</param>
        /// <returns>True</returns>
        public bool UnDeleteDirect(int unitId, int categoryId, int companyId)
        {
            UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway(null);
            unitsCategoryGateway.UnDelete(unitId, categoryId, companyId);

            return true;
        }
Пример #2
0
        /// <summary>
        /// CategoryIsUsed
        /// </summary>
        /// <param name="categoryId">categoryId</param>
        /// <param name="companyId">companyId</param>
        /// <returns>True or False</returns>
        public bool CategoryIsUsed(int categoryId, int companyId)
        {
            bool inUse = false;
            UnitsGateway unitsGateway = new UnitsGateway();
            unitsGateway.Load(companyId);

            foreach (UnitsTDS.LFS_FM_UNITRow row in (UnitsTDS.LFS_FM_UNITDataTable)unitsGateway.Table)
            {
                int unitId = row.UnitID;

                UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway(null);
                if (unitsCategoryGateway.IsUsedInUnitCategory(unitId, categoryId))
                {
                    inUse = true;
                }
            }

            LiquiForce.LFSLive.DA.FleetManagement.ChecklistRules.RuleGateway ruleGateway = new RuleGateway();
            ruleGateway.Load(companyId);

            foreach (RuleTDS.LFS_FM_RULERow row in (RuleTDS.LFS_FM_RULEDataTable)ruleGateway.Table)
            {
                int ruleId = row.RuleID;

                RuleCategoryGateway ruleCategoryGateway = new RuleCategoryGateway(null);
                if (ruleCategoryGateway.IsUsedInRuleCategory(ruleId, categoryId))
                {
                    inUse = true;
                }
            }

            return inUse;
        }
Пример #3
0
        /// <summary>
        /// DeleteDirect
        /// </summary>
        /// <param name="unitId">unitId</param>
        /// <param name="unitType">unitType</param>
        /// <param name="companyId">companyId</param>
        public void DeleteDirect(int unitId, string unitType, int companyId)
        {
            UnitsGateway unitsGateway = new UnitsGateway();
            unitsGateway.LoadByUnitId(unitId,  companyId);

            if (unitsGateway.Table.Rows.Count > 0)
            {
                // ... Delete unit categories
                UnitsCategory unitsCategory = new UnitsCategory(null);
                UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway();
                unitsCategoryGateway.LoadByUnitId(unitId, companyId);

                foreach (UnitsTDS.LFS_FM_UNIT_CATEGORYRow rowCategories in (UnitsTDS.LFS_FM_UNIT_CATEGORYDataTable)unitsCategoryGateway.Table)
                {
                    unitsCategory.DeleteDirect(unitId, rowCategories.CategoryID, companyId);
                }

                // ... if vehicle type then delete unit
                if (unitType == "Vehicle")
                {
                    UnitsVehicle unitsVehicle = new UnitsVehicle(null);
                    unitsVehicle.DeleteDirect(unitId, companyId);
                }

                // ... Delete inspections
                UnitsInspection unitsInspection = new UnitsInspection(null);
                UnitsInspectionGateway unitsInspectionGateway = new UnitsInspectionGateway();
                unitsInspectionGateway.LoadByUnitId(unitId, companyId);

                foreach (UnitsTDS.LFS_FM_UNIT_INSPECTIONRow rowInspections in (UnitsTDS.LFS_FM_UNIT_INSPECTIONDataTable)unitsInspectionGateway.Table)
                {
                    unitsInspection.DeletedDirect(unitId, rowInspections.InspectionID, companyId);
                }

                // ... Delete unit
                unitsGateway.Delete(unitId, companyId);
            }
        }
        private void GetNodeForCategory(TreeNodeCollection nodes, int parentId)
        {
            Int32 thisId;
            String thisName;
            UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway(null);

            DataRow[] children = categoriesTDS.Tables["LFS_FM_CATEGORY"].Select("ParentID='" + parentId + "'");

            //no child nodes, exit function
            if (children.Length == 0) return;

            foreach (DataRow child in children)
            {
                // step 1
                thisId = Convert.ToInt32(child.ItemArray[0]);

                // step 2
                thisName = Convert.ToString(child.ItemArray[2]);

                // step 3
                TreeNode newNode = new TreeNode(thisName, thisId.ToString());
                newNode.ShowCheckBox = true;
                newNode.SelectAction = TreeNodeSelectAction.None;

                //step 4
                if (unitsCategoryGateway.IsUsedInUnitCategory(Int32.Parse(hdfUnitId.Value), thisId))
                {
                    newNode.Checked = true;
                }

                // step 5
                nodes.Add(newNode);
                newNode.ToggleExpandState();

                // step 6
                GetNodeForCategory(newNode.ChildNodes, thisId);
            }
        }
Пример #5
0
        /// <summary>
        /// UpdateUnitCategory
        /// </summary>
        /// <param name="unitId">unitId</param>
        /// <param name="companyId">companyId</param>
        /// <param name="categoriesSelected">categoriesSelected</param>
        private void UpdateUnitCategory(int unitId, int companyId, ArrayList categoriesSelected)
        {
            CategoryGateway categoryGateway = new CategoryGateway();
            categoryGateway.Load(companyId);

            if (categoryGateway.Table.Rows.Count > 0)
            {
                foreach (CategoriesTDS.LFS_FM_CATEGORYRow row in (CategoriesTDS.LFS_FM_CATEGORYDataTable)categoryGateway.Table)
                {
                    int categoryId = row.CategoryID;

                    UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway(null);

                    if (unitsCategoryGateway.IsUsedInUnitCategory(unitId, categoryId))
                    {
                        if (!categoriesSelected.Contains(categoryId))
                        {
                            UnitsCategory unitsCategory = new UnitsCategory(null);
                            unitsCategory.DeleteDirect(unitId, categoryId, companyId);
                        }
                    }
                    else
                    {
                        if (categoriesSelected.Contains(categoryId))
                        {
                            UnitsCategory unitsCategory = new UnitsCategory(null);
                            unitsCategory.InsertDirect(unitId, categoryId, false, companyId);
                        }
                    }
                }
            }
        }
Пример #6
0
 // ////////////////////////////////////////////////////////////////////////
 // PUBLIC METHODS
 //
 /// <summary>
 /// InsertDirect
 /// </summary>
 /// <param name="unitId">unitId</param>
 /// <param name="categoryId">categoryId</param>
 /// <param name="deleted">deleted</param>
 /// <param name="companyId">companyId</param>
 public void InsertDirect(int unitId, int categoryId, bool deleted, int companyId)
 {
     UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway(null);
     unitsCategoryGateway.Insert(unitId, categoryId, deleted, companyId);
 }
        /// <summary>
        /// UpdateUnitCategory
        /// </summary>
        /// <param name="unitId">unitId</param>
        /// <param name="companyId">companyId</param>
        /// <param name="categoriesSelected">categoriesSelected</param>
        /// <param name="companyLevelId">companyLevelId</param>
        private void UpdateUnitCategory(int unitId, int companyId, ArrayList categoriesSelected, int companyLevelId)
        {
            RuleCategoryUnitsGateway ruleCategoryUnitsGateway = new RuleCategoryUnitsGateway(null);

            CategoryGateway categoryGateway = new CategoryGateway();
            categoryGateway.Load(companyId);

            if (categoryGateway.Table.Rows.Count > 0)
            {
                foreach (CategoriesTDS.LFS_FM_CATEGORYRow row in (CategoriesTDS.LFS_FM_CATEGORYDataTable)categoryGateway.Table)
                {
                    int categoryId = row.CategoryID;

                    UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway(null);

                    // Exists in DB
                    if (unitsCategoryGateway.IsUsedInUnitCategory(unitId, categoryId, true))
                    {
                        if (!categoriesSelected.Contains(categoryId))
                        {
                            UnitsCategory unitsCategory = new UnitsCategory(null);
                            unitsCategory.DeleteDirect(unitId, categoryId, companyId);

                            RuleCategoryGateway ruleCategoryGateway = new RuleCategoryGateway();
                            ruleCategoryGateway.LoadByCategoryId(categoryId, companyId);

                            foreach (RuleTDS.LFS_FM_RULE_CATEGORYRow rowRuleCategory in (RuleTDS.LFS_FM_RULE_CATEGORYDataTable)ruleCategoryGateway.Table)
                            {
                                int ruleId = rowRuleCategory.RuleID;

                                if (ruleCategoryUnitsGateway.IsUsedInRuleCategoryUnits(ruleId, categoryId, unitId))
                                {
                                    // Delete
                                    RuleCategoryUnits ruleCategoryUnits = new RuleCategoryUnits(null);
                                    ruleCategoryUnits.DeleteDirect(ruleId, categoryId, unitId, companyId);
                                }
                            }
                        }
                        else
                        {
                            UnitsCategory unitsCategory = new UnitsCategory(null);
                            unitsCategory.UnDeleteDirect(unitId, categoryId, companyId);
                        }
                    }
                    else
                    {
                        if (categoriesSelected.Contains(categoryId))
                        {
                            UnitsCategory unitsCategory = new UnitsCategory(null);
                            unitsCategory.InsertDirect(unitId, categoryId, false, companyId);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// UpdateRuleCategory
        /// </summary>
        /// <param name="ruleId">ruleId</param>
        /// <param name="companyId">companyId</param>
        /// <param name="companyLevelsSelected">companyLevelsSelected</param>
        /// <param name="categoriesSelected">categoriesSelected</param>
        /// <param name="unitsSelected">unitsSelected</param>
        private void UpdateRuleCategory(int ruleId, int companyId, ArrayList companyLevelsSelected, ArrayList categoriesSelected, ArrayList unitsSelected)
        {
            // Insert into checklist only selected units
            foreach (int categoryId in categoriesSelected)
            {
                RuleCategory ruleCategory = new RuleCategory(null);
                ruleCategory.InsertDirect(ruleId, categoryId, false, companyId);

                foreach (int unitId in unitsSelected)
                {
                    //int unitId = row.UnitID;

                    // Save categories and selected units
                    UnitsCategoryGateway unitsCategoryGatewayExist = new UnitsCategoryGateway(null);
                    if (unitsCategoryGatewayExist.IsUsedInUnitCategory(unitId, categoryId, false))
                    {
                        RuleCategoryUnits ruleCategoryUnits = new RuleCategoryUnits(null);
                        ruleCategoryUnits.InsertDirect(ruleId, categoryId, unitId, false, companyId);
                    }

                    // Save Chechklists for selected units
                    foreach (int companyLevelId in companyLevelsSelected)
                    {
                        UnitsGateway unitsGateway = new UnitsGateway(null);

                        if (unitsGateway.IsUsedInUnitsAndNotIsDisposed(unitId, companyLevelId))
                        {
                            ChecklistGateway checklistGateway = new ChecklistGateway(null);
                            if (!checklistGateway.IsUsedInChecklist(unitId, ruleId))
                            {
                                Checklist checklist = new Checklist(null);
                                checklist.InsertDirect(unitId, ruleId, null, null, false, "Unknown", false, companyId);
                            }
                        }
                    }
                }
            }
        }
Пример #9
0
        /// <summary>
        /// GetRulesAndUnitsByCategoryId
        /// </summary>
        /// <param name="categoryId">categoryId</param>
        /// <param name="companyId">companyId</param>
        /// <returns></returns>
        public string GetRulesAndUnitsByCategoryId(int categoryId, int companyId)
        {
            string rules = "";
            string units = "";

            UnitsGateway unitsGateway = new UnitsGateway();
            unitsGateway.Load(companyId);

            foreach (UnitsTDS.LFS_FM_UNITRow rowUnits in (UnitsTDS.LFS_FM_UNITDataTable)unitsGateway.Table)
            {
                int unitId = rowUnits.UnitID;

                UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway(null);
                if (unitsCategoryGateway.IsUsedInUnitCategory(unitId, categoryId))
                {
                    if (units.Length > 0)
                    {
                        units += "\t" + rowUnits.UnitCode + " - " + rowUnits.Description + "\n";
                    }
                    else
                    {
                        units += "Units:\n\n";
                        units += "\t" + rowUnits.UnitCode + " - " + rowUnits.Description + "\n";
                    }
                }
            }

            if (units.Length > 0)
            {
                units += "\n\n";
            }

            LiquiForce.LFSLive.DA.FleetManagement.ChecklistRules.RuleGateway ruleGateway = new RuleGateway();
            ruleGateway.Load(companyId);

            foreach (RuleTDS.LFS_FM_RULERow rowChecklistRules in (RuleTDS.LFS_FM_RULEDataTable)ruleGateway.Table)
            {
                int ruleId = rowChecklistRules.RuleID;

                RuleCategoryGateway ruleCategoryGateway = new RuleCategoryGateway(null);
                if (ruleCategoryGateway.IsUsedInRuleCategory(ruleId, categoryId))
                {
                    if (rules.Length > 0)
                    {
                        rules += "\t" + rowChecklistRules.Name + " - " + rowChecklistRules.Description + "\n";
                    }
                    else
                    {
                        rules += "Checklist Rules:\n\n";
                        rules += "\t" + rowChecklistRules.Name + "\n";
                    }
                }
            }

            return units + rules;
        }
Пример #10
0
        /// <summary>
        /// UpdateUnitsAndRulesCategories
        /// </summary>
        /// <param name="originalCategoryId">originalCategoryId</param>
        /// <param name="newCategoryId">newCategoryId</param>
        /// <param name="companyId">companyId</param>
        private void UpdateUnitsAndRulesCategories(int originalCategoryId, int? newCategoryId, int companyId)
        {
            // Update rules categories
            LiquiForce.LFSLive.DA.FleetManagement.ChecklistRules.RuleGateway ruleGateway = new RuleGateway();
            ruleGateway.Load(companyId);

            if (ruleGateway.Table.Rows.Count > 0)
            {
                foreach (RuleTDS.LFS_FM_RULERow row in (RuleTDS.LFS_FM_RULEDataTable)ruleGateway.Table)
                {
                    int ruleId = row.RuleID;

                    RuleCategoryGateway ruleCategoryGateway = new RuleCategoryGateway(null);

                    if ((ruleCategoryGateway.IsUsedInRuleCategory(ruleId, originalCategoryId)) && (newCategoryId.HasValue))
                    {
                        if (!ruleCategoryGateway.IsUsedInRuleCategory(ruleId, (int)newCategoryId, true))
                        {
                            RuleCategory ruleCategory = new RuleCategory(null);

                            // Insert new rule category
                            ruleCategory.InsertDirect(ruleId, (int)newCategoryId, false, companyId);

                            // Delete old rule category
                            ruleCategory.DeleteDirect(ruleId, originalCategoryId, companyId);
                        }
                        else
                        {
                            RuleCategory ruleCategory = new RuleCategory(null);

                            // Undelete nee rule category
                            ruleCategory.UnDeleteDirect(ruleId, (int)newCategoryId, companyId);

                            // Delete old rule category
                            ruleCategory.DeleteDirect(ruleId, originalCategoryId, companyId);
                        }
                    }
                }
            }

            // Update units categories
            UnitsGateway unitsGateway = new UnitsGateway();
            unitsGateway.Load(companyId);

            if (unitsGateway.Table.Rows.Count > 0)
            {
                foreach (UnitsTDS.LFS_FM_UNITRow row in (UnitsTDS.LFS_FM_UNITDataTable)unitsGateway.Table)
                {
                    int unitId = row.UnitID;
                    int companyLevelId = row.CompanyLevelID;

                    UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway(null);
                    if ((unitsCategoryGateway.IsUsedInUnitCategory(unitId, originalCategoryId)) && (newCategoryId.HasValue) )
                    {
                        if (!unitsCategoryGateway.IsUsedInUnitCategory(unitId, (int)newCategoryId, true))
                        {
                            UnitsCategory unitsCategory = new UnitsCategory(null);

                            // Insert new unit category
                            unitsCategory.InsertDirect(unitId, (int)newCategoryId, false, companyId);

                            // Delete old unit category
                            unitsCategory.DeleteDirect(unitId, originalCategoryId, companyId);

                            // Delete all checklist for unitId
                            DeleteChecklists(unitId, companyId);

                            // Update checklist
                            UpdateUnitChecklists(unitId, row.CompanyLevelID, companyId);
                        }
                        else
                        {
                            UnitsCategory unitsCategory = new UnitsCategory(null);

                            // Undelete new category
                            unitsCategory.UnDeleteDirect(unitId, (int)newCategoryId, companyId);

                            // Delete old category
                            unitsCategory.DeleteDirect(unitId, originalCategoryId, companyId);

                            // Delete all checklist for unitId
                            DeleteChecklists(unitId, companyId);

                            // Update checklist
                            UpdateUnitChecklists(unitId, row.CompanyLevelID, companyId);
                        }
                    }
                }
            }
        }
Пример #11
0
        /// <summary>
        /// UpdateUnitChecklists
        /// </summary>
        /// <param name="unitId">unitId</param>
        /// <param name="companyLevelId">companyLevelId</param>
        /// <param name="companyId">companyId</param>
        private void UpdateUnitChecklists(int unitId, int companyLevelId, int companyId)
        {
            UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway();
            unitsCategoryGateway.LoadByUnitId(unitId, companyId);

            foreach (UnitsTDS.LFS_FM_UNIT_CATEGORYRow row in (UnitsTDS.LFS_FM_UNIT_CATEGORYDataTable)unitsCategoryGateway.Table)
            {
                int categoryId = row.CategoryID;

                RuleCategoryGateway ruleCategoryGateway = new RuleCategoryGateway();
                ruleCategoryGateway.LoadByCategoryId(categoryId, companyId);

                foreach (RuleTDS.LFS_FM_RULE_CATEGORYRow rowRuleCategory in (RuleTDS.LFS_FM_RULE_CATEGORYDataTable)ruleCategoryGateway.Table)
                {
                    int ruleId = rowRuleCategory.RuleID;

                    RuleCompanyLevelGateway ruleCompanyLevelGateway = new RuleCompanyLevelGateway(null);

                    if (ruleCompanyLevelGateway.IsUsedInRuleCompanyLevel(ruleId, companyLevelId))
                    {
                        ChecklistGateway checklistGateway = new ChecklistGateway(null);

                        if (checklistGateway.IsUsedInChecklist(unitId, ruleId, true))
                        {
                            Checklist checklist = new Checklist(null);
                            checklist.UnDeleteDirect(ruleId, unitId, companyId);
                        }
                        else
                        {
                            Checklist checklist = new Checklist(null);
                            checklist.InsertDirect(unitId, ruleId, null, null, false, "Unknown", false, companyId);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// UpdateRuleCategoryUnits
        /// </summary>
        /// <param name="ruleId">ruleId</param>
        /// <param name="companyId">companyId</param>
        /// <param name="categoriesSelected">categoriesSelected</param>
        /// <param name="companyLevelsSelected">companyLevelsSelected</param>
        /// <param name="unitsSelected">unitsSelected</param>
        private void UpdateRuleCategoryUnits(int ruleId, int companyId, ArrayList categoriesSelected, ArrayList companyLevelsSelected, ArrayList unitsSelected)
        {
            // At each category
            CategoryGateway categoryGateway = new CategoryGateway();
            categoryGateway.Load(companyId);

            foreach (CategoriesTDS.LFS_FM_CATEGORYRow row in (CategoriesTDS.LFS_FM_CATEGORYDataTable)categoryGateway.Table)
            {
                int categoryId = row.CategoryID;

                // At each unit
                UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway();
                unitsCategoryGateway.LoadByCategoryId(categoryId, companyId);

                foreach (UnitsTDS.LFS_FM_UNIT_CATEGORYRow rowUnitCategory in (UnitsTDS.LFS_FM_UNIT_CATEGORYDataTable)unitsCategoryGateway.Table)
                {
                    int unitId = rowUnitCategory.UnitID;

                    RuleCategoryUnitsGateway ruleCategoryUnitsGateway = new RuleCategoryUnitsGateway(null);

                    // If it already exists and it's not deleted
                    if (ruleCategoryUnitsGateway.IsUsedInRuleCategoryUnits(ruleId, categoryId, unitId))
                    {
                        // Verify if it's at the current selection
                        if ((!categoriesSelected.Contains(categoryId)) || (categoriesSelected.Contains(categoryId) && (!unitsSelected.Contains(unitId))))
                        {
                            // Delete
                            RuleCategoryUnits ruleCategoryUnits = new RuleCategoryUnits(null);
                            ruleCategoryUnits.DeleteDirect(ruleId, categoryId, unitId, companyId);
                        }
                        else
                        {
                            RuleCategoryUnits ruleCategoryUnits = new RuleCategoryUnits(null);
                            ruleCategoryUnits.UnDeleteDirect(ruleId, categoryId, unitId, companyId);

                            // Insert checklist
                            foreach (int companyLevelId in companyLevelsSelected)
                            {
                                UnitsGateway unitsGateway = new UnitsGateway(null);

                                if (unitsGateway.IsUsedInUnitsAndNotIsDisposed(unitId, companyLevelId))
                                {
                                    ChecklistGateway checklistGateway = new ChecklistGateway(null);

                                    if (checklistGateway.IsUsedInChecklist(unitId, ruleId, true))
                                    {
                                        Checklist checklist = new Checklist(null);
                                        checklist.UnDeleteDirect(ruleId, unitId, companyId);
                                    }
                                    else
                                    {
                                        Checklist checklist = new Checklist(null);
                                        checklist.InsertDirect(unitId, ruleId, null, null, false, "Unknown", false, companyId);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        // If it already exists and it's deleted
                        if (ruleCategoryUnitsGateway.IsUsedInRuleCategoryUnitsAsDeleted(ruleId, categoryId, unitId))
                        {
                            // Verify if it's at the current selection
                            if (categoriesSelected.Contains(categoryId) && (unitsSelected.Contains(unitId)))
                            {
                                // UnDelete
                                RuleCategoryUnits ruleCategoryUnits = new RuleCategoryUnits(null);
                                ruleCategoryUnits.UnDeleteDirect(ruleId, categoryId, unitId, companyId);

                                // Insert checklist
                                foreach (int companyLevelId in companyLevelsSelected)
                                {
                                    UnitsGateway unitsGateway = new UnitsGateway(null);

                                    if (unitsGateway.IsUsedInUnitsAndNotIsDisposed(unitId, companyLevelId))
                                    {
                                        ChecklistGateway checklistGateway = new ChecklistGateway(null);

                                        if (checklistGateway.IsUsedInChecklist(unitId, ruleId, true))
                                        {
                                            Checklist checklist = new Checklist(null);
                                            checklist.UnDeleteDirect(ruleId, unitId, companyId);
                                        }
                                        else
                                        {
                                            Checklist checklist = new Checklist(null);
                                            checklist.InsertDirect(unitId, ruleId, null, null, false, "Unknown", false, companyId);
                                        }
                                    }
                                }
                            }
                        }
                        // If it's not at bd
                        else
                        {
                            // Verify if it's at the current selection
                            if (categoriesSelected.Contains(categoryId) && (unitsSelected.Contains(unitId)))
                            {
                                // Insert rule category units
                                RuleCategoryUnits ruleCategoryUnits = new RuleCategoryUnits(null);
                                ruleCategoryUnits.InsertDirect(ruleId, categoryId, unitId, false, companyId);

                                // Insert checklist
                                foreach (int companyLevelId in companyLevelsSelected)
                                {
                                    UnitsGateway unitsGateway = new UnitsGateway(null);

                                    if (unitsGateway.IsUsedInUnitsAndNotIsDisposed(unitId, companyLevelId))
                                    {
                                        ChecklistGateway checklistGateway = new ChecklistGateway(null);

                                        if (checklistGateway.IsUsedInChecklist(unitId, ruleId, true))
                                        {
                                            Checklist checklist = new Checklist(null);
                                            checklist.UnDeleteDirect(ruleId, unitId, companyId);
                                        }
                                        else
                                        {
                                            Checklist checklist = new Checklist(null);
                                            checklist.InsertDirect(unitId, ruleId, null, null, false, "Unknown", false, companyId);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }