📄 wfactivity.cs
字号:
attr = actElement.OwnerDocument.CreateAttribute("userSelect");
attr.Value = UserSelect;
actElement.Attributes.Append(attr);
*/
XmlAttribute attr = actElement.OwnerDocument.CreateAttribute("work_day");
attr.Value = this.Workday.ToString();
actElement.Attributes.Append(attr);
attr = actElement.OwnerDocument.CreateAttribute("warning_time");
attr.Value = this.Warning_time.ToString();
actElement.Attributes.Append(attr);
attr = actElement.OwnerDocument.CreateAttribute("issendself");
attr.Value = this.IsSendSelf.ToString();
actElement.Attributes.Append(attr);
attr = actElement.OwnerDocument.CreateAttribute("enablesendback");
attr.Value = this.IsSendBack.ToString();
actElement.Attributes.Append(attr);
attr = actElement.OwnerDocument.CreateAttribute("isselectuser");
attr.Value = this.IsSelectUser.ToString();
actElement.Attributes.Append(attr);
if (this.IsSelectUser == 0)
{
//创建角色元素
XmlElement roleElement = actElement.OwnerDocument.CreateElement("role");
//创建角色参照属性
XmlAttribute roleattr= actElement.OwnerDocument.CreateAttribute("ref");
if (Role == null)
{
roleattr.Value = "";
}
else
{
roleattr.Value = Role.Name;
}
roleElement.Attributes.Append(roleattr);
actElement.AppendChild(roleElement);
}
else
{
XmlElement beforeactivElement = actElement.OwnerDocument.CreateElement("before_activ");
XmlAttribute beforeactivattr = actElement.OwnerDocument.CreateAttribute("ref");
if (this.Before_ActiveInfo == null)
{
beforeactivattr.Value = "";
}
else
{
beforeactivattr.Value = this.Before_ActiveInfo.Name;
}
beforeactivElement.Attributes.Append(beforeactivattr);
actElement.AppendChild(beforeactivElement);
}
//创建应用程序集元素
XmlElement appsElement = actElement.OwnerDocument.CreateElement("applications");
actElement.AppendChild(appsElement);
//循环增加应用程序元素
int j = 1;
foreach (WfApplication app in AppList)
{
XmlElement appElement = actElement.OwnerDocument.CreateElement("application");
attr = actElement.OwnerDocument.CreateAttribute("ref");
attr.Value = app.Name;
appElement.Attributes.Append(attr);
XmlAttribute apprankattr = actElement.OwnerDocument.CreateAttribute("rank");
apprankattr.Value = j.ToString();
appElement.Attributes.Append(apprankattr);
appsElement.AppendChild(appElement);
j++;
}
//参数
XmlElement paramsElement = actElement.OwnerDocument.CreateElement("params");
actElement.AppendChild(paramsElement);
//int j = 1;
foreach (WfParam param in this.ParamsInfo)
{
XmlElement paramElement = actElement.OwnerDocument.CreateElement("param");
XmlAttribute paramattr = actElement.OwnerDocument.CreateAttribute("ref");
paramattr.Value = param.Name;
paramElement.Attributes.Append(paramattr);
//XmlAttribute paramrankattr = actElement.OwnerDocument.CreateAttribute("rank");
//paramrankattr.Value =j.ToString();
//paramElement.Attributes.Append(paramrankattr);
paramsElement.AppendChild(paramElement);
//j++;
}
XmlElement eventsElement = actElement.OwnerDocument.CreateElement("events");
actElement.AppendChild(eventsElement);
//接收前事件
XmlElement eventElement = actElement.OwnerDocument.CreateElement("event");
XmlAttribute eventattr = actElement.OwnerDocument.CreateAttribute("eventtype");
//收到前事件
eventattr.Value = "0";
eventElement.Attributes.Append(eventattr);
//SQL
eventattr = actElement.OwnerDocument.CreateAttribute("excutetype");
eventattr.Value = "0";
eventElement.Attributes.Append(eventattr);
eventattr = actElement.OwnerDocument.CreateAttribute("content");
eventattr.Value = this.BeforeRecive_Event;
eventElement.Attributes.Append(eventattr);
eventsElement.AppendChild(eventElement);
//发送后事件
XmlElement aftersendeventElement = actElement.OwnerDocument.CreateElement("event");
XmlAttribute aftersendeventattr = actElement.OwnerDocument.CreateAttribute("eventtype");
//收到前事件
aftersendeventattr.Value = "1";
aftersendeventElement.Attributes.Append(aftersendeventattr);
//SQL
aftersendeventattr = actElement.OwnerDocument.CreateAttribute("excutetype");
aftersendeventattr.Value = "0";
aftersendeventElement.Attributes.Append(aftersendeventattr);
aftersendeventattr = actElement.OwnerDocument.CreateAttribute("content");
aftersendeventattr.Value = this.AfterSend_Event;
aftersendeventElement.Attributes.Append(aftersendeventattr);
eventsElement.AppendChild(aftersendeventElement);
}
#endregion
#region 公用
/// <summary>
/// 打开对话框
/// </summary>
public override void OpenPropertyDialog()
{
ActivityInfoDlg dlg = new ActivityInfoDlg(this);
dlg.WfActivity = this;
dlg.ShowDialog();
dlg.Dispose();
}
private WfActivity GetActivityByName(String Name)
{
foreach (DesignerVisualObject vo in this.Flow.VisualObjectList)
{
if (vo is WfActivity)
{
if ((vo as WfActivity).Name == Name)
{
return (WfActivity)vo;
}
}
}
return null;
}
/// <summary>
/// 从xml初始化节点信息
/// </summary>
/// <param name="actElement">节点xml元素</param>
public override void InitFromXml(XmlElement actElement)
{
//需要改动
base.InitFromXml(actElement);
/* if (actElement.Attributes["cycle"].Value == "true")
{
HasCycleTrans = true;
}
else
{
HasCycleTrans = false;
}
FlowSelect = actElement.Attributes["flowSelect"].Value;
UserSelect = actElement.Attributes["userSelect"].Value;
*/
String IsSelectUser = actElement.Attributes["isselectuser"].Value;
this.IsSelectUser = Convert.ToInt32(IsSelectUser);
this.IsSendBack = Convert.ToInt32(actElement.Attributes["enablesendback"].Value);
this.IsSendSelf = Convert.ToInt32(actElement.Attributes["issendself"].Value);
this.Workday = Convert.ToDouble(actElement.Attributes["work_day"].Value);
this.Warning_time = Convert.ToDouble(actElement.Attributes["warning_time"].Value);
if (IsSelectUser == "0")
{
//得到角色元素
XmlElement roleElement = actElement.SelectSingleNode("role") as XmlElement;
//角色名称
String roleName = roleElement.Attributes["ref"].Value;
if (roleName == "")
{
Role = null;
}
else
{
//根据角色名称得到角色
Role = Program.WorkflowControl.WfPackageDocument.GetRoleByName(roleName);
}
}
else
{
XmlElement roleElement = actElement.SelectSingleNode("role") as XmlElement;
XmlElement beforeactivElement = actElement.SelectSingleNode("before_activ") as XmlElement;
String beforeactivName = beforeactivElement.Attributes["ref"].Value;
if (beforeactivName == "")
{
this.Before_ActiveInfo = null;
}
else
{
//根据角色名称得到角色
Before_ActiveInfo = this.GetActivityByName(beforeactivName);
}
}
//循环得到饮用
foreach (XmlElement appElement in actElement.SelectNodes("applications/application"))
{
//得到应用程序名称
String appName = appElement.Attributes["ref"].Value;
//根据应用名称得到应用
AppList.Add(Program.WorkflowControl.WfPackageDocument.GetApplicationByName(appName));
}
//循环参数
foreach (XmlElement paramElement in actElement.SelectNodes("params/param"))
{
//得到参数名称
String paramName = paramElement.Attributes["ref"].Value;
//根据应用名称得到应用
this.ParamsInfo.Add(Program.WorkflowControl.WfPackageDocument.GetParamByName(paramName));
}
//得到参数类型
foreach (XmlElement paramElement in actElement.SelectNodes("events/event"))
{
String eventType = paramElement.Attributes["eventtype"].Value;
if (eventType == "0")
{
this.BeforeRecive_Event = paramElement.Attributes["content"].Value;
//接收前事件
}
else
{
//发送后事件
if (paramElement.Attributes["content"] != null)
this.AfterSend_Event = paramElement.Attributes["content"].Value;
}
}
}
#endregion
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -