function initialAdvanceSearchParameters() {
    AdvanceSearchParameterChangeTokendoDatePicker("#BeginDateFrom");
    AdvanceSearchParameterChangeTokendoDatePicker("#BeginDateTo");
    AdvanceSearchParameterChangeTokendoDatePicker("#EndDateFrom");
    AdvanceSearchParameterChangeTokendoDatePicker("#EndDateTo");
    AdvanceSearchParameterChangeTokendoDatePicker("#txtSuccessorStartDate");
    AdvanceSearchParameterChangeTokendoDatePicker("#txtSuccessorEndDate");
}
function AdvanceSearchParameterChangeTokendoDatePicker(selector) {
    if ($(selector).is('input'))
        if (selector == "#SchedulerSelectedDate") {
            //$(selector).kendoMaskedTextBox({
            //    mask: "00/00/0000",
            //    value: "1396/11/01"
            //});
            $(selector).kendoDatePicker({
                culture: 'fa-IR',
                value: '',
                format: "yyyy/MM/dd",
                //dateInput: true,
                //min: new Date(1300, 01, 01),
                //max: new Date(1490, 12, 29),
                change: Scheduler_OnChangeDate
            });
        }
        else {
            //$(selector).kendoMaskedTextBox({
            //    mask: "00/00/0000",
            //    value: "1396/11/01"
            //});
            $(selector).kendoDatePicker({
                culture: 'fa-IR',
                format: "yyyy/MM/dd",
                //dateInput: true,
                //min: new Date(1300, 01, 01),
                //max: new Date(1490, 12, 29),
                //change: function () {
                //    var value = this.value();
                //    console.log(value);
                //}
                ////value: ''
            });
        }
}
function GetAdvanceSearchParameters() {
    var WFIID = $('#WorkflowInstaceID').val()
        , WFName = ''
        , WFID = $('#WorkflowName').val()
        , WFStatus = $('#WorkflowStatus').val()
        //, StarterUserID = $('#StarterUser').data('kendoAutoComplete').value()
        , StarterUserID = $('#StarterUser').val()
        , CreateDateFrom = $('#BeginDateFrom').val()
        , CreateDateTo = $('#BeginDateTo').val()
        , EndDateFrom = $('#EndDateFrom').val()
        , EndDateTo = $('#EndDateTo').val()
        , MaxRecords = $('#MaxResultRecord').val()
    var ReturnResult = {
        WorkflowInsId: WFIID
            , WorkflowInsName: WFName
            , WorkflowId: WFID
            , WfInsStatus: WFStatus
            , StarterUserId: StarterUserID
            , CreateDateFrom: CreateDateFrom
            , CreateDateTo: CreateDateTo
            , EndDateFrom: EndDateFrom
            , EndDateTo: EndDateTo
            , MaxRecords: MaxRecords
           , __RequestVerificationToken: $('input[name=__RequestVerificationToken]').val()
    };
    return ReturnResult;
}


function GetfavParameters() {
    var WFIID = $('#FWorkflowInstaceID').val()
        , WFName = ''
        , WFID = $('#FWorkflowName').val()
        , WFStatus = $('#FWorkflowStatus').val()
    var ReturnResult = {
        WorkflowInsId: WFIID
        , WorkflowInsName: WFName
        , WorkflowId: WFID
        , WfInsStatus: WFStatus
        , __RequestVerificationToken: $('input[name=__RequestVerificationToken]').val()
    };
    return ReturnResult;
}


function getAdvanceSearchStarterUser() {
    return {
        LikeName: $('#StarterUser').data('kendoAutoComplete').value()
        , __RequestVerificationToken: $('input[name=__RequestVerificationToken]').val()
    }
}
function getAdvanceSearchSenderUser() {
    return {
        LikeName: $('#SenderUser').data('kendoAutoComplete').value()
    }
}
function getAdvanceSearchRecipientUser() {
    return {
        LikeName: $('#RecipientUser').data('kendoAutoComplete').value()
    }
}
function GetSuccessorSearchParameters() {
    return {
        SuccessorId: $('#ddlUser_SuccessorFilter').data('kendoDropDownList').value()
        , startDate: $('#txtSuccessorStartDate').val()
        , endDate: $('#txtSuccessorEndDate').val()
}
}

function getShowAllTaskSuccessor() {
    return {        
        IsShowAllTaskSuccessor: $('#chkShowAllTaskSuccessor').is(':checked')
        , "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val()
    }
}

function getShowAllTaskSuccessorManagement() {
    return {
        IsShowAllTaskSuccessor: $('#chkShowAllTaskSuccessor').is(':checked')
        , "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val()
    }
}

function ShowSearchRes() {
    $('#grdAdvanceSearchResult').data('kendoGrid').dataSource.read();
}

function ShowSearchOnFavouriteTasks() {
    $('#grdFavouriteWFIResult').data('kendoGrid').dataSource.read();
}

function SuccessorSearchResult()
{
    $('#grdSuccessorSearchResult').data('kendoGrid').dataSource.read();
}
function ClearSearchParams() {
    $('#WorkflowInstaceID').val('');
    $('#WorkflowName').data('kendoDropDownList').value('-1');
    $('#WorkflowStatus').data('kendoDropDownList').value('-1');
    $('#StarterUser').val('');
    $('#BeginDateFrom').val('');
    $('#BeginDateTo').val('');
    $('#EndDateFrom').val('');
    $('#EndDateTo').val('');
}
function ClearFavouriteSearchParams() {
    $('#FWorkflowInstaceID').val('');
    $('#FWorkflowName').data('kendoDropDownList').value('-1');
    $('#FWorkflowStatus').data('kendoDropDownList').value('-1');
}