Esempio n. 1
0
        public ActionResult AddProfessor(string RowKey, string Name, string Lastname)
        {
            NetTcpBinding binding = new NetTcpBinding();
            ChannelFactory <IJobReader> factory = new ChannelFactory <IJobReader>(binding, new EndpointAddress("net.tcp://localhost:10101/InputRequest"));
            IJobReader proxy = factory.CreateChannel();

            NetTcpBinding binding1 = new NetTcpBinding();
            ChannelFactory <IJobWriter> factory1 = new ChannelFactory <IJobWriter>(binding, new EndpointAddress("net.tcp://localhost:10100/InputRequest"));
            IJobWriter proxy1 = factory1.CreateChannel();

            NetTcpBinding binding2 = new NetTcpBinding();
            ChannelFactory <IJobLogger> factory2 = new ChannelFactory <IJobLogger>(binding, new EndpointAddress("net.tcp://localhost:10102/InputRequest"));
            IJobLogger proxy2 = factory2.CreateChannel();

            Professor professor = new Professor(RowKey)
            {
                Name = Name, Surname = Lastname
            };

            if (!proxy.ExistsProfessor(professor))
            {
                proxy1.AddProfessor(professor);
                proxy2.LoggerProfessor("Upisano u Table", RowKey, Name, Lastname);

                // proxy2.Download(RowKey + Name);

                return(RedirectToAction("Index", "Subject"));
            }


            return(RedirectToAction("AddProfessor", "Subject"));
        }
Esempio n. 2
0
        public ActionResult AddLesson(string RowKey, string Title, DateTime PlannedDate, string Description)
        {
            NetTcpBinding binding = new NetTcpBinding();
            ChannelFactory <IJobReader> factory = new ChannelFactory <IJobReader>(binding, new EndpointAddress("net.tcp://localhost:10101/InputRequest"));
            IJobReader proxy = factory.CreateChannel();

            NetTcpBinding binding1 = new NetTcpBinding();
            ChannelFactory <IJobWriter> factory1 = new ChannelFactory <IJobWriter>(binding, new EndpointAddress("net.tcp://localhost:10100/InputRequest"));
            IJobWriter proxy1 = factory1.CreateChannel();

            NetTcpBinding binding2 = new NetTcpBinding();
            ChannelFactory <IJobLogger> factory2 = new ChannelFactory <IJobLogger>(binding, new EndpointAddress("net.tcp://localhost:10102/InputRequest"));
            IJobLogger proxy2 = factory2.CreateChannel();


            Lesson l = new Lesson(RowKey)
            {
                Title = Title, PlannedDate = PlannedDate, Description = Description
            };

            if (!proxy.ExistsLesson(l))
            {
                proxy1.AddLesson(l);
                proxy2.LoggerLesson("Upisano u Table", RowKey, Title, PlannedDate, Description);


                return(RedirectToAction("Index", "Subject"));
            }


            return(RedirectToAction("AddLesson", "Subject"));
        }
            public TestContext()
            {
                _fixture = new Fixture().Customize(new AutoRhinoMockCustomization());

                _jobId       = _fixture.Create <Guid>();
                _description = _fixture.Create <string>();

                var jobDetail =
                    new JobDetailImpl(_fixture.Create <string>(), typeof(JobExecutor))
                {
                    Key         = JobKey.Create(_jobId.ToString()),
                    Description = _description
                };

                _fixture.Inject <IJobDetail>(jobDetail);

                _scheduler = _fixture.Freeze <IScheduler>();
                _converter = _fixture.Freeze <IJobConverter>();
                _sut       = _fixture.Create <JobReader>();

                _expected =
                    new Job(
                        _jobId,
                        _description,
                        _fixture.Create <Uri>(),
                        _fixture.Create <HttpVerb>(),
                        _fixture.Create <string>(),
                        _fixture.Create <string>(),
                        null,
                        _fixture.Create <DateTime>());
            }
Esempio n. 4
0
 public JobController(
     IJobReader reader,
     IJobCreator creator,
     IJobDeleter deleter)
 {
     _reader  = reader;
     _creator = creator;
     _deleter = deleter;
 }
Esempio n. 5
0
        public ActionResult GetLesson()
        {
            NetTcpBinding binding = new NetTcpBinding();
            ChannelFactory <IJobReader> factory = new ChannelFactory <IJobReader>(binding, new EndpointAddress("net.tcp://localhost:10101/InputRequest"));
            IJobReader proxy = factory.CreateChannel();

            List <Lesson> listaSub = new List <Lesson>();



            listaSub = proxy.ReadFromDatabase2();



            return(View(listaSub));
        }
Esempio n. 6
0
        public ActionResult EditLesson(string RowKey)
        {
            NetTcpBinding binding = new NetTcpBinding();
            ChannelFactory <IJobReader> factory = new ChannelFactory <IJobReader>(binding, new EndpointAddress("net.tcp://localhost:10101/InputRequest"));
            IJobReader proxy = factory.CreateChannel();

            List <Lesson> listaSub = new List <Lesson>();

            listaSub = proxy.ReadFromDatabase2();

            Lesson l = listaSub.Find(st => st.RowKey.Equals(RowKey));

            ViewBag.Lesson = l;

            return(View());
            //    return View("Edit",s);
        }
Esempio n. 7
0
        public ActionResult EditSubject(string RowKey)
        {
            NetTcpBinding binding = new NetTcpBinding();
            ChannelFactory <IJobReader> factory = new ChannelFactory <IJobReader>(binding, new EndpointAddress("net.tcp://localhost:10101/InputRequest"));
            IJobReader proxy = factory.CreateChannel();

            NetTcpBinding binding2 = new NetTcpBinding();
            ChannelFactory <IJobLogger> factory2 = new ChannelFactory <IJobLogger>(binding, new EndpointAddress("net.tcp://localhost:10102/InputRequest"));
            IJobLogger proxy2 = factory2.CreateChannel();

            List <Subject> listaSub = new List <Subject>();

            listaSub = proxy.ReadFromDatabase();

            Subject s = listaSub.Find(st => st.RowKey.Equals(RowKey));

            ViewBag.Subject = s;

            return(View());
            //    return View("Edit",s);
        }
Esempio n. 8
0
        public ActionResult AddSubject(string RowKey, string Name)
        {
            NetTcpBinding binding = new NetTcpBinding();
            ChannelFactory <IJobReader> factory = new ChannelFactory <IJobReader>(binding, new EndpointAddress("net.tcp://localhost:10101/InputRequest"));
            IJobReader proxy = factory.CreateChannel();

            NetTcpBinding binding1 = new NetTcpBinding();
            ChannelFactory <IJobWriter> factory1 = new ChannelFactory <IJobWriter>(binding, new EndpointAddress("net.tcp://localhost:10100/InputRequest"));
            IJobWriter proxy1 = factory1.CreateChannel();


            NetTcpBinding binding2 = new NetTcpBinding();
            ChannelFactory <IJobLogger> factory2 = new ChannelFactory <IJobLogger>(binding, new EndpointAddress("net.tcp://localhost:10102/InputRequest"));
            IJobLogger proxy2 = factory2.CreateChannel();



            Subject subject = new Subject(RowKey)
            {
                Name = Name
            };

            if (!proxy.Exists(subject))
            {
                proxy1.AddSubject(subject);

                proxy2.Logger("Upisano u Table", RowKey, Name);

                //proxy2.Send(RowKey + Name);

                return(RedirectToAction("Index", "Subject"));
            }


            return(RedirectToAction("AddSubject", "Subject"));
        }