Esempio n. 1
0
        static void Main(string[] args)
        {
            SharedConfigurator.Configure();

            using (var client1 = CreateSharedConnection("shareme", "net://localhost:3131/SharedAppId"))
                using (var client2 = CreateSharedConnection("shareme", "net://localhost:3132/SharedAppId"))
                {
                    client1.Open();
                    client2.Open();

                    IBasicService service1 = client1.RemoteExecutor.Create <IBasicService>();
                    IBasicService service2 = client2.RemoteExecutor.Create <IBasicService>();

                    Console.WriteLine($"Service 1 says that 2 + 2 = {service1.Add(2, 2)}");
                    Console.WriteLine($"Service 2 says that 2 + 2 = {service2.Add(2, 2)}");

                    Console.WriteLine("Saying hello to service1...");
                    service1.SayHello("Hi!");
                    Console.WriteLine("Saying hello to service2...");
                    service2.SayHello("Sup!");

                    Console.WriteLine("Done. Press enter to exit.");
                    Console.ReadLine();
                }
        }
Esempio n. 2
0
 public Dependent4(IBasicService basicService1, IBasicService basicService2, IBasicService basicService3, IBasicService basicService4)
 {
     _basicService1 = basicService1 ?? throw new ArgumentNullException(nameof(basicService1));
     _basicService2 = basicService2 ?? throw new ArgumentNullException(nameof(basicService2));
     _basicService3 = basicService3 ?? throw new ArgumentNullException(nameof(basicService3));
     _basicService4 = basicService4 ?? throw new ArgumentNullException(nameof(basicService4));
 }
Esempio n. 3
0
        private void BindDictList()
        {
            IBasicService service = ServiceFactory.GetService <IBasicService>();

            this.gvList.DataSource = (from item in service.GetList_Dictionary() where item.DictKind == this.Kind.ToInt() select item).ToList();
            this.gvList.DataBind();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Console.Write("\n  Starting Programmatic Basic Service Client");
            Console.Write("\n ============================================\n");

            string        url   = "http://localhost:8080/BasicService";
            IBasicService svc   = null;
            int           count = 0;

            while (true)
            {
                try
                {
                    svc = CreateProxy(url);
                    break;
                }
                catch
                {
                    Console.Write("\n  connection to service failed {0} times - trying again", ++count);
                    Thread.Sleep(100);
                    continue;
                }
            }
            string msg = "This is a test message from client";

            svc.sendMessage(msg);

            msg = svc.getMessage();
            Console.Write("\n  Message recieved from Service: {0}\n\n", msg);
        }
        private void BindOrg()
        {
            if (!this.IsInsert)
            {
                IBasicService service = ServiceFactory.GetService <IBasicService>();

                BasicOrganization entity = service.GetObject_Organization(this.PkId);

                if (entity != null)
                {
                    this.txtOrgNumber.Text     = entity.OrgNumber;
                    this.txtOrgName.Text       = entity.OrgName;
                    this.txtOrgAddress.Text    = entity.OrgAddress;
                    this.hfOrgParentId.Value   = entity.OrgParentId.ToString();
                    this.txtOrgParentName.Text = entity.OrgParentId.ToString().GetOrgName(true);

                    this.txtOrgNumber.ReadOnly     = true;
                    this.btnSubmitContinue.Visible = false;
                }

                else
                {
                    this.JscriptMsg("数据不存在", this.ReturnUrl, "Error");
                }
            }
        }
 public CreateRequestForm(ICustomerService serviceC, IArticleService serviceP, IBasicService serviceM)
 {
     InitializeComponent();
     this.serviceC = serviceC;
     this.serviceP = serviceP;
     this.serviceM = serviceM;
 }
Esempio n. 7
0
 /// <summary>
 ///  /// This is used to create a proxy channel for the client to the server2
 /// The client uses this channel to communicate with server2.
 /// </summary>
 void getConnection2()
 {
     try
     {
         if (ConnectButton2.IsEnabled)
         {
             server2Port = RemotePortTextBox2.Text;
             string endpoint = RemoteAddressTextBox2.Text + server2Port + "/IBasicService";
             try
             {
                 if (client == null)
                 {
                     client = new ClientService();
                 }
                 server2ServiceChannel = client.CreateSendChannel(endpoint);
             }
             catch (Exception ex)
             {
                 showErrorWindow(ex.Message, server2Port);
             }
         }
     }
     catch (Exception ex)
     {
         Console.Write("\n\n Error in the input data. Exception {0}. Please check the input data\n", ex.Message);
     }
 }
