Asp.net - Achieving The Below Logic In C#?
Apr 4, 2011
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.
View 4 Replies
Similar Messages:
Jun 18, 2010
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.
View 4 Replies
Oct 12, 2010
Im developing an admin section for a cms tool and in previous tools i used a master page, which then had a page called verified.aspx. this contained a menu control and then dependant on which menu item they selected loaded a user control into a multiview controlThis works fine accept for some small annoying post back issues (not refreshing data and also the time taken to load the large amount of controls)
I have a master page with 2 content placeholders. Im my verified page (which uses the master), i have a nav menu on the left. Dependant on the item selected fro the nav menu on the left, id like to poplute the content placeholders content with an aspx page (which contains a user control) or just an apsx page
ive seen a couple of articles suggesting iframe, and a couple suggesting nested master pages but i dont believe i can get this to work with nester masters,
View 3 Replies
Nov 21, 2010
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.
View 2 Replies
Apr 21, 2010
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?
View 9 Replies
Jan 7, 2010
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 .
View 4 Replies
Jan 3, 2011
i cannot understand logic of mvc edit.for example
StudentReposirory students= new StudentReposirory();
// GET: /Student/Edit/5
public ActionResult Edit(int id)
[code]...
View 8 Replies
Aug 16, 2010
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.
View 2 Replies
Apr 16, 2010
i want the logic for rating.
View 1 Replies
Sep 9, 2010
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?
View 3 Replies
Feb 9, 2011
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.
View 1 Replies
Sep 16, 2010
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
[code]...
View 3 Replies
Oct 16, 2010
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.
View 2 Replies
Aug 12, 2010
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:
View 1 Replies
Jan 13, 2010
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.
[Code]....
View 2 Replies
Mar 24, 2011
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?
View 1 Replies
Nov 28, 2010
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.
View 3 Replies
Jan 28, 2011
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
View 5 Replies
Mar 8, 2011
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?
View 6 Replies
May 8, 2010
Is there a way that a hacker or someone who wants to copy my software logic, can reverse engineer the business logic that I have in a webservice?
Is there a way to protect such information?
My development platform in .net asp.net and C#
View 3 Replies
May 5, 2010
what's is better?That I put my business logic in the sqls(DataStore) or in the C#.DataSore:
[Code]....
What's faster and better?
View 4 Replies
Jan 17, 2011
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?
View 1 Replies
Jan 4, 2011
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
View 4 Replies
Apr 6, 2010
I'm using DataAnnotations as well as server-side validation logic.
Is there a way to show DataAnnotation's client-side validation errors in the ValidationSummary, as it shows when returning from server validation?
I know I can use ValidateMessage and ValidateMessageFor next to elements, but the spacial design of the form I'm working with doesn't allow for anything other than highlighting the HTML element, however, I would still like to have a message saying what's wrong.
If I place ValidateFor's alongside ValidationSummary in order to mimic a ValidationSummary during client-side validation, they both appear when returning from a failed server side validation.
View 4 Replies
Nov 3, 2010
I have bunch pages and I need to validate data there. If culture for example "es-ES" I should use one validation logic, if culture "en-US" than another validation logic. For example I need validate phone number. Minimum length is 11 digits. For other culture 9 digits.
View 3 Replies