Both are used when sending arguments by reference instead of values. Both should be explicitly written in the calling function and called function. The main difference is that in "ref" the function expects that the reference sent is already initiated. Where as "out" does not expect it to be initiated or it ignores the initiation of the type.
I will be spending more time on this later...
Wednesday, August 19, 2009
Monday, August 17, 2009
PAGE METHOD
function GetdueDateFromSever() {
var state = document.getElementById("ctl00_cplHolderDefault_ddlIssueState").options[document.getElementById("ctl00_cplHolderDefault_ddlIssueState").selectedIndex].value;
var receivedDate = document.getElementById("ctl00_cplHolderDefault_wdcInqReceivedDate_input").value;
var dateOfLetter = document.getElementById("ctl00_cplHolderDefault_wdcDateOfLetter_input").value;
var inquiryType = document.getElementById("ctl00_cplHolderDefault_ddlInquiryType").options[document.getElementById("ctl00_cplHolderDefault_ddlInquiryType").selectedIndex].value;
var responsibleFunction = document.getElementById("ctl00_cplHolderDefault_lstResponsibleFunction");
var responsiblefunction1 = '';
for (var i = 0; i < responsibleFunction.options.length; ++i) {
if (responsibleFunction.options[i].selected == true) {
responsiblefunction1 = responsiblefunction1.concat(responsibleFunction.options[i].value + ',')
}
}
//
var varResult;
if (state != -1 && receivedDate != "") {
var varWebRequest = new Sys.Net.WebRequest();
varWebRequest.set_httpVerb('POST');
varWebRequest.get_headers()['Content-Type'] = 'application/json; charset=utf-8';
//
//, subEntityName: subEntityName
var varUrlParams = { receivedDate: receivedDate, state: state, inquiryType: inquiryType, responsiblefunction1: responsiblefunction1, dateOfLetter: dateOfLetter };
varWebRequest.set_url(Sys.Net.WebRequest._createUrl(PageMethods.get_path() + "/getDueDateFromServer", varUrlParams));
var varBody = null;
varBody = Sys.Serialization.JavaScriptSerializer.serialize(varUrlParams);
if (varBody === "{}") varBody = "";
varWebRequest.set_body(varBody);
//
var varExecutor = new Sys.Net.XMLHttpSyncExecutor();
varWebRequest.set_executor(varExecutor);
varWebRequest.invoke();
//
if (varExecutor.get_responseAvailable())
varResult = varExecutor.get_object();
document.getElementById("ctl00_cplHolderDefault_wdcDueDate_input").value = varResult;
document.getElementById("ctl00_cplHolderDefault_hdnDueDate").value = varResult;
}
}
[WebMethod()]
[ScriptMethod()]
public static string getDueDateFromServer(string receivedDate, string state, string inquiryType, string responsiblefunction1, string dateOfLetter)
{
CSSI.VUE.CS.Web.Service.Inquiry.SchemaHeader sh = WebHelper.GetServiceSoapHeader("INQUIRY", "INQUIRYRESEARCHREP1DATASCHEMA") as CSSI.VUE.CS.Web.Service.Inquiry.SchemaHeader;
InquiryService inquiryService = WebHelper.GetInquiryService();
inquiryService.SchemaHeaderValue = sh;
XmlDocument xdDueDateList = new XmlDocument();
xdDueDateList.LoadXml(@"" + state + " " + receivedDate + " " + dateOfLetter + " " + inquiryType + " " + responsiblefunction1 + " ");
////
XmlNode xnUserList = inquiryService.GetDueDateByState(xdDueDateList);
string dueDate = xnUserList.SelectSingleNode("//DUEDATE").InnerText;
if (dueDate == "01/01/1900")
{
dueDate = "";
}
return dueDate;
}
var state = document.getElementById("ctl00_cplHolderDefault_ddlIssueState").options[document.getElementById("ctl00_cplHolderDefault_ddlIssueState").selectedIndex].value;
var receivedDate = document.getElementById("ctl00_cplHolderDefault_wdcInqReceivedDate_input").value;
var dateOfLetter = document.getElementById("ctl00_cplHolderDefault_wdcDateOfLetter_input").value;
var inquiryType = document.getElementById("ctl00_cplHolderDefault_ddlInquiryType").options[document.getElementById("ctl00_cplHolderDefault_ddlInquiryType").selectedIndex].value;
var responsibleFunction = document.getElementById("ctl00_cplHolderDefault_lstResponsibleFunction");
var responsiblefunction1 = '';
for (var i = 0; i < responsibleFunction.options.length; ++i) {
if (responsibleFunction.options[i].selected == true) {
responsiblefunction1 = responsiblefunction1.concat(responsibleFunction.options[i].value + ',')
}
}
//
var varResult;
if (state != -1 && receivedDate != "") {
var varWebRequest = new Sys.Net.WebRequest();
varWebRequest.set_httpVerb('POST');
varWebRequest.get_headers()['Content-Type'] = 'application/json; charset=utf-8';
//
//, subEntityName: subEntityName
var varUrlParams = { receivedDate: receivedDate, state: state, inquiryType: inquiryType, responsiblefunction1: responsiblefunction1, dateOfLetter: dateOfLetter };
varWebRequest.set_url(Sys.Net.WebRequest._createUrl(PageMethods.get_path() + "/getDueDateFromServer", varUrlParams));
var varBody = null;
varBody = Sys.Serialization.JavaScriptSerializer.serialize(varUrlParams);
if (varBody === "{}") varBody = "";
varWebRequest.set_body(varBody);
//
var varExecutor = new Sys.Net.XMLHttpSyncExecutor();
varWebRequest.set_executor(varExecutor);
varWebRequest.invoke();
//
if (varExecutor.get_responseAvailable())
varResult = varExecutor.get_object();
document.getElementById("ctl00_cplHolderDefault_wdcDueDate_input").value = varResult;
document.getElementById("ctl00_cplHolderDefault_hdnDueDate").value = varResult;
}
}
[WebMethod()]
[ScriptMethod()]
public static string getDueDateFromServer(string receivedDate, string state, string inquiryType, string responsiblefunction1, string dateOfLetter)
{
CSSI.VUE.CS.Web.Service.Inquiry.SchemaHeader sh = WebHelper.GetServiceSoapHeader("INQUIRY", "INQUIRYRESEARCHREP1DATASCHEMA") as CSSI.VUE.CS.Web.Service.Inquiry.SchemaHeader;
InquiryService inquiryService = WebHelper.GetInquiryService();
inquiryService.SchemaHeaderValue = sh;
XmlDocument xdDueDateList = new XmlDocument();
xdDueDateList.LoadXml(@"
////
XmlNode xnUserList = inquiryService.GetDueDateByState(xdDueDateList);
string dueDate = xnUserList.SelectSingleNode("//DUEDATE").InnerText;
if (dueDate == "01/01/1900")
{
dueDate = "";
}
return dueDate;
}
Sunday, August 16, 2009
RAISE ERROR
RAISERROR ('User does not have privileges to perform this action.' -- Message text.
,11 -- Severity
,1 -- State
,N'number' -- First argument.
,5);
RETURN
,11 -- Severity
,1 -- State
,N'number' -- First argument.
,5);
RETURN
Saturday, August 15, 2009
ALTER TABLE ADD NEW COLUMN
ALTER TABLE table_name ADD column_name datatype
ALTER TABLE table_name DROP COLUMN column_name
ALTER TABLE table_name ALTER COLUMN column_name datatype
ALTER TABLE table_name DROP COLUMN column_name
ALTER TABLE table_name ALTER COLUMN column_name datatype
Friday, August 14, 2009
Thursday, August 13, 2009
Access Master page events from Content page
The following are the steps to be taken to access a master page's event from a content page.
1. Create a drop down list in the Master page.
2. Create an Event handler for SelectIndexChanged event.
3. Define an event in the Master page for the Dropdowns select index changed with the above signature.
4. Subscribe to the event in the contentpage that care about the changing of the ddl.
Here is the code to subscribe the event from the content page.
protected void Page_Init(object sender, EventArgs e)
{
Master.EventHandlerName += new CommandEventHandler(MasterPageEventName);
}
1. Create a drop down list in the Master page.
2. Create an Event handler for SelectIndexChanged event.
3. Define an event in the Master page for the Dropdowns select index changed with the above signature.
4. Subscribe to the event in the contentpage that care about the changing of the ddl.
Here is the code to subscribe the event from the content page.
protected void Page_Init(object sender, EventArgs e)
{
Master.EventHandlerName += new CommandEventHandler(MasterPageEventName);
}
protected void MasterPageEventName(object sender, CommandEventArgs e)
{
string text = e.CommandName;
string value = e.CommandArgument.ToString();
}
NOTE: We can use delegates as well.
Monday, August 10, 2009
Sql Server Split Function
Here is the split function that splits the given varchar with the given dilimiteer
CREATE FUNCTION [dbo].[ufn_Split](@text varchar(8000), @delimiter
varchar(20) = ' ')
RETURNS @Strings TABLE
(
position int IDENTITY PRIMARY KEY,
value varchar(8000)
)
AS
BEGIN
DECLARE @index int
SET @index = -1
WHILE (LEN(@text) > 0)
BEGIN
SET @index = CHARINDEX(@delimiter , @text)
IF (@index = 0) AND (LEN(@text) > 0)
BEGIN
INSERT INTO @Strings VALUES (@text)
BREAK
END
IF (@index > 1)
BEGIN
INSERT INTO @Strings VALUES (LEFT(@text, @index - 1))
SET @text = RIGHT(@text, (LEN(@text) - @index))
END
ELSE
BEGIN
--You can uncomment the below statement if you want to insert nulls
--INSERT INTO @Strings VALUES (NULL)
SET @text = RIGHT(@text, (LEN(@text) - @index))
END
END
RETURN
END
CREATE FUNCTION [dbo].[ufn_Split](@text varchar(8000), @delimiter
varchar(20) = ' ')
RETURNS @Strings TABLE
(
position int IDENTITY PRIMARY KEY,
value varchar(8000)
)
AS
BEGIN
DECLARE @index int
SET @index = -1
WHILE (LEN(@text) > 0)
BEGIN
SET @index = CHARINDEX(@delimiter , @text)
IF (@index = 0) AND (LEN(@text) > 0)
BEGIN
INSERT INTO @Strings VALUES (@text)
BREAK
END
IF (@index > 1)
BEGIN
INSERT INTO @Strings VALUES (LEFT(@text, @index - 1))
SET @text = RIGHT(@text, (LEN(@text) - @index))
END
ELSE
BEGIN
--You can uncomment the below statement if you want to insert nulls
--INSERT INTO @Strings VALUES (NULL)
SET @text = RIGHT(@text, (LEN(@text) - @index))
END
END
RETURN
END
Subscribe to:
Posts (Atom)