Esempio n. 8
0
            public Dependent6(IBasicService basicService1, IBasicService basicService2, IBasicService basicService3, IBasicService basicService4, IBasicService basicService5, IBasicService basicService6)
            {
                if (basicService1 == null)
                {
                    throw new ArgumentNullException(nameof(basicService1));
                }
                if (basicService2 == null)
                {
                    throw new ArgumentNullException(nameof(basicService2));
                }
                if (basicService3 == null)
                {
                    throw new ArgumentNullException(nameof(basicService3));
                }
                if (basicService4 == null)
                {
                    throw new ArgumentNullException(nameof(basicService4));
                }
                if (basicService5 == null)
                {
                    throw new ArgumentNullException(nameof(basicService5));
                }
                if (basicService6 == null)
                {
                    throw new ArgumentNullException(nameof(basicService6));
                }

                _basicService1 = basicService1;
                _basicService2 = basicService2;
                _basicService3 = basicService3;
                _basicService4 = basicService4;
                _basicService5 = basicService5;
                _basicService6 = basicService6;
            }
Esempio n. 9
0
        /// <summary>
        /// Test stud for the program. This is the entry point of the program 
        /// when the module is run as a stand alone application.
        /// </summary>
        /// <param name="args">Command line parameters</param>
        static void Main(string[] args)
        {
            Console.Title = "BasicHttp Client";
            Console.Write("\n  Starting Programmatic Basic Service Client");
            Console.Write("\n ============================================\n");

            string url = "http://localhost:4000/IBasicService";
            ClientService client = new ClientService();
            while (true)
            {
                try
                {
                    IBasicService svc = client.CreateSendChannel(url);

                    string msg = "This is a test message from client";
                    client.SendMessage(svc, msg);

                    msg = client.GetMessage(svc);
                    Console.Write("\n  Message recieved from Service: {0}\n\n", msg);
                    List<ProjectTree> files = client.GetFilesList(svc, ".", false);
                    //foreach (string file in files)
                    //  Console.WriteLine("{0}\n", file);
                    //client.SetFilesList(svc, files, "server1");
                    break;
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception thrown " + ex.Message);
                    Console.WriteLine("Retrying...");
                }
            }
            Console.ReadKey();
        }
Esempio n. 10
0
        static HttpServer CreateServer(IBasicService service)
        {
            HttpServer server = new HttpServer(HTTP_PREFIX);

            server.Add <IBasicService>(service);
            return(server);
        }
 public PutOnResource(IResourceService serviceS, IIngridientService serviceC, IBasicService serviceM)
 {
     InitializeComponent();
     this.serviceS = serviceS;
     this.serviceC = serviceC;
     this.serviceM = serviceM;
 }
 public FundingPackageController(IProjectService projectService, IBasicService basicService, IUserService userService, IFundingPackageService fundingPackage)
 {
     _projectService = projectService;
     _basicService   = basicService;
     _fundingPackage = fundingPackage;
     _userService    = userService;
 }
Esempio n. 13
0
 public ProjectController(IProjectService projectService, IBasicService basicService, IWebHostEnvironment hostEnvironment, IUserService userService, IUserBackerService userBackerService)
 {
     _projectService    = projectService;
     _basicService      = basicService;
     _hostEnviroment    = hostEnvironment;
     _userService       = userService;
     _userBackerService = userBackerService;
 }
Esempio n. 14
0
 public FiveArgParameterService(string stringArg,
                                int intArg,
                                double doubleArg,
                                decimal decimalArg,
                                IBasicService basicService)
 {
     Parameters = new object[] { stringArg, intArg, doubleArg, decimalArg, basicService };
 }
