﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ICaiBan.Remoting.Client;
using ICaiBan.IBLL;
using ICaiBan.ModelBL.Merchant;

using System.Web.Security;
using ICaiBan.ModelAPI;
using ICaiBan.ModelBL.Enums;
using ICaiBan.ModelAPI.Merchant;

namespace MerchantManager.tran
{
    /// <summary>
    /// 商户信用支付
    /// author:邓俊龙
    /// update:2013-7-5
    /// </summary>
    public partial class credit : FatherPage
    {
        IMerchant merchant = (Merchant)InvokeRemoting.GetObj<IMerchant>();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (base.IsFirstLoad)
            {
                BindShow();
            }
        }

        #region 是否签约和开通信用支付
        protected void BindShow()
        {
            GetMerchantSecurityInfoOutPut model = merchant.GetMerchantSecurityInfo(new MerchantCommonParam(this.CompanyID));
            
            if (model.State == RestaurantType.Sign)//已经签约
            {
                switch (model.CreditState)//信用支付状态
                {
                    case CreditState.Open:
                        status.Value = "3";
                        break;
                    case CreditState.Close:
                        status.Value = "2";
                        break;
                }
            }
            else
            {
                if (model.SignIsAudit)//申请签约，审核中
                {
                    status.Value = "1";
                }
                else
                {
                    status.Value = "0";
                }
            }
        }
        #endregion
    }
}