您的位置:首页 > 编程语言

.net之工作流工程展示及代码分享(一)工作流表单

2015-02-28 16:56 375 查看
Workflow表单的作用是能够在客户端进行表单设计,然后在流程中动态开放哪些输入框可以供用户填写。

在这里我扩展了一个常用的WebEditor工具——KindEditor,能够插入自定义的html符号,如下图:

[Serializable]
public class TextLineFormControl : FormControl
{
public override string GetDesignString()
{
return string.Format("<input type=\"text\" value=\"{0}//{1}//{2}\" style=\"{3}\" id=\"{4}\">",
WorkflowConstant.TextBoxFormControlName, FieldName, Width, WorkflowConstant.ControlDesignWidth,ControlId);
}

public override string GetInputString()
{
return string.Format("<input type=\"text\" value=\"{0}\" id=\"{1}\" size=\"{2}\" maxlength=\"{2}\" name=\"{1}\" >",
FieldValue, ControlId, Width);
}
}

[Serializable]
public class MultiLineFormControl : FormControl
{
public override string GetDesignString()
{
return string.Format("<input type=\"text\" value=\"{0}//{1}//{2}//{5}\" style=\"{3}\" id=\"{4}\">",
WorkflowConstant.TextAreaFormControlName, FieldName, Width, WorkflowConstant.ControlDesignWidth, ControlId, Height);
}

public override string GetInputString()
{
return string.Format("<textarea cols=\"{2}\" rows=\"{3}\" id=\"{1}\" name=\"{1}\" >{0}</textarea>",
FieldValue != null ? FieldValue.Replace("<br/>", "\n\r") : string.Empty, ControlId, Width, Height);
}
}

[Serializable]
public class RadioFormControl : FormControl
{
public override string GetDesignString()
{
return string.Format("<input type=\"text\" value=\"{0}//{1}//{2}\" style=\"{3}\" id=\"{4}\">",
WorkflowConstant.RadioFormControlName, FieldName, InitialData, WorkflowConstant.ControlDesignWidth, ControlId);
}

public override string GetInputString()
{
StringBuilder sb= new StringBuilder();
var data = InitialData.Split('|');
for (int i = 0; i < data.Length; i ++)
{
sb.AppendFormat("<input type=\"radio\" name=\"{0}\" id=\"{0}-{1}\" value=\"{2}\" {3}/>", ControlId, i,
data[i], FieldValue == data[i] ? " checked=\"checked\"" : string.Empty);
sb.AppendFormat("<label for=\"{0}-{1}\">{2}</label>", ControlId, i, data[i]);
}
return sb.ToString();
}
}
.........


View Code

Form类使用InitializeFormControls方法生成各种实例化控件,放在FormControls字段里。

这两个类使用的基本上是领域模型。

本系列导航:

.net之工作流工程展示及代码分享(预告)

.net之工作流工程展示及代码分享(一)工作流表单

.net之工作流工程展示及代码分享(二)工作流引擎

.net之工作流工程展示及代码分享(三)数据存储引擎

.net之工作流工程展示及代码分享(四)主控制类

.net之工作流工程展示及代码分享(五)前端交互
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