package com.gx.obe.management.action;

import org.eclipse.swt.core.MessageDialog;
import org.eclipse.swt.widgets.Display;

import com.gx.obe.action.bean.Action;
import com.gx.obe.components.core.Constants;
import com.gx.obe.components.core.enumeration.TenderProjectEnum;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.gx.obe.web.service.ProjectRuleService;

public class SupplierAnonymousAction extends Action{
	private  ProjectRuleService projectRuleService;
	private boolean isAnonymous = false;
	@Override
	public void run() {
	}
	public boolean isAnonymous(){
		if(null != getListener()){
			TenderProjectEntity tenderProjectEntity = (TenderProjectEntity)this.getListener().getParentComposite().getData("tenderProjectEntity");
			if(null != tenderProjectEntity){
				// 如果需要匿名保护
				if(Constants.SHOW_ANONYMOUS){
					if(null == projectRuleService){
						projectRuleService = new ProjectRuleService();
					}
					if(projectRuleService.isAnonymous(tenderProjectEntity.getId())){
						isAnonymous = true;
						MessageDialog.openWarning(Display.getDefault().getActiveShell(), "未到"+TenderProjectEnum.getOpenBidEnum(tenderProjectEntity.getPhaseType())+"时间，不允许进行此操作！");
					}
				}
			}
		}
		return isAnonymous;
	}
}
