Esempio n. 1
0
        public ActionResult DeleteLesson(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 p = listaSub.Find(st => st.RowKey.Equals(RowKey));

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


            proxy1.DeleteLesson(RowKey);
            proxy2.Logger("Izbrisan iz tabele", RowKey, "deleted");



            return(RedirectToAction("GetLesson", "Subject"));
        }
Esempio n. 2
0
        public ActionResult Edit(string RowKey, string Name)
        {
            NetTcpBinding binding = 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
            };

            proxy1.Edit(subject);
            proxy2.Logger("Update u tabele", RowKey, "update " + Name);


            return(RedirectToAction("GetSubject", "Subject"));
        }
Esempio n. 3
0
        public ActionResult Edit2(string RowKey, string Title, DateTime PlannedDate, string Description)
        {
            NetTcpBinding binding1 = new NetTcpBinding();
            ChannelFactory <IJobWriter> factory1 = new ChannelFactory <IJobWriter>(binding1, new EndpointAddress("net.tcp://localhost:10100/InputRequest"));
            IJobWriter proxy1 = factory1.CreateChannel();

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


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

            proxy1.EditLesson(lesson);

            proxy2.Logger("Update u tabele", RowKey, "update " + Title);

            return(RedirectToAction("GetLesson", "Subject"));
        }
Esempio n. 4
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"));
        }