demo test
Information box is a blog about all type of new information related to fast growing world..
Tuesday, 28 June 2016
Wednesday, 15 July 2015
Dynamic Date Picker On grid view...
$(".datagrid-row").each(function(index, element){
var id = $(this).attr("id");
var dates = $("#"+id+" .StartDatetext, #"+id+" .EndDatetext").datepicker({
minDate: '0',
maxDate: '10000D',
dateFormat: "MM dd yy",
onSelect: function (selectedDate) {
var option = this.id == ".EndDatetext" ? "maxDate" : "minDate",
instance = $(this).data("datepicker"),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings);
var odate = date;
if (this.id == "StartDatetext") {
odate.setDate(odate.getDate() + 1);
}
dates.not('.StartDatetext').datepicker("option", option, odate);
}
});
});
Wednesday, 25 March 2015
Dynamic Date picker In Jqurey
$(function () {
var dates = $(".StartDtaeText, .EndDateText").datepicker({
minDate: '0',
maxDate: '100D',
onSelect: function (selectedDate) {
var option = this.id == ".EndDateText" ? "maxDate" : "minDate",
instance = $(this).data("datepicker"),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings);
//alert(this);
dates.not('.StartDtaeText').datepicker("option", option, date);
}
});
var dates = $(".StartDtaeText, .EndDateText").datepicker({
minDate: '0',
maxDate: '100D',
onSelect: function (selectedDate) {
var option = this.id == ".EndDateText" ? "maxDate" : "minDate",
instance = $(this).data("datepicker"),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings);
//alert(this);
dates.not('.StartDtaeText').datepicker("option", option, date);
}
});
Saturday, 14 February 2015
Can I use CASE statement in a JOIN condition?
A CASE expression returns a value from the THEN portion of the clause.
You could use it thusly:
SELECT *
FROM sys.indexes i
JOIN sys.partitions p
ON i.index_id = p.index_id
JOIN sys.allocation_units a
ON CASE
WHEN a.type IN (1, 3) AND a.container_id = p.hobt_id THEN 1
WHEN a.type IN (2) AND a.container_id = p.partition_id THEN 1
ELSE 0
END = 1
Friday, 30 January 2015
Stop page post back action
if (!IsPostBack)
{
ViewState["postids"] = System.Guid.NewGuid().ToString();
Session["postid"] = ViewState["postids"].ToString();
}
else
{
if (ViewState["postids"].ToString() != Session["postid"].ToString())
{
IsPageRefresh = true;
}
Session["postid"] = System.Guid.NewGuid().ToString();
ViewState["postids"] = Session["postid"].ToString();
}
{
ViewState["postids"] = System.Guid.NewGuid().ToString();
Session["postid"] = ViewState["postids"].ToString();
}
else
{
if (ViewState["postids"].ToString() != Session["postid"].ToString())
{
IsPageRefresh = true;
}
Session["postid"] = System.Guid.NewGuid().ToString();
ViewState["postids"] = Session["postid"].ToString();
}
Tuesday, 25 November 2014
Procedure to insert bulk data from heirarchy XML
USE [OMS]
GO
/****** Object: StoredProcedure [inv].[insertbulkphysicalInventoryold] Script Date: 11/26/2014 10:09:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
------Create by preeti on 10-10-2014
--inv.insertphysicalInventory '
--<inv_feed>
-- <item>
-- <code>kba6_34</code>
-- <inv_detail>
-- <loc>DL</loc>
-- <bucket>
-- <name>PGRN</name>
-- <qty>20</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>10</qty>
-- </bucket>
-- <bucket>
-- <name>CSMT</name>
-- <qty>50</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>10</qty>
-- </bucket>
-- </inv_detail>
-- <inv_detail>
-- <loc>ST</loc>
-- <bucket>
-- <name>PGRN</name>
-- <qty>100</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>80</qty>
-- </bucket>
-- <bucket>
-- <name>CSMT</name>
-- <qty>70</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>10</qty>
-- </bucket>
-- </inv_detail>
-- </item>
-- <item>
-- <code>kcr3765_32</code>
-- <inv_detail>
-- <loc>DL</loc>
-- <bucket>
-- <name>PGRN</name>
-- <qty>20</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>40</qty>
-- </bucket>
-- <bucket>
-- <name>CSMT</name>
-- <qty>60</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>10</qty>
-- </bucket>
-- </inv_detail>
-- <inv_detail>
-- <loc>ST</loc>
-- <bucket>
-- <name>PGRN</name>
-- <qty>10</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>20</qty>
-- </bucket>
-- <bucket>
-- <name>CSMT</name>
-- <qty>40</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>10</qty>
-- </bucket>
-- </inv_detail>
-- </item>
--</inv_feed>
--'
ALTER Proc [inv].[insertbulkphysicalInventoryold]
@invfeedxml XML =null,
@userid varchar(10)=''
as begin
begin try
begin transaction
begin
if(@invfeedxml is not null)
begin
delete from inv.physicalstock
insert into inv.physicalstock(itemcode,loccode,bucketcode ,qty,disabled,dstatus,createdby,createddate)
SELECT
CAST(CAST(x.item.query('data(code)') AS varchar(30)) AS varchar(30)),
CAST(CAST(y.item.query('data(loc)') AS varchar(1000)) AS varchar(1000)),
CAST(CAST(z.item.query('data(name)') AS char(25)) AS varchar(100)),
CAST(z.item.query('data(qty)') AS varchar(25)),'false' as disabled,'false' as dstatus,@userid as createdby,GETDATE() as createdate
FROM
@invfeedxml.nodes('/inv_feed/item') x(item)
CROSS APPLY
x.item.nodes('./inv_detail') AS y(item)
CROSS APPLY
y.item.nodes('./bucket') AS z(item)
end
--select itemcode,loccode,bucketcode ,qty from inv.physicalstock
end
select 'successfully updated' as msg
commit transaction
end try
begin catch
rollback transaction
select 'not successfully updated' as msg
end catch
end
GO
/****** Object: StoredProcedure [inv].[insertbulkphysicalInventoryold] Script Date: 11/26/2014 10:09:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
------Create by preeti on 10-10-2014
--inv.insertphysicalInventory '
--<inv_feed>
-- <item>
-- <code>kba6_34</code>
-- <inv_detail>
-- <loc>DL</loc>
-- <bucket>
-- <name>PGRN</name>
-- <qty>20</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>10</qty>
-- </bucket>
-- <bucket>
-- <name>CSMT</name>
-- <qty>50</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>10</qty>
-- </bucket>
-- </inv_detail>
-- <inv_detail>
-- <loc>ST</loc>
-- <bucket>
-- <name>PGRN</name>
-- <qty>100</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>80</qty>
-- </bucket>
-- <bucket>
-- <name>CSMT</name>
-- <qty>70</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>10</qty>
-- </bucket>
-- </inv_detail>
-- </item>
-- <item>
-- <code>kcr3765_32</code>
-- <inv_detail>
-- <loc>DL</loc>
-- <bucket>
-- <name>PGRN</name>
-- <qty>20</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>40</qty>
-- </bucket>
-- <bucket>
-- <name>CSMT</name>
-- <qty>60</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>10</qty>
-- </bucket>
-- </inv_detail>
-- <inv_detail>
-- <loc>ST</loc>
-- <bucket>
-- <name>PGRN</name>
-- <qty>10</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>20</qty>
-- </bucket>
-- <bucket>
-- <name>CSMT</name>
-- <qty>40</qty>
-- </bucket>
-- <bucket>
-- <name>BSTK</name>
-- <qty>10</qty>
-- </bucket>
-- </inv_detail>
-- </item>
--</inv_feed>
--'
ALTER Proc [inv].[insertbulkphysicalInventoryold]
@invfeedxml XML =null,
@userid varchar(10)=''
as begin
begin try
begin transaction
begin
if(@invfeedxml is not null)
begin
delete from inv.physicalstock
insert into inv.physicalstock(itemcode,loccode,bucketcode ,qty,disabled,dstatus,createdby,createddate)
SELECT
CAST(CAST(x.item.query('data(code)') AS varchar(30)) AS varchar(30)),
CAST(CAST(y.item.query('data(loc)') AS varchar(1000)) AS varchar(1000)),
CAST(CAST(z.item.query('data(name)') AS char(25)) AS varchar(100)),
CAST(z.item.query('data(qty)') AS varchar(25)),'false' as disabled,'false' as dstatus,@userid as createdby,GETDATE() as createdate
FROM
@invfeedxml.nodes('/inv_feed/item') x(item)
CROSS APPLY
x.item.nodes('./inv_detail') AS y(item)
CROSS APPLY
y.item.nodes('./bucket') AS z(item)
end
--select itemcode,loccode,bucketcode ,qty from inv.physicalstock
end
select 'successfully updated' as msg
commit transaction
end try
begin catch
rollback transaction
select 'not successfully updated' as msg
end catch
end
Wednesday, 10 September 2014
asp.net Questions and Answers
What is difference between HTTP Handler and HTTP Module.
Http Handlers:
Http handlers are component developed by asp.net developers to work as end point to asp.net pipeline. It has to implement System.Web.IHttpHandler interface and this will act as target for asp.net requests. Handlers can be act as ISAPI dlls the only difference between ISAPI dlls and HTTP Handlers are Handlers can be called directly URL as compare to ISAPI Dlls.
Http Modules:
Http modules are objects which also participate in the asp.net request pipeline but it does job after and before HTTP Handlers complete its work. For example it will associate a session and cache with asp.net request. It implements System.Web.IHttpModule interface.
HTTP Handler implement following Methods and Properties
- Process Request: This method is called when processing asp.net requests. Here you can perform all the things related to processing request.
- IsReusable: This property is to determine whether same instance of HTTP Handler can be used to fulfill another request of same type.
- InIt: This method is used for implementing events of HTTP Modules in HTTPApplication object.
- Dispose: This method is used perform cleanup before Garbage Collector destroy everything.
- AcquireRequestState: This event is raised when asp.net request is ready to acquire the session state in http module.
- AuthenticateRequest: This event is raised when asp.net runtime ready to authenticate user.
- AuthorizeRequest: This event is raised when asp.net request try to authorize resources with current user identity.
- BeginRequest: This event is raised when HTTP Modules receive new request.
- EndRequest: This event is raised before sending response to client.
- Disposed: This event is raised when http modules completes processing of request
- Error: This event is raised when any error occurs during processing of request.
- PreRequestHandlerExecute: This event is raised just before ASP.NET begins executing a handler for the HTTP request. After this event, ASP.NET will forward the request to the appropriate HTTP handler.
- PostRequestHandlerExecute: This event is raised when when HTTP Handler will finish the execution of current request.
- PreSendRequestContent: This event is raised just before ASP.NET sends the response contents to the client. This event allows us to change the contents before it gets delivered to the client. We can use this event to add the contents, which are common in all pages, to the page output. For example, a common menu, header or footer.
- PreSendRequestHeaders: This event is raised before asp.net Just send response header to client browser.
- ReleaseRequestState: This event is raised when asp.net runtime finishes handling of all the request.
- ResolveRequestCache: This event is raised to determine whether the request can be fulfilled by returning the contents from the Output Cache.
- UpdateRequestCache: This event is raised when ASP.NET has completed processing the current HTTP request and the output contents are ready to be added to the Output Cache.
Difference between API and Rest API.
C# - Types of Polymorphism in C#.Net with Example | Basic Polymorphism in C#.NET
difference between compile time and Run-time Polymorpism?
Polymorphism
Polymorphism means many
forms (ability to take more than one form). In Polymorphism poly means
“multiple” and morph means “forms” so polymorphism means many forms.
In polymorphism we will
declare methods with same name and different parameters in same class or
methods with same name and same parameters in different classes. Polymorphism
has ability to provide different implementation of methods that are implemented
with same name.
In
Polymorphism we have 2 different types those are
- Compile Time Polymorphism (Called as Early Binding or Overloading
or static binding)
- Run Time Polymorphism (Called as Late Binding or Overriding
or dynamic binding)
Compile Time Polymorphism
Compile
time polymorphism means we will declare methods with same name but different
signatures because of this we will perform different tasks with same method
name. This compile time polymorphism also called as early binding or method
overloading.
Method
Overloading or compile time polymorphism means same method names with different
signatures (different parameters)
Example
public class Class1
{
public void
NumbersAdd(int a, int
b)
{
Console.WriteLine(a + b);
}
public void
NumbersAdd(int a, int
b, int c)
{
Console.WriteLine(a + b + c);
}
}
|
In
above class we have two methods with same name but having different input
parameters this is called method overloading or compile time polymorphism or
early binding.
Run Time Polymorphism
Run
time polymorphism also called as late
binding or method overriding or dynamic polymorphism. Run time
polymorphism or method overriding means same method names with same signatures.
In
this run time polymorphism or method overriding we can override a method in
base class by creating similar function in derived class this can be achieved
by using inheritance principle and using “virtual
& override” keywords.
In
base class if we declare methods with virtual
keyword then only we can override those methods in derived class using override keyword
Example
//Base Class
public class Bclass
{
public virtual void Sample1()
{
Console.WriteLine("Base
Class");
}
}
// Derived Class
public class DClass : Bclass
{
public override void Sample1()
{
Console.WriteLine("Derived
Class");
}
}
// Using base and derived class
class Program
{
static void Main(string[] args)
{
// calling the overriden method
DClass objDc = new DClass();
objDc.Sample1();
// calling the base class method
Bclass objBc = new DClass();
objBc.Sample1();
}
}
|
If
we run above code we will get output like as shown below
Output
----------------------------------
Derived Class
Derived ClassWhat is immutable?
string in C# is immutable(read-only)
Once you have assigned it, you can't change the original string value. If you try to alter it in some way, perhaps by appending another string it creates a new string. This can be very inefficient if done a lot but there is a StringBuilder class that will overcome that.
Difference between string and stringBuilder?
stringBuilder has methods to let you Append,
Replace, Insert, and Remove characters from a StringBuilder String. You
can also directly access and manipulate the chars in the object by
indexing. StringBuilder SB = "HEllo World"; SB[1]='e'; // Changes it to Hello World
Why String is a reference type while Integer is a Value type?
An integer has fixed memory set at 4 bytes. Hence, an integer can be directly stored within fixed memory, or on the stack.
Alternatively, a string does not have a pre-defined memory size, so it requires dynamic memory. When a string object is created, the actual value is stored within dynamic memory, or on the heap. To access it, a reference to this memory space is stored in the stack, thus the name "reference type".
Note that when you create an object variable, a value-type variable contains the actual value whereas a reference-type variable contains only the reference to the actual location of the object's value.
Following are the transport schemes supported by WCF:
It is the agreement between client and service which specifies:
Address specifies where the services is hosted.
Binding specifies how to access the hosted service. It specifies the transport, encoding, protocol etc.
Contract specifies what type of data can be sent to or received from the service.
Eg:
Multicast delegates must contain only methods that return
for reference
Alternatively, a string does not have a pre-defined memory size, so it requires dynamic memory. When a string object is created, the actual value is stored within dynamic memory, or on the heap. To access it, a reference to this memory space is stored in the stack, thus the name "reference type".
Note that when you create an object variable, a value-type variable contains the actual value whereas a reference-type variable contains only the reference to the actual location of the object's value.
Difference B/W char and string?
Difference B/w value type and ref type?
value type store on stack and ref type on heap
what is endpoints in WCF?
how many http bindings are there in WCF?
what are contracts?
there are different type of parameters option in a function like value type,reference type , param type ,out type .Explain them with difference?
difference b/w abstract class and interface?
Can we creat object of interface ? and if yes how?
what are generics?
Covariance and Contravariance in Generics
http://www.codeproject.com/Articles/72467/C-Covariance-And-Contravariance-In-Generics
What is WCF ?
- Stands for Windows Communication Foundation.
- Its code name is “Indigo”.
- It is a framework for building, configuring and deploying interoperable distributed services.
- It enables you to write more secure flexible services without any code change (using configuration).
- It also provide built-in support for logging. You can enable/disable logging using configuration.
WCF = Web Service + Remoting + MSMQ + COM+
or
WCF = ASMX + .Net Remoting + WSE + Messaging + Enterprise Services
What are the transport schemes supported by WCF ? Give example of address for each scheme.
Following are the transport schemes supported by WCF:
- HTTP/HTTPS - http://localhost:8001/MyService
- TCP - net.tcp://localhost:8002/MyService
- IPC - net.pipe://localhost/MyPipe
- Peer network
- MSMQ - net.msmq://localhost/private/MyQueue
- Service bus - sb://MyNamespace.servicebus.windows.net/
What is Contract ? What are the types of Contract ?
It is the agreement between client and service which specifies:
- [ServiceContract] - which services are exposed to the client.
- [OperationContract] - which operations the client can perform on the service.
- [DataContract] – which data types are passed to and from the service.
- [MessageContract] - allow the service to interact directly with messages. Message contracts can be typed or untyped and are useful in interoperability cases when another party has already dictated some explicit (typically proprietary) message format.
- [FaultContract] -which errors are raised by the service and how the service handles andpropagates errors to its clients.
What is the difference between Web Service and WCF Service ?
| Features | Web Service | WCF |
| Hosting | It can be hosted in IIS. | It can be hosted in IIS, WAS (windows activation service), Self-hosting or Windows service |
| Programming | Apply [WebService] attribute to the class to be exposed as a service. | Apply [ServiceContract] attribute to the class to be exposed as a service. |
| Model | Apply [WebMethod] attribute to the method exposed to client. | Apply [OperationContract] attribute to the method exposed to client. |
| Supported Operations | One-way and Request- Response. | One-Way, Request-Response and Duplex. |
| Logging | Needs custom implementation. | No custom implementation needed. Can be configured in service config file. |
| Serialization | System.Xml.serialization namespace is used. | System.Runtime.Serialization namespace is used. |
| Supported Encoding | XML 1.0, MTOM(Message Transmission Optimization Mechanism), DIME, Custom. | XML 1.0, MTOM, Binary, Custom. |
| Supported Transports | Can be accessed through HTTP, TCP and Custom. | Can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P(Peer to Peer) and Custom. |
| Service Types | ASMX, .Net Remoting | .ASMX, .Net Remoting, WSE(WS* Protocols), MSMQ and Enterprise Services |
| Supported Protocols | Security | Security, Reliable messaging, Transactions |
How can we host WCF service ?
Every WCF service needs to be hosted in a windows process called the host process. A single host process can host multiple services, and the same service type can be hosted in multiple host processes.
What is Endpoint in WCF ?
or
What is ABC in WCF ?
Endpoint = Address (A) + Binding (B) + Contract (C)Address specifies where the services is hosted.
Binding specifies how to access the hosted service. It specifies the transport, encoding, protocol etc.
Contract specifies what type of data can be sent to or received from the service.
Eg:
What is a Delegate?
Delegate is a type which holds the method(s) reference in an object. It is also referred to as a type safe function pointer.Advantages
- Encapsulating the method's call from caller
- Effective use of delegate improves the performance of application
- Used to call a method asynchronously
What is Multicast Delegate?
It is a delegate which holds the reference of more than one method.Multicast delegates must contain only methods that return
void, else there is a run-time exception.Delegate is added using the += operator and removed using the -= operator. for reference
http://www.codeproject.com/Articles/11657/Understanding-Delegates-in-C
Why Delegates?
Delegates are used in the following cases:- Delegates can be used to handle(call/invoke) multiple methods on a single event.
- Delegates can be used to define callback(asynchronous) methods.
- Delegates can be used for decoupling and implementing generic behaviors.
- Delegates can be invoked method at runtime.
- Delegates can be used in LINQ for parsing the
ExpressionTree. - Delegates can be used in different Design Pattern.
Definition
A delegate(known as function pointer in C/C++) is a references type that invokes single/multiple method(s) through the delegate instance. It holds a reference of the methods. Delegate types are sealed and immutable type.Types of Delegates
There are three types of delegates that can be used in C#.- Single Delegate
- Multicast Delegate
- Generic Delegate
Subscribe to:
Posts (Atom)
रूस-यूक्रेन संकट लाइव: भारतीयों को 'उपलब्ध किसी भी साधन' के माध्यम से कीव को तत्काल छोड़ने के लिए कहा
रूस यूक्रेन संकट लाइव: कीव में भारतीय दूतावास ने मंगलवार को जारी एक एडवाइजरी में भारतीयों को 'किसी भी उपलब्ध साधन' के माध्यम से क...
-
Link Of Interview Topics on Asp.net. http://www.dotnetwatch.com
-
Tata Nexon: All you have to know Tata Motors on Friday, September 22, reported its entrance into the developing conservative SUV po...
-
selectionchangecommitted vs selectedindexchanged SelectionChangeCommitted is raised only when the user changes the combo box selection...