Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 /// <remarks/>
 public void addRequirementAsync(string sessionHash, Requirement requirement, object userState) {
     if ((this.addRequirementOperationCompleted == null)) {
         this.addRequirementOperationCompleted = new System.Threading.SendOrPostCallback(this.OnaddRequirementOperationCompleted);
     }
     this.InvokeAsync("addRequirement", new object[] {
                 sessionHash,
                 requirement}, this.addRequirementOperationCompleted, userState);
 }
Ejemplo n.º 3
0
 /// <remarks/>
 public void addRequirementAsync(string sessionHash, Requirement requirement) {
     this.addRequirementAsync(sessionHash, requirement, null);
 }
Ejemplo n.º 4
0
 public Requirement addRequirement(string sessionHash, Requirement requirement) {
     object[] results = this.Invoke("addRequirement", new object[] {
                 sessionHash,
                 requirement});
     return ((Requirement)(results[0]));
 }