Esempio n. 15
0
 public Dependent1(IBasicService basicService1)
 {
     if (basicService1 == null)
     {
         throw new ArgumentNullException(nameof(basicService1));
     }
     _basicService1 = basicService1;
 }
		public MixedParameterConstructor(IBasicService basicService, string stringParam, int intParam)
		{
			BasicService = basicService;

			StringParam = stringParam;

			IntParam = intParam;
		}
Esempio n. 17
0
		public void ImportMethod(IBasicService basicService, string stringParam, int intParam)
		{
			BasicService = basicService;

			StringParam = stringParam;

			IntParam = intParam;
		}
Esempio n. 18
0
		public WithCtorParamClass(string stringParam, int intParam, IBasicService basicService)
		{
			BasicService = basicService;

			StringParam = stringParam;

			IntParam = intParam;
		}
Esempio n. 19
0
 public BasicController(IBasicService service, ILogger <BasicController> logger, IHttpContextAccessor httpContextAccessor, ApplicationDbContext context)
 {
     _service             = service;
     _logger              = logger;
     _httpContextAccessor = httpContextAccessor;
     _context             = context;
     CurrentUser.Configure(_httpContextAccessor);
 }
Esempio n. 20
0
        public BasicServiceProxy()
        {
            var address = new EndpointAddress("http://localhost:9010/MyWcfServiceLibraryBasic/BasicService");

            var factory = new ChannelFactory<IBasicService>(new WSHttpBinding());

            _service = factory.CreateChannel(address);
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (this.IsValid)
            {
                IBasicService service = ServiceFactory.GetService <IBasicService>();

                BasicOrganization entity = null;

                if (this.IsInsert)
                {
                    entity = new BasicOrganization()
                    {
                        OrgNumber   = this.txtOrgNumber.Text.Trim(),
                        OrgName     = this.txtOrgName.Text.Trim(),
                        OrgAddress  = this.txtOrgAddress.Text.Trim(),
                        OrgParentId = this.hfOrgParentId.Value.Trim().ToInt(0),
                        OrgFullPath = ""
                    };

                    if (service.CheckExists_Organization(entity))
                    {
                        this.JscriptMsg("网点机构号码已存在", null, "Error");

                        return;
                    }
                }

                else
                {
                    entity = service.GetObject_Organization(this.PkId);

                    if (entity != null)
                    {
                        entity.OrgName     = this.txtOrgName.Text.Trim();
                        entity.OrgAddress  = this.txtOrgAddress.Text.Trim();
                        entity.OrgParentId = this.hfOrgParentId.Value.Trim().ToInt(0);
                    }
                }

                service.Save_Organization(entity);

                if (this.IsInsert)
                {
                    entity.OrgFullPath = entity.OrgParentId.ToString().GetOrgFullPath() + "[" + entity.PkId + "]";

                    service.Save_Organization(entity);
                }

                if (this.IsInsert && (sender as Button).CommandName == "SubmitContinue")
                {
                    this.ReturnUrl = this.Request.Url.PathAndQuery;
                }

                this.JscriptMsg("数据保存成功", this.ReturnUrl, "Success");
            }

            BasicConvert.ClearCache();
        }
Esempio n. 22
0
 public Dependent7(IBasicService basicService1, IBasicService basicService2, IBasicService basicService3, IBasicService basicService4, IBasicService basicService5, IBasicService basicService6, IBasicService basicService7)
 {
     _basicService1 = basicService1 ?? throw new ArgumentNullException(nameof(basicService1));
     _basicService2 = basicService2 ?? throw new ArgumentNullException(nameof(basicService2));
     _basicService3 = basicService3 ?? throw new ArgumentNullException(nameof(basicService3));
     _basicService4 = basicService4 ?? throw new ArgumentNullException(nameof(basicService4));
     _basicService5 = basicService5 ?? throw new ArgumentNullException(nameof(basicService5));
     _basicService6 = basicService6 ?? throw new ArgumentNullException(nameof(basicService6));
     _basicService7 = basicService7 ?? throw new ArgumentNullException(nameof(basicService7));
 }
Esempio n. 23
0
        public void Container_InjectionContext_Convert_Mismatch_Type_Throws()
        {
            var container = new DependencyInjectionContainer();

            container.Configure(c => c.Export <BasicService>().As <IBasicService>().ImportProperty(i => i.Count));

            IBasicService instance = null;

            Assert.Throws <LocateException>(() => instance = container.Locate <IBasicService>(new { Count = "Hello" }));
        }
