例:
using System;
using System.Collections;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using System.Reflection;
using Microsoft.Crm.Workflow;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
using Microsoft.Crm.Sdk.Query;
using System.Data.SqlClient;
namespace zz_zywqjActivityLibrary
{
[CrmWorkflowActivity("获取当前业务期间", "自定义工作流程")]
public partial class huoqueywqj : Activity
{
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
try
{
SqlConnection conn = new SqlConnection(clsCn.GetCnCrm());
conn.Open();
SqlCommand cmd = new SqlCommand("select zz_zywqjid,zz_name from zz_zywqj where Zz_ywlx="+clsCn.GetPackListValue("zz_zywqj","zz_ywlx",业务类型)+" and Zz_sfdqqj=1",conn);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
string csid = dr["zz_zywqjid"].ToString();
ywqj = new Lookup("zz_zywqj", new Guid(csid));
string tyw=dr["zz_name"].ToString();
业务期间 = tyw;
}
conn.Close();
}
catch
{
}
return base.Execute(executionContext);
}
public static DependencyProperty 业务类型Property =
DependencyProperty.Register("业务类型",
typeof(String),
typeof(huoqueywqj));
[CrmInput("业务类型")]
public String 业务类型
{
get
{
return (String)base.GetValue(业务类型Property);
}
set
{
base.SetValue(业务类型Property, value);
}
}
public static DependencyProperty ywqjProperty =
DependencyProperty.Register("ywqj",
typeof(Lookup),
typeof(huoqueywqj));
[CrmOutput("ywqj")]
[CrmReferenceTarget("zz_zywqj")]
public Lookup ywqj
{
get
{
return (Lookup)base.GetValue(ywqjProperty);
}
set
{
base.SetValue(ywqjProperty, value);
}
}
public static DependencyProperty 业务期间Property =
DependencyProperty.Register("业务期间",
typeof(String),
typeof(huoqueywqj));
[CrmOutput("业务期间")]
public String 业务期间
{
get
{
return (String)base.GetValue(业务期间Property);
}
set
{
base.SetValue(业务期间Property, value);
}
}
}
}
评论