private void btn4_Click(object sender, RoutedEventArgs e)
        {
            Service2Client x = new Service2Client();


            tblStock stk = new tblStock
            {
                stockId            = Convert.ToInt32(txt1.Text),
                stockName          = txt2.Text,
                quantity           = Convert.ToInt32(txt3.Text),
                quantity_remaining = Convert.ToInt32(txt3.Text),
                addedBy            = 1,
                status             = txt4.Text
            };

            if (!x.updateStockById(stk))
            {
                stat.Content = "invalid id";
            }
            else
            {
                stat.Content = "data updated";
            }

            txt2.Text = "";
            txt3.Text = "";
            txt4.Text = "";
        }
        static void Main(string[] args)
        {
            try
            {
                ServiceClient sc = new ServiceClient();
                Console.WriteLine(sc.Ping());

                Service2Client sc2 = new Service2Client();
                Console.WriteLine(sc2.Ping2());

                //Console.WriteLine("Sending...");
                //int chunkSize = 16777216;
                //int totalSize = 134217728;
                //byte[] data = new byte[chunkSize];
                //for (int i = 0; i < totalSize; i += chunkSize)
                //    sc.Send(data);
                //Console.WriteLine("Sent.");

                Console.WriteLine("\nPress <any key> to continue.");
                Console.ReadKey(true);

                sc.Close();
            }
            catch (Exception ex)
            {
                while (ex != null)
                {
                    Console.WriteLine(ex.Message);
                    ex = ex.InnerException;
                }

                Console.ReadKey(true);
            }
        }
Example #3
0
        /// <summary>
        /// Evento que permite agregar un alumno
        /// </summary>
        /// <param name="sender">Generador de evento</param>
        /// <param name="e">Argumentos del evento</param>
        private void button1_Click(object sender, EventArgs e)
        {
            //Agregar alumno
            int codigo = Int32.Parse(textBoxCodigo.Text);
            string nombre = textBoxNombre.Text;
            int dni = Int32.Parse(textBoxDNI.Text);
            int creditos = 1;
            string email = "*****@*****.**";
            int telefono = 1;
            int ciclo = 1;
            int facultad = comboBoxFacultad.SelectedIndex;
            Especialidad newEspecialidad = new Especialidad();
            newEspecialidad.Codigo = 1;
            newEspecialidad.Nombre = "Ingenieria Informatica";
            string unidad;
            switch (facultad)
            {
                case 0:
                    {
                        unidad = "FACI";
                        break;
                    }
                default :
                    {
                        unidad = "EEGGCC";
                        break;
                    }
            }
            Service2Client servicio = new Service2Client();
            Alumno newAlumno = servicio.crearAlumno(codigo, nombre, dni, email, telefono, ciclo, creditos, newEspecialidad, newEspecialidad, "", unidad);

            AlumnoAgregado = newAlumno;
            MessageBox.Show("Alumno agregado");
            this.Close();
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Service2Client wcfTest = new Service2Client();

            Label1.Text = wcfTest.DoWork();
            wcfTest.Close();
        }