Esempio n. 24
0
        public static void Save()
        {
            IBasicService service = ServiceFactory.GetService <IBasicService>();

            foreach (BasicParameter item in basicParameterList)
            {
                service.Save_Parameter(item);
            }

            SystemParameter.Refresh();
        }
Esempio n. 25
0
 /// <summary>
 /// This is used to set the repository of the servers. When server process
 /// a request to do the analysis, it will store the result in its repo. If
 /// a new client makes a connection then the repository contents of each of 
 /// the server should be set. This method does this task.
 /// </summary>
 /// <param name="svc"></param>
 public void SetRepo(IBasicService svc)
 {
     try
     {
         svc.setRepo();
     }
     catch (Exception)
     {
         Console.Write("\n\n The service object is null. Please check the input");
     }
 }
Esempio n. 26
0
 /// <summary>
 /// This method is used to send the request to a server from the
 /// client. Once the client is connected to the server, we send
 /// a test message to check whether connection was successful or
 /// not. The message are sent using the service object which is
 /// derived from the WCF interface classs IBasicService.
 /// </summary>
 /// <param name="serviceObject"></param>
 /// <param name="msg"></param>
 public void SendMessage(IBasicService serviceObject, string msg)
 {
     try
     {
         serviceObject.sendMessage(msg);
     }
     catch (Exception)
     {
         Console.Write("\n\n The service object is null. Please check the input");
     }
 }
Esempio n. 27
0
 /// <summary>
 /// This method is used to send the merged type table to individual servers.
 /// Since ther are multiple servers involved in this project, there will be 
 /// partial type tables from each of the servers. These partial table needs
 /// to be merged. This is done by the client. Once client merges the type 
 /// table, it is sent back to each of the individual servers.After this 
 /// the server does a second round of analysis using the merged table
 /// </summary>
 /// <param name="serviceObject">The service object through which communication
 /// between client and server are carried out</param>
 /// <param name="typeTableMerged">Merged type table which contains list of 
 /// all the types of all the servers.
 /// </param>
 public void SendMergedTypeTable(IBasicService serviceObject, List<Elem> typeTableMerged)
 {
     try
     {
         serviceObject.sendMergedTypeTable(typeTableMerged);
     }
     catch (Exception)
     {
         Console.Write("\n\n The service object is null. Please check the input");
     }
 }
Esempio n. 28
0
 /// <summary>
 /// This method is used to start the second round of analysis for the files.
 /// Since there are multiple servers involved in the system, second round of 
 /// analysis is required once partial type table for each of the server is 
 /// available. The client merges these partial type tables and then sends
 /// it to the server. After the server gets this merged type table, the 
 /// server has to start the second round of analysis on this merged type table.
 /// This method is used to start the second round of analysis in the server.
 /// </summary>
 /// <param name="serverObject">The server object in which the analysis has to be done</param>
 /// <param name="files">List of files for which analysis is needed</param>
 public void GetAnalyzedData(IBasicService serverObject, List<string> files)
 {
     try
     {
         serverObject.startSecondAnalysis(files);
     }
     catch (Exception)
     {
         Console.Write("\n\n The service object is null. Please check the input");
     }
 }
Esempio n. 29
0
 /// <summary>
 /// This method is used to get the response from a server
 /// Once the client is connected to the server, we get
 /// a test message from the server to check whether connection
 /// was successful or not. The message are received using the service object which is
 /// derived from the WCF interface classs IBasicService.
 /// </summary>
 /// <param name="serviceObject"></param>
 /// <returns></returns>
 public string GetMessage(IBasicService serviceObject)
 {
     try
     {
         return serviceObject.getMessage();
     }
     catch (Exception)
     {
         Console.Write("\n\n The service object is null. Please check the input");
         return "";
     }
 }
