コード例 #1
0
        public void ProcessFile()
        {
            XmlDocument XmlDoc = new XmlDocument();

            XmlDoc.Load(FilePath);

            foreach (var Node in XmlDoc.DocumentElement.GetElementsByTagName("AdminUserRole"))
            {
                XmlElement Element = (XmlElement)Node;

                AdminUserRole AdmUserRole = new AdminUserRole();

                AdmUserRole.Name        = Element.GetElementsByTagName("Name")[0].InnerText;
                AdmUserRole.Description = Element.GetElementsByTagName("Description")[0].InnerText;

                AdminUserRoleDAO.Save(AdmUserRole);
            }
        }
コード例 #2
0
        public void AdminUsers_CreateAll()
        {
            List <AdminUserRole> RoleList = AdminUserRoleDAO.LoadAll();

            if (RoleList != null && RoleList.Count > 0)
            {
                foreach (var UserRole in RoleList)
                {
                    var DeleteQuery = Query <AdminUser> .EQ(e => e.Username, UserRole.Name);

                    Execute.Delete <AdminUser>("AdminUsers", DeleteQuery);

                    AdminUser NewUser = new AdminUser();

                    NewUser.Active          = true;
                    NewUser.Username        = UserRole.Name;
                    NewUser.Hashed_Password = "******";
                    NewUser.RoleList.Add(UserRole.Name);

                    AdminUserDAO.Save(NewUser);
                }
            }
        }