Example #5
0
File: Form2.cs Project: tume01/lp2
        /// <summary>
        /// Evento que permite agregar tutor
        /// </summary>
        /// <param name="sender">Generador de evento</param>
        /// <param name="e">Argumentos del evento</param>
        private void button1_Click(object sender, EventArgs e)
        {
            int          codigo         = Int32.Parse(textBoxCodigo.Text);
            string       nombre         = textBoxNombre.Text;
            int          dni            = Int32.Parse(textBoxDNI.Text);
            string       correo         = textBoxCorreo.Text;
            int          telefono       = Int32.Parse(textBoxTelefono.Text);
            string       regimen        = comboBoxDedicacion.SelectedText;
            int          idioma         = comboBoxIdioma.SelectedIndex;
            DateTime     fechaInicio    = dateTimePickerInicio.Value;
            DateTime     fechaFin       = dateTimePickerFin.Value;
            int          anio           = fechaInicio.Year;
            string       gradoAcademico = comboBoxGrado.SelectedText;
            Especialidad especialidad   = new Especialidad();

            especialidad.Codigo = comboBoxEspecialidad.SelectedIndex + 1;
            especialidad.Nombre = "informatica";
            string FechaFin     = fechaInicio.ToString("yyyy-MM-dd");
            string FechaIinicio = fechaFin.ToString("yyyy-MM-dd");

            Service2Client servicio    = new Service2Client();
            Profesor       newProfesor = servicio.crearProfesor(codigo, nombre, dni, correo, telefono, "regimen", idioma, anio, "grado",
                                                                especialidad, FechaIinicio, FechaIinicio, FechaFin, "categoria");

            ProfesorAgregado = newProfesor;

            MessageBox.Show("Profesor agregado");
            this.Close();
        }
        static void Main(string[] args)
        {
            try
            {
                ServiceClient sc = new ServiceClient();
                Console.WriteLine(sc.Ping());

                Service2Client sc2 = new Service2Client();
                Console.WriteLine(sc2.Ping2());

                //Console.WriteLine("Sending...");
                //int chunkSize = 16777216;
                //int totalSize = 134217728;
                //byte[] data = new byte[chunkSize];
                //for (int i = 0; i < totalSize; i += chunkSize)
                //    sc.Send(data);
                //Console.WriteLine("Sent.");

                Console.WriteLine("\nPress <any key> to continue.");
                Console.ReadKey(true);

                sc.Close();
            }
            catch (Exception ex)
            {
                while (ex != null)
                {
                    Console.WriteLine(ex.Message);
                    ex = ex.InnerException;
                }

                Console.ReadKey(true);
            }
        }
        private void btn2_Click(object sender, RoutedEventArgs e)
        {
            Service2Client x    = new Service2Client();
            tblStock       stk1 = x.getStockRowbyId(Convert.ToInt32(txt1.Text));

            tblStock stk = new tblStock {
                stockId            = Convert.ToInt32(txt1.Text),
                stockName          = txt2.Text,
                quantity           = Convert.ToInt32(txt3.Text),
                quantity_remaining = Convert.ToInt32(txt3.Text),
                addedBy            = 1,
                status             = txt4.Text
            };

            if (stk1.stockName == null)
            {
                x.setStock(stk);
                stat.Content = "stock has been added";
            }
            else
            {
                stat.Content = "stockID already exists";
            }

            txt2.Text = "";
            txt3.Text = "";
            txt4.Text = "";
        }
Example #8
0
        void TableLoad()
        {
            List <Timetablesc> modl    = new List <Timetablesc>();
            Service2Client     service = new Service2Client();

            dataGridView1.DataSource = service.GetComTimetables();
        }
Example #9
0
File: Form2.cs Project: tume01/lp2
        /// <summary>
        /// Evento que permite agregar tutor
        /// </summary>
        /// <param name="sender">Generador de evento</param>
        /// <param name="e">Argumentos del evento</param>
        private void button1_Click(object sender, EventArgs e)
        {
            int codigo                = Int32.Parse(textBoxCodigo.Text);
            string nombre             = textBoxNombre.Text;
            int dni                   = Int32.Parse(textBoxDNI.Text);
            string correo             = textBoxCorreo.Text;
            int telefono              = Int32.Parse(textBoxTelefono.Text);
            string regimen            = comboBoxDedicacion.SelectedText;
            int idioma                = comboBoxIdioma.SelectedIndex;
            DateTime fechaInicio      = dateTimePickerInicio.Value;
            DateTime fechaFin         = dateTimePickerFin.Value;
            int anio                  = fechaInicio.Year;
            string gradoAcademico     = comboBoxGrado.SelectedText ;
            Especialidad especialidad = new Especialidad();
            especialidad.Codigo = comboBoxEspecialidad.SelectedIndex+1;
            especialidad.Nombre = "informatica";
            string FechaFin           = fechaInicio.ToString("yyyy-MM-dd");
            string FechaIinicio       = fechaFin.ToString("yyyy-MM-dd");

            Service2Client servicio = new Service2Client();
            Profesor newProfesor = servicio.crearProfesor(codigo,nombre,dni,correo,telefono,"regimen",idioma,anio,"grado",
                                    especialidad,FechaIinicio,FechaIinicio,FechaFin,"categoria");

            ProfesorAgregado = newProfesor;

            MessageBox.Show("Profesor agregado");
            this.Close();
        }
Example #10
0
        void TableLoad()
        {
            List <Feedbacksc> modl    = new List <Feedbacksc>();
            Service2Client    service = new Service2Client();

            dataGridView1.DataSource = service.GetComFeedbacks();
        }
Example #11
0
        void TableLoad()
        {
            List <Lecturersc> modl    = new List <Lecturersc>();
            Service2Client    service = new Service2Client();

            dataGridView1.DataSource = service.GetComputingLecturers();
            dataGridView2.DataSource = service.GetComputingStudents();
        }
