package com.gx.obe.management.action;

import org.eclipse.swt.SWT;
import org.eclipse.swt.core.MessageDialog;
import org.eclipse.swt.widgets.Composite;

import com.gx.obe.action.bean.Action;
import com.gx.obe.action.listener.ActionListener;
import com.gx.obe.management.composite.NoEvaluationStepComposite;
import com.gx.obe.management.composite.TenderProjectEvaluationResultTabComposite;
import com.gx.obe.message.Messages;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.gx.obe.web.service.evaluation.EvaluationStepService;

/**
 * @Description: 评标结果
 * @author guoyr
 */
public class EvaluationResultAction extends Action{

	public void run() {
		ActionListener listener = this.getListener();
		TenderProjectEntity tenderProjectEntity = this.getTenderProject();
		if (null != tenderProjectEntity) {
			boolean hasNode = new EvaluationStepService().isHasEvaluationStep(tenderProjectEntity.getId());
			if (!hasNode) {
				MessageDialog.openWarning(listener.getParentComposite().getShell(), Messages.Tips_creatEvalStep);
				return ;
			}
			listener.onLoad(this);
			Composite parent = listener.getParentComposite();
			parent.setData("tenderProjectEntity", this.getTenderProject());
			parent.setData("result", this.getData("01"));
			if (hasNode) {
				listener.loadComposite(this, new TenderProjectEvaluationResultTabComposite(parent, this, SWT.NONE));
			} else {
				listener.loadComposite(this, new NoEvaluationStepComposite(parent, SWT.NONE));
				
			}
		}
		
	}
}