Esempio n. 30
0
 /// <summary>
 /// This method is used to get the list of files from the server test
 /// folder. Initially all the files of the server are present in a 
 /// test folder which is not known to the client. When the client connects
 /// to the server, client uses this method to get the list of files 
 /// present in the server. Now user can select any file in this set for 
 /// which analysis will be performed. 
 /// </summary>
 /// <param name="serviceObject">The service object through which the 
 /// request is sent to the server</param>
 /// <param name="path">This indicates the path from which the files 
 /// have to fetched. This path is initially selected in the server.
 /// Once the path is set in the server, the client gets the path 
 /// of the server test folder and then uses it to get the full file list</param>
 /// <param name="recurse">This option is used to specify whether the files which
 /// are present in subdirectories of the server test folder needs to fetched.</param>
 /// <returns></returns>
 public List<ProjectTree> GetFilesList(IBasicService serviceObject, string path, bool recurse)
 {
     try
     {
         return serviceObject.getFilesList(path, recurse);
     }
     catch (Exception)
     {
         Console.Write("\n\n The service object is null. Please check the input");
         return null;
     }
 }
Esempio n. 31
0
 /// <summary>
 /// This is used to the repository of the servers. Client needs the reporitory
 /// of each of the server to create the merged type table. Every time when the
 /// server is done with the analysis, the client needs to get the updated 
 /// repository from the server. 
 /// </summary>
 /// <param name="serviceObject">The server object in which the repo is present</param>
 /// <returns></returns>
 public Repository GetRepo(IBasicService serviceObject)
 {
     try
     {
         return serviceObject.getRepo();
     }
     catch (Exception)
     {
         Console.Write("\n\n The service object is null. Please check the input");
         return null;
     }
 }
        private void BindOrgList()
        {
            IBasicService service = ServiceFactory.GetService <IBasicService>();

            this.Paging.CurrentPageIndex = this.objANP.CurrentPageIndex;
            this.Paging.PageSize         = this.objANP.PageSize;

            this.gvList.DataSource = service.GetList_Organization(0, this.OrgNumber, this.OrgName, this.OrgParentId.ToInt(0), this.Paging);
            this.gvList.DataBind();

            this.objANP.RecordCount = this.Paging.RowCount.Value;
        }
Esempio n. 33
0
 /// <summary>
 /// The client uses this method to send the list of files for which analysis 
 /// has to be performed. Initally the client gets the list of all the files
 /// present in the test folder of the server. User can then select individual 
 /// files from this list. The analysis will be performed only for these selected
 /// files. So this method sends the final files list from which analysis needs to
 /// be performed.
 /// </summary>
 /// <param name="serviceObject">The service object through which filelist is 
 /// sent to the server from the client</param>
 /// <param name="files">List of files for which analysis needs to be performed.</param>
 /// <param name="serverName">Name of the server in which analysis has to be done.
 /// Since there are multiple servers, they are identified using the servername</param>
 /// <returns>Returns the analysis result which is sent by the server.</returns>
 public List<Elem> SetFilesList(IBasicService serviceObject, List<string> files, string serverName)
 {
     try
     {
         List<Elem> table = serviceObject.setFilesList(files, serverName);
         return table;
     }
     catch (Exception)
     {
         Console.Write("\n\n The service object is null. Please check the input");
         return null;
     }
 }
Esempio n. 34
0
            public Dependent2(IBasicService basicService1, IBasicService basicService2)
            {
                if (basicService1 == null)
                {
                    throw new ArgumentNullException(nameof(basicService1));
                }
                if (basicService2 == null)
                {
                    throw new ArgumentNullException(nameof(basicService2));
                }

                _basicService1 = basicService1;
                _basicService2 = basicService2;
            }
Esempio n. 35
0
 /// <summary>
 /// sends a message to the server connected at the svc channel
 /// </summary>
 /// <param name="svc">The IBasicService contract of the connected server</param>
 /// <param name="msg">The message to be sent to the server</param>
 public void SendMessage(IBasicService svc, string msg)
 {
     svc.sendMessage(msg);
 }
Esempio n. 36
0
 /// <summary>
 /// Gets the message from the server
 /// </summary>
 /// <param name="svc">The IBasicService contract of the connected server</param>
 /// <returns>the message sent from the server</returns>
 public string GetMessage(IBasicService svc)
 {
     return svc.getMessage();
 }
Esempio n. 37
0
		public ImportAllTypes(IBasicService basicService)
		{
			Assert.NotNull(basicService);
		}