Example #12
0
 public ActionResult GetWeekTcp()
 {
     ServiceReference2.IService2 s = new Service2Client();
     s.SayHello("Ram");
     return(View("Index", new TcpHttpModel()
     {
         WeekMessage = s.TodayProgram()
     }));
 }
Example #13
0
 public ActionResult GetTcp()
 {
     ServiceReference2.IService2 s = new Service2Client();
     s.SayHello("Ram");
     return(View("Index", new TcpHttpModel()
     {
         HelloMessage = s.SayHello("Ram")
     }));
 }
Example #14
0
 static void Main(string[] args)
 {
     using (var proxy = new Service2Client())
     {
         Console.WriteLine("{0} + {1} = {2}", 23, 5, proxy.Add(23, 5));
         Console.WriteLine("{0} - {1} = {2}", 13, 5, proxy.Subtract(13, 5));
         Console.Read();
     }
 }
Example #15
0
        public string GetModel2()
        {
            using (Service2Client client = new Service2Client())
            {
                var data = client.GetModel();

                return(JsonConvert.SerializeObject(data));
            }
        }
Example #16
0
        void TableLoad()
        {
            List <Modulesc> modl    = new List <Modulesc>();
            Service2Client  service = new Service2Client();

            dataGridView1.DataSource = service.GetComModules();
            dataGridView2.DataSource = service.GetComLecHalls();
            dataGridView3.DataSource = service.GetComLabs();
        }
Example #17
0
        static void Main(string[] args)
        {
            Service1Client proxy1 = new Service1Client();
            IService2      proxy2 = new Service2Client();

            Console.WriteLine(proxy1.GetData(10));
            Console.WriteLine(proxy2.DoWork("Nilesh"));

            Console.ReadLine();
        }
Example #18
0
        static async Task Main(string[] args)
        {
            using (var client = new Service1Client())
            {
                client.Open();

                var version = await client.GetServiceVersionAsync();

                Console.WriteLine(version);

                Console.WriteLine("Enter number: ");
                if (int.TryParse(Console.ReadLine(), out var num))
                {
                    //
                    var doubled = await client.DoubleNumberAsync(num);

                    Console.WriteLine($"Doubled: {doubled}");
                }
                else
                {
                    Console.WriteLine("Not a number!");
                }
            }

            using (var client = new Service2Client())
            {
                client.Open();

                var que = new Question {
                    QuestionId = 2, Category = "random", Rating = 5
                };

                await client.AddQuestionAsync(que);

                var queList = await client.GetQuestionsAsync();

                foreach (var item in queList)
                {
                    Console.WriteLine(item.Category);
                }

                Console.WriteLine("Edit?");
                var que2 = await client.GetQuestionByIdAsync(que.QuestionId);

                que2.Category = "Something";

                await client.EditQuestionAsync(que2);

                Console.WriteLine((await client.GetQuestionByIdAsync(que.QuestionId)).Category);

                await client.DeleteQuestionAsync((await client.GetQuestionsAsync()).Last().QuestionId);
            }
            Console.ReadKey();
        }
Example #19
0
        public string GetData2()
        {
            using (Service2Client client = new Service2Client())
            {
                var composite = new ServiceReference2.CompositeType();

                var data = client.GetDataUsingDataContract(composite);

                return(JsonConvert.SerializeObject(data));
            }
        }
Example #20
0
        static void Main(string[] args)
        {
            IService1 client1 = new Service1Client();
            IService2 client2 = new Service2Client();
            IService3 client3 = new Service3Client();

            Console.WriteLine("Client 1 says: " + client1.DoAction1());
            Console.WriteLine("Client 2 says: " + client2.DoAction2());
            Console.WriteLine("Client 3 says: " + client3.DoAction3());

            Console.ReadLine();
        }
Example #21
0
 static void Main(string[] args)
 {
     Service1Client prx1 = new Service1Client("EPbasicHttp1");
     Console.WriteLine(prx1.DoWork1("Peps1"));
     //Utilizando o outro binding do Service1
     prx1 = new Service1Client("EPwsHttp1");
     Console.WriteLine(prx1.DoWork1("Peps1"));
     Service2Client prx2 = new Service2Client("EPwsHttp2");
     Console.WriteLine(prx2.DoWork2("Peps2"));
     Service3Client prx3 = new Service3Client();
     Console.WriteLine(prx3.DoWork("Peps3"));
 }
