表单编辑字段
自定义表单添加、修改、删除列,列字段类型保存到字段表中,并且修改自定义主表添加修改列。
表单字段列表
表单管理:编辑字段
表单名称:
表单描述:
添加字段
">
批量添加字段 --%>
字段名称
字段显示名
字段位置
表现形式
字段类型
显示顺序
您可以点击“批量添加字段服务器托管网”按钮添加字段!
FormFieldList.aspx.cs
///
/// 删除字段
///
///
///
protected void onDeleteFieldButtonClick(object sender, EventArgs e)
{
//1)关于此表单是否有工作流实例
//2)工作流节点字段视图要修改 可见 必填 编辑
Button deleteButton = sender as Button;
GridViewRow row = deleteButton.NamingContainer as GridViewRow;
int fieldID = (int)FormFieldGridView.DataKeys[row.RowIndex]["id"];
M.workflow_billfield billfield = billfieldBLL.GetModel(fieldID);
if (billfield != null)
{
int viewType = billfield.viewtype.Value;
if (viewType == 0)
{//清理主表
formBLL.DeleteFieldOfMainTable(billfield);
}
else
{//清理明细表
formBLL.DeleteFieldOfDetailTable(billfield);
}
string htmlType = billfield.fieldhtmltype;
if (htmlType == "5")
{//清理下拉框
List selectItemList = selectItemBLL.GetModelList("fieldid=" + fieldID);
foreach (M.workflow_SelectItem item in selectItemList)
{
selectItemBLL.Delete(item.id);
}
}
if (htmlType == "7")
{//清理特殊字段
服务器托管网 List specialfieldList = specialfieldBLL.GetModelList("fieldid=" + fieldID);
foreach (M.workflow_specialfield specialfield in specialfieldList)
{
specialfieldBLL.Delete(specialfield.id);
}
}
billfieldBLL.Delete(fieldID);
initialForm();//刷新列表
}
}
protected string getFormID()
{
return ViewState["formid"].ToString();
}
protected string ShowViewType(object o)
{
if (o.ToString() == "0")
{
return "主表";
}
if (o.ToString() == "1")
{
return "明细表";
}
return "";
}
protected string ShowHtmlType(object o)
{
if(htmlTypeDic.ContainsKey(o.ToString()))
{
return htmlTypeDic[o.ToString()];
}
return "";
}
///
/// 显示列的详细类型
///
///
///
///
///
protected string ShowColumnType(object htmlType, object type, object fieldID)
{
string result = "";
string fieldType = type.ToString();
switch (htmlType.ToString())
{
case "1"://单行文本框
if (fieldType == "1")
{//文本
result = "文本";
}
else if (fieldType == "2")
{//整数
result = "整数";
}
else if (fieldType == "3")
{//浮点数
result = "浮点数";
}
else if (fieldType == "4")
{//金额转换
result = "金额转换";
}
else if (fieldType == "5")
{//金额千分位
result = "金额千分位";
}
break;
case "2"://多行文本框
result = "多行文本框";
break;
case "3"://浏览按钮
int db_type = int.Parse(fieldType);
result = getBrowserUrlType(db_type);
break;
case "4"://Check框
result = "Check框";
break;
case "5"://选择框
result = getContentItem(fieldID);
break;
case "6"://附件上传
if (fieldType == "1")
{
result = "上传文件";
}
if (fieldType == "2")
{
result = "上传图片";
}
break;
case "7"://特殊字段
if (fieldType == "1")
{
result = "自定义链接";
}
if (fieldType == "2")
{
result = "描述性文字";
}
break;
}
return result;
}
private string getContentItem(object fieldID)
{
StringBuilder sb = new StringBuilder();
sb.Append("");
List selectItemList = selectItemBLL.GetModelList("fieldid=" + fieldID.ToString() + " order by listorder");
if (selectItemList != null && selectItemList.Count > 0)
{
foreach (M.workflow_SelectItem item in selectItemList)
{
sb.Append("");
sb.Append(item.selectname);
sb.Append(" ");
}
}
sb.Append("
");
return sb.ToString();
}
private void initialForm()
{
string formid = ViewState["formid"].ToString();
int id = -1;
if (int.TryParse(formid, out id))
{
M.workflow_bill formModel = formBLL.GetModel(id);
if (formModel != null)
{
FormNameLabel.Text = formModel.namelabel;
FormDesLabel.Text = formModel.formdes;
}
List formFieldModelList = billfieldBLL.GetModelList("billid=" + formid + " order by viewtype,dsporder");
FormFieldGridView.DataSource = formFieldModelList;
FormFieldGridView.DataBind();
}
}
private string getBrowserUrlType(int db_type)
{
YaXing.Model.WorkFlow.workflow_browserurl browserurl = browserurlBLL.GetModel(db_type);
if (browserurl != null)
{
return browserurl.fielddbtype;
}
return "";
}
#region Fields
BLL.WorkFlow.workflow_browserurl browserurlBLL = new BLL.WorkFlow.workflow_browserurl();
private BLL.WorkFlow.SequenceIndex seqBLL = new B.SequenceIndex();
private BLL.WorkFlow.workflow_bill formBLL = new B.workflow_bill();
private B.workflow_billfield billfieldBLL = new B.workflow_billfield();
private B.workflow_billdetailtable formDetailTableBLL = new B.workflow_billdetailtable();
private B.workflow_formdetailinfo formDetailInfoBLL = new B.workflow_formdetailinfo();
BLL.WorkFlow.workflow_SelectItem selectItemBLL = new BLL.WorkFlow.workflow_SelectItem();
BLL.WorkFlow.workflow_specialfield specialfieldBLL = new BLL.WorkFlow.workflow_specialfield();
private Dictionary htmlTypeDic = new Dictionary(){{"1", "单行文本框"}, {"2", "多行文本框"}, {"3", "浏览按钮"}, {"4", "Check框"}, {"5", "选择框"}, {"6", "附件上传"}, {"7", "特殊字段"}};
#endregion //End Fields
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
相关推荐: 企业架构师权威认证—TOGAF® 认证组合中文考试正式上线!
@所有架构从业人员 TOGAF® 认证组合中文版考试正式上线啦! The Open Group亚太区负责人高美华女士进行发布 千呼万唤始出来—TOGAF®认证组合中文版考试正式上线!一直翘首以待中文版考试的朋友们可以开始报名预约啦! 2023年…