﻿function GetProfessionLevel(){
    AjaxMethodPL.GetProfessionLevel
    (
        parseInt($("select[id$='dic_GameProfession'] option:selected").val()),
        function(result){
            if(null==result.error){
                if(result.value!=null){
                    var dt = result.value;
                    var sel_Level=$("select[id$='DDL_Level']")[0];
                    sel_Level.options.length = 0;
                    for(i=0;i<dt.Rows.length;i++){
                        sel_Level.options.add(new Option(dt.Rows[i].ProfessionLevel,dt.Rows[i].ProfessionID)); 
                    }
                    ProfessionChange();
                }
            }
        }
    );    
}

function ProfessionChange()
{
//    checkCustomPL();
    AjaxMethodPL.GetProfessionPriceInfo
    (
        parseInt($("select[id$='dic_GameProfession'] option:selected").val()),
        parseInt($("select[id$='DDL_Level'] option:selected").val()),
        function(result){
             if(null==result.error){
                if(result.value!=null){
                    var princeInfo=eval(result.value);
                    $("span[mark='currencyMark']").text(princeInfo.CurrencyMark);
                    //$("#currencyMark").text(princeInfo.CurrencyMark);
                    $("#Amount").text(princeInfo.Amount);
                    $("#Times").text(princeInfo.Days);
                    $("#VipAmount").text(princeInfo.VipAmount);
                }
            }
        }
    )
}

function Add()
{
    var GameProfessionID=parseInt($("select[id$='dic_GameProfession'] option:selected").val());
//    var CurrentLevelID=parseInt($("select[id$='dic_CurrentLevel'] option:selected").val());
//    var DesiredLevelID=parseInt($("select[id$='dic_DesiredLevel'] option:selected").val());
    var LevelID=parseInt($("select[id$='DDL_Level'] option:selected").val());
    if(0==GameProfessionID||0==LevelID){
        alert("Please select the service");
        return;
    }
    AjaxMethodPL.AddProfessionOrder
    (
        parseInt($("select[id$='dic_GameProfession'] option:selected").val()),
//        parseInt($("select[id$='dic_CurrentLevel'] option:selected").text()),
//        parseInt($("select[id$='dic_DesiredLevel'] option:selected").text()),
        LevelID,
        function(result){                
            //函数在common文件里
            AddTemp_CallBack(result);
        }
    )
}