Example #22
0
        private void TeamLogin_Click(object sender, RoutedEventArgs e)
        {
            TeamLogIn LW = new TeamLogIn();

            LW.Owner = this;
            LW.ShowDialog();
            string          name    = LW.TeamName;
            InstanceContext context = new InstanceContext(this);

            proxy = new Service2Client(context);
            proxy.LogInTeam(name);
        }
Example #23
0
        static void Main(string[] args)
        {
            IService1 client1 = new Service1Client();
            IService2 client2 = new Service2Client();
            IService3 client3 = new Service3Client();

            Console.WriteLine("Client 1 says: " + client1.DoAction1());
            Console.WriteLine("Client 2 says: " + client2.DoAction2());
            Console.WriteLine("Client 3 says: " + client3.DoAction3());

            Console.ReadLine();
        }
        private async void button2_Click(object sender, RoutedEventArgs e)
        {
            var proxy2 = new Service2Client();

            var game = await proxy2.GetDataUsingDataContractAsync(new Game()
            {
                BoolValue   = true,
                StringValue = "Jhon"
            });

            MessageBox.Show($"{game.StringValue}, {game.BoolValue}");
        }
Example #25
0
        private void buttonGuardarReunion_Click(object sender, EventArgs e)
        {
            string tema        = textBoxTema.Text;
            string sugerancias = richTextBoxSugerencias.Text;
            DateTime fecha = dateTimePickerFechaReunion.Value;
            Service2Client serviceTutor = new Service2Client();

            string result = serviceTutor.agregarReunion(alumno, profesor, fecha.ToString("yyyy-MM-dd"), tema, sugerancias);
            MessageBox.Show(result);
            // Reunion newReunion = new Reunion(alumno, profesor, fecha, tema, sugerancias);

            this.Close();
        }
Example #26
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            List <Lecturersc> sl = new List <Lecturersc>();
            Lecturersc        t  = new Lecturersc();

            {
                t.Username = txtUsername.Text;
            };

            Service2Client service = new Service2Client();

            sl.Add(service.SearchLecturers(t));
            dataGridView1.DataSource = sl;
        }
Example #27
0
        private void btnStusearch_Click(object sender, EventArgs e)
        {
            List <Studentsc> stus = new List <Studentsc>();
            Studentsc        ts   = new Studentsc();

            {
                ts.Username = txtUsername.Text;
            };

            Service2Client service = new Service2Client();

            stus.Add(service.SearchStudents(ts));
            dataGridView2.DataSource = stus;
        }
Example #28
0
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            logIn LW = new logIn();

            LW.Owner = this;
            LW.ShowDialog();
            string          name    = LW.name;
            string          email   = LW.email;
            InstanceContext context = new InstanceContext(this);

            proxy = new Service2Client(context);
            proxy.LogIn(name, email);
            //textBlock.Text = name + " " + email;
        }
Example #29
0
        private void buttonGuardarReunion_Click(object sender, EventArgs e)
        {
            string         tema         = textBoxTema.Text;
            string         sugerancias  = richTextBoxSugerencias.Text;
            DateTime       fecha        = dateTimePickerFechaReunion.Value;
            Service2Client serviceTutor = new Service2Client();

            string result = serviceTutor.agregarReunion(alumno, profesor, fecha.ToString("yyyy-MM-dd"), tema, sugerancias);

            MessageBox.Show(result);
            // Reunion newReunion = new Reunion(alumno, profesor, fecha, tema, sugerancias);


            this.Close();
        }
        protected override void OnStartup(System.Windows.StartupEventArgs e)
        {
            var s1 = new Service1Client();
            s1CompositeType d1 = s1.GetData();

            var s2 = new Service2Client();

            // must do some mapping
            var d2 = new s2CompositeType
                {
                    IntVal = d1.IntVal,
                    StrVal = d1.StrVal
                };
            s2.SetData(d2);
        }
        public void endGame(Player winner)
        {
            statusLabel.Content = "Game end winner is: " + winner.UserName;
            if (MainPlayer.Color == "Red")
            {
                game.WinnerId = winner.id;
                InstanceContext context = new InstanceContext(this);
                proxy = new Service2Client(context);
                proxy.endGameServer(game, MoveToMove());
            }

            CurrentPlayre = new Player {
                UserName = "", id = -999, Color = ""
            };
            statusLabel.Content = "Game end winner is: " + winner.UserName;
        }
Example #32
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            using (var client = new Service1Client())
            {
                client.Open();

                var version = await client.GetServiceVersionAsync();

                Console.WriteLine(version);

                Console.WriteLine("Enter number: ");
                if (int.TryParse(Console.ReadLine(), out var num))
                {
                    var doubled = await client.DoubleNumberAsync(num);

                    Console.WriteLine($"Doubled: {doubled}");
                }
                else
                {
                    Console.WriteLine("Not a number!");
                }

                MyService.Question question = client.GetQuestion(1);
                Console.WriteLine(question.QuestionId);
                // can't access datemodified

                MyService.Question question12 = client.GetQuestion(2);
                Console.WriteLine(question.QuestionId);
            }

            using (var client = new Service2Client())
            {
                client.Open();



                // Dealing with Question list
                QuestionList newList = client.CreateQuestionList();
            }



            Console.ReadKey();
        }
 public void endGame(Team winner)
 {
     statusLabel.Content = "Game end winning Team is: Team " + winner.TeamName;
     if (MainTeam.id == game.Team1.id)
     {
         InstanceContext context = new InstanceContext(this);
         proxy = new Service2Client(context);
         proxy.endTeamGameServer(game, winner, MoveToMove());
     }
     CurrentPlayre = new Player {
         UserName = "", id = -999, Color = ""
     };
     CurrentTeam = new Team {
         TeamName = "", id = -9999
     };
     statusLabel.Content = "Game end winning Team is: Team " + winner.TeamName;
 }
        private void btn3_Click(object sender, RoutedEventArgs e)
        {
            Service2Client x = new Service2Client();


            if (!x.deleteStockById(Convert.ToInt32(txt1.Text)))
            {
                stat.Content = "invalid id";
            }
            else
            {
                stat.Content = "data deleted";
            }
            txt2.Text = "";
            txt3.Text = "";
            txt4.Text = "";
        }
Example #35
0
        private void button4_Click(object sender, EventArgs e)
        {
            Labsc u = new Labsc();

            Service2Client service = new Service2Client();

            u = service.SearchLabs(txtLabcode.Text);
            if (u != null)
            {
                txtLabcode.Text   = u.Labcode;
                txtLabnumstu.Text = u.Numstu;
            }

            else
            {
                MessageBox.Show("Invalid Mode Code !! Try Again !!");
            }
        }
Example #36
0
        private void btnLechallSearch_Click(object sender, EventArgs e)
        {
            Lechallsc u = new Lechallsc();

            Service2Client service = new Service2Client();

            u = service.SearchLecHalls(txtHcode.Text);
            if (u != null)
            {
                txtHcode.Text  = u.Lechallcode;
                txtNumstu.Text = u.Numstu;
            }

            else
            {
                MessageBox.Show("Invalid Mode Code !! Try Again !!");
            }
        }
Example #37
0
        static void Main(string[] args)
        {
            Console.Title = "Client";

            var client1 = new Service1Client();
            var client2 = new Service2Client();
            while (true)
            {
                var input = Console.ReadLine();
                var i = 0;
                int.TryParse(input, out i);
                var result1 = client1.GetData(i);
                var result2 = client2.GetData(i);
                Console.WriteLine(result1);
                Console.WriteLine(result2);

            }
        }
Example #38
0
        private void btn1_Click(object sender, RoutedEventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            MyData1 data = new MyData1();

            sb.AppendLine("直接创建对象:");
            sb.AppendLine("myName2:" + data.MyName2);
            sb.AppendLine("myNmae3:" + data.myName3);                    //myName3是private,无法获取
            sb.AppendLine("Telephone:" + data.Telephone);
            Service2Client client = new Service2Client();
            MyData1        data1  = client.GetMyData1();

            sb.AppendLine("通过服务获取对象:");
            sb.AppendLine("myName2:" + data1.MyName2);
            sb.AppendLine("myNmae3:" + data1.myName3);                    //myName3是private,无法获取
            sb.AppendLine("Telephone:" + data1.Telephone);
            textBlock.Text = sb.ToString();
        }
Example #39
0
 private void button3_Click(object sender, EventArgs e)
 {
     System.ServiceModel.InstanceContext instanceContext = new System.ServiceModel.InstanceContext(new CalculatorCallback());
     var sc = new Service2Client(instanceContext);
     sc.DoWork();
 }
 protected override void OnStartup(StartupEventArgs e)
 {
     var svcS1 = new Service1Client();
     var d = svcS1.GetData();
     var svcS2 = new Service2Client();
     svcS2.SetData(d);
 }