i have a requirement that i need to download xml file from ftp and store it in a local folder and i have to read the xml and store it in my database. So i need to read the xml file and insert into database as bulk way. not instant insert. so which would the best way?
In bus reservation mutiple end-user are requested for single seat at a time. How we can handle the multiple user request. how we can reserved the seat for one requester and how to handle the other requests for that seat.
I was wondering if setting a default value for a SelectList is considered to be presentation logic or business logic? For example, if a requirement is that an Employee cannot be saved without a Location, but 99% of the time the location that would be selected is a particular item -- say Atlanta. Because of this, the location SelectList should be defaulted to Atlanta when ever a entry screen for a new employee is displayed. Should I be defaulting the location in the model or in the view-model? One thing I realized is that the unit tests become awkward because in both cases, I'd be forced to test against a location that will always be present in production but I cannot create a unit test with my own test dataunless "Atlanta" was in the set of locations being used in the test.
I know this is probably a pretty easy thing to do and it is if I can upload the file and store it onto the hard drive of the server. What I need to do is read the text file into memory and then parse through it one line at a time. Anyone have any code that demonstrates that?
but when I tried to add the service reference to the silverlight app, the Add Service Reference window would show me that there was a service file, but the node wouldn't expand to show the rest of the files that contain the services and what not. I got this error instead:
"An error occurred during the processing of a configuration file required to service this request. review the specific error details below and modify your configuration file appropriately."
"Parser Error Message:There is no service behavior named 'AdventureWorks_WebServer.Service1Behavior'."
"Metadata contains a reference that cannot be resolved: 'http://localhost:55579/Service1.svc'.
The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
If the service is defined in the current solution, try building the solution and adding the service reference again."
I've got a C# MVC 2 application using EF 4. My DAL project gets data from the Model, translates them into POCO's and returns ViewModels to the BLL which is called from the controllers.I've set up validation attributes on the POCO classes and that works for "Required" fields etc. I would like to add business logic such as "From" has to be before the "To" date. Can this be done on the POCO classes so it is automatically validated client-side in the view?
Also, I would like to add some functionality to the BLL layer such as checking if a resource is already booked between the From and To dates to avoid double bookings. This should fire before the ViewModel is saved. I tried a Try/Catch statement in the controller so that I can throw an error in the BLL, but I don't understand how to return this error to the view with an appropriate error message added.
I need to assign channel for each schedule. There can be as many concurrent events as number of channels allocated for the customer. I.e if the customer is allocated 3 channels then he can have 3 concurrent events. If a channel was allocated to a event then the same channel cannot to allocated to another event that falls under same time but the same channel can be allocate to another event if the time differs.
Does anybody know how to implement this new feature of the MVC 2 RC?
Here is verbatim what ASP.NET MVC 2 Release Candidate Release Notes says:
"...Buttons in a form can specify that they do not cause validation logic to run. The default is that every button in a form causes validation logic to run, and if validation fails, the validation logic blocks submission of the form. Enabling validation selectively for buttons lets you create forms .
have gone through many post but unable to identify how IsPostback peroperty of page works.HTTP is a stateless protocol so how server identify that a client is making request 2nd time not 1st time and set the value for IsPostBack Peoprty.
As I am learning and working on Asp.Net MVC application, I want to know that what is the better place to write Business Logic and Data Access logic in MVC.Where should I write DataAccess and Business Logic among three layers (Model, View and Controller) ??Could anybody please tell me the correct way to write the code for this.Scenario: I want to retrieve all the employees where employee name like 'Mi%' ( I have SQL procedure to execute and retrieve the data.)PS: Want to know that where I should create instance of Business Logic class and where I should create instance of Data Access layers class?
Trying to figure out the best way to organize a ASP.NET MVC site. Take a very simple 1..N relationship: Company can have many Contacts, Contacts must have exactly one Company.I have your typical routes:
Company/Index (list all companies) Company/Details/{int} (details of Company {int}) Company/Create (create new company) Contact/Index (list all contacts) Contact/Create (create new contact, company is selected from drop down)
Now if I wanted to create a page that created a Contact in the context of a Company (from the Company detail page) so that the required company is filled in/not editable), what would be the best route of going about that, while not duplicating code where possible.Not sure if I can leverage the Contact/Create logic/view from the Company controller (and be able to route back to the Company Details page when complete), or mess with the routes to do something like Company/Details/{int}/Contact/Create (not even sure if that makes sense or would work)?There has got to be a better way then me adding my logic and view for adding a Contact into my Controller view and having it duplicated.
I'm building a first MVC app in ASP.NET and I'm using link2SQL model to work with data.All tutorials on the microsoft site let you write LINQ code in the controller to get data and pass it to the view, like this:
Function Index() As ActionResult Dim datacontext As New ErrorVaultDataContext Dim questions = From q In datacontext.Questions
I have to maintain an ASP.net application in VB.Net. There is a page with a FormView bound to a ObjectDataSource. I have to add some business logic on the ItemUpdating event of this FormView. Unfortunately, some the data that I need to add this business logic is not exposed on the FormView user-interface itself, so I can not use FindControl to get the values (I could add the controls, bind them to the fields I need and set their visible property to true, but that's ugly).
So, what I would need to do is to get access to the Data Row corresponding to the currently selected item in the FormView from the code behind as it has the data I need to add my business logic code. Unfortunately, I don't manage to get access to the row.
I'm binding my DataRepeater control to a table that has many columns. I'd like to only display a subset of those, depending on what is populated.How/where should I do my contitional tests within a dataRepeater? This is the code within my itemtemplate:
Im having to update a class that was being used for security validation thru our active directory. i found where i need to add the new security groups allowed to use the application, but everyone within the new groups are not allowed access. I found this bit of code that seems to be trimming the groups name, so could be reason why the new groups dnt work, since they arent named the same as the others. what they were doing so i can update it.
I have an ASP.NET web site (blog based on blogengine.net). I want to perform an integration with Twitter. I need some logic, that constantly checks, whether I have posted a new twits, and if I did, will create an identical blog post on my site. This requires a checker object in a separate thread constantly active. Where should I place the instantiation of my classes, so that they are active whenever the ASP.NET web site is working in IIS? Where do I link the logic to my web application?
Here is an interesting problem... I have configured wildcard domains on my production site and will be using it as a customer identifier. This allows me to display the right banner/css/logos for each customer simply be pulling out the wildcard prefix (eg. CompanyABC.website.com will be displayed the logos and branding related to CompanyABC).
But how do I test this on my local Visual Studio 2010 installation? In production the site loads COMPANY.website.com etc., but locally I can only use the flat http://localhost address.
I am just a student so sorry if I sound amateurish. I am doing developemnt for a web application that uses LINQ to SQL (even though apparently its going to be depreciated soon) and this query always returns 0 results. I have lots of experience with LINQ to SQL and have applied it to the entirety of a huge site; this one query isn't working right though.
[Code]....
so I emailed myself stuff for debugging and sure enough, the parse to datetime and accesssing year worked fine, it grabbed 2010 from the db, month and day as correctly in the DB.the querystrings were in the URL and i verified that they are the values from which there would be many results
Suppose you have to query a lot of tables and calculate some values and spit it out to the user. Is it ok to have all the business logic for this in the stored procedures? Or is it a better practice to return all the data to the application and do all the data manipulation and rolling up in there?
I'am using enterprise library data access block in my asp.net application. I want to implement transaction from the Business logic layer, across multiple stored procs. Entlib opens a new connection for database access. Does using Transaction Scope in the following way lead to distributed transaction?
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { // calling necessary DAL methods scope.Complete(); }
Is there better methods to implement transaction from BLL?
public int InsertCompanyDetailsInformation(int companyId, int bankId, int accountNo, string accountType) { int rowsAffected = -1; int returnValue; try { SqlConnection con = DBProvider.GetDbConnection(); using (con) { con.Open(); SqlCommand objCmd = new SqlCommand("dbo.sp_InsertCompanyDetailsInformation", con); objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@companyId", companyId); objCmd.Parameters.AddWithValue("@bankId", bankId); objCmd.Parameters.AddWithValue("@accountNo", accountNo); objCmd.Parameters.AddWithValue("@accountType", accountType); rowsAffected = objCmd.ExecuteNonQuery(); SqlParameter sqlParam = objCmd.Parameters.Add("@insert_flag", SqlDbType.Int); objCmd.Parameters["@insert_flag"].Direction = ParameterDirection.ReturnValue; returnValue = int.Parse(objCmd.Parameters["@insert_flag"].Value.ToString()); con.Close(); } } catch (Exception ex) { throw ex; } return rowsAffected; } and stored procedure USE [SGTime_Development] GO /****** Object: StoredProcedure [dbo].[sp_InsertCompanyDetailsInformation] Script Date: 01/04/2011 14:31:09 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[sp_InsertCompanyDetailsInformation] ( @companyId int, @bankId int, @accountNo int, @accountType varchar(50)) AS BEGIN SET NOCOUNT ON; declare @insert_flag int; if not exists(select AccountNo from [Company_Account_Details] where AccountNo=@accountNo) begin INSERT INTO [Company_Account_Details] ( Company_Id, BankID, AccountNo, AccountType) values (@companyId, @bankId, @accountNo, @accountType) set @insert_flag=1; END else begin set @insert_flag=-1; end return @insert_flag; end
I am getting error in the code i want return returnValue in InsertCompanyDetailsInformation. how we can return returnValue