예제 #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);
        }
예제 #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;
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string          logUser;
            IIdentity       WinId = HttpContext.Current.User.Identity;
            WindowsIdentity wi    = (WindowsIdentity)WinId;

            logUser = wi.Name.ToString().Substring(wi.Name.ToString().LastIndexOf("\\") + 1);
            RoleEntity role = Authorization.isAuthorized(logUser, Request.RawUrl);

            if (role == null)
            {
                Response.Redirect("~/Authorization.aspx");
            }

            HtmlGenericControl li;
            HtmlGenericControl a;
            HtmlGenericControl ul = new HtmlGenericControl("ul");

            List <FormEntity> list = new FormMapper().ListWithAdvanced("", null, StatusEnum.Active, true, role.Id, null);

            foreach (FormEntity entity in list)
            {
                li = new HtmlGenericControl("li");
                a  = new HtmlGenericControl("a");

                a.Attributes.Add("href", entity.Path);
                a.InnerText = entity.Title;
                li.Controls.Add(a);

                List <FormEntity> childs = new FormMapper().ListWithAdvanced("", entity.Id, StatusEnum.Active, true, role.Id, null);

                ul = new HtmlGenericControl("ul");
                foreach (FormEntity child in childs)
                {
                    HtmlGenericControl liChild = new HtmlGenericControl("li");
                    HtmlGenericControl aChild  = new HtmlGenericControl("a");

                    aChild.Attributes.Add("href", child.Path);
                    aChild.InnerText = child.Title;
                    liChild.Controls.Add(aChild);

                    ul.Controls.Add(liChild);
                }
                if (childs.Count != 0)
                {
                    li.Controls.Add(ul);
                }

                menu.Controls.Add(li);
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string logUser;
            IIdentity WinId = HttpContext.Current.User.Identity;
            WindowsIdentity wi  = (WindowsIdentity)WinId;
            logUser = wi.Name.ToString().Substring(wi.Name.ToString().LastIndexOf("\\") + 1);
            RoleEntity role = Authorization.isAuthorized(logUser, Request.RawUrl);

            if (role == null)
            {
                Response.Redirect("~/Authorization.aspx");
            }

            HtmlGenericControl li;
            HtmlGenericControl a;
            HtmlGenericControl ul = new HtmlGenericControl("ul");

            List<FormEntity> list = new FormMapper().ListWithAdvanced("", null, StatusEnum.Active, true, role.Id, null);

            foreach (FormEntity entity in list)
            {
                li = new HtmlGenericControl("li");
                a = new HtmlGenericControl("a");

                a.Attributes.Add("href", entity.Path);
                a.InnerText = entity.Title;
                li.Controls.Add(a);

                List<FormEntity> childs = new FormMapper().ListWithAdvanced("", entity.Id, StatusEnum.Active, true, role.Id, null);

                ul = new HtmlGenericControl("ul");
                foreach (FormEntity child in childs)
                {
                    HtmlGenericControl liChild = new HtmlGenericControl("li");
                    HtmlGenericControl aChild = new HtmlGenericControl("a");

                    aChild.Attributes.Add("href", child.Path);
                    aChild.InnerText = child.Title;
                    liChild.Controls.Add(aChild);

                    ul.Controls.Add(liChild);
                }
                if (childs.Count != 0)
                {
                    li.Controls.Add(ul);
                }

                menu.Controls.Add(li);
            }
        }
예제 #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;
        }
예제 #6
0
 public void Setup()
 {
     _unit = new FormMapper(Moq.Mock.Of <ILog>());
 }
예제 #7
0
        public static void Main(string[] args)
        {
            var formMapper = new FormMapper(new ChromeDriverProvider(), new TestSchemaProvider(), new TestDataProvider());

            formMapper.Map().GetAwaiter().GetResult();
        }