Exemplo n.º 1
0
        public static List <G_JSTree> GetAllNodes(string id, string isOrganizationUnit)
        {
            List <G_JSTree> list = new List <G_JSTree>();

            //if (isOrganizationUnit == "False")
            //    return list;

            if (id == "0")
            {
                List <FormEntity> formEntities = new FormMapper().ListWithAdvanced("", null, StatusEnum.Active, true, null, 1);
                foreach (FormEntity formentity in formEntities)
                {
                    G_JSTree parent = new G_JSTree();
                    parent.data        = formentity.Title;
                    parent.state       = "closed";
                    parent.IdServerUse = 10;
                    if (formentity.IsChecked == true)
                    {
                        parent.attr = new G_JsTreeAttribute {
                            id = "0" + formentity.Id.ToString(), selected = true, isOrganizationUnit = true
                        };
                    }
                    else
                    {
                        parent.attr = new G_JsTreeAttribute {
                            id = "0" + formentity.Id.ToString(), selected = false, isOrganizationUnit = true
                        };
                    }

                    list.Add(parent);
                }
            }
            else
            {
                List <FormEntity> childForms = new FormMapper().ListWithAdvanced("", Convert.ToInt32(id), StatusEnum.Active, null, null, 1);
                foreach (FormEntity childForm in childForms)
                {
                    G_JSTree child = new G_JSTree();
                    child.data        = childForm.Title;
                    child.state       = "closed";
                    child.IdServerUse = 10;
                    child.children    = null;
                    if (childForm.IsChecked == true)
                    {
                        child.attr = new G_JsTreeAttribute {
                            id = childForm.Id.ToString(), selected = true, isOrganizationUnit = false
                        };
                    }
                    else
                    {
                        child.attr = new G_JsTreeAttribute {
                            id = childForm.Id.ToString(), selected = false, isOrganizationUnit = false
                        };
                    }
                    list.Add(child);
                }
            }

            return(list);
        }
Exemplo n.º 2
0
        public static List<G_JSTree> GetAllNodes(string id, string isOrganizationUnit, string roleId)
        {
            int role = Convert.ToInt32(roleId);

            List<G_JSTree> list = new List<G_JSTree>();
            //if (isOrganizationUnit == "False")
            //    return list;

            if (id == "0")
            {
                List<FormEntity> formEntities = new FormMapper().ListWithAdvanced("", null, StatusEnum.Active, true, Convert.ToInt32(roleId), 1);
                foreach (FormEntity formentity in formEntities)
                {
                    G_JSTree parent = new G_JSTree();
                    parent.data = formentity.Title;
                    parent.state = "closed";
                    parent.IdServerUse = 10;
                    if (formentity.IsChecked == true)
                    {
                        parent.attr = new G_JsTreeAttribute { id = "0" + formentity.Id.ToString(), selected = true, isOrganizationUnit = true };
                    }
                    else
                    {
                        parent.attr = new G_JsTreeAttribute { id = "0" + formentity.Id.ToString(), selected = false, isOrganizationUnit = true };
                    }

                    list.Add(parent);
                }
            }
            else
            {
                List<FormEntity> childForms = new FormMapper().ListWithAdvanced("", Convert.ToInt32(id), StatusEnum.Active, null, Convert.ToInt32(roleId), 1);
                foreach (FormEntity childForm in childForms)
                {
                    G_JSTree child = new G_JSTree();
                    child.data = childForm.Title;
                    child.state = "closed";
                    child.IdServerUse = 10;
                    child.children = null;
                    if (childForm.IsChecked == true)
                    {
                        child.attr = new G_JsTreeAttribute { id = childForm.Id.ToString(), selected = true, isOrganizationUnit = false };
                    }
                    else
                    {
                        child.attr = new G_JsTreeAttribute { id = childForm.Id.ToString(), selected = false, isOrganizationUnit = false };
                    }
                    list.Add(child);
                }
            }

            return list;
        }
Exemplo n.º 3
0
        public static List <G_JSTree> GetAllNodes(string id, string isOrganizationUnit, string contractTemplateId)
        {
            List <G_JSTree> list = new List <G_JSTree>();

            if (isOrganizationUnit == "False")
            {
                return(list);
            }

            if (id == "0")
            {
                List <OrganizationalUnitView> organizationalUnits = new OrganizationalUnitMapper().List("");
                foreach (OrganizationalUnitView organizationalUnit in organizationalUnits)
                {
                    G_JSTree parent = new G_JSTree();
                    parent.data        = organizationalUnit.Title;
                    parent.state       = "closed";
                    parent.IdServerUse = 10;
                    parent.attr        = new G_JsTreeAttribute {
                        id = "0" + organizationalUnit.Id.ToString(), selected = false, isOrganizationUnit = true
                    };

                    list.Add(parent);
                }
            }
            else
            {
                List <EmployeeView> employees = new List <EmployeeView>();
                if (contractTemplateId != "0")
                {
                    employees = new EmployeeMapper().ListWithAdvancedFilterByContractPreffix("", "", "", Convert.ToInt32(id), "", StatusEnum.Active, Convert.ToInt32(contractTemplateId));
                }
                else
                {
                    employees = new EmployeeMapper().ListWithAdvancedFilterByContractPreffix("", "", "", Convert.ToInt32(id), "", StatusEnum.Active, null);
                }
                foreach (EmployeeView employee in employees)
                {
                    G_JSTree child = new G_JSTree();
                    child.data        = employee.ToString();
                    child.state       = "closed";
                    child.IdServerUse = 10;
                    child.children    = null;
                    child.attr        = new G_JsTreeAttribute {
                        id = employee.Id.ToString(), selected = false, isOrganizationUnit = false
                    };
                    list.Add(child);
                }
            }

            return(list);
        }
        public static List<G_JSTree> GetAllNodes(string id, string isOrganizationUnit, string contractTemplateId)
        {
            List<G_JSTree> list = new List<G_JSTree>();
            if (isOrganizationUnit == "False")
                return list;

            if (id == "0")
            {
                List<OrganizationalUnitView> organizationalUnits = new OrganizationalUnitMapper().List("");
                foreach (OrganizationalUnitView organizationalUnit in organizationalUnits)
                {
                    G_JSTree parent = new G_JSTree();
                    parent.data = organizationalUnit.Title;
                    parent.state = "closed";
                    parent.IdServerUse = 10;
                    parent.attr = new G_JsTreeAttribute { id = "0" + organizationalUnit.Id.ToString(), selected = false, isOrganizationUnit = true };

                    list.Add(parent);
                }
            }
            else
            {
                List<EmployeeView> employees = new List<EmployeeView>();
                if (contractTemplateId != "0")
                {
                    employees = new EmployeeMapper().ListWithAdvancedFilterByContractPreffix("", "", "", Convert.ToInt32(id), "", StatusEnum.Active, Convert.ToInt32(contractTemplateId));
                }
                else
                {
                    employees = new EmployeeMapper().ListWithAdvancedFilterByContractPreffix("", "", "", Convert.ToInt32(id), "", StatusEnum.Active, null);
                }
                foreach (EmployeeView employee in employees)
                {
                    G_JSTree child = new G_JSTree();
                    child.data = employee.ToString();
                    child.state = "closed";
                    child.IdServerUse = 10;
                    child.children = null;
                    child.attr = new G_JsTreeAttribute { id = employee.Id.ToString(), selected = false, isOrganizationUnit = false };
                    list.Add(child);
                }
            }

            return list;
        }
Exemplo n.º 5
0
        public static List<G_JSTree> SaveNodes(string id, string isOrganizationUnit)
        {
            List<G_JSTree> list = new List<G_JSTree>();
            if (isOrganizationUnit == "False")
                return list;

            if (id == "0")
            {
                List<FormEntity> formEntities = new FormMapper().ListWithAdvanced("", null, StatusEnum.Active, true, null, 1);
                foreach (FormEntity formEntity in formEntities)
                {
                    G_JSTree parent = new G_JSTree();
                    parent.data = formEntity.Title;
                    parent.state = "closed";
                    parent.IdServerUse = 10;
                    parent.attr = new G_JsTreeAttribute { id = formEntity.Id.ToString(), selected = false, isOrganizationUnit = true };

                    list.Add(parent);
                }
            }
            else
            {
                List<FormEntity> formEntities = new FormMapper().ListWithAdvanced("", Convert.ToInt32(id), StatusEnum.Active, false, null, 1);

                foreach (FormEntity formEntity in formEntities)
                {
                    G_JSTree child = new G_JSTree();
                    child.data = formEntity.Title;
                    child.state = "closed";
                    child.IdServerUse = 10;
                    child.children = null;
                    child.attr = new G_JsTreeAttribute { id = formEntity.Id.ToString(), selected = false, isOrganizationUnit = false };
                    list.Add(child);
                }
            }

            return list;
        }