﻿/*
    查询
*/

/*
    常用
*/

function getColumn(ID, column)
{
    ID = String(ID);
    var arr = column.split('.');
    return ascx_AjaxUtil.GetColumn('[' + arr[0] + ']', ID, arr[1]).value;
}

function getBreed(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getBreed', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getBreed', ID, text).value;
    }
}
function getCity(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getCity', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getCity', ID, text).value;
    }
}
function getSteelMill(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getSteelMill', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getSteelMill', ID, text).value;
    }
}

function getBreedAllArray()
{
    return ascx_AjaxUtil.GetArray('getBreedAllArray', 'Categoryname', 'ID').value;
}
function getBreedList()
{
    return ascx_AjaxUtil.GetList('getBreedList').value;
}
function getCityList()
{
    return ascx_AjaxUtil.GetList('getCityList').value;
}
function getCityListByBreed(param)
{
    param = String(param);
    return ascx_AjaxUtil.GetListByParameter('getCityListByBreed', param).value;
}
function getSteelMillList()
{
    return ascx_AjaxUtil.GetList('getSteelMillList').value;
}

/*
    用户
*/

function getUser(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getUser', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getUser', ID, text).value;
    }
}

function getUserByName(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getUserByName', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getUserByName', ID, text).value;
    }
}

function getUserList()
{
    value = 'ID';
    text = 'Name';
    return ascx_AjaxUtil.GetArray('getUserList', text, value).value;
} 

function getUserCompleteList()
{
    var reArr = new Array();
    var keywordArr = getUserList();
    for (var i = 0; i < keywordArr.length; i++)
    {
        reArr[i] = keywordArr[i].split(',')[0];
    }
    return reArr;
} 

/*
    修改
*/

/*
    根据参数更新对象状态
*/

function updUser(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('updUser', param).value;
}

function updUserPassword(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('updUserPassword', param).value;
}

/*
    添加
*/

/*
    根据用户ID设置对象文件夹
*/

function setUserFolder(userID)
{
    userID = parseInt(userID);
    return ascx_AjaxUtil.SetUserFolder(userID).value;
}

/*
    删除
*/

/*
    根据用户ID删除对象文件夹
*/

function delUserFolder(userID)
{
    userID = parseInt(userID);
    return ascx_AjaxUtil.DelUserFolder(userID).value;
}

/*
    删除指定用户
*/

function delUser(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('delUser', param).value;
}
/*
    服务
*/

//短信服务价格
function getSMSServicePriceListByUserID(param)
{
    param = String(param);
    return ascx_AjaxUtil.GetListByParameter('getSMSServicePriceListByUserID', param).value;
}

//短信服务价格
function getSMSServicePriceListByParentID(param)
{
    param = String(param);
    return ascx_AjaxUtil.GetListByParameter('getSMSServicePriceListByParentID', param).value;
}

//服务价格
function getServicePrice(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getServicePrice', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getServicePrice', ID, text).value;
    }
}

//删除服务记录
function delService(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('delService', param).value;
}

//删除服务价格
function delServicePrice(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('delServicePrice', param).value;
}

//删除服务备注
function delServiceRecord(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('delServiceRecord', param).value;
}

/*
    钢材市场
*/

function getSteelMarket(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getSteelMarket', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getSteelMarket', ID, text).value;
    }
}

/*
    博客
*/

function getBlog(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getBlog', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getBlog', ID, text).value;
    }
}

/*
    模板
*/

function getTemplate(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getTemplate', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getTemplate', ID, text).value;
    }
}

function getTemplateList()
{
    return ascx_AjaxUtil.GetList('getTemplateList').value;
}

function getTemplateListByParameter(param)
{
    param = String(param);
    return ascx_AjaxUtil.GetListByParameter('getTemplateListByParameter', param).value;
}

/*
    搜索
*/

function getKeywordList()
{
    value = 'ID';
    text = 'Keywordname';
    return ascx_AjaxUtil.GetArray('getKeywordList', text, value).value;
} 

function getKeywordCompleteList()
{
    var reArr = new Array();
    var keywordArr = getKeywordList();
    for (var i = 0; i < keywordArr.length; i++)
    {
        reArr[i] = keywordArr[i].split(',')[0];
    }
    return reArr;
} 

/*
    菜单
*/

