style="resize:none;"
Monday, September 14, 2015
Thursday, September 10, 2015
sql conditional insert,update,delete with merge command
declare @target table
(
id int,
lead_id int
)
insert into @target(id,lead_id) values(1,521),(2,521),(1,13),(2,13)
--select * from @target
declare @source table
(
id int,
lead_id int
)
insert into @source(id,lead_id) values(2,521),(3,521),(4,521)
--select * from @source
merge into @target as ttable
using @source as stable
on stable.lead_id = ttable.lead_id and stable.id = ttable.id
when NOT MATCHED then
INSERT (id,lead_id)
VALUES(stable.id,stable.lead_id)
WHEN NOT MATCHED BY SOURCE
AND ttable.lead_id IN(521) THEN
DELETE;
select * from @target
Tuesday, September 8, 2015
sql alter table drop column
ALTER TABLE trn_l DROP COLUMN cash |
Tuesday, September 1, 2015
telerik kendo grid refresh after create,update,delete event
var dataSourceBudgetStatus = new kendo.data.DataSource({
transport: {
read: {
url: APIbaseUrl + "/Workflow/GetBudgetStatus",
dataType: "json",
type: "POST",
data: budgetStatusInfo
},
update: {
url: APIbaseUrl + "/Workflow/AddUpdateBudgetStatus",
dataType: "json",
type: "POST",
data: budgetStatusInfo
},
destroy: {
url: APIbaseUrl + "/Workflow/GetBudgetStatus",
dataType: "json",
type: "POST",
data: budgetStatusInfo
},
create: {
url: APIbaseUrl + "/Workflow/AddUpdateBudgetStatus",
dataType: "json",
type: "POST",
data: budgetStatusInfo,
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models[0]) {
options.models[0].ExpenseWorkflowId = 4;//parseInt($('input[id$=hdnExpenseId]').val());
return options.models[0];
}
else if (operation == "read" && options.models) {
return options.models;
}
}
},
requestEnd: function (e) {
var type = e.type;
if (type != "read") {
$('#budgetstatusgrid').data('kendoGrid').dataSource.read();
}
},
batch: true,
pageSize: 5,
schema: {
model: {
id: "BudgetStatusId",
fields: {
BudgetStatusId: { editable: false, nullable: true },
ExpenseWorkflowId: { editable: false, nullable: true },
ExpenseHead: { validation: { required: true } },
TotalBudget: { validation: { required: true } },
TotalExpenseIncurredTillDate: { validation: { required: true } },
CurrentExpenses: { validation: { required: true } },
RemainingBudget: { validation: { required: true } }
}
}
}
});
transport: {
read: {
url: APIbaseUrl + "/Workflow/GetBudgetStatus",
dataType: "json",
type: "POST",
data: budgetStatusInfo
},
update: {
url: APIbaseUrl + "/Workflow/AddUpdateBudgetStatus",
dataType: "json",
type: "POST",
data: budgetStatusInfo
},
destroy: {
url: APIbaseUrl + "/Workflow/GetBudgetStatus",
dataType: "json",
type: "POST",
data: budgetStatusInfo
},
create: {
url: APIbaseUrl + "/Workflow/AddUpdateBudgetStatus",
dataType: "json",
type: "POST",
data: budgetStatusInfo,
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models[0]) {
options.models[0].ExpenseWorkflowId = 4;//parseInt($('input[id$=hdnExpenseId]').val());
return options.models[0];
}
else if (operation == "read" && options.models) {
return options.models;
}
}
},
requestEnd: function (e) {
var type = e.type;
if (type != "read") {
$('#budgetstatusgrid').data('kendoGrid').dataSource.read();
}
},
batch: true,
pageSize: 5,
schema: {
model: {
id: "BudgetStatusId",
fields: {
BudgetStatusId: { editable: false, nullable: true },
ExpenseWorkflowId: { editable: false, nullable: true },
ExpenseHead: { validation: { required: true } },
TotalBudget: { validation: { required: true } },
TotalExpenseIncurredTillDate: { validation: { required: true } },
CurrentExpenses: { validation: { required: true } },
RemainingBudget: { validation: { required: true } }
}
}
}
});
Thursday, August 27, 2015
Telerik kendo ui grid - How to pass data from page to api service
<div style="width: 99%; margin-left: 6px; margin-right: 6px;">
<div id="example">
<div id="grid"></div>
</div>
</div>
$(document).ready(function () {
var APIbaseUrl = '<%=this.APIbaseUrl%>';
var models = {};
var expenseWorkflowInfo = {
models: {
ExpenseId: 1
}
};
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: APIbaseUrl + "/User/Product",
dataType: "json",
type: "POST",
data: expenseWorkflowInfo
},
update: {
url: APIbaseUrl + "/User/Product",
dataType: "json",
type: "POST",
data: expenseWorkflowInfo
},
destroy: {
url: APIbaseUrl + "/User/Product",
dataType: "json",
type: "POST",
data: expenseWorkflowInfo
},
create: {
url: APIbaseUrl + "/User/Product",
dataType: "json",
type: "POST",
data: expenseWorkflowInfo
},
parameterMap: function (options, operation) {
debugger;
if (operation !== "read" && options.models[0]) {
return options.models[0];
}
else if (operation == "read" && options.models) {
return options.models;
}
}
},
batch: true,
pageSize: 5,
schema: {
model: {
id: "ExpenseId",
fields: {
ExpenseId: { editable: false, nullable: true },
Subject: { validation: { required: true } }//,
//BranchId: { type: "number", validation: { required: true } },
//LeadId: { type: "number", validation: { required: true } }
}
}
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
height: 550,
toolbar: ["create"],
columns: [
"Subject",
//{ field: "BranchId", title: "Branch Id", format: "{0:c}", width: "120px" },
//{ field: "LeadId", title: "Lead Id", width: "120px" },
{ command: ["edit", "destroy"], title: " ", width: "250px" }],
editable: "inline"
});
});
<div id="example">
<div id="grid"></div>
</div>
</div>
$(document).ready(function () {
var APIbaseUrl = '<%=this.APIbaseUrl%>';
var models = {};
var expenseWorkflowInfo = {
models: {
ExpenseId: 1
}
};
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: APIbaseUrl + "/User/Product",
dataType: "json",
type: "POST",
data: expenseWorkflowInfo
},
update: {
url: APIbaseUrl + "/User/Product",
dataType: "json",
type: "POST",
data: expenseWorkflowInfo
},
destroy: {
url: APIbaseUrl + "/User/Product",
dataType: "json",
type: "POST",
data: expenseWorkflowInfo
},
create: {
url: APIbaseUrl + "/User/Product",
dataType: "json",
type: "POST",
data: expenseWorkflowInfo
},
parameterMap: function (options, operation) {
debugger;
if (operation !== "read" && options.models[0]) {
return options.models[0];
}
else if (operation == "read" && options.models) {
return options.models;
}
}
},
batch: true,
pageSize: 5,
schema: {
model: {
id: "ExpenseId",
fields: {
ExpenseId: { editable: false, nullable: true },
Subject: { validation: { required: true } }//,
//BranchId: { type: "number", validation: { required: true } },
//LeadId: { type: "number", validation: { required: true } }
}
}
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
height: 550,
toolbar: ["create"],
columns: [
"Subject",
//{ field: "BranchId", title: "Branch Id", format: "{0:c}", width: "120px" },
//{ field: "LeadId", title: "Lead Id", width: "120px" },
{ command: ["edit", "destroy"], title: " ", width: "250px" }],
editable: "inline"
});
});
Tuesday, August 18, 2015
Call parent Javascript function from inside an iframe
window.parent.rxTreeSelectNode(folderID);
rxTreeSelectNode - Your Function Name
rxTreeSelectNode - Your Function Name
Iframe set source or href using jquery
var folderID = $(this).closest('[id]').attr('id');
var url = 'UploadMultipleFiles.aspx?folderId=' + folderID;
$('#myframe').attr("src", url);
var url = 'UploadMultipleFiles.aspx?folderId=' + folderID;
$('#myframe').attr("src", url);
Subscribe to:
Posts (Atom)