Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var client = new DemoServiceClient();
            Response.Write(client.GetDayOfWeek(DateTime.Now));

            Response.Write(client.GetStringRepeatedCount("Create a Web service library which accepts two string as parameters. It should return the number of times the second string contains the first string. Test it with the integrated WCF client.", "the"));
        }
Esempio n. 2
0
        private void DemoForm_Load(object sender, EventArgs e)
        {
            InstanceContext ic;

            ic    = new InstanceContext(this);
            proxy = new DemoServiceClient(ic);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var client = new DemoServiceClient();

            Response.Write(client.GetDayOfWeek(DateTime.Now));

            Response.Write(client.GetStringRepeatedCount("Create a Web service library which accepts two string as parameters. It should return the number of times the second string contains the first string. Test it with the integrated WCF client.", "the"));
        }
Esempio n. 4
0
        void load_database()
        {
            DemoServiceClient webservice = new DemoServiceClient();

            Database_fireworks_.ServiceReference1.DemoServiceClient webService = new DemoServiceClient();
            webservice.GetRows1Completed += new EventHandler <GetRows1CompletedEventArgs>(webservice_GetRows1Completed);
            webservice.GetRows1Async();
        }
Esempio n. 5
0
        private static void Main()
        {
            Console.WriteLine("Client - wait for services");
            Console.ReadLine();
            var service = new DemoServiceClient();

            Console.WriteLine(service.GetData("HelloB"));
            Console.ReadLine();
        }
Esempio n. 6
0
        private static void Main(string[] args)
        {
            var client    = new DemoServiceClient();
            var data      = client.GetData(125);
            var composite = new CompositeType()
            {
                BoolValue = true
            };

            var type = client.GetDataUsingDataContract(composite);
        }
Esempio n. 7
0
        /*Check existing users authentication*/
        void auth_btn_submit_Click(object sender, RoutedEventArgs e)
        {
            DemoServiceClient webservice = new DemoServiceClient();

            mybuttton = sender as Button;

            Database_fireworks_.ServiceReference1.DemoServiceClient webService = new DemoServiceClient();

            webService.GetRowsCompleted += new EventHandler <GetRowsCompletedEventArgs>(webService_GetRowsCompleted);

            webService.GetRowsAsync();
        }
        public void OnGet()
        {
            DemoServiceClient demoServiceClient = new DemoServiceClient();

            Result1 = demoServiceClient.DoWorkAsync().Result;
            Result2 = demoServiceClient.HiAsync("ABC").Result;
            Result3 = demoServiceClient.SumAsync(1, 2).Result;

            ProductService1Client productService1Client = new ProductService1Client();

            product  = productService1Client.findAsync().Result;
            products = productService1Client.findAllAsync().Result;
        }
Esempio n. 9
0
        private void status_button_remove_Click(object sender, RoutedEventArgs e)
        {
            // Now access the service to delete the item
            DemoServiceClient webService = new DemoServiceClient();

            webService.DeleteRowAsync(global_uid);
            System.Windows.MessageBox.Show("File " + global_filename + " has been deleted.");

            //check for index of list box
            status_lstbox.SelectedIndex = -1;
            status_lstbox.Items.Clear();
            query = "select all";
            load_database();
        }
Esempio n. 10
0
        private static async Task InvokeDemoService()
        {
            OperationResult response;

            using (var cancellationSource = new CancellationTokenSource())
                using (var client = new DemoServiceClient())
                {
                    cancellationSource.CancelAfter(TimeSpan.FromSeconds(1));

                    response = await client.RunOperationAsync(TimeSpan.FromSeconds(5), cancellationSource.Token).ConfigureAwait(false);
                }

            Console.WriteLine("ExecutionTime: {0}", response.ExecutionTime);
            Console.WriteLine("IsCanceled: {0}", response.IsCanceled);
        }
