We have a legacy software which was built in MS-Access (UI) but was using Sqlserver 2005 as database server.
The UI in Ms-Access has got Menus with different menu-items. But some of the menu-items doesn't have screens yet (incomplete). So we decided now to move to .net environment (i.e. .net web application). Here is my main question.
Firstly I want start working on the screens in .net (.net web application) which are incomplete for the menu-items in MS-Access. Secondly I will be completing the other screens which are now working in MS-Access UI. So how can I use/call .net web application screens when ever user clicks on menu-items in MS-Access UI.
Please suggest me.
Thanks
It not really practical to integrate screens built in Access with some web based forms. I not sure why or who or what was suggested to you that such an approach is EVER used in our industry.
You can most certainly launch any web form or web site or launch any URL form the Access client running on your desktop. The code to launch that URL is:
Application.FollowHyperlink "path to web form or site goes here"
So you can place a button or menu in an Access form to launch a web form, or even launch eBay if you want. However I do not think the issue (or solution) is the ability to launch some web form, but is having parts of the application talk to each other.
An application becomes useful since all the application parts can tightly talk to each other. Access is a great RAD tool due to great ease as to one form launching a report or another form and passing information. And all of that application can EASY share common code and routines that allows you to accomplish useful business tasks.
So when you click on a detail row in an Access grid of data (continues form), then launching another form to edit the one record takes one line of code. So an application is never really just a single standalone form to edit data, but the talking between the forms and use of code and how those objects dance together is what really makes an application useful. If an application was just forms with no code then I think we would be all out of job in this industry.
The model of how you navigate and build web applications is rather different then how Access works. I mean if you have 5 browsers open, which browser has some form to edit your data and which browser is watching videos on YouTube?
You really cannot approach such a half-baked system in which some forms are in Access and parts of the application are web, based. The only way this is practical is if the web forms do not need to work with or use any of the code in the client forms.
However, you CAN build web forms in Access 2010. In other words, in the Access client you can build both client forms and web forms. The client forms can call and use web forms (they run in the client) as regular forms and things like where clauses etc. will work). When you publish to the web, then ONLY the web forms run. Here is a video of an access application of mine, and note how at the half way point I run the same forms in a web browser:
http://www.youtube.com/watch?v=AU4mH0jPntI
However, the above ability in Access right now cannot work with sql server, and must use SharePoint (or the upcoming office 365).
So no question the concept of moving bits and parts out of an application to being web based makes sense (so your concept of not moving ALL of the applicaton out to the web makes sense). However, the parts being moved out to the web must make sense as web or stand alone and not require integration with the client forms (at least during use).
In other words if you have a legacy payroll system in Access now, but want employees to enter their payroll hours, then that new web part is separate from the payroll system. And no question the payroll system could take and pull hours from the new employee hour entry system that is web based.
However, the idea that menus and parts of the client based application will seamlessly launch and use the web browser parts makes no sense at all . Again this makes zero sense and you are barking up the wrong tree here. As noted, if the web part is really a separate business process, then there are some possibilities here.
Last but not least, you can certainly build a set of web services (application business code and logic that is separate from the UI) on the .net web site. This separate business layer could then be used by both the Access client forms and the web forms. However, once again such a setup likely suggests that you better off to build the application as web based anyway as the web based forms can talk and use the business code with greater ease then the client forms can – only exception here again is if you using Access web services, then both web or client forms can use the stored procedures and business routines you write to run server side.
Last but not least, perhaps your problem(s) are solved by increased connectivity, and not really the need for web based? I address this question in the following article of mine.
http://www.kallal.ca/Toweb/Index.html
Related
I'm new in programming with .Net and C# and, as said in the title, I have a WPF app which is accessible in a system tray icon and I want to run it a windows service.
Typically, I want an output like it was described in an answer provided in a discussion here.
If you want it in the system tray I think what you'll have to do is make it a Windows service. I've only written 1 Windows Service and that was years ago, but I believe that's what you'll have to do. If I'm correct about writing a Windows service, then what I would suggest you do is create a new Visual Studio solution and add two projects to it. One would be a DLL which would run as a Windows service. The second project would be a WPF project that will be your UI the user interacts with. Then you'll have to use some messaging system to communicate between the two. For the action messages that would mimic what Outlook does, I've used some WPF toast messages to accomplish that. If you Bing/Google "WPF toast popup" you'll get lots of results.
I have many searched in Internet and find some helpful answers like:
URL1
You can't, not directly, because the windows service will necessarily start when the machine does, not when a user logs in. The service will also be running in a different context, likely as a different user. What you can do is to write a separate system tray based "controller" that interacts with the service.
URL2
It needs some effort to achieve. Well, just two hints: 1) use static property System.Environment.UserInteractive to detect in which mode your application is running, see http://msdn.microsoft.com/en-us/library/system.environment.userinteractive.aspx; 2) get rid of app.xaml, because it will force starting WPF Application in all cases; instead, create and run and instance of System.Windows.Application (or better, a specially derived class) explicitly and only for interactive mode, see http://msdn.microsoft.com/en-us/library/system.windows.application.aspx.
And, I could not apply their instructions.
Thanks advance!
There's an application written in C# that doesn't have any means of remote controlling. The only use scenario possible is to click the buttons with the mouse to get some result.
I'd like to create a server that would expose some common usage scenario with pre-defined clicking logic. So for example the application has a button "do thing" and I'm willing to make an HTTP (or other) server that would click it when a certain URL is loaded.
The application is intended to be used on Windows, though it should work fine with wine - my primary OS is Ubuntu, but I think that running the app in a VM is a better option. To program the rest of of the logic I can use java, python, ruby, php or node.js (I don't know C#).
What is the best approach to handle this? I would prefer not relying on click at the predefined X*Y position on the screen. Ideally the solution would also allow reading the data back.
You can easily automate the gui using the ui automation api. Check for example the White framework on codeplex
http://white.codeplex.com/
I am not sure however if yiu will be able to easily expose such automated application from an application server. The automation is not possible without explicit user session with visible desktop interface thus limiting your server processing to one active session at a time.
I wrote a client/server program using windows form application in visual studio. Now i want to put this program onto a web page, so on the client side they can just go onto any browser and and access the server.
Can i just embed the program i already hav onto a webpage or do i need to rewrite it using visual studio web application or maybe web services?? If so, will it be any different than a regular windows form application?
Sorry, you'll have to rewrite it. Your windows forms application runs on the client, but you want to run it through the browser, where it would have to run on the server.
If you've followed good design principles, the core functionality of your app will not be in the forms, but in classes (hopefully in a class library) that are not specifically tied to the UI. If that is the case, you'll just need to create a web front end (UI), and you can reuse the existing C# classes.
If, however, like many inexperienced developers, you've coupled the underlying logic tightly to the UI - a good example is putting code in the form's .cs file that's not really UI-centric - you're looking at a lot of refactoring, and THEN writing a web front end.
Perhaps you should have a look at ClickOnce deployment. I believe you can utilize it to download the WinForm app from a website.
Let me rephrase the question...
Here's the scenario: As an insurance agent you are constantly working with multiple insurance websites. For each website I need to login and pull up a client. I am looking to automate this process.
I currently have a solution built for iMacros but that requires a download/installation.
I'm looking for a solution using the .NET framework that will allow the user to provide their login credentials and information about a client and I will be able to automate this process for them.
This will involve knowledge of each specific website which is fine, I will have all of that information.
I would like for this process to be able to happen in the background and then launch the website to the user once the action is performed.
You could try the following tools:
StoryTestIQ
Selenium
Watir
Windmill Testing Framework
Visual Studio Web Tests
They are automated testing tools/frameworks that allow you to write automated tests from a UI perspective and verify the results.
Use Watin. It's an open source .NET library to automate IE and Firefox. It's a lot easier than manipulating raw HTTP requests or hacking the WebBrowser control to do what you want, and you can run it from a console app or service, since you mentioned this wouldn't be a WinForms app.
You can also make the browser window invisible if needed, since you mentioned only showing this to the user at a certain point.
I've done this in the past using the WebBrowser control inside a winforms app that i execute on the server. The WebBrowser control will allow you to access the html elements on the page, input information, click buttons/links, etc. It should allow you to accomplish your goal.
There are ways to do this without the WebBrowser control, look at the HTML Agility Pack.
Assuming that you are talking about filling and submitting a form or forms using a bot of some sort then scraping the response to display to the user.
Use HttpWebRequest(?) to create a form post containing the relevant form fields and data from your model and submit the request.
Retrieve and analyse the response, store any cookies as you will need to resubmit the cookie on the next request.
Formulate the next request based on the results of the first request ( remembering to attach cookies as necessary ) and submit it.
Retrieve the response and display or parse and display ( depending on what you are hoping to achieve ).
You say this is not a client app - therefore I will assume a web app. The downside of this is that once you start proxying requests for the user, you will have to always proxy those requests as there is no way for you to transfer any session cookies from the target site to the user and there is no ( simple / easy / logical ) way for the user to log in to the target site and then transfer the cookie to you.
Usually when trying to do this sort of integration, people will use some form of published API for interacting with the companies / systems in question as they are designed for the type of interactions that you are referring to.
It is not clear to me what difficulty you want to communicate when you wrote:
I currently have a solution built for
iMacros but that requires a
download/installation.
I think here lies some your requirements about which you are not explicit. You certainly need to "download/install" your .Net program on your client's machines. So, what's the difference?
Anyway, Crowbar seems promising:
Crowbar is a web scraping environment
based on the use of a server-side
headless mozilla-based browser.
Its purpose is to allow running
javascript scrapers against a DOM to
automate web sites scraping but
avoiding all the syntax normalization
issues.
For people not familiar with this terminology: "javascript scrapers" here means something like an iMacros' macro, used to extract information from a web site (in the end is a Javascript program, for what purpose you use it I do not think makes a difference).
Design
Crowbar is implemented as a (rather
simple, in fact) XULRunner application
that provides an HTTP RESTful web
service implemented in javascript
(basically turning a web browser into
a web server!) that you can use to
'remotely control' the browser.
I don't know if this headless browser can be extended with add-ons like a normal Firefox installation. In such case you can even think to use yours iMacros' macros (or use CoScripter) with appropriate packaging.
The more I think about this, more I feel that this is a convoluted solution for what you wrote you want to achieve. So, please, clarify.
i wish to interact with my browser window may be IE great if it works on Firefox too, using C#.
I want to make a software which can fill the entries in a webform automatically. In old times there was gator now is roboform, where it can fill in the values automatically.
I actually have users who are comfortable working on an old windows forms application, so i want to make a solution where they can still enter the data in their windows application and it actually fills in the entries at the web form and acts as if the request had generated from the browser itself.
I know i can merge both the databases, since it is a legacy application re writing the database for windows app is a trouble..
Any suggestion?
WatiN is designed to make testing web applications easy from .NET, and it sounds like it could be handy for what you want to do:
Following is the Hello world example
of web test automation; searching
Google.
[Test] public void
SearchForWatiNOnGoogle() { using (IE
ie = new IE("http://www.google.com"))
{
ie.TextField(Find.ByName("q")).TypeText("WatiN");
ie.Button(Find.ByName("btnG")).Click();
Assert.IsTrue(ie.ContainsText("WatiN"));
} }
WatiN Feature List
Automates all major HTML elements
Find elements by multiple attributes
Supports AJAX website testing
Supports frames (cross domain) and iframes
Supports popup dialogs like alert, confirm, login etc..
Supports HTML dialogs (modal and modeless)
Works with Internet Explorer 6, 7, 8 and FireFox 2 and 3
It's billed as a testing application, but Selenium RC can be used to fill in forms and is fairly easy to setup. You could also check out WatiN. Don't know anything about what security issues you might see though.
You might also want to check out Selenium which is a web application testing framework that you can programmitically interact the web UI.
If you use fiddler you may be able to see what the browser sends back to the server, and so you could write C# code to generate the same kind of HTTP request.
If the interaction is very complex (it often is with modern webapps), you could instead automate the browser, as you suggested.
I've had some success automating IE by using the InternetExplorer.Application object. It basically launches a copy of IE and lets you control it from code. I wrote a script this way a few years ago to search for cheap train ticket reservations for me on the Virgin Trains website.
The problem was that with some IE installs, it would sometimes stop to give security warnings that I couldn't skip automatically. There didn't seem to be a pattern to this.
If your users are simply using the application via a WindForms application, then is there any particular reason why you have to manipulate the user interface of an existing web browser, such as Internet Explorer, rather than just making the necessary HTTP requests yourself in your WinForms application? You can use the WebRequest class by setting the Method property to "POST" and writing the field data to the Stream, which you can get using the httpRequest.GetRequestStream() method.