A Timer Job is a periodically executed task inside SharePoint Server. It provides us a task execution environment. for more information please click on this link Custom Timer Jobs in SharePoint 2013
Friday, 31 October 2014
Saturday, 25 October 2014
What are the different types of filters, in an asp.net mvc application?
- Authorization filters
- Action filters
- Result filters
- Exception filters
What is the page lifecycle of an ASP.NET MVC?
The page lifecycle of ASP.NET MVC is having the following process and it is as follows:
1. App initialization
2. Routing
3. Instantiate and execute controller
4. Locate and invoke controller action
5. Instantiate and render view
What is Repository Pattern in ASP.NET MVC?
The repository and unit of work patterns are intended to create an abstraction layer between the data access layer.
and the business logic layer of an application. Implementing these patterns can help insulate your application from changes in the data store and can facilitate automated unit testing or test-driven development (TDD).
and the business logic layer of an application. Implementing these patterns can help insulate your application from changes in the data store and can facilitate automated unit testing or test-driven development (TDD).
- Repository pattern is used as a default entity operation that allow the decoupling of the components used for presentation.
- Repository pattern allows easy testing in the form of unit testing and mocking.
- Repository pattern will have the proper infrastructure services to be used in the web applications.
What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. Having Clause is basically used only with the GROUP BY function in a query whereas WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
Differentiate between an Abstract Class and an Interface.
Abstract Class:
A class can extend only one abstract class
The members of abstract class can be private as well as protected.
Abstract classes should have subclasses
Any class can extend an abstract class.
Methods in abstract class can be abstract as well as concrete.
There can be a constructor for abstract class.
The class extending the abstract class may or may not implement any of its method.
An abstract class can implement methods.
Interface :
A class can implement several interfaces
An interface can only have public members.
Interfaces must have implementations by classes
Only an interface can extend another interface.
All methods in an interface should be abstract
Interface does not have constructor.
All methods of interface need to be implemented by a class implementing that interface.
Interfaces cannot contain body of any of its method.
Wednesday, 15 October 2014
What is the use of RunWithElevatedPrivileges in Sharepoint
There are certain object model calls model that
require site-administration privileges. To bypass access-denied error, we use
RunWithElevatedPrivileges property when request is initiated by a Nonprivileged
user. We can successfully make calls into the object model by calling the
RunWithElevatedPrivileges method provided by the SPSecurity class.
Wednesday, 13 August 2014
K2 back pearl important Assemblies and Descriptions
Tuesday, 5 August 2014
SmartObject
Transaction Support in Service Instances
All Service instances are
instantiated and executed as part of a Transaction Scope in the
SmartObjectBroker. The transaction option as specified on the SmartObject
method determines the TransactionScopeOption.
We have three options:
- Continue: TransactionScopeOption = Suppressed - No transaction, all services (execution blocks) will execute even if one or more fail.
- Stop: TransactionScopeOption = Suppressed – No transaction, execution will halt immediately after first service execution fails.
- Rollback: TransactionScopeOption = Required – A root transaction is created and will be the relating transaction for all participating services to obtain in.
The concept of Transaction Scope and ambient
transactions is clearly explained in the following article
Saturday, 2 August 2014
Introduction to ASP.NET vNext
ASP.NET MVC which will be version 6 and is code named vNext.
Here are the
main features summarized:
- Optimized for Cloud
and on premise servers.
- ASP.NET MVC and Web
API have been merged into a single programming model.
- New JSON based
project structure.
- No need to
recompile for every change. Just hit save and refresh the browser.
Compilation done with the new Roslyn real-time compiler.
- Dependency
injection out of the box.
- Side by side
deployment of the runtime and framework with your application.
- Everything packaged
with NuGet, Including the .NET runtime itself.
- vNext is Open
Source via the .NET Foundation and is taking public contributions.
- vNext (and Rosyln) also runs on Mono, on both Mac and Linux today.
I especially like the fact that WebAPI is
being merged with MVC as this will make a much easier and cleaner framework to
use for full stack development. Rest based API’s are now pretty much the
in-thing when it comes to programming your back-end, so it is good to see that
Microsoft are making things easier.
You can get more information from the official Microsoft vNext site.
How to fix your asp.net site to be responsive on windows phone
There is a
well-known bug on Internet Explorer 10 for Windows Phone 8 that
avoids responsive web sites to display correctly.
The cause is
that Internet Explorer 10 doesn't differentiate device width from viewport
width, and thus doesn't properly apply the media queries in your favorite
responsive CSS framework (for example Twitter Bootstrap ).
Be careful
that if you're testing the web site using mobile emulators, may be you'll not
be able to experiment the bug. You have to use a real Windows Phone (e.g. Nokia
Lumina).
To fix it on
the client side you have to add CSS and JavaScript declarations
in all your pages, but if you are using ASP.NET, you can add the following
lines of code in your master page and the whole web site will be fixed.
public
partial class SiteMaster : MasterPage
{
public void FixWinPhoneIE10Responsiveness(Page page)
{
// Build the base style declaration
var style = new StringBuilder(
"<style type=\"text/css\">" +
"@-moz-viewport{width:device-width}" +
"@-ms-viewport{width:device-width}" +
"@-o-viewport{width:device-width}" +
"@viewport{width:device-width}");
// If the request comes from IE10 on Windows Phone add an additional declaration
var browserCapabilities = page.Request.Browser;
if (String.Compare(browserCapabilities.Browser, "IEMobile",
StringComparison.OrdinalIgnoreCase) == 0 &&
browserCapabilities.MajorVersion == 10 &&
browserCapabilities.MinorVersionString == "0")
style.Append("@-ms-viewport{width:auto!important}");
style.Append("</style>");
// Add the style declaration in the page head section
var placeholder = new Literal {Text = style.ToString()};
page.Header.Controls.Add(placeholder);
}
protected void Page_Load(object sender, EventArgs e)
{
FixWinPhoneIE10Responsiveness(Page);
}
}
{
public void FixWinPhoneIE10Responsiveness(Page page)
{
// Build the base style declaration
var style = new StringBuilder(
"<style type=\"text/css\">" +
"@-moz-viewport{width:device-width}" +
"@-ms-viewport{width:device-width}" +
"@-o-viewport{width:device-width}" +
"@viewport{width:device-width}");
// If the request comes from IE10 on Windows Phone add an additional declaration
var browserCapabilities = page.Request.Browser;
if (String.Compare(browserCapabilities.Browser, "IEMobile",
StringComparison.OrdinalIgnoreCase) == 0 &&
browserCapabilities.MajorVersion == 10 &&
browserCapabilities.MinorVersionString == "0")
style.Append("@-ms-viewport{width:auto!important}");
style.Append("</style>");
// Add the style declaration in the page head section
var placeholder = new Literal {Text = style.ToString()};
page.Header.Controls.Add(placeholder);
}
protected void Page_Load(object sender, EventArgs e)
{
FixWinPhoneIE10Responsiveness(Page);
}
}
What is AngularJS?
AngularJS is a JavaScript framework that is used for making rich, extensible web applications. It runs on plain JavaScript and HTML, so you don't need any other dependencies to make it work, and it is CSS-agnostic so you can use whatever CSS framework/methodology you want when designing your Angular application.
click on this link for more information. Getting Started
Getting Started with ASP.NET MVC 5
This tutorial will teach you the basics of building
an ASP.NET MVC 5 Web application using Visual Studio 2013. Getting Started with ASP.NET MVC 5
Saturday, 19 July 2014
Asp.net MVC Features from Asp.net MVC 2.0 to Asp.net MVC 5
The below image shows the quick information regarding the features from asp.net mvc 2.0 to Asp.net mvc 5.
![]() |
Thursday, 3 July 2014
K2 Rules and Logic – Business Rules and Logic
K2 Processes contains
Activities and Events. Rules are build around these to ensure that business
logic is applied. Activities are important components in a process
because they are points in the process where decisions are made, data delivery
takes place and actions go into effect. An activity within a process will
contain one or more events.
Business logic includes the
following concepts:
1. Who or what service is
involved
2. Are there prerequisites to be
met
For the above decisions to be
made rules logic is required to evaluate the conditions set out by the process,
activity and event and determine the course of action to take based on
what they are. The rules logic is facilitated by the Process, Activity and
Event Rules; they represent the means with which business logic is implemented
in the process. This section provides an overview of the Rules that are
available to create business logic for a process.
Rules
Process Start Rule:
The Process Start Rule is used
to create custom process Start rules using the Process Start
Rule wizard.
Process Finish Rule:
The Process Finish Rule is used
to create custom process Finish rules using the Process Finish
Rule wizard.
Exception Rule:
The Exception Rule provides exception
management within a process. Exceptions can be incorporated within the
process Start and Finish rules, or created for Line rules and Activities.
Preceding Rule:
The Preceding Rule is a logical
expression that evaluates a set of conditions. When evaluated to True, the
Activity is allowed to start.
Start Rule:
The Activity Start Rule is time based and
determines when the Activity can start.
Destination
Rule:
When the Activity requires human
interaction, a Destination User (Process Participant) is specified. The
destination User or User Groups is allocated permissions to Action the Activity.
Escalation Rule:
The time taken to Action the Activity can
be regulated using the Escalation rule. This rule will allocate a user
configurable time to Action the Activity before an Escalation comes into effect.
Line Rule:
The Line Rule is the logical navigation
system that determines the route within the process to follow as the process
executes.
Succeeding Rule:
The
Succeeding Rule is a logical expression that when evaluated to true, allows the
Activity to complete.
The following diagram shows the
components that can be used with a K2 Process
Sunday, 15 June 2014
K2 Studio
K2 Studio
is a "codeless" design environment for creating blackpearl
applications. The K2 Designer presents similar tooling to the K2 Designer for
Visual Studio environment in a familiar format utilizing a context relevant
ribbon. Any projects created in this environment can be opened in K2 Designer
for SharePoint or K2 Designer for Visual Studio. The workflows created
within the K2 Studio enables integration with Microsoft Office, Microsoft
InfoPath and Microsoft SharePoint, along with a number of other third-party
software packages.
With the K2 Studio, developers simply drag and drop components
onto the process-design canvas. Windows Presentation Foundation-based wizards —
including wizards for integrating with technologies like SharePoint, sending
e-mail and displaying ASP.NET or Microsoft Office InfoPath 2007 forms — guide
the developer through configuration and automatically generate the underlying
definitions, Workflow Foundation schedules files, rules and activities.
Developers may use a K2-provided SDK to develop their own custom wizards.
Processes built in K2 are extensible.
Process debugging is available, allowing developers to access
executing processes.
Friday, 6 June 2014
K2 Fundamentals
K2 Fundamentals Video which demonstrates the overall view of the K2
blackpearl and what is K2 workflow and its features. Click on link k2 fundament video
K2 Server and Client Components
Server Components
Client Components
The K2
client components consist of the process designers that are installed on a
client machine. The K2 designers include environments for Visual Studio 2010
and K2 designer for SharePoint. Each of these environments provides a
connection to the server environment to expose information for use in building
applications, such as connection variables and business entity information. In
addition, the designers provide the ability to deploy new applications directly
to the server environment. Multiple environments can be setup to handle the
development lifecycle.
3-Tier Architecture in .NET
Introduction to 3-Tier Architecture in .NET
How to create
asp.net 3-tier architecture, I will explain and what the advantages and how to
create 3-tier architecture. Firstly what are the uses of 3-tier architecture.
Uses of 3-Tier Architecture
1. To
make application more understandable.
2. Easy
to maintain, easy to modify application and maintain architecture.
If we use this 3-Tier
application we can maintain our application in consistency
manner.
Basically 3-tier architecture contains 3
layers
1. Application
Layer / Presentation Layer.
2. Business
Access Layer (BAL) or Business Logic Layer (BLL).
3. Data
Access Layer (DAL).
Here I will explain each layer
with simple example that is User Registration
Application Layer or Presentation Layer
Presentation layer contains UI
part of our application i.e., our aspx pages or input is taken
from the user. This layer mainly used for User Interface purpose and get
or set the data back and forth. Here I have designed my registration aspx
page like this
This my
presentation layer for our project add new page to your project page and open
the page in design mode and drag and drop the control and rename the controls properly.
And double click on the Save button now in code behind we need to write
statements to insert data into database this entire process related to Business
Logic Layer and Data Access Layer.
Now we will discuss about
Business Access Layer or Business Logic Layer
Business Access Layer (BAL) or Business Logic Layer (BLL)
This layer contains our
business logic, calculations related thing with the data like insert data,
retrieve data and validating the data. This acts as an interface between
Application layer and Data Access Layer.
Now I will explain this business logic layer
with my sample
I have already finished form
design (Application Layer) now I need to insert user details into database if
user click on button save. Here user entering details like Username, password, First
Name, Last Name, Email, phone no, Location. I need to insert all these 7
parameters to database. Here we are placing all of our database actions into
data access layer (DAL) in this case we need to pass all these 7
parameters to data access layers.
In this scenario we will write
one function, we will pass these 7 parameters to function like this
String Username= InserDetails (string
Username, string Password, string Email, string Firstname, string Lastname,
string phnno, string Location)
If we need this functionality
in another button click there also we need to declare the parameters like string
Username, string Password like this rite. If we place all these
parameters into one place and use these parameters to pass values from
application layer to data access layer by using single object to whenever we
require how much coding will reduce think about it for this reason we will create entity
layer or property layer this layer comes under sub group
of our Business Logic layer.
Follow my instructions that are
enough. Creation of the entity layer is very simple.
Right click on your project web
application---> select add new item ----> select class file in
wizard --->give name as BEL.CS because here I am using
this name click ok
Open the BEL.CS class
file declare the parameters like this in entity layer
Don’t worry about code it’s
very simple for looking it’s very big nothing is there just parameters
declaration that’s all check I have declared whatever the parameters I need to
pass to data access layer I have declared those parameters only
BEL.CS
...................................................................................................................................
#region Variables
/// <summary>
/// User
Registration Variables
/// </summary>
private string _UserName;
private string _Password;
private string _FirstName;
private string _LastName;
private string _Email;
private string _Phoneno;
private string _Location;
private string _Created_By;
#endregion
/// <summary>
/// Gets
or sets the <b>_UserName</b> attribute value.
/// </summary>
/// <value>The <b>_UserName</b> attribute value.</value>
public string UserName
{
get
{
return _UserName;
}
set
{
_UserName = value;
}
}
/// <summary>
/// Gets
or sets the <b>_Password</b> attribute value.
/// </summary>
/// <value>The <b>_Password</b> attribute value.</value>
public string Password
{
get
{
return _Password;
}
set
{
_Password = value;
}
}
/// <summary>
/// Gets
or sets the <b>_FirstName</b> attribute value.
/// </summary>
/// <value>The <b>_FirstName</b> attribute value.</value>
public string FirstName
{
get
{
return _FirstName;
}
set
{
_FirstName = value;
}
}
/// <summary>
/// Gets
or sets the <b>_LastName</b> attribute value.
/// </summary>
/// <value>The <b>_LastName</b> attribute value.</value>
public string LastName
{
get
{
return _LastName;
}
set
{
_LastName = value;
}
}
/// <summary>
/// Gets
or sets the <b>_Email</b> attribute value.
/// </summary>
/// <value>The <b>_Email</b> attribute value.</value>
public string Email
{
get
{
return _Email;
}
set
{
_Email = value;
}
}
/// <summary>
/// Gets
or sets the <b>_Phoneno</b> attribute value.
/// </summary>
/// <value>The <b>_Phoneno</b> attribute value.</value>
public string Phoneno
{
get
{
return _Phoneno;
}
set
{
_Phoneno = value;
}
}
/// <summary>
/// Gets
or sets the <b>_Location</b> attribute value.
/// </summary>
/// <value>The <b>_Location</b> attribute value.</value>
public string Location
{
get
{
return _Location;
}
set
{
_Location = value;
}
}
/// <summary>
/// Gets
or sets the <b>_Created_By</b> attribute value.
/// </summary>
/// <value>The <b>_Created_By</b> attribute value.</value>
public string Created_By
{
get
{
return _Created_By;
}
set
{
_Created_By = value;
}
--------------------------------------------------------------------------------------
Our
parameters declaration is finished now I need to create Business logic layer
how I have create it follow same process for add one class file now give name
called BLL.CS. Here one point don’t forget this layer will act as
only mediator between application layer and data access layer based on this
assume what this layer contains. Now I am writing the following BLL.CS(Business
Logic layer)
...................................................................................................................................
#region Insert
UserInformationDetails
/// <summary>
/// Insert
UserDetails
/// </summary>
/// <param
name="objUserBEL"></param>
/// <returns></returns>
public string InsertUserDetails(BEL objUserDetails)
{
DAL objUserDAL
= new DAL();
try
{
return objUserDAL.InsertUserInformation(objUserDetails);
}
catch (Exception ex)
{
throw ex;
}
finally
{
objUserDAL
= null;
}
}
#endregion
Here
if you observe above code you will get doubt regarding these
what
is
BEL objUserDetails
DAL objUserDAL
= new DAL();
...................................................................................................................................
and
how this method comes
return objUserDAL.InsertUserInformation(objUserDetails);
Here BEL objUserDetails
means we already created one class file called BEL.CS with some parameters have
you got it now I am passing all these parameters to Data access Layer by simply
create one object for our BEL class file
What
is about these statements I will explain about it in data access layer
DAL objUserDAL
= new DAL();
return objUserDAL.InsertUserInformation(objUserDetails);
This DAL related
our Data access layer. Check below information to know about that function and
Data access layer
Data Access Layer (DAL)
Data
Access Layer contains methods to connect with database and to perform insert,
update, delete, get data from database based on our input data
I
think its much data now directly I will enter into DAL
Create
one more class file like same as above process and give name as DAL.CS
Write
the following code in DAL class file
..................................................................................................................................
//SQL
Connection string
string ConnectionString
= ConfigurationManager.AppSettings["LocalConnection"].ToString();
#region Insert
User Details
/// <summary>
/// Insert
Job Details
/// </summary>
/// <param
name="objBELJobs"></param>
/// <returns></returns>
public string InsertUserInformation(BEL objBELUserDetails)
{
SqlConnection con
= new SqlConnection(ConnectionString);
con.Open();
SqlCommand cmd
= new SqlCommand("sp_userinformation",
con);
cmd.CommandType
= CommandType.StoredProcedure;
try
{
cmd.Parameters.AddWithValue("@UserName",objBELUserDetails.UserName);
cmd.Parameters.AddWithValue("@Password",
objBELUserDetails.Password);
cmd.Parameters.AddWithValue("@FirstName",
objBELUserDetails.FirstName);
cmd.Parameters.AddWithValue("@LastName",
objBELUserDetails.LastName);
cmd.Parameters.AddWithValue("@Email",
objBELUserDetails.Email);
cmd.Parameters.AddWithValue("@PhoneNo",
objBELUserDetails.Phoneno);
cmd.Parameters.AddWithValue("@Location",
objBELUserDetails.Location);
cmd.Parameters.AddWithValue("@Created_By", objBELUserDetails.Created_By);
cmd.Parameters.Add("@ERROR", SqlDbType.Char,
500);
cmd.Parameters["@ERROR"].Direction
= ParameterDirection.Output;
cmd.ExecuteNonQuery();
string strMessage
= (string) cmd.Parameters["@ERROR"].Value;
con.Close();
return strMessage;
}
catch (Exception ex)
{
throw ex;
}
finally
{
cmd.Dispose();
con.Close();
con.Dispose();
}
}
#endregion
..................................................................................................................................
Here if you observe above functionality I am getting all the parameters by simply creating BEL objBELUserDetails. If we create one entity file we can access all parameters throughout our project by simply creation of one object for that entity class based on this we can reduce redundancy of code and increase re usability
Observe above code have u seen this function before? in BLL.CS . I said, I will explain it later got it in DAL.CS I have created one function Insert User Information and using this one in BLL.CS by simply creating one object of DAL in BLL.CS.
Here
you will get one doubt that is why BLL.CS we can use
this DAL.CS directly into our code behind we already
discuss Business logic layer provide interface between DAL and Application
layer by using this we can maintain consistency to our application.
Now our Business Logic Layer is ready and our Data Access layer is ready now how we can use this in our application layer write following code in your save button click like this
..................................................................................................................................
protected void btnsubmit_Click(object sender, EventArgs e)
{
string Output
= string.Empty;
if (txtpwd.Text
== txtcnmpwd.Text)
{
BEL objUserBEL
= new BEL();
objUserBEL.UserName
= txtuser.Text;
objUserBEL.Password
= txtpwd.Text;
objUserBEL.FirstName
= txtfname.Text;
objUserBEL.LastName
= txtlname.Text;
objUserBEL.Email
= txtEmail.Text;
objUserBEL.Phoneno
= txtphone.Text;
objUserBEL.Location
= txtlocation.Text;
objUserBEL.Created_By
= txtuser.Text;
BLL objUserBLL
= new BLL();
Output
= objUserBLL.InsertUserDetails(objUserBEL);
}
else
{
Page.RegisterStartupScript("UserMsg", "<Script
language='javascript'>alert('" + "Password
mismatch" +"');</script>");
}
lblErrorMsg.Text
= Output;
}
...............................................................................................................................
Here if you observe I am passing all parameters using this BEL(Entity Layer) and we are calling the method InsertUserDetails by using this BLL(Business Logic Layer)
Now
run your application test with debugger you can get clarity about this
application flow.
Subscribe to:
Posts (Atom)