Esempio n. 11
0
 private static async Task DisplayText(List<string> list)
 {
     list.ForEach(async item =>
    {
        try
        {
            Task<string> task = new DemoServiceClient().GetStringDataAsync(item);
            if ( task == await Task.WhenAny(task, Task.Delay(9000)))
            {
                Console.WriteLine(await task);
            }
            else
                Console.WriteLine("The execution has timed out.");
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
    });
 }
Esempio n. 12
0
        void sup_tbox_duname_LostFocus(object sender, RoutedEventArgs e)
        {
            flag = 1;
            sup_tblock_tip.Visibility = Visibility.Collapsed;
            img_duname.Visibility     = Visibility.Collapsed;
            SolidColorBrush mybrush = new SolidColorBrush();

            if (sup_tbox_duname.Text.Length > 12)//check for desired user name whether exceeding 12 characters
            {
                System.Windows.Browser.HtmlPage.Window.Alert("Maximum limit for desird user name crossed.Maximum limit is 12 characters.");
                img_duname.Visibility = System.Windows.Visibility.Visible;
                //sup_tblock_duname.Foreground = mybrush;
                sup_tblock_duname.Foreground = new SolidColorBrush(Colors.Red);
                flag = 0;
            }

            if (sup_tbox_duname.Text != "")//check for desired user name whether it is blank or not and if not blank then enter
            {
                char[] sup_chk_duname = new char[12];
                int    flag1          = 0;//variable for checking error in user name

                sup_chk_duname = sup_tbox_duname.Text.ToCharArray();

                /*Check whether first character of user name is not a number or special character*/
                if (!((sup_chk_duname[0] >= 'a' && sup_chk_duname[0] <= 'z') || (sup_chk_duname[0] >= 'A' && sup_chk_duname[0] <= 'Z')))
                {
                    System.Windows.Browser.HtmlPage.Window.Alert("User name should start with character.");
                    img_duname.Visibility = Visibility.Visible;
                    flag1 = 1;//error
                }

                if (flag1 == 0)//call for checking availability of user name if there exist no error
                {
                    DemoServiceClient webService = new DemoServiceClient();

                    webService.GetRowsCompleted += new EventHandler <GetRowsCompletedEventArgs>(webService_GetRowsCompleted);

                    webService.GetRowsAsync();
                }
            }
        }
Esempio n. 13
0
        private static async Task InvokeDemoService()
        {
            OperationResult response;

            using (var cancellationSource = new CancellationTokenSource())
                using (var client = new DemoServiceClient())
                {
                    // !!! ServiceModel.Cancellation demo: set-up client to support cancellation
                    client.UseCancellation();

                    ////// !!! ServiceModel.Cancellation demo: set-up client to support cancellation custom client factory
                    ////client.UseCancellation(o => o.ContractFactory = CancellationContractClientFactory.CreateClient);

                    cancellationSource.CancelAfter(TimeSpan.FromSeconds(1));

                    response = await client.RunOperationAsync(TimeSpan.FromSeconds(5), cancellationSource.Token).ConfigureAwait(false);
                }

            Console.WriteLine("ExecutionTime: {0}", response.ExecutionTime);
            Console.WriteLine("IsCanceled: {0}", response.IsCanceled);
        }
Esempio n. 14
0
 private static async Task DisplayText(List <string> list)
 {
     list.ForEach(async item =>
     {
         try
         {
             Task <string> task = new DemoServiceClient().GetStringDataAsync(item);
             if (task == await Task.WhenAny(task, Task.Delay(9000)))
             {
                 Console.WriteLine(await task);
             }
             else
             {
                 Console.WriteLine("The execution has timed out.");
             }
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     });
 }
Esempio n. 15
0
        /*Function for subscription*/
        private void sup_btn_subscribe_Click(object sender, RoutedEventArgs e)
        {
            char[] sup_chk_duname = new char[30];                         //variable for converting string to char array

            if (sup_tbox_fname.Text == "")                                //check if First name text box is blank
            {
                img_fname.Visibility = System.Windows.Visibility.Visible; //show error image
                flag = 0;                                                 //all mandatory fields are
            }

            /*check whether date,month or year of birthdate is blank or not*/
            if (sup_bdate_date.SelectedIndex == -1 || sup_bdate_month.SelectedIndex == -1 || sup_bdate_year.Text == "")
            {
                img_dob.Visibility = Visibility.Visible;
                flag = 0;
            }
            /*If birthdate is not blank*/
            else
            {
                int temp_date = int.Parse(sup_bdate_date.SelectionBoxItem.ToString());
                int temp_year = int.Parse(sup_bdate_year.Text);

                /*Check for validation of leap year*/
                if (((sup_bdate_month.SelectionBoxItem.ToString() == "April") || (sup_bdate_month.SelectionBoxItem.ToString() == "June") || (sup_bdate_month.SelectionBoxItem.ToString() == "September") || (sup_bdate_month.SelectionBoxItem.ToString() == "November")) && (temp_date == 31))
                {
                    img_dob.Visibility = Visibility.Visible;
                    flag = 0;
                }
                if ((sup_bdate_month.SelectionBoxItem.ToString() == "February"))
                {
                    if (temp_year % 400 == 0 || (temp_year % 100 != 0 && temp_year % 4 == 0))
                    {
                        if ((temp_date == 30) || (temp_date == 31))
                        {
                            img_dob.Visibility = Visibility.Visible;
                            flag = 0;
                        }
                    }
                    else
                    {
                        if ((temp_date == 30) || (temp_date == 31) || (temp_date == 29))
                        {
                            img_dob.Visibility = Visibility.Visible;
                            flag = 0;
                        }
                    }
                }
            }

            if (sup_tbox_lname.Text == "")//Check whether last name is blank or not if blank then enter
            {
                //System.Windows.Browser.HtmlPage.Window.Alert("Please enter last name.");
                img_lname.Visibility = System.Windows.Visibility.Visible;
                flag = 0;
            }

            if (sup_tbox_duname.Text == "")//Check whether desired user name is blank or not if blank then enter
            {
                //System.Windows.Browser.HtmlPage.Window.Alert("Please enter Desired user name.");
                img_duname.Visibility = System.Windows.Visibility.Visible;
                flag = 0;
            }

            if (sup_pbox_pswd.Password == "")//Check whether password box is blank or not if blank then enter
            {
                //System.Windows.Browser.HtmlPage.Window.Alert("Please enter password.");
                img_pswd.Visibility = System.Windows.Visibility.Visible;
                flag = 0;
            }

            //Check whether both passwords matches or not
            if (sup_pbox_pswd.Password != sup_pbox_vpswd.Password)
            {
                img_pswd.Visibility  = System.Windows.Visibility.Visible;
                img_vpswd.Visibility = System.Windows.Visibility.Visible;
                System.Windows.Browser.HtmlPage.Window.Alert("Passwords does not match.");
                flag = 0;
            }

            //Check whether permanent email is blank or not if blank then enter
            if (sup_tbox_pemail.Text == "")
            {
                //System.Windows.Browser.HtmlPage.Window.Alert("Please enter primary Email ID.");
                img_pemail.Visibility = System.Windows.Visibility.Visible;
                flag = 0;
            }

            //Check whether alternet email is blank or not if blank then enter
            if (sup_tbox_pemail.Text == sup_tbox_aemail.Text && !(sup_tbox_pemail.Text == ""))
            {
                img_aemail.Visibility = System.Windows.Visibility.Visible;
                System.Windows.Browser.HtmlPage.Window.Alert("Primary and Alternate Email ID can not be same.");
                flag = 0;
            }

            /*If there is no error in any mandatory fields then make entry in database*/
            if (flag == 1)
            {
                DemoServiceClient webService = new DemoServiceClient();

                webService.InsertDataAsync(sup_tbox_fname.Text, sup_tbox_lname.Text, sup_tbox_duname.Text, sup_tbox_add.Text, malefemale, global_bdate, sup_pbox_pswd.Password, sup_tbox_pemail.Text, sup_tbox_aemail.Text);

                System.Windows.MessageBox.Show("Congratulation!!! You have subscribed succesfully.");

                App.Navigate(new Page());
            }
        }
Esempio n. 16
0
 static async void StartSendMessage()
 {
     var callBackInstance = new InstanceContext(new CallBackHandler());
     var client           = new DemoServiceClient(callBackInstance);
     await client.StartSendMessageAsync();
 }
 public DemoServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(DemoServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 public DemoServiceClient(EndpointConfiguration endpointConfiguration) :
     base(DemoServiceClient.GetBindingForEndpoint(endpointConfiguration), DemoServiceClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 public DemoServiceClient() :
     base(DemoServiceClient.GetDefaultBinding(), DemoServiceClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IDemoService.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(DemoServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IDemoService));
 }
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(DemoServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IDemoService));
 }
Esempio n. 22
0
 static async void StartSendRequest()
 {
     var callbackInstance = new InstanceContext(new CallbackHandler());
     var client           = new DemoServiceClient(callbackInstance);
     await client.StartSendingMessagesAsync();
 }
 static async void StartSendRequest()
 {
     var callbackInstance = new InstanceContext(new CallbackHandler());
     var client = new DemoServiceClient(callbackInstance);
     await client.StartSendingMessagesAsync();
 }