/**
 * Created on 2003/09/24
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package jp.co.sint.basic;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import jp.co.sint.config.SIConfig;
import jp.co.sint.database.SIDBAccessException;
import jp.co.sint.database.SIDBUtil;
import jp.co.sint.tools.SIUtil;

import org.apache.log4j.Category;

/**
 * @version $Id: SIFeeRule.java,v 1.0 2003/11/21 Exp $
 * @author  Jinwang Chen
 * <br>Description: 特定商取引法
 * <p>History</p>
 * <p>Author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reason</p>
 *  ============&nbsp;&nbsp;&nbsp;==========&nbsp;&nbsp;===========================<br>
 * arai           2003/11/21 14:06:23  Original
 */
public class SIExRule extends SIBasic {
  //ログ用のインスタンスの生成
  private static Category log=Category.getInstance(SIConfig.SILOG4J_WEBSHOP_CATEGORY_NAME);
  
  private String mallShopCode = "";
  
  private String sellerName = "";
  private String ownerName = "";
  private String location = "";
  private String tel = "";
  private String fax = "";
  private String email = "";
  private String commentOfOrder = "";
  private String commentOfPrice = "";
  private String commentOfPeriod = "";
  private String commentOfAmount = "";
  private String commentOfDeliver = "";
  private String commentOfPayment = "";
  private String commentOfPayPeriod = "";
  private String commentOfReturn = "";
  
  public SIExRule(){
  }
  public SIExRule(String lMallShopCode){
    setMallShopCode(lMallShopCode);
  }
  /**
   * @return
   */
  public String getCommentOfAmount() {
    return commentOfAmount;
  }
  
  /**
   * @return
   */
  public String getCommentOfDeliver() {
    return commentOfDeliver;
  }
  
  /**
   * @return
   */
  public String getCommentOfOrder() {
    return commentOfOrder;
  }
  
  /**
   * @return
   */
  public String getCommentOfPayment() {
  return commentOfPayment;
  }
  
  /**
   * @return
   */
  public String getCommentOfPayPeriod() {
    return commentOfPayPeriod;
  }
  
  /**
   * @return
   */
  public String getCommentOfPeriod() {
    return commentOfPeriod;
  }
  
  /**
   * @return
   */
  public String getCommentOfPrice() {
    return commentOfPrice;
  }
  
  /**
   * @return
   */
  public String getCommentOfReturn() {
    return commentOfReturn;
  }
  
  /**
   * @return
   */
  public String getEmail() {
    return email;
  }
  
  /**
   * @return
   */
  public String getFax() {
    return fax;
  }
  
  /**
   * @return
   */
  public String getLocation() {
    return location;
  }
  
  /**
   * @return
   */
  public String getMallShopCode() {
    return mallShopCode;
  }
  
  /**
   * @return
   */
  public String getOwnerName() {
    return ownerName;
  }
  
  /**
   * @return
   */
  public String getSellerName() {
    return sellerName;
  }
  
  /**
   * @return
   */
  public String getTel() {
    return tel;
  }
  
  /**
   * @param string
   */
  public void setCommentOfAmount(String string) {
    if(string==null)string="";
    commentOfAmount = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setCommentOfDeliver(String string) {
    if(string==null)string="";
    commentOfDeliver = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setCommentOfOrder(String string) {
    if(string==null)string="";
    commentOfOrder  = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setCommentOfPayment(String string) {
    if(string==null)string="";
    commentOfPayment  = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setCommentOfPayPeriod(String string) {
    if(string==null)string="";
    commentOfPayPeriod  = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setCommentOfPeriod(String string) {
    if(string==null)string="";
    commentOfPeriod  = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setCommentOfPrice(String string) {
    if(string==null)string="";
    commentOfPrice  = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setCommentOfReturn(String string) {
    if(string==null)string="";
    commentOfReturn  = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setEmail(String string) {
    if(string==null)string="";
    email = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setFax(String string) {
    if(string==null)string="";
    fax = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setLocation(String string) {
    if(string==null)string="";
    location  = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setMallShopCode(String string) {
    if(string==null)string="";
    mallShopCode = string;
  }
  
  /**
   * @param string
   */
  public void setOwnerName(String string) {
    if(string==null)string="";
    ownerName  = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setSellerName(String string) {
    if(string==null)string="";
    sellerName = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * @param string
   */
  public void setTel(String string) {
    if(string==null)string="";
    tel = SIUtil.changeTo(string.trim(),this.encode);
  }
  
  /**
   * <b>reset</b>
   * ショップコードから特定商取引法詳細情報を取得します
   * @param lConnection
   * @return なし
   * @throws SIDBAccessException
   */
  public void reset(Connection lConnection)throws SIDBAccessException {
    Statement lStatement=null;
    ResultSet lResultSet=null;
    String lSql="SELECT * FROM ExchangeRuleMTbl WHERE MallShopCode="+SIDBUtil.SQL2Str(mallShopCode);
    log.debug("reset:lSql="+lSql);
    try {
      lStatement=lConnection.createStatement();
      lResultSet=lStatement.executeQuery(lSql);
      
      if (lResultSet.next()){
        this.setEncode(SIConfig.SIENCODE_NONE);
        this.setMallShopCode(lResultSet.getString("mallShopCode"));//管理コード
        this.setSellerName(lResultSet.getString("sellerName"));//販売業者
        this.setOwnerName(lResultSet.getString("ownerName"));//代表者
        this.setLocation(lResultSet.getString("location"));//所在地
        this.setTel(lResultSet.getString("tel"));//電話番号
        this.setFax(lResultSet.getString("fax"));//FAX番号
        this.setEmail(lResultSet.getString("email"));//email
        this.setCommentOfOrder(lResultSet.getString("commentOfOrder"));//注文方法
        this.setCommentOfPrice(lResultSet.getString("commentOfPrice"));//必要料金
        this.setCommentOfPeriod(lResultSet.getString("commentOfPeriod"));//有効期限
        this.setCommentOfAmount(lResultSet.getString("commentOfAmount"));//販売数量
        this.setCommentOfDeliver(lResultSet.getString("commentOfDeliver"));//引渡時期
        this.setCommentOfPayment(lResultSet.getString("commentOfPayment"));//支払方法
        this.setCommentOfPayPeriod(lResultSet.getString("commentOfPayPeriod"));//支払期限
        this.setCommentOfReturn(lResultSet.getString("commentOfReturn"));//返品
      }
    }catch(SQLException sqle){
      sqle.printStackTrace();
    }finally{
      SIDBUtil.close(lStatement,lResultSet);
    }
  }
}