#region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved.
//
// All rights are reserved. Reproduction or transmission in whole or in part, 
// in any form or by any means, electronic, mechanical or otherwise, is 
// prohibited without the prior written consent of the copyright owner.
//
// Filename:SelectConsentSvcDac.cs
//
#endregion
using CLIP.eForm.Consent.Entity;
using CLIP.eForm.Server.Data;
using IBatisNet.DataMapper;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CLIP.eForm.Consent.Dac {
  public class ConsentDac :DacBase {
    public IList<ConsentFormListVO> GetConsentSetList(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForList<ConsentFormListVO>("getUserFormSet", param);
    }

    public IList<ConsentFormListVO> GetConsentBySearch(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForList<ConsentFormListVO>("GET_CONSENT_BY_SEARCH_LIST", param);
    }

    public IList<ConsentFormListVO> GetConsentList(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForList<ConsentFormListVO>("GET_CONSENT_LIST", param);
    }

    public object GetFormGuidByFormCd(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject("GET_FORM_GUID_BY_FORM_CD", param);
    }

    public IList<ConsentImageVO> GetConsentImage(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForList<ConsentImageVO>("GET_CONSENT_IMAGE", param);
    }

    public IList<ConsentImageVO> GetConsentImageFileName(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForList<ConsentImageVO>("GET_CONSENT_IMAGE_FILE_NAME", param);
    }

    public void UpdateConsentImage(ISqlMapper mapper, Hashtable param) {
      if (param["consentState"].Equals("CERTIFY_CMP")) {
        mapper.Update("UPDATE_CONSENT_IMAGE", param);
      }
      mapper.Update("UPDATE_CHARPAGE_T", param);
    }

    public IList<UnFinishedListVO> GetUnfinishedListPerDoctor(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForList<UnFinishedListVO>("GetUnfinishedListPerDoctor", param);
    }

    public IList<ConsentVO> GetUnfinishedListPerUserName(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForList<ConsentVO>("GetUnfinishedListPerUserName", param);
    }

    public String GetConsentStateCheck(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<String>("GetConsentStateCheck", param);
    }

    public ConsentFormListVO GetConsentByFormcd(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<ConsentFormListVO>("GET_CONSENT_BY_FORMCD", param);
    }

    public String getOcrString(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<String>("GET_OCR_STRING", param);
    }

    /// <summary>
    /// 원무 서식의 인증저장 사용 여부
    /// </summary>
    /// <param name="mapper">SQL mapper</param>
    /// <param name="param">The parameter.</param>
    /// <returns></returns>
    public String getCertuseYn(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<String>("GET_CERTUSEYN", param);
    }

    /// <summary>
    /// 원무 서식의 인증저장 사용 여부
    /// 서식이 여러개 선택되었을때
    /// </summary>
    /// <param name="mapper">SQL mapper</param>
    /// <param name="param">The parameter.</param>
    /// <returns></returns>
    public String getCertUseYnData(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<String>("GET_CERTUSEYN_MAP", param);
    }

    /// <summary>
    /// 동의서가 금일 작성되었는지 여부 확인 formCd 반환
    /// </summary>
    /// <param name="mapper">SQL mapper</param>
    /// <param name="param">The parameter.</param>
    /// <returns></returns>
    public String getDupCertConsent(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<String>("GET_RESULT", param);
    }

    /// <summary>
    /// 경북대학교병원 accu 모니터 설치 사용자 여부
    /// </summary>
    /// <param name="mapper"></param>
    /// <param name="param"></param>
    /// <returns></returns>
    public String getDualViewMode(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<String>("GET_DUAL_MODE", param);
    }

    public void updateToCertifyConsentMst(ISqlMapper mapper, Hashtable param) {
      mapper.QueryForObject<Int32>("TO_CERTIFY_CONSENT_MST", param);
    }

    public void updateToCertifyOcrprnt(ISqlMapper mapper, Hashtable param) {
      mapper.QueryForObject<Int32>("TO_CERTIFY_OCRPRNT", param);
    }

    public void updateConsentMaster(ISqlMapper mapper, Hashtable param) {
      mapper.QueryForObject<Int32>("UPDATE_CONSENT_MASTER", param);
    }

    public void updateOcrPrintHistory(ISqlMapper mapper, Hashtable param) {
      mapper.QueryForObject<Int32>("UPDATE_OCR_HISTORY", param);
    }

    public Int32 checkJinJeongDocument(ISqlMapper mapper, Hashtable param) {
      Object res = mapper.QueryForObject("CHECK_JINJEONG_DOCUMENT", param);

      return Convert.ToInt32(res);
    }

    public Int32 getMultiprintable(ISqlMapper mapper, Hashtable param) {
      Object res = mapper.QueryForObject("getMultiprintable", param);

      return Convert.ToInt32(res);
    }

    public String getLinkedAsntDocument(ISqlMapper mapper, Hashtable param) {
      String linkFormCd = mapper.QueryForObject<String>("GET_LINKED_ANST_DOCUMENT", param);
      if (linkFormCd == null) {
        linkFormCd = "";
      }
      return linkFormCd;
    }

    public String checkOperationDocuemnt(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<String>("CHECK_OPERATION_DOCUMENT", param);
    }

    public Int32 checkOcrtagDup(ISqlMapper mapper, Hashtable param) {
      Object res = mapper.QueryForObject("CHECK_OCRTAG_DUP", param);
      return Convert.ToInt32(res);
    }

    public string getPenOptions(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<string>("getPenOptions", param);
    }

    public string getZoomRate(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<string>("getZoomRate", param);
    }

    public string getPrintControlMsg(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<string>("getPrintControlMsg", param);
    }

    public string getPrintOnly(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<string>("getPrintOnly", param);
    }

    public AgmtVo getConsentMst(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<AgmtVo>("getConsentMstForAgmt", param);
    }

    public string getConsentData(ISqlMapper mapper, Hashtable param) {
      return mapper.QueryForObject<string>("getConsentDataForAgmt", param);
    }
  }
}
