using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SuperMap.RealEstate.Utility;
using SuperMap.RealEstate.WorkFlow.Instance;
using Running = SuperMap.RealEstate.Contract.Running;
using Storage = SuperMap.RealEstate.Contract.Running;
namespace SuperMap.RealEstate.Contract.Plugins
{
///
public class ContractProInst : IWorkFlowProInstDataAction, IWorkFlowActInstDataAction
{
ProInst_310020 _ProInst_310020 = null;
///
public string ErrorString
{
get;
set;
}
///
/// 办结
///
///
///
public bool EndProcess(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst WorkFlowProInst)
{
bool Flag = true;
string _ErrorString = "";
Running.Business.CONTRACTPROINST _CONTRACTPROINST = GetPropertyProinst(WorkFlowProInst);
//DeleteCommonInfo(_CONTRACTPROINST);
switch (WorkFlowProInst.Operation_Type_BaseValue)
{
case 310020:
#region 退场审批
_ProInst_310020 = new ProInst_310020(_CONTRACTPROINST);
Flag = _ProInst_310020.EndProcess(WorkFlowProInst, out _ErrorString);
ErrorString += _ErrorString;
#endregion
break;
default:
throw new Exception("Plugins尚未配置");
}
return Flag;
}
///
/// 驳回
///
///
///
public bool FallBackRunning(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst WorkFlowProInst)
{
throw new NotImplementedException();
}
///
/// 入库
///
///
///
public bool PutInStorage(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst WorkFlowProInst)
{
bool Flag = true;
string _ErrorString = "";
Running.Business.CONTRACTPROINST _CONTRACTPROINST = GetPropertyProinst(WorkFlowProInst);
//PutInStorageCommonInfo(_CONTRACTPROINST);
switch (WorkFlowProInst.Operation_Type_BaseValue)
{
case 310020:
#region 退场审批
_ProInst_310020 = new ProInst_310020(_CONTRACTPROINST);
Flag = _ProInst_310020.PutInStorage(WorkFlowProInst, out _ErrorString);
ErrorString += _ErrorString;
#endregion
break;
default:
throw new Exception("Plugins尚未配置");
}
return Flag;
}
///
/// 流程删除
///
///
///
public bool DeleteProcess(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst WorkFlowProInst)
{
bool Flag = false;
string _ErrorString = "";
Running.Business.CONTRACTPROINST _CONTRACTPROINST = GetPropertyProinst(WorkFlowProInst);
DeleteCommonInfo(_CONTRACTPROINST);
switch (WorkFlowProInst.Operation_Type_BaseValue)
{
case 310020:
#region 退场审批
_ProInst_310020 = new ProInst_310020(_CONTRACTPROINST);
Flag = _ProInst_310020.DeleteProcess(WorkFlowProInst, out _ErrorString);
ErrorString += _ErrorString;
#endregion
break;
default:
throw new Exception("Plugins尚未配置");
}
return Flag;
}
///
///
///
///
public void DeleteCommonInfo(Running.Business.CONTRACTPROINST _CONTRACTPROINST)
{
//删除审批信息
foreach (Running.Business.APPROVED _APPROVED in _CONTRACTPROINST.ApprovedCollection)
{
_APPROVED.Delete();
}
}
///
///
///
///
public void PutInStorageCommonInfo(Running.Business.CONTRACTPROINST _CONTRACTPROINST)
{
Storage.Business.APPROVED StorageApproved = null;
foreach (Running.Business.APPROVED _Approved in _CONTRACTPROINST.ApprovedCollection)
{
StorageApproved = new Storage.Business.APPROVED(_CONTRACTPROINST.Transaction);
StorageApproved.APPROVED_ID = _Approved.APPROVED_ID;
if (StorageApproved.Select())
{
StorageApproved.Delete();
StorageApproved.ResetProperty();
}
StorageApproved.CopyFrom(_Approved);
StorageApproved.Insert();
}
//foreach (Running.Business.Proposer _Proposer in _PropertyProinst.ProposerCollection)
//{
// StorageProposer = new Storage.Business.Proposer(_PropertyProinst.Transaction);
// StorageProposer.CopyFrom(_Proposer);
// StorageProposer.Insert();
//}
}
///
/// 获取当前流程信息
///
///
///
public Running.Business.CONTRACTPROINST GetPropertyProinst(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst WorkFlowProInst)
{
Running.Business.CONTRACTPROINST _PropertyProinst = new Running.Business.CONTRACTPROINST(WorkFlowProInst.Transaction);
_PropertyProinst.AddSearchParameter("proinst_id", WorkFlowProInst.ProInst_ID);
if (_PropertyProinst.Search())
{
return _PropertyProinst;
}
else
{
throw new Exception("无法获取ProInst实例对象!");
}
}
#region 流转
///
public bool OverRuled(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
///
public bool OverRuling(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
///
public bool Transfered(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
///
public bool Transferring(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
///
public bool TurnOvered(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
///
public bool TurnOvering(SuperMap.RealEstate.WorkFlow.Instance.Business.ProInst ProInst)
{
return true;
}
#endregion
}
}