下面以CRM客户单据链接活动列表为例说明实现方法。
一:客户单据插件 public class OrganizationEdit : AbstractBillPlugIn
{
private string _ActivityViewPageId = "";
private IDynamicFormView _ActivityView;
public override void AfterBindData(EventArgs e)
{
object FCUSTID = this.View.Model.GetPKValue();
//添加活动页签
AddActivityForm(FCUSTID);
}
private void AddActivityForm(object FCUSTID)
{
this._ActivityView = (IDynamicFormView)this.View.GetView(_ActivityViewPageId);
if (this._ActivityView != null)
{
_ActivityView.Close();
this.View.SendDynamicFormAction(this._ActivityView);
}
ListShowParameter param = new ListShowParameter();
param.FormId = CRMFormIdConst.CRM_ACTIVITY;//活动单据在BOS中的唯一标示
param.OpenStyle.TagetKey = "FActivityList";//BOS中配置的活动页签名字
param.OpenStyle.ShowType = ShowType.InContainer;
param.PageId = _ActivityViewPageId = Guid.NewGuid().ToString();
param.ParentPageId = this.View.PageId;
param.IsShowQuickFilter = false;
string sFCUSTID = "0";
if (FCUSTID != null)
{
sFCUSTID = FCUSTID.ToString();
}
//自定义参数,在活动列表插件中会用到
param.CustomParams.Add("CustID", sFCUSTID);
this.View.ShowForm(param);
}
}
二:活动列表插件
///
/// 活动 列表
///
public class ActivityList : AbstractListPlugIn
{
public override void PrepareFilterParameter(BOS.Core.List.PlugIn.Args.FilterArgs e)
{
//客户下链接活动
object FCustID = this.View.OpenParameter.GetCustomParameter("CustID");
if (FCustID != null)
{
if (FCustID.ToString() != "0")
{
e.FilterString = " FCUSTOMERID = " + FCustID.ToString();
}
else
{
e.FilterString = "1=0";
}
return;
}
}
}
推荐阅读