Example #1
0
        static void Main(string[] args)
        {
            Console.Write("Login: "******"Password: "******"Try to connect using login:{0} password:{1}", login, pass));

            var authenticationService = new AuthenticationService();

            var token = new UsernameToken("test_user", "12345678", PasswordOption.SendPlainText);

            authenticationService.RequestSoapContext.Security.Tokens.Add(token);
            var credentials = new Credentials();
            credentials.Login = login;
            credentials.Password = pass;
            credentials.LanId = new decimal(1);
            credentials.AppCode = "I";

            var sessionHash = authenticationService.authenticate(credentials);
            Console.WriteLine("Sessioh hash: {0}", sessionHash);

            var personService = new PersonService();
            var user = personService.getCurrentUser(sessionHash);
            var projects = personService.getUserProjectsList(sessionHash, (decimal)user.Id);
            decimal projectId = 0;
            foreach (var project in projects)
            {
                Console.WriteLine("Project id: {0}, project name: {1}", project.Key, project.Value);
                if (project.Value.Equals("ABC-TST"))
                {
                    projectId = (decimal)project.Key;
                    personService.changeProject(sessionHash, projectId);
                }
            }
            if (projectId != 0)
            {
                var requirementService = new RequirementService();
                var requirement = new Requirement
                {
                    ItemName = "Test req",
                    ParentItemId = projectId
                };
                requirement = requirementService.addRequirement(sessionHash, requirement);
                if (requirement.Id != 0)
                {
                    Console.WriteLine("Requirement was added with id: {0}", requirement.Id);
                }
            }
            else
            {
                Console.WriteLine("Project wasn't changed");
            }
            Console.ReadLine();
            authenticationService.invalidateSession(sessionHash);
        }
Example #2
0
 /// <remarks/>
 public void authenticateAsync(Credentials crd, object userState) {
     if ((this.authenticateOperationCompleted == null)) {
         this.authenticateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnauthenticateOperationCompleted);
     }
     this.InvokeAsync("authenticate", new object[] {
                 crd}, this.authenticateOperationCompleted, userState);
 }
Example #3
0
 /// <remarks/>
 public void authenticateAsync(Credentials crd) {
     this.authenticateAsync(crd, null);
 }
Example #4
0
 public string authenticate(Credentials crd) {
     object[] results = this.Invoke("authenticate", new object[] {
                 crd});
     return ((string)(results[0]));
 }