예제 #1
0
        private IProjectTimeTrackerService CreateService()
        {
            IProjectTimeTrackerService service = null;

            if (_Service == null)
            {
                BasicHttpBinding binding = new BasicHttpBinding("BasicHttpBinding_PTTService");
                //binding.Name = "BasicHttpBinding_PTTService";
                //binding.SendTimeout = TimeSpan.FromMinutes(5);
                //binding.SendTimeout = TimeSpan.FromMinutes(5);
                //binding.MaxBufferPoolSize = int.MaxValue;
                //binding.MaxBufferSize = int.MaxValue;
                //binding.MaxReceivedMessageSize = int.MaxValue;
                //binding.ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas();
                //binding.ReaderQuotas.MaxArrayLength = int.MaxValue;
                //binding.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
                //binding.ReaderQuotas.MaxDepth = int.MaxValue;
                //binding.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
                //binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
                EndpointIdentity spn    = EndpointIdentity.CreateSpnIdentity("service_spn_name");
                Uri             uri     = new Uri(_ServiceAddress);
                EndpointAddress address = new EndpointAddress(uri, spn);

                ChannelFactory <IProjectTimeTrackerService> channelFactory = new ChannelFactory <IProjectTimeTrackerService>(binding, address);
                _Service = channelFactory.CreateChannel();
            }
            return(_Service);
        }
예제 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            _Service = CreateService();

            stopButton.Hide();
            pauseButton.Hide();
            resumeButton.Hide();

            //
            //Check if there is an open session
            //
            checkOpenSession();

            hideButtons();
            chooseprojectDropdown.Text = "ABC";
            LoadProjects();
            loadProjectsIntoDropDown();
            NameLabel.Text = "You are logged-in as: " + "'" + userName + "'";
            //
            //If username does not have an id
            //
            int?personid = _Service.GetPersonId(userName);

            if (personid.ToString() == "")
            {
                MessageBox.Show("The name '" + userName + @"' is not in our data base.
Please contact one of our administrators if this problem continues.");
                System.Windows.Forms.Application.Exit();
            }
        }
예제 #3
0
        private IProjectTimeTrackerService CreateService()
        {
            IProjectTimeTrackerService service = null;
            BasicHttpBinding           binding = new BasicHttpBinding();

            binding.Name        = "BasicHttpBinding_PTTService";
            binding.SendTimeout = TimeSpan.FromMinutes(5);

            EndpointIdentity spn    = EndpointIdentity.CreateSpnIdentity("service_spn_name");
            Uri             uri     = new Uri(_ServiceAddress);
            EndpointAddress address = new EndpointAddress(uri, spn);

            ChannelFactory <IProjectTimeTrackerService> channelFactory = new ChannelFactory <IProjectTimeTrackerService>(binding, address);

            service = channelFactory.CreateChannel();
            return(service);
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _Service  = CreateService();                                                             //create service
            _Projects = _Service.GetProjects();                                                      //Populate projet array with all projects
            _People   = _Service.GetPeople();                                                        //Populate people array with all people
            int personId       = Convert.ToInt32(Request["Id"]);                                     //Set personId to Id in Url
            var personSessions = _Service.GetHistoryByPerson(personId);                              //Get history for person with Id of personId

            ViewModel = new PersonProjectHistoryViewModel();                                         //Create a new PersonProjectHistoryView Object for displaying on our page
            Person myPerson = _People.Single(p => p.Id == personId);                                 //Search through _People and get the first one with an Id matching personId

            ViewModel.Person   = myPerson.Name;                                                      //Set our viewModel's person to our person's name
            ViewModel.Projects = new List <ProjectViewModel>();
            foreach (var project in personSessions)                                                  //Loop through Sessions
            {
                var projectViewModel = new ProjectViewModel();                                       //Create a new ProjectViewModel
                projectViewModel.ProjectName = _Projects.First(p => p.Id == project.ProjectId).Name; //Search through _Projects and get the first one with a Id matching project's projectId
                projectViewModel.UserName    = _People.First(p => p.Id == project.PersonId).Name;
                projectViewModel.StartDate   = project.Start;
                projectViewModel.EndDate     = project.End;

                ViewModel.Projects.Add(projectViewModel);//Add filled out projectViewModel to our list of Projects
            }
        }
예제 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _Service         = CreateService(); //create service
     _Projects        = _Service.GetProjects();
     _OnGoingSessions = _Service.GetOngoingSessions();
 }