Esempio n. 38
0
 /// <summary>
 /// Client sends the merged type table to the server
 /// </summary>
 /// <param name="svc">The IBasicService contract of the connected server</param>
 /// <param name="typeTableMerged">The merged type table to be sent to the server</param>
 public void SendMergedTypeTable(IBasicService svc, List<Elem> typeTableMerged)
 {
     svc.sendMergedTypeTable(typeTableMerged);
 }
Esempio n. 39
0
		public void ImportMethod(IBasicService basicService)
		{
			BasicService = basicService;
		}
Esempio n. 40
0
 /// <summary>
 /// Empties the repos
 /// </summary>
 /// <param name="svc">The IBasicService object whose repo has to be set to empty</param>
 public void SetRepo(IBasicService svc)
 {
     svc.setRepo();
 }
Esempio n. 41
0
 /// <summary>
 /// Sets the list of files selected by the user and sends it to the server
 /// The server returns the analyzed files back to the client
 /// </summary>
 /// <param name="svc">The IBasicService contract of the connected server</param>
 /// <param name="files">The list of files selected by the user</param>
 /// <param name="serverName">The name of the server</param>
 /// <returns>The List of analyzed files</returns>
 public List<Elem> SetFilesList(IBasicService svc, List<string> files, string serverName)
 {
     List<Elem> table = svc.setFilesList(files, serverName);
     return table;
 }
Esempio n. 42
0
 /// <summary>
 /// Gets the list of files under the server under the path given by the user
 /// </summary>
 /// <param name="svc">The IBasicService contract of the connected server</param>
 /// <param name="path">the path to be searched for in the server</param>
 /// <returns>The list of files in the server under the specified path</returns>
 public List<ProjectTree> GetFilesList(IBasicService svc, string path, bool recurse)
 {
     return svc.getFilesList(path, recurse);
 }
Esempio n. 43
0
		public BasicServiceWrapper(IBasicService basicService)
		{
			BasicService = basicService;
		}
Esempio n. 44
0
 /// <summary>
 /// Call to start the Pass 2 of the analysis from the server
 /// </summary>
 /// <param name="svc">The IBasicService contract of the connected server</param>
 /// <param name="files">THe list of files selected by the user</param>
 public void GetAnalyzedData(IBasicService svc, List<string> files)
 {
     svc.getAnalyzedData(files);
 }
Esempio n. 45
0
 public void create_proxy()
 {
     _proxy = new BasicServiceProxy();
 }
Esempio n. 46
0
		public ConstructorImportService(IBasicService basicService)
		{
			BasicService = basicService;
		}
Esempio n. 47
0
		public MultipleConstructor(IBasicService basicService)
		{
			BasicService = basicService;
		}
Esempio n. 48
0
 /// <summary>
 /// creates a connection to server2 if not already connected by fetching the port number seleted by the user
 /// </summary>
 void getConnection2()
 {
     if (ConnectButton2.IsEnabled)
     {
         server2Port = RemotePortTextBox2.Text;
         endPoint2 = RemoteAddressTextBox2.Text;
         string endpoint = endPoint2 + ":" + server2Port + "/IBasicService";
         try
         {
             if (client == null)
                 client = new ProgClient();
             svcServer2Channel = client.CreateSendChannel(endpoint);
         }
         catch (Exception ex)
         {
             showErrorWindow(ex.Message, server2Port);
         }
     }
 }
Esempio n. 49
0
		public MultipleConstructor(IBasicService basicService, ISimpleObject simpleObject)
		{
			BasicService = basicService;

			SimpleObject = simpleObject;
		}
Esempio n. 50
0
		public ImportConstructor(IBasicService basicService)
		{
			BasicService = basicService;
		}
Esempio n. 51
0
 /// <summary>
 /// Gets the analyzed data after pass 2 of the analysis from the server
 /// </summary>
 /// <param name="svc">The IBasicService contract of the connected server</param>
 /// <returns>The analyzed data from the server</returns>
 public Repository GetRepo(IBasicService svc)
 {
     return svc.getRepo();
 }
		public MultipleConstructorImport(IBasicService basicService, IConstructorImportService constructorImportService)
		{
			BasicService = basicService;

			ConstructorImportService = constructorImportService;
		}