using Forks.JsonRpc.Client;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ButcherFactory.BO.LocalBL
{
  public static class DialogBL
  {
    const string RpcPath = @"/MainSystem/B3Sale/Rpcs/BaseInfoSelectRpc/";
    public static IEnumerable<ExtensionObj> GetStoreList()
    {
      return GetBaseInfoList("GetStoreList", string.Empty);
    }

    public static IEnumerable<ExtensionObj> GetDeliverGoodsLineList()
    {
      return GetBaseInfoList("GetDeliverGoodsLineList", string.Empty);
    }

    public static IEnumerable<ExtensionObj> GetCustomerList(string spell)
    {
      return GetBaseInfoList("GetCustomerList", spell);
    }

    static IEnumerable<ExtensionObj> GetBaseInfoList(string method, params string[] spell)
    {
      var json = RpcFacade.Call<string>(RpcPath + method, spell);
      return JsonConvert.DeserializeObject<IEnumerable<ExtensionObj>>(json);
    }
  }
}
