İlgilenenler için sayfanın kaynak kodu şöyledir.
Kod: Tümünü seç
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>EskiUyeQuery</title>
<link href="/tzob/Content/kendo/2014.1.416/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="/tzob/Content/kendo/2014.1.416/kendo.blueopal.min.css" rel="stylesheet" type="text/css" />
<link href="/tzob/Content/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<link href="/tzob/Content/Site.css?v=9" rel="stylesheet" type="text/css" />
<link href="/tzob/Content/kendo.ext.css?v=1" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var baseUrl = '/tzob/';
</script>
<script src="/tzob/Scripts/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="/tzob/Scripts/kendo/2014.1.416/kendo.custom.min.js" type="text/javascript"></script>
<script src="/tzob/Scripts/kendo/2014.1.416/cultures/kendo.culture.tr-TR.min.js" type="text/javascript"></script>
<script src="/tzob/Scripts/kendo.modernizr.custom.js" type="text/javascript"></script>
<script src="/tzob/Scripts/jquery.mb.browser.min.js" type="text/javascript"></script>
<script src="/tzob/Scripts/jquery.contextMenu.js" type="text/javascript"></script>
<script src="/tzob/Scripts/b12-library.js?v=70" type="text/javascript"></script>
<script src="/tzob/Scripts/kendo.web.ext.js?v=4" type="text/javascript"></script>
<script src="/tzob/Scripts/jquery.maskedinput.min.js" type="text/javascript"></script>
<script src="/tzob/Scripts/jquery-ui-1.10.4.positiononly.min.js" type="text/javascript"></script>
<script type="text/javascript">
kendo.culture("tr-TR");
</script>
</head>
<body>
<form id="mainForm" method="GET" action='/tzob/Tzob/EskiUyeMatrixFormAction'>
<div><table style='padding:0px;margin:18px 16px 18px 16px;'><tr style='padding:0px;margin:0px;'><td style='padding:0px;margin:0px;vertical-align:middle;'><span class="b12-fixed-width" id="containerSicilNo" ><span class="b12-label" id="labelSicilNo" >Sicil No</span><input Value="" class="k-textbox " id="SicilNo" name="SicilNo" tabindex="1" type="text" value="" /><span class="field-validation-valid" data-valmsg-for="SicilNo" data-valmsg-replace="true"></span></span></td><td style='padding:0px 0px 0px 20px;margin:0px;vertical-align:middle;'><span class="b12-fixed-width" id="containerCiftci_Person_Name" ><span class="b12-label" id="labelCiftci_Person_Name" >Gerçek Kişi Ad</span><input Value="" class="k-textbox " id="Ciftci_Person_Name" name="Ciftci_Person_Name" tabindex="3" type="text" value="" /><span class="field-validation-valid" data-valmsg-for="Ciftci_Person_Name" data-valmsg-replace="true"></span></span></td><td style='padding:0px 0px 0px 20px;margin:0px;vertical-align:middle;'><span class="b12-fixed-width" id="containerCiftci_Person_NationalIdentityNumber" ><span class="b12-label" id="labelCiftci_Person_NationalIdentityNumber" >TC Kimlik No</span><input Value="" class="k-textbox " id="Ciftci_Person_NationalIdentityNumber" name="Ciftci_Person_NationalIdentityNumber" tabindex="5" type="text" value="" /><span class="field-validation-valid" data-valmsg-for="Ciftci_Person_NationalIdentityNumber" data-valmsg-replace="true"></span></span></td></tr><tr style='padding:0px;margin:0px;'><td style='padding:0px;margin:0px;vertical-align:middle;'><span class="b12-fixed-width" id="containerEskiSicilNo" ><span class="b12-label" id="labelEskiSicilNo" >Eski SicilNo</span><input Value="" class="k-textbox " id="EskiSicilNo" name="EskiSicilNo" tabindex="2" type="text" value="" /><span class="field-validation-valid" data-valmsg-for="EskiSicilNo" data-valmsg-replace="true"></span></span></td><td style='padding:0px 0px 0px 20px;margin:0px;vertical-align:middle;'><span class="b12-fixed-width" id="containerCiftci_Person_SurName" ><span class="b12-label" id="labelCiftci_Person_SurName" >Gerçek Kişi Soyad</span><input Value="" class="k-textbox " id="Ciftci_Person_SurName" name="Ciftci_Person_SurName" tabindex="4" type="text" value="" /><span class="field-validation-valid" data-valmsg-for="Ciftci_Person_SurName" data-valmsg-replace="true"></span></span></td><td style='padding:0px 0px 0px 20px;margin:0px;vertical-align:middle;'></td></tr></table></div>
<p id="sayfaMesaj"></p>
</form>
<div id="grid">
</div>
<div id="container" style="visibility:hidden;">
<span class="b12-fixed-width" id="containerIkametgahBuradaMiToCopy">
<select class="b12-combo-customEditor" data-val="true" data-val-required="The IkametgahBuradaMiEditor field is required." id="IkametgahBuradaMiEditor" name="IkametgahBuradaMiEditor"><option value=""></option>
<option value="Evet">Evet</option>
<option value="Hayir">Hayır</option>
</select><span class="field-validation-valid" data-valmsg-for="IkametgahBuradaMiEditor" data-valmsg-replace="true"></span>
</span>
<span class="b12-fixed-width" id="containerKoyMahalleToCopy">
<input type="text" name="KoyMahalleEditor.Exp" id="KoyMahalleEditorExp" class="b12-autocomplete" tabindex="0" />
<input type="hidden" name='KoyMahalleEditor.Id' id='KoyMahalleEditorId' />
<span class="field-validation-valid" data-valmsg-for="KoyMahalleEditor" data-valmsg-replace="true"></span>
</span>
<span class="b12-fixed-width" id="containerDurumToCopy">
<select class="b12-combo-customEditor" data-val="true" data-val-required="The DurumEditor field is required." id="DurumEditor" name="DurumEditor"><option value=""></option>
<option value="Aktif">Aktif</option>
<option value="OnayBekliyor">Onay Bekliyor</option>
<option value="Pasif">Silindi</option>
</select><span class="field-validation-valid" data-valmsg-for="DurumEditor" data-valmsg-replace="true"></span>
</span>
</div>
<script type="text/javascript">
var insertedIds = new Array();
DisableBackspace();
var dataSource = new kendo.data.DataSource({
type: "json", batch: true,
error : function(e){
alert('hata oluştu:' + e.errors);
},
change: function (e) {
if (dataSource.hasChanges()) {
grid.pager.element.hide();
} else {
grid.pager.element.show();
}
},
transport:
{
update: {
url: '/tzob/Tzob/EskiUyeUpdate',
contentType: "application/json; charset=utf-8",
cache: false,
dataType: "json",
type: "POST",
error: function (xhr, ajaxOptions, thrownError) {
alert("error " + xhr.responseText);
}
},
destroy: {
url: '/tzob/Tzob/EskiUyeMatrixDelete',
contentType: "application/json; charset=utf-8",
cache: false,
dataType: "json",
type: "POST"
},
create: {
url: '/tzob/Tzob/EskiUyeUpdate',
contentType: "application/json; charset=utf-8",
cache: false,
dataType: "json",
type: "POST"
},
read:
{
url: '/tzob/Tzob/EskiUyeMatrixList',
type: "GET",
contentType: "application/json; charset=utf-8",
cache: false
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return JSON.stringify({ models: options.models });
}
var $form = $('form').first();
var $inputs = $form.find(':input').not(':input[type="submit"]');
var $checkboxes = $form.find(':input[type="checkbox"]');
$checkboxes.each(function () {
var $checkbox = $(this);
var $hiddenField = $checkbox.next(':input[type="hidden"]');
if ($hiddenField.length > 0) {
if (this.checked) {
$hiddenField.val('true');
} else {
$hiddenField.val('false');
}
}
});
$inputs.each(function () {
if ($(this).val() != '' && (this.name != 'Id')) {
options[this.name] = $(this).val();
}
if (this.type == 'checkbox') {
options[this.name] = this.checked;
}
});
return options;
}
},
schema:
{
data: function (data) {
return data.Sonuclar;
},
total: function (data) {
return data.Total;
},
model: {
id: "Id",
fields: {
Id: { editable: false, nullable: true, type: "string" },
CiftciPersonNationalIdentityNumber: {type:"string" },
CiftciName: {type:"string" , editable: false},
SicilNo: {type:"string" , editable: false},
EskiSicilNo: {type:"string" },
IkametgahBuradaMiEditor: { defaultValue: { Exp: "", Id: "" } },
KoyMahalleEditor: { defaultValue: { Exp: "", Id: "" } },
GirisTarihEski: {type:"date" },
DurumEditor: { defaultValue: { Exp: "", Id: "" } , editable: false},
}
}
},
pageSize: 10,
serverSorting: true,
serverPaging: true
});
var grid = $("#grid").kendoGrid({
sortable: true, navigatable: true,editable: {inline: true, confirmation: 'Kaydı silmek istediğinize emin misiniz?'},
resizable: true,
pageable: {
refresh: true,
pageSize: 10,
messages: b12gridMessages
},
toolbar: [
{
template: kendo.template("<a class=\"k-button k-button-icontext k-grid-_1\" href=\"\\#\">Sorgu</a>")
},
{
name: "save",
text: 'Kaydet'
},
{
name: "cancel",
text: 'Geri Al'
},
{
name: "create",
text: 'Ekle'
},
{
name: "help",
text: 'Yardım'
},
],
columns: [
{
field: "Id",
filterable: false,
width: 50,
hidden: true
},
{
field: "CiftciPersonNationalIdentityNumber",
title: 'TC Kimlik No',
editor: CiftciPersonNationalIdentityNumberFieldEditor,
width: '80px',
},
{
field: "CiftciName",
title: 'Üye',
width: '80px',
},
{
field: "SicilNo",
title: 'Üye SicilNo',
width: '80px',
},
{
field: "EskiSicilNo",
title: 'Eski SicilNo',
width: '80px',
},
{
field: "IkametgahBuradaMiEditor",
title: 'İkametgâh Odası mı',
template: '<span id="IkametgahBuradaMiEditor">#= IkametgahBuradaMiEditor ? (IkametgahBuradaMiEditor.Exp ? IkametgahBuradaMiEditor.Exp : "") : "" # </span>',
editor: IkametgahBuradaMiFieldEditor,
width: '110px',
},
{
field: "KoyMahalleEditor",
title: 'Delegesi Olduğu Köy',
template: '<span id="KoyMahalleEditor">#= KoyMahalleEditor ? (KoyMahalleEditor.Exp ? KoyMahalleEditor.Exp : "") : "" # </span>',
editor: KoyMahalleFieldEditor,
width: '110px',
},
{
field: "GirisTarihEski",
title: 'Giriş Tarihi',
width: '80px',
format: "{0:dd.MM.yyyy}",
editor: dateTimeEditor
},
{ command: [{ id: "btnUyeIslem", name: "btnUyeIslem", text: 'Üye İşlem Kayıt', click: function(e) {var dataItem = this.dataItem($(e.currentTarget).closest('tr'));UyeIslemKayit(dataItem);} }], title: " ", width: 100 },
{ command: [{ id: "btnUyeBorco", name: "btnUyeBorco", text: 'Üye Borç Kayıt', click: function(e) {var dataItem = this.dataItem($(e.currentTarget).closest('tr'));UyeBorcKayit(dataItem);} }], title: " ", width: 100 },
{
field: "DurumEditor",
title: 'Durum',
template: '<span id="DurumEditor">#= DurumEditor ? (DurumEditor.Exp ? DurumEditor.Exp : "") : "" # </span>',
editor: DurumFieldEditor,
width: '110px',
},
{ command: [{ name: "destroy", text: 'Sil' }], title: " ", width: 90 }
],
dataBound: dataBoundFunc,
dataSource: dataSource,
selectable: "multiple, row"
}).data("kendoGrid");
function dateTimeEditor(container, options) {
$('<input name ="' +options.field + '" data-text-field="' + options.field + '" data-value-field="' + options.field + '" data-bind="value:' + options.field + '" data-format="' + options.format + '"/>')
.appendTo(container)
.mask("99.99.9999")
.kendoDatePicker({});
}
function CiftciPersonNationalIdentityNumberFieldEditor(container, options) {
$('<input name="' + options.field + '" class="k-textbox"/>')
.appendTo(container)
.mask("99999999999");
}
function IkametgahBuradaMiFieldEditor(container, options) {
var IkametgahBuradaMiType = $('#containerIkametgahBuradaMiToCopy').clone(true, true);
IkametgahBuradaMiType.find('.b12-combo-customEditor').
attr('data-value-field', 'Id').attr('data-text-field', 'Exp').
attr('data-role', 'dropdownlist').attr('style', "display: none;").
attr('data-bind', 'value: IkametgahBuradaMiEditor');
IkametgahBuradaMiType
.appendTo(container);
}
function KoyMahalleFieldEditor(container, options) {
var inputType = $('#containerKoyMahalleToCopy').clone(true, true);
inputType.find('#KoyMahalleEditorId').attr('data-bind', 'value: ' + options.field + '').appendTo(container);
inputType.find('#KoyMahalleEditorExp').appendTo(container)
.appendTo(container)
.kendoAutoComplete({
dataSource: {
type: "json",
serverFiltering: true,
serverPaging: true,
pageSize: 20,
transport: {
read: '/tzob/Tzob/GetKoyMahalleAutoCompleteForEskiUyeMatrix' + '?filterStmt=' + "(( e.Id in (Select id from Address a where a.Parent in (( Select Ilce FROM OdaIlce o WHERE o.IlceDurum= 'Aktif' and o.Oda.Kod=e.Profile.Code )))) )",
}
},
filter: "contains",
valuePrimitive: true,
dataTextField: "Description",
template: '<span class="k-state-default">#: data.SecondParam #</span>',
select: function (e) {
var dataItem = this.dataItem(e.item.index());
var grid = $("#grid").data("kendoGrid");
var currentSelection = grid.select();
var $tr = currentSelection.closest("tr");
var $cell = $tr.find('#KoyMahalleEditor').closest('td');
grid.editCell($cell);
var KoyMahalle = {
Exp: dataItem.SecondParam,
Id: dataItem.Id
};
var newDataItem = grid.dataItem($tr);
newDataItem.set('KoyMahalleEditor', KoyMahalle);
valid = true;
}
});
}
function DurumFieldEditor(container, options) {
var DurumType = $('#containerDurumToCopy').clone(true, true);
DurumType.find('.b12-combo-customEditor').
attr('data-value-field', 'Id').attr('data-text-field', 'Exp').
attr('data-role', 'dropdownlist').attr('style', "display: none;").
attr('data-bind', 'value: DurumEditor');
DurumType
.appendTo(container);
}
var blankUrl = '/tzob/PublicUser/BlankPage';
$(".k-pager-refresh", "#grid").bind("click", function (ev) {
insertedIds = new Array();
});
$(".k-grid-_1", "#grid").bind("click", function (ev) {
insertedIds = new Array();
var grid = $('#grid').data("kendoGrid");
grid.dataSource.read();
});
$(".k-grid-help", "#grid").bind("click", function (ev) {
var request = new XMLHttpRequest;
var htmUrl = baseUrl + "Help/EskiUyeMatrix.htm";
request.open("GET", htmUrl, false);
request.send();
if (request.status == 200) {
pageJs.openHelp(htmUrl);
}
else {
pageJs.openHelp(baseUrl + "Help/Default.htm");
}
});
$("#Ciftci_Person_NationalIdentityNumber").mask("99999999999");
var clickedLovButton;
$("#CiftciPersonNationalIdentityNumber").mask("99999999999");
var lastId;
var isInserted = false;
pageJs.pageQueryInit();
</script>
<style>
.k-dropdown {
width: 130px;
}
.k-grid {
font-size: 10px;
}
</style>
<script type="text/javascript">
//$("#query").kendoTooltip({
// content: "F6",
// position: "top"
//});
//$("#saveChanges").kendoTooltip({
// content: "F4",
// position: "top"
//});
//$("#cancelChanges").kendoTooltip({
// content: "F5",
// position: "top"
//});
//$("#insert").kendoTooltip({
// content: "F3",
// position: "top"
//});
$("#sayfaMesaj").text("Sorgu - F6 , Kaydet - F4 , Geri Al - F5 , Ekle - F3");
$('body').trigger('GridResize');
/////////// tuş işlemleri ///////////////
if (window.document.addEventListener) {
window.document.addEventListener("keydown", avoidInvalidKeyStorkes, false);
} else {
window.document.attachEvent("onkeydown", avoidInvalidKeyStorkes);
document.captureEvents(Event.KEYDOWN);
}
function avoidInvalidKeyStorkes(evtArg) {
var evt = (document.all ? window.event : evtArg);
var isIE = (document.all ? true : false);
var KEYCODE = (document.all ? window.event.keyCode : evtArg.which);
var CTRL = (document.all ? window.event.ctrlKey : evtArg.ctrlKey);
var ALT = (document.all ? window.event.altKey : evtArg.altKey);
var element = (document.all ? window.event.srcElement : evtArg.target);
var msg = "We have disabled this key[New]";
//if (KEYCODE == 8) { //Backspace pressed
// if (element.type == "text" || element.type == "textarea" || element.type == "password" || element.type == "file") {
// return true;
// } else {
// if (isIE) {
// evt.keyCode = 0;
// evt.returnValue = false;
// window.status = msg;
// } else {
// evt.preventDefault();
// evt.stopPropagation();
// //alert(msg);
// }
// return false;
// }
//}
//if (CTRL) { // Enable Copy Paste
// if (KEYCODE == 67 || KEYCODE == 99 || // Ctrl+C Enabling Copy
// KEYCODE == 86 || KEYCODE == 118 || // Ctrl+V Enabling Paste
// KEYCODE == 88 || KEYCODE == 120) { // Ctrl+X Enabling Cut
// return true;
// } else {
// if (isIE) {
// evt.returnValue = false;
// evt.keyCode = 0;
// window.status = msg;
// } else {
// evt.preventDefault();
// evt.stopPropagation();
// alert(msg);
// }
// return false;
// }
//}
//if (ALT) {
// if (isIE) {
// evt.returnValue = false;
// evt.keyCode = 0;
// window.status = msg;
// } else {
// evt.preventDefault();
// evt.stopPropagation();
// alert(msg);
// }
//}
switch (KEYCODE) {
//case 112: //F1
//case 113: //F2
case 114: //F3
case 115: //F4
case 116: //F5
case 117: //F6
case 118: //F7
case 119: //F8
//case 120: //F9
//case 121: //F10
//case 122: //F11
//case 123: //F12
//case 27: //ESCAPE
if (isIE) {
evt.returnValue = false;
evt.keyCode = 0;
//window.status = msg;
} else {
evt.preventDefault();
evt.stopPropagation();
//alert(msg);
}
break;
//default:
// window.status = "Done";
}
var grida = $("#grid").data("kendoGrid");
switch (KEYCODE) {
case 114: //F3
if ($("#grid").data("kendoGrid").dataSource.hasChanges()) {
addControl = true;
$("#grid").data("kendoGrid").saveChanges();
return false;
}
else
grida.addRow();
break;
case 115: //F4
grida.saveChanges();
break;
case 116: //F5
grida.cancelChanges();
break;
case 117: //F6
grida.dataSource.read();
break;
case 118: //F7
case 119: //F8
}
}
/////////////////////////////////////////
var lastTc = 0;
var uyeislemkaydet = false;
var uyeborckaydet = false;
var lastuid = "";
var islemyapilantc = "";
/////////////////////////////// ekleme işlemi kontrolleri ///////////////////////////////7
var addControl = false;
// $("#grid").data("kendoGrid").bind("requestStart", dataSource_requestStart);
$(function () {
var grd = $("#grid").data("kendoGrid");
grd.wrapper.find(".k-grid-add").unbind("click");
grd.wrapper.find(".k-grid-add").on("click", function (e) {
// debugger;
e.preventDefault();
if (grd.options.editable) { //editable check
if (grd.dataSource.hasChanges()) {
addControl = true;
grd.saveChanges();
return false;
}
//use timeout in case multiple click
//clearTimeout(grd._adding);
//setTimeout(function () {
// if (requestEndResponse.errors != undefined) {
// return false;
// }
//}, 5000);
}
});
});
dataSource.bind("requestStart", function (e) {
// debugger;
var response = e.response;
var type = e.type;
});
dataSource.bind("requestEnd", function (e) {
if (addControl && (e.type == "create" || e.type == "update")) {
var grd = $("#grid").data("kendoGrid");
if (e.response.errors == undefined) {
grd.addRow();
addControl = false;
}
}
// sadece satır güncellemesi için yapıldı ama calısmadı
//if (e.type == "create" || e.type == "update") {
// debugger;
// var grd = $("#grid").data("kendoGrid");
// if (e.response.errors == undefined) {
// //e.sender.read();
// this.read();
// }
//}
});
////////////////////////////////////////////////////////////////////////////////////777
//lastId = "0";
//$(".k-grid-_1").wrap("<span id=query></div>");
//$(".k-grid-save-changes").wrap("<span id =saveChanges ></div>");
//$(".k-grid-cancel-changes").wrap("<span id =cancelChanges ></div>");
//$(".k-grid-add").wrap("<span id =insert ></div>");
$(document).ready(function () {
//$("#query").kendoTooltip({
// content: "F6",
// position: "top"
//});
//$("#saveChanges").kendoTooltip({
// content: "F4",
// position: "top"
//});
//$("#cancelChanges").kendoTooltip({
// content: "F5",
// position: "top"
//});
//$("#insert").kendoTooltip({
// content: "F3",
// position: "top"
//});
});
$("#grid .k-grid-header-wrap") //header k-grid-header-wrap
.find("colgroup col")
.eq(0)
.css({ width: "100px" });
$("#grid .k-grid-content") //content
.find("colgroup col")
.eq(0)
.css({ width: "100px" });
$("#grid .k-grid-header-wrap") //header k-grid-header-wrap
.find("colgroup col")
.eq(2)
.css({ width: "70px" });
$("#grid .k-grid-content") //content
.find("colgroup col")
.eq(2)
.css({ width: "70px" });
$("#grid .k-grid-header-wrap") //header k-grid-header-wrap
.find("colgroup col")
.eq(3)
.css({ width: "70px" });
$("#grid .k-grid-content") //content
.find("colgroup col")
.eq(3)
.css({ width: "70px" });
$("#grid .k-grid-header-wrap") //header k-grid-header-wrap
.find("colgroup col")
.eq(5)
.css({ width: "170px" });
$("#grid .k-grid-content") //content
.find("colgroup col")
.eq(5)
.css({ width: "170px" });
//$(document).keydown(function (e) {
// var grida = $("#grid").data("kendoGrid");
// var key = (e.keyCode ? e.keyCode : e.charCode);
// // f2
// if (key == 114) {
// e.preventDefault();
// //grida.addRow();
// if ($("#grid").data("kendoGrid").dataSource.hasChanges()) {
// addControl = true;
// $("#grid").data("kendoGrid").saveChanges();
// return false;
// }
// else
// grida.addRow();
// }
// // shift g
// if (key == 71 && e.shiftKey && e.ctrlKey) {
// grida.cancelChanges();
// }
// // shift k
// if (key == 115) {
// grida.saveChanges();
// }
// // shift s
// if (key == 83 && e.shiftKey && e.ctrlKey) {
// grida.dataSource.read();
// }
//});
//$("#grid .k-grid-header-wrap") //header k-grid-header-wrap
// .find("colgroup col")
// .eq(6)
// .css({ width: "70px" });
//$("#grid .k-grid-content") //content
// .find("colgroup col")
// .eq(6)
// .css({ width: "70x" });
//var gridDS = $("#grid").data("kendoGrid").dataSource;
//gridDS.bind("change", gridchange);
//var gridD = $("#grid").data("kendoGrid");
//gridD.bind("change", gridchange);
//var gridchange = function (e) {
// debugger;
// var gridt = $("#grid").data("kendoGrid");
// var dataItem = gridt.dataItem(gridt.select());
// lastTc = dataItem.CiftciPersonNationalIdentityNumber;
//}
//function gridchange(e) {
// debugger;
// var gridt = $("#grid").data("kendoGrid");
// var dataItem = gridt.dataItem(gridt.select());
// lastTc = dataItem.CiftciPersonNationalIdentityNumber;
//}
if ($('#grid').data() != null){
$('#grid').data().kendoGrid.dataSource.bind('change', function (e) {
if (e.action == "sync") {
if (uyeislemkaydet) {
if (e.items[0].Id != null) {
lastuid = e.items[0].uid;
UyeIslemEkranAc(e.items[0].Id.toString());
}
uyeislemkaydet = false;
}
if (uyeborckaydet) {
if (e.items[0].Id != null) {
lastuid = e.items[0].uid;
UyeBorcEkranAc(e.items[0].Id.toString());
}
uyeborckaydet = false;
}
//lastId = "";
//for (var i = 0; i < e.items.length; i++) {
// if (e.items[i].CiftciPersonNationalIdentityNumber == lastTc)
// lastId = e.items[i].Id;
//}
}
//if (e.action == "itemchange") {
// if (e.field = "CiftciPersonNationalIdentityNumber") {
// }
//}
});
}
//g.bind("saveChanges", function (e) {
// var gridt = $("#grid").data("kendoGrid");
// var dataItem = gridt.dataItem(gridt.select());
// lastTc = dataItem.CiftciPersonNationalIdentityNumber;
//});
var g = $("#grid").data("kendoGrid");
g.bind("edit", function (e) {
if (e.model.isNew() && !e.model.dirty) {
//debugger;
lastTc = "";
//debugger;
//var aa = {
// Id: "Person",
// Exp: "Person"
//};
//e.model.fields["Ciftci_ActorTypeEditor"].editable = true;
//e.model.set("Ciftci_ActorTypeEditor", aa);
//e.model.fields["Ciftci_ActorTypeEditor"].editable = false;
e.model.set("GirisTarihEski", null);
e.model.set("IkametgahBuradaMiEditor.Exp", "Evet");
e.model.set("IkametgahBuradaMiEditor.Id", "Evet");
$('#grid').data("kendoGrid").tbody.find("tr[data-uid='" + e.model.uid + "']")[0].children[5].children.IkametgahBuradaMiEditor.innerHTML = "Evet";
}
else {
// tc değiştirmesi engellenmesi için
if (e.model.Id != null && e.model.Id != '' && e.model.Id != "" && e.model.Id != '0') {
var fieldName = e.container.find("input").attr("name");
if (fieldName == "CiftciPersonNationalIdentityNumber" ) {
this.closeCell();
}
if (fieldName == "GirisTarihEski" && e.model.GirisTarihEski != null) {
this.closeCell();
}
}
}
});
if ($('#grid').data() != null) {
$('#grid').data().kendoGrid.dataSource.bind('change', function (e) {
if (e.action == "remove") {
$("#grid").data("kendoGrid").saveChanges();
}
});
}
// satırda değişiklik kontrolleri
g.bind("save", function (e) {
if (e.values.CiftciPersonNationalIdentityNumber && e.model.CiftciPersonNationalIdentityNumber != e.values.CiftciPersonNationalIdentityNumber) {
if (e.values.CiftciPersonNationalIdentityNumber != undefined && e.values.CiftciPersonNationalIdentityNumber.length == 11) {
//debugger;
if (lastTc != e.values.CiftciPersonNationalIdentityNumber) {
lastTc = e.values.CiftciPersonNationalIdentityNumber;
//TcKontrol(e.values.Ciftci_Person_NationalIdentityNumber);
$.ajax({
url: '/tzob/Tzob/TcKontrol',
data: { tckimlik: e.values.CiftciPersonNationalIdentityNumber },
async: false
}).done(function (data) {
if (data.success) {
e.model.fields["CiftciName"].editable = true;
e.model.set("CiftciName", data.AdSoyad);
e.model.fields["CiftciName"].editable = false;
if (data.message == "") {
$('#grid').data('kendoGrid').refresh();
setTimeout(function () { //refocusing the cell
return function () {
var lastCell = $("#grid tr[data-uid='" + e.model.uid + "'] td:nth-child(" + 5 + ")");
//var lastCell = $('#grid').data('kendoGrid').tbody.find("tr:first td:first");
$('#grid').data('kendoGrid').current(lastCell);
$('#grid').data('kendoGrid').table.focus();
$('#grid').data('kendoGrid').editCell(lastCell);
var e3 = $.Event('keypress', { keyCode: 13 });
lastCell.trigger(e3);
//var focusedCell = $("#grid tr[data-uid='" + e.model.uid + "'] td:nth-child("+ 3 + ")")
//$('#grid').data('kendoGrid').editCell(focusedCell);
}
}(), 200);
}
else {
$.when(kendo.ui.ExtAlertDialog.show({
title: "Mesaj",
message: data.message,
icon: "k-ext-information"
})).done(function () {
$('#grid').data('kendoGrid').refresh();
setTimeout(function () { //refocusing the cell
return function () {
var lastCell = $("#grid tr[data-uid='" + e.model.uid + "'] td:nth-child(" + 5 + ")");
$('#grid').data('kendoGrid').current(lastCell);
$('#grid').data('kendoGrid').table.focus();
$('#grid').data('kendoGrid').editCell(lastCell);
setTimeout(function () {
var e5 = $.Event('keypress', { keyCode: 13 });
lastCell.trigger(e5);
}, 300);
//var focusedCell = $("#grid tr[data-uid='" + e.model.uid + "'] td:nth-child("+ 3 + ")")
//$('#grid').data('kendoGrid').editCell(focusedCell);
}
}(), 200);
});
// ok tuşuna focuslanması için
setTimeout(function () {
$('#extAlertDialog').parent().find(".k-button").focus();
}, 500);
}
//e.model.set("CiftciPersonNationalIdentityNumber", e.values.CiftciPersonNationalIdentityNumber)
}
else {
//lastTc = "";
//e.model.set("Ciftci_Person_NationalIdentityNumber", 0);
$.when(kendo.ui.ExtAlertDialog.show({
title: "Mesaj",
message: data.message,
icon: "k-ext-information"
})).done(function () {
$('#grid').data('kendoGrid').refresh();
setTimeout(function () { //refocusing the cell
return function () {
var lastCell = $("#grid tr[data-uid='" + e.model.uid + "'] td:nth-child(" + 2 + ")");
$('#grid').data('kendoGrid').current(lastCell);
$('#grid').data('kendoGrid').table.focus();
$('#grid').data('kendoGrid').editCell(lastCell);
setTimeout(function () {
var e5 = $.Event('keypress', { keyCode: 13 });
lastCell.trigger(e5);
}, 300);
//var focusedCell = $("#grid tr[data-uid='" + e.model.uid + "'] td:nth-child("+ 3 + ")")
//$('#grid').data('kendoGrid').editCell(focusedCell);
}
}(), 200);
});
// ok tuşuna focuslanması için
setTimeout(function () {
$('#extAlertDialog').parent().find(".k-button").focus();
}, 500);
//Dialog2Message(data.message).done(function () {
// $('#grid').data('kendoGrid').refresh();
// setTimeout(function () { //refocusing the cell
// return function () {
// //var lastCell = $('#grid').data('kendoGrid').tbody.find("tr:first td:first");
// $('#grid').data('kendoGrid').current(lastCell);
// $('#grid').data('kendoGrid').table.focus();
// $('#grid').data('kendoGrid').editCell(lastCell);
// var e3 = $.Event('keypress', { keyCode: 13 });
// lastCell.trigger(e3);
// //var focusedCell = $("#grid tr[data-uid='" + e.model.uid + "'] td:nth-child("+ 3 + ")")
// //$('#grid').data('kendoGrid').editCell(focusedCell);
// }
// }(), 200);
//});
}
});
}
}
}
});
function TcKontrol(tckimlik) {
$.ajax({
url: '/tzob/Tzob/TcKontrol',
data: { tckimlik: tckimlik },
async: false
}).done(function (data) {
var grid = $("#grid").data("kendoGrid");
var currentSelection = grid.select();
var $tr = currentSelection.closest("tr");
var $cell = $tr.find("td:eq(1)");
grid.editCell($cell);
var dataItem = grid.dataItem($tr);
if (data.success) {
dataItem.set("CiftciName", data.AdSoyad);
}
else {
DialogMessage(data.message);
dataItem.set("CiftciPersonNationalIdentityNumber", 0);
}
});
}
function UyeIslemKayit(dataItem) {
var uyeid = "";
if (dataItem.Id != null && dataItem.Id != "") {
lastuid = dataItem.uid;
islemyapilantc = dataItem.CiftciPersonNationalIdentityNumber;
UyeIslemEkranAc(dataItem.Id.toString());
//lastId = dataItem.Id;
}
else {
uyeislemkaydet = true;
grid.saveChanges();
}
}
function UyeIslemEkranAc(uyeid) {
var targetUrl = '/tzob/Tzob/EskiUyeIslemMatrix' + "?UyeId=" + uyeid;
var width = '1200px';
var height = '370px';
pageJs.openWindow(targetUrl, blankUrl, 'Üye İşlem', width, height);
}
function UyeBorcKayit(dataItem) {
if (dataItem.Id != null && dataItem.Id != "") {
lastuid = dataItem.uid;
UyeBorcEkranAc(dataItem.Id.toString());
}
else {
//DialogMessage("Lütfen üye kaydı yapıldıktan sonra üye borç kaydı yapınız!");
uyeborckaydet = true;
grid.saveChanges();
}
}
function UyeBorcEkranAc(uyeid) {
var targetUrl = '/tzob/Tzob/EskiUyeAidatMatrix' + "?UyeId=" + uyeid.toString();
var width = '1200';
var height = '370px';
pageJs.openWindow(targetUrl, blankUrl, 'Üye Borç', width, height);
}
function Dialog2Message(message) {
$.when(kendo.ui.ExtAlertDialog.show({
title: "Mesaj",
message: message,
icon: "k-ext-information"
})
);
setTimeout(function () {
$('#extAlertDialog').parent().find(".k-button").focus();
}, 500);
// $('#extAlertDialog').siblings().find("k-ext-dialog-buttons").find("k-button").focus();
//$('#extAlertDialog').parent().find(".k-button").focus();
//var e3 = $.Event('keypress', { keyCode: 9 });
//$('#extAlertDialog').parent().parent().trigger(e3);
}
$('body').bind('EkranKapandi', function (e, insertMode, insertedId) {
if (islemyapilantc != "") {
//$('#grid').data('kendoGrid').refresh();
setTimeout(function () { //refocusing the cell
return function () {
var data = $("#grid").data().kendoGrid.dataSource._data;
for (var i = 0; i < data.length; i++) {
if (data[i].CiftciPersonNationalIdentityNumber == islemyapilantc) {
// debugger;
$("#grid").data("kendoGrid").clearSelection();
var rowset = $("#grid").data("kendoGrid").tbody.find("tr[data-uid='" + data[i].uid + "']");
$("#grid").data("kendoGrid").select(rowset);
islemyapilantc = "";
var lastCell = $("#grid tr[data-uid='" + data[i].uid + "'] td:nth-child(" + 1 + ")");
//var lastCell = $('#grid').data('kendoGrid').tbody.find("tr:first td:first");
$('#grid').data('kendoGrid').current(lastCell);
$('#grid').data('kendoGrid').table.focus();
$('#grid').data('kendoGrid').editCell(lastCell);
var e9 = $.Event('keypress', { keyCode: 13 });
lastCell.trigger(e9);
break;
}
}
////$("#grid").data("kendoGrid").clearSelection();
////var rowset = $("#grid").data("kendoGrid").tbody.find("tr[data-uid='" + lastuid + "']");
////$("#grid").data("kendoGrid").select(rowset);
//var lastCell = $("#grid tr[data-uid='" + lastuid + "'] td:nth-child(" + 1 + ")");
////var lastCell = $('#grid').data('kendoGrid').tbody.find("tr:first td:first");
//$('#grid').data('kendoGrid').current(lastCell);
//$('#grid').data('kendoGrid').table.focus();
//$('#grid').data('kendoGrid').editCell(lastCell);
//var e9 = $.Event('keypress', { keyCode: 13 });
//lastCell.trigger(e9);
////var focusedCell = $("#grid tr[data-uid='" + e.model.uid + "'] td:nth-child("+ 3 + ")")
////$('#grid').data('kendoGrid').editCell(focusedCell);
}
}(), 600);
}
});
</script>
</body>
</html>