コード例 #1
0
ファイル: Program.cs プロジェクト: y1026/Aras.ViewModel
        static void Main(string[] args)
        {
            // Create Logging
            Logging.Console log = new Logging.Console();

            // Connect to Server
            ViewModel.Manager.Server server = new ViewModel.Manager.Server("http://localhost/11SP9", log);

            // Load Assemblies
            server.LoadAssembly("Aras.Model.Design");
            server.LoadAssembly("Aras.ViewModel.Design");

            // Login
            ViewModel.Manager.Database database = server.Database("Development");
            ViewModel.Manager.Session  session  = database.Login("admin", IO.Server.PasswordHash("innovator"));

            Model.Design.Queries.Searches.Part partquery = new Model.Design.Queries.Searches.Part(session.Model);
            Model.Design.Items.Part            part      = (Model.Design.Items.Part)partquery.Store.First();

            Model.Design.Queries.Trees.Part treequery = new Model.Design.Queries.Trees.Part(session.Model);
            treequery.Root = part;

            Model.Design.Items.Part treeroot = (Model.Design.Items.Part)treequery.Store.First();

            ViewModel.Trees.Relationship reltree = new Trees.Relationship(session, typeof(Aras.ViewModel.Design.NodeFormatters.Part));
            reltree.Binding = treeroot;

            TreeNode rootnode = reltree.Root;

            rootnode.Load.Execute();

            String test = rootnode.Label;
        }
コード例 #2
0
        public Models.Response Login(String Name, Models.Credentials Credentials)
        {
            try
            {
                // Get Database
                ViewModel.Manager.Database database = this.Server.Database(Name);

                // Login
                ViewModel.Manager.Session session = database.Login(Credentials.Username, Credentials.Password);
                HttpCookie cookie = new HttpCookie(tokencookie, session.Token);
                HttpContext.Current.Response.Cookies.Add(cookie);

                return(new Models.Responses.Empty(session));
            }
            catch (Exception e)
            {
                throw this.ProcessException(e);
            }
        }