本文整理汇总了C#中HyoaClass.Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid方法的典型用法代码示例。如果您正苦于以下问题:C# HyoaClass.Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid方法的具体用法?C# HyoaClass.Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid怎么用?C# HyoaClass.Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HyoaClass.Hyoa_flowfield
的用法示例。
在下文中一共展示了HyoaClass.Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckfmMainInput
//保存或提交时的JS代码(判断是否必填项),动态架构 Written by xf 20110515
public string CheckfmMainInput()
{
string ls_mid = "";
if (this.Request.QueryString["mid"] != null)
{
ls_mid = this.Request.QueryString["mid"].ToString();
if (ls_mid.Contains(","))
ls_mid = ls_mid.Substring(0, ls_mid.IndexOf(","));
}
string ls_tableid = "";
if (this.Request.QueryString["tableid"] != null)
{
ls_tableid = this.Request.QueryString["tableid"].ToString();
if (ls_tableid.Contains(","))
ls_tableid = ls_tableid.Substring(0, ls_tableid.IndexOf(","));
}
string ls_return = "";
//如果是“可修改所有文档的权限人员”,则可以修改所有的字段,不需要提示是否必填了。
HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
if (Hyoa_global.isHaveRole("Role9995", Session["hyuid"].ToString()))
{
}
else
{
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
//根据模块ID和表单ID得到对应的配置字段
DataTable dt_gettablecolumns = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mid, ls_tableid);
if (dt_gettablecolumns.Rows.Count > 0)
{
//判断是否必填
for (int i = 0; i < dt_gettablecolumns.Rows.Count; i++)
{
if (dt_gettablecolumns.Rows[i]["hy_required"].ToString() == "是")
{
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本加按钮" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本加按钮" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "日期" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "口令")
ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value==\"\"){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "不能为空!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".focus();return false;}}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "数值")
ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value==\"\"){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "不能为空!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".focus();return false;}if(isNaN(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value)){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "必须为数值!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".focus();return false}}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "对话框列表")
ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".selectedIndex==0){alert(\"请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".focus();return false;}}catch(err){}";
//if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "复选框")
// ls_return += "try{var ls_select=\"\";var obj1=document.getElementsById(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "\");for(var i = 0; i < obj1.length; i++){if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_select==\"\"){alert('请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!');return false;}}catch(err){}";
//if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "单选框")
// ls_return += "try{var ls_select=\"\";var obj1=document.getElementsById(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "\");for(var i = 0; i < obj1.length; i++){if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_select==\"\"){alert('请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!');return false;}}catch(err){}";
}
//哪个字段是待办事宜提醒的字段 edited by xf 20140625
if (dt_gettablecolumns.Rows[i]["hy_ifdbsybt"].ToString() == "是")
{
ls_return += "try{var d=document.getElementById('" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "');if(d==null||typeof(d.value)=='undefined'){}else{document.getElementById('hy_bt').value=d.value;}}catch(err){}";
}
}
}
}
return ls_return;
}
示例2: CheckfmMainInput
//保存或提交时的JS代码(判断是否必填项),动态架构 Written by xf 20110515
public string CheckfmMainInput()
{
string ls_mid = "";
if (this.Request.QueryString["mid"] != null)
{
ls_mid = this.Request.QueryString["mid"].ToString();
if (ls_mid.Contains(","))
ls_mid = ls_mid.Substring(0, ls_mid.IndexOf(","));
}
string ls_tableid = "";
if (this.Request.QueryString["tableid"] != null)
{
ls_tableid = this.Request.QueryString["tableid"].ToString();
if (ls_tableid.Contains(","))
ls_tableid = ls_tableid.Substring(0, ls_tableid.IndexOf(","));
}
string ls_return = "";
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
//根据模块ID和表单ID得到对应的配置字段
DataTable dt_gettablecolumns = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mid, ls_tableid);
if (dt_gettablecolumns.Rows.Count > 0)
{
//判断是否必填
for (int i = 0; i < dt_gettablecolumns.Rows.Count; i++)
{
if (dt_gettablecolumns.Rows[i]["hy_required"].ToString() == "是")
{
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本加按钮" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本加按钮" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "日期" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "口令")
ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value==\"\"){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "不能为空!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.focus();return false;}}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "数值")
ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value==\"\"){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "不能为空!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.focus();return false;}if(isNaN(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value)){alert(\"" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "必须为数值!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.focus();return false}}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "对话框列表")
ls_return += "try{if(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.selectedIndex==0){alert(\"请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!\");fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.focus();return false;}}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "复选框")
ls_return += "try{var ls_select=\"\";var obj1=document.getElementsByName(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1\");for(var i = 0; i < obj1.length; i++){if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_select==\"\"){alert('请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!');return false;}}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "单选框")
ls_return += "try{var ls_select=\"\";var obj1=document.getElementsByName(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1\");for(var i = 0; i < obj1.length; i++){if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_select==\"\"){alert('请选择" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "!');return false;}}catch(err){}";
}
}
}
return ls_return;
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string ls_mudelid="";
string ls_colname="";
string ls_colid="";
string ls_colname2="";
string ls_colid2="";
string ls_colname3="";
string ls_colid3="";
string ls_tableid = "";
if (this.Request.QueryString["mudelid"] != null)
{
ls_mudelid = this.Request.QueryString["mudelid"].ToString();
}
if (this.Request.QueryString["tableid"] != null)
{
ls_tableid = this.Request.QueryString["tableid"].ToString();
}
//模块对应的域
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
DataTable dt4 = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mudelid, ls_tableid);
if (dt4.Rows.Count > 0)
{
for (int i = 0; i < dt4.Rows.Count; i++)
{
if (ls_colname == "")
{
ls_colname = dt4.Rows[i]["hy_fieldname"].ToString();
ls_colid = dt4.Rows[i]["hy_fieldid"].ToString();
}
else
{
ls_colname = ls_colname + "+" + dt4.Rows[i]["hy_fieldname"].ToString();
ls_colid = ls_colid + "+" + dt4.Rows[i]["hy_fieldid"].ToString();
}
}
}
dt4.Clear();
string lsid = "";
//HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
//dt4 = Hyoa_listconfig.GetlistconfigsbyMudelidAndTableid(ls_mudelid,ls_tableid);
HyoaClass.DAO db = new HyoaClass.DAO();
string sql = "select *from hyt_searchconfig where hy_mudelid='" + ls_mudelid + "' and hy_tableid='" + ls_tableid + "'";
dt4 = db.GetDataTable(sql);
if (dt4.Rows.Count > 0)
{
ls_colname2 = dt4.Rows[0]["hy_columnshow"].ToString();
ls_colid2 = dt4.Rows[0]["hy_columnshowid"].ToString();
lsid = dt4.Rows[0]["ID"].ToString();
ls_colname3 = dt4.Rows[0]["hy_xszd"].ToString();
ls_colid3 = dt4.Rows[0]["hy_xszdid"].ToString();
}
dt4.Clear();
//HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();
//dt4 = Hyoa_listsearchfield.GetlistsearchfieldsbyMudelidAndListid(ls_mudelid,lsid);
//if (dt4.Rows.Count > 0)
//{
// for (int k = 0; k < dt4.Rows.Count; k++)
// {
// if (ls_colname3 == "")
// {
// ls_colname3 = dt4.Rows[k]["hy_field"].ToString();
// ls_colid3 = dt4.Rows[k]["hy_fieldid"].ToString();
// }
// else
// {
// ls_colname3 = ls_colname3 + "+" + dt4.Rows[k]["hy_field"].ToString();
// ls_colid3 = ls_colid3 + "+" + dt4.Rows[k]["hy_fieldid"].ToString();
// }
// }
//}
//HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();
//this.Response.Write(ls_colname + "*" + ls_colid + "#" + ls_colname2 + "*" + ls_colid2);
this.Response.Write(ls_colname + "*" + ls_colid + "#" + ls_colname2 + "*" + ls_colid2 + "#" + ls_colname3 + "*" + ls_colid3);
//return ;
}
示例4: ReplaceMainInput
//保存或提交时的JS代码(赋值),动态架构 Written by xf 20110714
public string ReplaceMainInput()
{
string ls_mid = "";
if (this.Request.QueryString["mid"] != null)
{
ls_mid = this.Request.QueryString["mid"].ToString();
if (ls_mid.Contains(","))
ls_mid = ls_mid.Substring(0, ls_mid.IndexOf(","));
}
string ls_tableid = "";
if (this.Request.QueryString["tableid"] != null)
{
ls_tableid = this.Request.QueryString["tableid"].ToString();
if (ls_tableid.Contains(","))
ls_tableid = ls_tableid.Substring(0, ls_tableid.IndexOf(","));
}
string ls_return = "";
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
//根据模块ID和表单ID得到对应的配置字段
DataTable dt_gettablecolumns = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mid, ls_tableid);
if (dt_gettablecolumns.Rows.Count > 0)
{
//赋值代码
for (int i = 0; i < dt_gettablecolumns.Rows.Count; i++)
{
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "文本加按钮" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "日期" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "口令")
ls_return += "try{fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value = fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value;}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本" || dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "多行文本加按钮")
ls_return += "try{fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value = RtftoTxt(fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value);}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "数值")
ls_return += "try{fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value = fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.value;}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "对话框列表")
ls_return += "try{fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value = fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.options[fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1.selectedIndex].value;}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "复选框")
ls_return += "try{var ls_select=\"\";var ls_flag=\"0\";var obj1=document.getElementsByName(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1\");for(var i = 0; i < obj1.length; i++){ls_flag=\"1\";if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_flag==\"1\"){fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value=ls_select;}}catch(err){}";
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "单选框")
ls_return += "try{var ls_select=\"\";var ls_flag=\"0\";var obj1=document.getElementsByName(\"" + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + "_1\");for(var i = 0; i < obj1.length; i++){ls_flag=\"1\";if(obj1[i].checked){if(ls_select==\"\"){ls_select = obj1[i].value;}else{ls_select=ls_select+\"#\"+obj1[i].value;}}}if(ls_flag==\"1\"){fm." + dt_gettablecolumns.Rows[i]["hy_fieldid"].ToString() + ".value=ls_select;}}catch(err){}";
}
}
return ls_return;
}
示例5: GetDataTableFieldHtml
//得到表单的HTML pi_flag 0:不赋值 1:需赋值 Written by xf 20110515
//docid:旧文档使用时,文档ID
//ifhavarole:是否有权限 0:lable输出 1:input输出
//ifflowdoc:是否流程表单 0:非流程 1:流程
//curtacheid:当前环节ID,用于判断字段是否在当前环节有权限
public DataTable GetDataTableFieldHtml(string hy_mudelid, string hy_tableid, string pi_flag, string ifsearch, string docid, string ifhavarole, string ifflowdoc, string curtacheid)
{
//加载表单
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
//根据模块ID和表单ID得到对应的配置字段
DataTable dt_gettablecolumns = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(hy_mudelid, hy_tableid);
string ls_html = "";
Int32 li_tdnums = 0; //TDS数(colspan的值相加)
DataTable tempTable = new DataTable();
DataColumn col = new DataColumn("displaycol", typeof(String)); //定义新的一列 add
tempTable.Columns.Add(col); //追加一列 add
if (dt_gettablecolumns.Rows.Count > 0)
{
//先从配置表中将配置的列数取出,如果配置表中找不到,则默认为4列,并且设置相应的宽度start
HyoaClass.Hyoa_detail Hyoa_detail = new HyoaClass.Hyoa_detail();
int li_col = 4;//一行显示几列
string ls_leftwidth = "15";//左侧列宽
string ls_rightwidth = "35";//右侧列宽
DataTable detaildt = Hyoa_detail.Getdetail(hy_tableid);
if (detaildt.Rows.Count > 0)
{
li_col = int.Parse(detaildt.Rows[0]["hy_colnum"].ToString());
if (detaildt.Rows[0]["hy_colnum"].ToString() == "6")
{
ls_leftwidth = "10";
ls_rightwidth = "23";
}
else
{
if (detaildt.Rows[0]["hy_colnum"].ToString() == "8")
{
ls_leftwidth = "5";
ls_rightwidth = "7";
}
else
{
if (detaildt.Rows[0]["hy_colnum"].ToString() == "10")
{
ls_leftwidth = "4";
ls_rightwidth = "6";
}
}
}
}
//先从配置表中将配置的列数取出,如果配置表中找不到,则默认为4列,并且设置相应的宽度end
//开始加载字段信息到DT中,用于前台显示
for (int i = 0; i < dt_gettablecolumns.Rows.Count; i++)
{
if (i == 0)
{
ls_html += "<TR height=\"30\">";
}
//输出字段说明列(文字说明除外)
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() != "说明文字")
{
//20120724
//如果是隐藏字段,则隐藏(增加display) added by xf 20120217
if (dt_gettablecolumns.Rows[i]["hy_ifhiddle"].ToString() != "是")
ls_html += "<TD width=\"" + ls_leftwidth + "%\" align=\"center\" class=\"Tdcellleft\">" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "</TD>";
else
ls_html += "<div style=\"display:none\">" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "</div>";
//ls_html += "<TD width=\"" + ls_leftwidth + "%\" align=\"center\" class=\"Tdcellleft\">" + dt_gettablecolumns.Rows[i]["hy_fieldname"].ToString() + "</TD>";
}
//得到当前字段的值
HyoaClass.Hyoa_flowmain Hyoa_flowmain = new HyoaClass.Hyoa_flowmain();
DataTable dt_flowmain = Hyoa_flowmain.Getflowmain(docid);
string field_docvalue = " ";
if (dt_flowmain.Rows.Count > 0)
{
if (dt_gettablecolumns.Rows[i]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
{
field_docvalue = System.DateTime.Parse(dt_flowmain.Rows[0][dt_gettablecolumns.Rows[i]["hy_sqlfield"].ToString()].ToString()).ToShortDateString() + field_docvalue;
}
else
{
//如果SQL为数值的字段部分,则需要截取小数点后边两位
if (dt_gettablecolumns.Rows[i]["hy_fieldtype"].ToString() == "数值")
{
if (dt_flowmain.Rows[0][dt_gettablecolumns.Rows[i]["hy_sqlfield"].ToString()].ToString().Contains(".") == true)
field_docvalue = float.Parse(dt_flowmain.Rows[0][dt_gettablecolumns.Rows[i]["hy_sqlfield"].ToString()].ToString()).ToString("F2") + field_docvalue;
else
field_docvalue = dt_flowmain.Rows[0][dt_gettablecolumns.Rows[i]["hy_sqlfield"].ToString()].ToString() + field_docvalue;
}
else
{
field_docvalue = dt_flowmain.Rows[0][dt_gettablecolumns.Rows[i]["hy_sqlfield"].ToString()].ToString() + field_docvalue;
}
}
}
//输出字段列
//this.Response.Write("<script>alert('" + ifhavarole + "');</script>");
if (ifhavarole == "0") //无权限(当前表单来讲)
//.........这里部分代码省略.........
示例6: DataPlay
private void DataPlay()
{
//是否启用
this.ddlifsearch.Items.Insert(0, "是");
this.ddlifsearch.Items.Insert(1, "否");
this.ddlifflowdoc.Items.Insert(0, "是");
this.ddlifflowdoc.Items.Insert(1, "否");
this.ddlifshowsearch.Items.Insert(0, "是");
this.ddlifshowsearch.Items.Insert(1, "否");
//模块编号
//加载模块信息
HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
DataTable dtmudel = Hyoa_mudel.Getmudels();
if (dtmudel.Rows.Count > 0)
{
this.ddlmudelid.DataSource = dtmudel;
this.ddlmudelid.DataTextField = "hy_mudelname";
this.ddlmudelid.DataValueField = "hy_mudelid";
this.ddlmudelid.DataBind();
this.ddlmudelid.Items.Insert(0, new ListItem("请选择", "请选择"));
this.ddlmudelid.SelectedIndex = 0;
}
if (this.Request.QueryString["op"] != null)
{
this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改
//判断当前用户是否有保存的权限
HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString()))
{
this.btn_submit.Visible = true; //保存
}
else
{
this.btn_submit.Visible = false; //保存
}
//旧文档
HyoaClass.Hyoa_listconfig Hyoa_listconfig = new HyoaClass.Hyoa_listconfig();
if (this.Request.QueryString["op"] == "modify")
{
if (this.Request.QueryString["id"] != null)
{
//根据id得到信息
this.txtdocid.Value = this.Request.QueryString["id"].ToString();
DataTable dt = Hyoa_listconfig.Getlistconfig(this.txtdocid.Value);
if (dt.Rows.Count > 0)
{
this.txtsort.Text = dt.Rows[0]["hy_sort"].ToString();
if (dt.Rows[0]["hy_ifsearch"].ToString() == "是")
{
this.ddlifsearch.SelectedIndex = 0;
}
else
{
this.ddlifsearch.SelectedIndex = 1;
}
if (dt.Rows[0]["hy_ifshowsearch"].ToString() != "否")
{
this.ddlifshowsearch.SelectedIndex = 0;
}
else
{
this.ddlifshowsearch.SelectedIndex = 1;
}
this.ddlmudelid.SelectedValue = dt.Rows[0]["hy_mudelid"].ToString();
if (dt.Rows[0]["hy_ifflowdoc"].ToString() == "是")
{
this.ddlifflowdoc.SelectedIndex = 0;
}
else
{
this.ddlifflowdoc.SelectedIndex = 1;
}
this.txthy_listname.Text = dt.Rows[0]["hy_listname"].ToString();
this.txtwidth.Text = dt.Rows[0]["hy_width"].ToString();
//加载所有列信息
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
DataTable dtflowfield;
//dtflowfield = Hyoa_flowfield.Getflowfields();
dtflowfield = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_tableid"].ToString());
if (dtflowfield.Rows.Count > 0)
{
this.ddlcolumnshow.DataSource = dtflowfield;
this.ddlcolumnshow.DataTextField = "hy_fieldname";
this.ddlcolumnshow.DataValueField = "hy_fieldid";
this.ddlcolumnshow.DataBind();
this.ddlcolumnshow.SelectedIndex = 0;
}
dtflowfield.Clear();
//将列都列出来
string[] lv_columnshowselect;
string[] lv_columnshowselectid;
lv_columnshowselect = dt.Rows[0]["hy_columnshow"].ToString().Split(',');
lv_columnshowselectid = dt.Rows[0]["hy_columnshowid"].ToString().Split(',');
for (int j = 0; j < lv_columnshowselect.Length; j++)
//.........这里部分代码省略.........
示例7: ExpertControl
/// <summary>
/// 将Web控件导出
/// </summary>
/// <param name="source">控件实例</param>
/// <param name="type">类型:Excel或Word</param>
public void ExpertControl(string ls_ids, DocumentType type)
{
//设置Http的头信息,编码格式
if (type == DocumentType.Excel)
{
//Excel
Response.AppendHeader("Content-Disposition", "attachment;filename=result.xls");
Response.ContentType = "application/ms-excel";
}
else if (type == DocumentType.Word)
{
//Word
Response.AppendHeader("Content-Disposition", "attachment;filename=result.doc");
Response.ContentType = "application/ms-word97";
}
Response.Charset = "Default";
Response.ContentEncoding = System.Text.Encoding.Default;
//关闭控件的视图状态
//source.Page.EnableViewState = false;
//初始化HtmlWriter
//System.IO.StringWriter writer = new System.IO.StringWriter();
//System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(writer);
//source.RenderControl(htmlWriter);
string ls_mid = "";
if (this.Request.QueryString["mid"] != null)
{
ls_mid = this.Request.QueryString["mid"].ToString();
}
string ls_tableid = "";
if (this.Request.QueryString["tableid"] != null)
{
ls_tableid = this.Request.QueryString["tableid"].ToString();
}
//根据模块ID+表单ID得到对应的域
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
DataTable dt_flowfield = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(ls_mid, ls_tableid);
string[] lv_left = new string[dt_flowfield.Rows.Count];
double[] lv_tatal = new double[dt_flowfield.Rows.Count];
string[] lv_right = new string[dt_flowfield.Rows.Count];
for (int i = 0; i < dt_flowfield.Rows.Count; i++)
{
if (dt_flowfield.Rows[i]["hy_sqlfield"].ToString().Contains("hy_field"))
{
if (dt_flowfield.Rows[i]["hy_fieldname"].ToString().IndexOf('(') >= 0 && dt_flowfield.Rows[i]["hy_fieldname"].ToString().IndexOf(')') >= 0)
{
lv_left[i] = dt_flowfield.Rows[i]["hy_fieldname"].ToString().Substring(0, dt_flowfield.Rows[i]["hy_fieldname"].ToString().LastIndexOf('('));
lv_tatal[i] = 0;
lv_right[i] = dt_flowfield.Rows[i]["hy_fieldname"].ToString().Substring(dt_flowfield.Rows[i]["hy_fieldname"].ToString().LastIndexOf('(') + 1, dt_flowfield.Rows[i]["hy_fieldname"].ToString().Length - dt_flowfield.Rows[i]["hy_fieldname"].ToString().LastIndexOf('(') - 2);
}
else
{
lv_left[i] = dt_flowfield.Rows[i]["hy_fieldname"].ToString();
lv_tatal[i] = 0;
lv_right[i] = "";
}
}
}
//得到数据
HyoaClass.Hyoa_flowmain Hyoa_flowmain = new HyoaClass.Hyoa_flowmain();
string[] lv_ids = ls_ids.Split(',');
for (var i = 0; i < lv_ids.Length; i++)
{
if (lv_ids[i] != "")
{
DataTable dt = Hyoa_flowmain.Getflowmain(lv_ids[i]);
if (dt.Rows.Count > 0)
{
if (dt_flowfield.Rows.Count > 0)
{
for (var j = 0; j < dt_flowfield.Rows.Count; j++)
{
if (dt_flowfield.Rows[j]["hy_sqlfield"].ToString().Contains("hy_field"))
{
if (dt.Rows[0][dt_flowfield.Rows[j]["hy_sqlfield"].ToString()].ToString() == "")
lv_tatal[j] = lv_tatal[j];
else
lv_tatal[j] = lv_tatal[j] + double.Parse(dt.Rows[0][dt_flowfield.Rows[j]["hy_sqlfield"].ToString()].ToString());
//if (j < dt_flowfield.Rows.Count - 1)
//{
// Response.Write(dt_flowfield.Rows[j]["hy_fieldname"].ToString() + ":");
// Response.Write(dt.Rows[0][dt_flowfield.Rows[j]["hy_sqlfield"].ToString()].ToString() + ",");
//}
}
}
//Response.Write("\n");
//Response.Write("\n");
}
}
//.........这里部分代码省略.........
示例8: btnDRToSQL_Click
//fy20130801 导入功能
protected void btnDRToSQL_Click(object sender, EventArgs e)
{
HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
//链接SQL数据库
if (FileUpload1.HasFile == false) //HasFile用来检查FileUpload是否有指定文件
{
Response.Write("<script>alert('请您选择Excel文件')</script> ");
return; //当无文件时,返回
}
string IsXls = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower(); //System.IO.Path.GetExtension获得文件的扩展名
if (IsXls != ".xls" && IsXls != ".xlsx")
{
Response.Write("<script>alert('只可以选择Excel文件')</script>");
return; //当选择的不是Excel文件时,返回
}
//根据年份判断在该路径下是否存在以当年年份文件夹 否则将建立以该年份的文件夹
string ls_ny = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString();
//HttpContext.Current.Server.MapPath(相对路径):把相对路径转为服务器上的绝对路径。File.Exists(绝对路径):检查是否存在绝对路径指向的文件或目录。
if (!Directory.Exists(HttpContext.Current.Server.MapPath("~\\upload\\") + "/" + ls_ny))
{
//System.IO.Directory.CreateDirectory(文件夹绝对路径):建立绝对路径文件夹。
System.IO.Directory.CreateDirectory(@HttpContext.Current.Server.MapPath("~\\upload\\") + "/" + ls_ny);
}
string filename = DateTime.Now.ToString("hhMMss") + FileUpload1.FileName; //重新为文件命名,获取Execle文件名 DateTime日期函数
// 保存文件到路径,用Server.MapPath()取当前文件的绝对目录.在asp.net里""必须用"\"代替
string savePath = Server.MapPath(("~\\upload/" + ls_ny + "\\") + filename);//Server.MapPath 获得虚拟服务器相对路径
FileUpload1.SaveAs(savePath); //SaveAs 将上传的文件内容保存在服务器上
DataSet ds = ExecleDs(savePath, filename); //调用自定义方法
DataRow[] dr = ds.Tables[0].Select(); //定义一个DataRow数组
int rowsnum = ds.Tables[0].Rows.Count;
int i_into = 0;
if (rowsnum == 0)
{
Response.Write("<script>alert('Excel表为空表,无数据!')</script>"); //当Excel表为空时,对用户进行提示
}
else
{
String ls_zbdocid = ""; //总表的文档id,用于记录到子表中的关联字段中
int li_excelcolumnnum=0;
for (int i = 0; i < dr.Length; i++)
{
try
{
String sql = "";
String insertstr_left = "";
String insertstr_right = "";
if (dr[i][0].ToString() != "")
{
//总表
ls_zbdocid = Hyoa_global.GetRandom();
DataTable dt_field = Hyoa_flowfield.GetflowfieldsbyMudelidAndTableid(mudelid.Text, tableid.Text);
if (dt_field.Rows.Count > 0)
{
insertstr_left = "insert into hyc_" + tableid.Text + " (DOCID,hy_mudelid,hy_tableid,hy_djrid,hy_djrname,hy_djrbmid,hy_djrbmname,hy_djsj";
insertstr_right = "'" + ls_zbdocid + "','" + mudelid.Text + "','" + tableid.Text + "','" + Session["hyuid"].ToString() + "','" + Session["hyuname"].ToString() + "','" + Session["hydeptid"].ToString() + "','" + Session["hydeptname"].ToString() + "','" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
li_excelcolumnnum = 0;
int jj = 0;
for (int j = 0; j < dt_field.Rows.Count; j++)
{
String field_type = dt_field.Rows[j]["hy_fieldtype"].ToString();
if (field_type == "文本" || field_type == "多行文本" || field_type == "文本加按钮" || field_type == "多行文本加按钮" || field_type == "日期" || field_type == "数值" || field_type == "对话框列表" || field_type == "复选框" || field_type == "单选框" || field_type == "口令" || field_type == "编辑器")
{
insertstr_left += ",hyc_" + dt_field.Rows[j]["hy_fieldid"].ToString();
if (j == 0)
{
insertstr_right += ",'" + Session["hyuname"].ToString() + "'"; //登记人
}
else
{
if (j == 1)
{
insertstr_right += ",'" + System.DateTime.Now.ToString("yyyy-MM-dd") + "'"; //登记时间
}
else
{
if (j == 2)
{
insertstr_right += ",'" + Session["hydeptname"].ToString() + "'"; //登记部门
}
else
{
insertstr_right += ",'" + dr[i][jj].ToString() + "'";
li_excelcolumnnum += 1;
jj += 1;
}
}
}
}
}
}
}
else
{
//子表
//.........这里部分代码省略.........