function changeDropList(child, parent, key, param, text, value, select)
{
    var item = new Array();
    if (parent == null)
    {
        if (param == null)
        {
            item = ascx_AjaxUtil.GetArray(key, text, value).value;
        }
        else
        {
            item = ascx_AjaxUtil.GetArrayByParameter(key, param, text, value).value;
        }
    }
    else
    {
        parent = document.getElementById(parent).value;
        item = ascx_AjaxUtil.GetArrayByParameter(key, parent, text, value).value;
    }
    child = document.getElementById(child);
    child.options.length = 0;
    for (var i = 0; i < item.length; i++)
    {
        var arr = item[i].split(',');
        child.options.add(new Option(arr[0], arr[1]));
        if (typeof(select) != 'undefined')
        {
            if (arr[1] == select)
            {
                child.options[i].selected = true;
                child.value = select;
            }
        }
    }
}

function selectDropList(child, parent)
{
    var value = document.getElementById(parent).value;
    if (value.length > 0)
    {
        document.getElementById(child).value = value;
    }
}

function initializeDropList(sun, child, parent, sunKey, childKey, parentKey, column, text, value)
{
    var param = document.getElementById(parentKey) == null ? null : document.getElementById(parentKey).value;
    var ID = document.getElementById(sun).value;
    if (ID.length > 0)
    {
        var PID = ascx_AjaxUtil.GetColumn(sunKey, ID, column).value;
        changeDropList(parent, null, (param == null ? parentKey : childKey), param, text, value, PID);
        changeDropList(child, parent, childKey, null, text, value, ID);
        selectDropList(sun, child);
    }
    else
    {
        changeDropList(parent, null, (param == null ? parentKey : childKey), param, text, value);
        changeDropList(child, parent, childKey, null, text, value);
        selectDropList(sun, child);
    }
}

/*
    品种菜单
*/

function getBreedTemplate(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getBreedTemplate', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getBreedTemplate', ID, text).value;
    }
}

function getBreedTemplateList()
{
    return ascx_AjaxUtil.GetList('getBreedTemplateList').value;
}

function getBreedTemplateListByParameter(param)
{
    param = String(param);
    return ascx_AjaxUtil.GetListByParameter('getBreedTemplateListByParameter', param).value;
}


/*
    修改
*/

/*
    模板
*/

function updTemplate(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('updTemplate', param).value;
}

/*
    钢材市场
*/

function updSteelMarketLatLng(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('updSteelMarketLatLng', param).value;
}

/*
    服务
*/

function updServicePriceState(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('updServicePriceState', param).value;
}

function updServicePriceParentID(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('updServicePriceParentID', param).value;
}

/*
    Admin
    管理员
*/

/*
    查询
*/

/*
    根据类型查询管理员数组
    param:类型
*/
function getAdminArrayByClass(param)
{
    var value = 'ID';
    var text = 'People';
    var key = 'getAdminArrayByClass';
    param = String(param);
    return ascx_AjaxUtil.GetArrayByParameter(key, param, text, value).value;
}

function getAdmin(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getAdmin', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getAdmin', ID, text).value;
    }
}

/*
    Tmessage
    求购资源
*/

/*
    查询
*/

/*
    根据ID获取对象
*/

function getTmessage(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getTmessage', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getTmessage', ID, text).value;
    }
}

/*
    修改
*/

/*
    根据参数更新对象状态
*/

function updTmessage(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('updTmessage', param).value;
}

/*
    删除
*/

/*
    根据ID删除对象
*/

function delTmessage(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('delTmessage', param).value;
}

/*
    Message
    供应资源
*/

/*
    查询
*/

/*
    根据ID获取对象
*/

function getMessage(ID, text)
{
    ID = String(ID);
    if (typeof(text) == 'undefined')
    {
        return ascx_AjaxUtil.GetObject('getMessage', ID).value;
    }
    else
    {
        return ascx_AjaxUtil.GetColumn('getMessage', ID, text).value;
    }
}

/*
    修改
*/

/*
    根据参数更新对象状态
*/

function updMessage(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('updMessage', param).value;
}

/*
    删除
*/

/*
    根据ID删除对象
*/

function delMessage(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('delMessage', param).value;
}

/*
    客户信息登记
    Uservisit
*/

/*
    删除
*/

/*
    根据ID删除对象
*/

function delUservisit(param)
{
    param = String(param);
    return ascx_AjaxUtil.UpdObjectByParameter('delUservisit', param).value;
}

/*
    查询
*/

function getUservisitListByUserID(param)
{
    param = String(param);
    return ascx_AjaxUtil.GetListByParameter('getUservisitListByUserID', param).value;
}

function getUservisitListByUserIDAdminID(param)
{
    param = String(param);
    return ascx_AjaxUtil.GetListByParameter('getUservisitListByUserIDAdminID', param).value;
}
/*
    其它选项
*/
function getOption(ID, text)
{
    ID = String(ID);
    return ascx_AjaxUtil.GetOption(ID, text).value;
}

