本文整理汇总了C#中HyoaClass.Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid方法的典型用法代码示例。如果您正苦于以下问题:C# HyoaClass.Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid方法的具体用法?C# HyoaClass.Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid怎么用?C# HyoaClass.Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HyoaClass.Hyoa_flowfield
的用法示例。
在下文中一共展示了HyoaClass.Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataPlay
//.........这里部分代码省略.........
for (int n = 0; n < lvcolname.Length; n++)
{
if (n >= lvcolwidth.Length)
{ lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
else
{ lscolwidthper = lvcolwidth[n]; }
this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[n] + "</td>";
}
}
for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++)
{
if (i > dt.Rows.Count - 1)
break;
DataRow dr = tempTable.NewRow();
//输出主表所有字段,start
for (int j = 0; j < dt.Columns.Count; j++)
{
dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
}
//输出主表所有字段,end
//////开始得到列的值
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
DataTable dtgetsqlfield;
for (int m = 0; m < lvcolname.Length; m++)
{
//如果有数据,则输出数据
if (m >= lvcolwidth.Length)
{ lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
else
{ lscolwidthper = lvcolwidth[m]; }
dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m],this.txttableid.Value);
//ztm
if (i % System.Int32.Parse(PageSize.Text) == 0)
this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[m] + "</td>";
//根据字段英文名,得到数据库中对应的字段
string lsgetsqlfield = dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString();
//根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换)
string lsgetputfiled="";
if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
{
lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToShortDateString();
}
else
{
//解决Float小数点后面出现N位小数乱码的问题
if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
{
//是否包含小数点,包含的话,取小数点后两位
if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true)
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2");
}
else
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString();
}
//lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString();
}else
{
lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString();
}
示例2: GetSearchTableHtml
public void GetSearchTableHtml()
{
//输出查询字段的表格(查询输入框) start
HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();
DataTable dtlistsearch = Hyoa_listsearchfield.GetlistsearchfieldsbyMudelidAndTableid(this.txtmudelid.Value, this.txttableid.Value);
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
//DataTable dtgetsqlfield;
string lssearchdispaly = ""; //返回值
//输出外框(开始)
lssearchdispaly +="<tr height=40px>";
lssearchdispaly +="<td valign=\"top\" >";
lssearchdispaly +="<table width=\"100%\" border=0>";
lssearchdispaly +="<tr>";
lssearchdispaly +="<td align=\"center\" valign=\"top\">";
lssearchdispaly +="<table width=\"100%\" height=\"5\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
lssearchdispaly +="<tr>";
lssearchdispaly +="<td></td>";
lssearchdispaly +="</tr>";
lssearchdispaly +="</table>";
lssearchdispaly +="<table width=\"98%\" border=0 cellpadding=0 cellspacing=1 class=\"tb1-main\">";
HyoaClass.DAO db = new HyoaClass.DAO();
string lsflag = "0"; //1表示有</tr>,则最后不用输出,否则循环完后,要输出一个</tr>
for (int t = 0; t < dtlistsearch.Rows.Count; t++)
{
if (t % 2 == 0)
{
lssearchdispaly += "<tr>";
lsflag = "0";
}
//得到hyt_listsearchfield表中的hy_fieldid,
string lslistsearch = dtlistsearch.Rows[t]["hy_fieldid"].ToString();
//根据字段英文名得到数据库中对应的字段名,ztmztm
DataTable dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lslistsearch, this.txttableid.Value); //得到与SQL表对应的字段名
lssearchdispaly += "<td width=\"15%\" height=\"30\" align=\"center\" class=\"Tdcellleft\">";
lssearchdispaly += dtlistsearch.Rows[t]["hy_field"].ToString();
lssearchdispaly += "</td>";
lssearchdispaly += " <td width=\"35%\" align=\"left\" class=\"Tdcellright\">";
//调用公用函数,输出txt查询框
lssearchdispaly += GetFieldHtml(this.txtmudelid.Value, dtgetsqlfield.Rows[0]["hy_fieldid"].ToString(), "0", this.txttableid.Value, "1");
lssearchdispaly += "</td>";
if ((t + 1) % 2 == 0)
{
lssearchdispaly += "</tr>";
lsflag = "1";
}
dtgetsqlfield.Clear();
}
//如果上面</tr>没有输出过,则要输出一个</tr>,保证html的完整性
if (lsflag != "1")
{
for (int t = 0; t < (4 - dtlistsearch.Rows.Count % 2 * 2); t++)
{
//如果行不足四列,则要补满四列
lssearchdispaly += " <td align=\"left\" class=\"Tdcellright\">";
lssearchdispaly += " ";
lssearchdispaly += "</td>";
}
lssearchdispaly += "</tr>";
}
//输出外框(结束)
lssearchdispaly += "<tr>";
lssearchdispaly += "<td height=\"30\" align=\"right\" class=\"Tdcellright\" colspan=4>";
lssearchdispaly += "<input type=\"button\" onclick=\"jssearch();\" value=\" 查 询\" class=btn7 name=\"Button_Return\" /> ";
lssearchdispaly += "</td>";
lssearchdispaly += "</tr>";
lssearchdispaly += "</table>";
lssearchdispaly += "</td>";
lssearchdispaly += "</tr>";
lssearchdispaly += "</table>";
lssearchdispaly += "</td>";
lssearchdispaly += "</tr>";
this.lbsearchidspaly.Text = lssearchdispaly;
//输出查询字段的表格 end
}
示例3: hyjs
public string hyjs()
{
//输出查询字段的JS start
HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();
DataTable dtlistsearch = Hyoa_listsearchfield.GetlistsearchfieldsbyMudelidAndTableid(this.txtmudelid.Value,this.txttableid.Value);
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
DataTable dtgetsqlfield;
string ls_return = "";
string fieldfz = "";//对应域JS域值
ls_return += "<script>function jssearch()"; //js生成
ls_return += "{fm = document.forms[0];";//js生成
for (int t = 0; t < dtlistsearch.Rows.Count; t++)
{
//根据模块ID和当前域名和表名id得到SQL字段 ztmztm
dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, dtlistsearch.Rows[t]["hy_fieldid"].ToString(), this.txttableid.Value);
fieldfz = "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + ".value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_1.value;";
if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString()=="数值")
{
fieldfz = "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_start.value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1.value;";
fieldfz += "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_end.value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1.value;";
}
if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "日期")
{
fieldfz = "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_start.value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_start_1.value;";
fieldfz += "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_end.value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_end_1.value;";
}
if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "对话框列表")
{
//document.forms[0].fNumber(域名).options[document.forms[0].fNumber(域名).selectedIndex].text
fieldfz += "fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + ".value = fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_1.options[fm." + dtgetsqlfield.Rows[0]["hy_sqlfield"].ToString() + "_1.selectedIndex].text;";
}
ls_return += fieldfz;
dtgetsqlfield.Clear();
}
ls_return += "fm.btnsearch.click();";//js生成
ls_return += "}</script>";//js生成
return ls_return;
}
示例4: DataPlay
//.........这里部分代码省略.........
lvcolwidth = lscolwidth.Split(',');
if (dt.Rows.Count <= 0)
{
//如果没有数据则输出表头
for (int n = 0; n < lvcolname.Length; n++)
{
if (n >= lvcolwidth.Length)
{ lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
else
{ lscolwidthper = lvcolwidth[n]; }
this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[n] + "</td>";
}
}
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = tempTable.NewRow();
//输出主表所有字段,start
for (int j = 0; j < dt.Columns.Count; j++)
{
dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
}
//输出主表所有字段,end
//////开始得到列的值
DataTable dtgetsqlfield;
for (int m = 0; m < lvcolname.Length; m++)
{
//如果有数据,则输出数据
if (m >= lvcolwidth.Length)
{ lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
else
{ lscolwidthper = lvcolwidth[m]; }
dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m], this.txttableid.Value);
if (i % System.Int32.Parse(PageSize.Text) == 0)
this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\"><a href=\"#\" title=\"点击可排序\" onclick=\"fun_sort('" + lvcolnameid[m] + "');\">" + lvcolname[m] + "</a></p></td>";
//根据字段英文名,得到数据库中对应的字段
string lsgetsqlfield = "hyc_" + dtgetsqlfield.Rows[0]["hy_fieldid"].ToString();
//根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换)
string lsgetputfiled = "";
if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
{
if (dt.Rows[i][lsgetsqlfield].ToString() != "")
lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToShortDateString();
}
else
{
//解决Float小数点后面出现N位小数乱码的问题
if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
{
if (dt.Rows[i][lsgetsqlfield].ToString() != "")
{
//是否包含小数点,包含的话,取小数点后两位
if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true)
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2");
}
else
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString();
}
}
else
{
示例5: GetFieldHtml
//得到某一个字段的HTML
//pi_flag 0:不赋值 1:需赋值
//ifsearch:是否查询时使用 0:非查询时使用 1:查询时使用
public string GetFieldHtml(string hy_mudelid, string hy_fieldid, string pi_flag, string hy_tableid, string ifsearch)
{
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(hy_mudelid, hy_fieldid, hy_tableid);
HyoaClass.DAO db = new HyoaClass.DAO();
string lsField = "";
string field_css = "";
string field_value = "";
string field_functionhy_onclick = "";
string field_functionhy_ondblclick = "";
string field_functionhy_onchange = "";
string field_functionhy_onkeydown = "";
string field_functionhy_onkeyup = "";
if (dtfield.Rows.Count > 0)
{
//得到该字段的样式start
if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
{
if (ifsearch == "0")
field_css += " readonly ";
}
if (dtfield.Rows[0]["hy_class"].ToString() != "")
{
field_css += " class='" + dtfield.Rows[0]["hy_class"].ToString() + "' ";
}
if (dtfield.Rows[0]["hy_width"].ToString() != "")
{
field_css += " style='width:" + dtfield.Rows[0]["hy_width"].ToString() + ";";
}
else
{
field_css += " style='";
}
if (dtfield.Rows[0]["hy_height"].ToString() != "")
{
field_css += " height:" + dtfield.Rows[0]["hy_height"].ToString() + "'";
}
else
{
field_css += "'";
}
//默认值
//默认值取值的方式,查询时不使用默认值
if (ifsearch == "0")
{
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "")
{
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "0")
field_value += dtfield.Rows[0]["hy_defaultvalue"].ToString();
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "1")
{
DataTable dtdefault = db.GetDataTable(dtfield.Rows[0]["hy_defaultvalue"].ToString());
if (dtdefault.Rows.Count > 0)
field_value += dtdefault.Rows[0][0].ToString();
}
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "2")
{
field_value += Session[dtfield.Rows[0]["hy_defaultvalue"].ToString()].ToString();
}
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "3")
{
if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
field_value += System.DateTime.Now.ToShortDateString();
else
field_value += System.DateTime.Now.ToString();
}
}
}
//事件
if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
{
field_functionhy_onclick += " onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" ";
}
if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
{
field_functionhy_ondblclick += " ondblclick=\"" + dtfield.Rows[0]["hy_ondblclick"].ToString() + "\" ";
}
if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
{
field_functionhy_onchange += " onchange=\"" + dtfield.Rows[0]["hy_onchange"].ToString() + "\" ";
}
if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
{
field_functionhy_onkeydown += " onkeydown=\"" + dtfield.Rows[0]["hy_onkeydown"].ToString() + "\" ";
}
if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
{
field_functionhy_onkeyup += " onkeyup=\"" + dtfield.Rows[0]["hy_onkeyup"].ToString() + "\" ";
}
//得到该字段的样式end
string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString();
//单行文本
if (field_type == "文本")
//.........这里部分代码省略.........
示例6: GetFieldHtml
//输出一个字段
//li_tdnums_onerow:当前行已输出了几列
//li_colnums_show:每行显示几列(标准情况下)
//pi_isnewdoc 0:新文档 1:旧文档
//ifhavarole:表单上是否有权限 0:lable输出 1:input输出
//ifflowdoc:是否流程表单 0:非流程 1:流程
//curtacheid:当前环节ID,用于判断字段是否在当前环节有权限
public int GetFieldHtml(TableRow tRow, int li_tdnums_onerow, int li_colnums_show, string hy_fieldid, string pi_isnewdoc, string ifhavarole, string ifflowdoc, string curtacheid)
{
int li_return = li_tdnums_onerow;
string ls_laborinput = "0"; //输出LABLE还是INPUT 0:LABLE 1:INPUT
HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.hy_mudelid.Text, hy_fieldid, this.hy_tableid.Text);
int li_left = 30;
int li_right = 70;
if (dtfield.Rows.Count > 0)
{
string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString(); //字段类型
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "5") //如果设置了不显示左侧说明文字,则不加载左侧列
{
li_return += 1;
//插入单元格(左侧)
TableCell tCell = new TableCell();
tRow.Cells.Add(tCell);
tCell.Width = Unit.Percentage((li_left / li_colnums_show));
tCell.Height = Unit.Pixel(30);
tCell.CssClass = "Tdcellleft";
tCell.HorizontalAlign = HorizontalAlign.Center;
tCell.Controls.Add(new LiteralControl(dtfield.Rows[0]["hy_fieldname"].ToString()));
}
else
{
li_left = 50;
li_right = 50;
}
//插入单元格(右侧)
TableCell tCell2 = new TableCell();
tRow.Cells.Add(tCell2);
tCell2.Width = Unit.Percentage((li_right / li_colnums_show));
tCell2.Height = Unit.Pixel(30);
tCell2.CssClass = "Tdcellright";
if (dtfield.Rows[0]["hy_align"].ToString() == "left")
{
tCell2.HorizontalAlign = HorizontalAlign.Left;
}
if (dtfield.Rows[0]["hy_align"].ToString() == "center")
{
tCell2.HorizontalAlign = HorizontalAlign.Center;
}
if (dtfield.Rows[0]["hy_align"].ToString() == "right")
{
tCell2.HorizontalAlign = HorizontalAlign.Right;
}
tCell2.ColumnSpan = int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString());
li_return += int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString());
//赋值(新文档取配置的默认值,旧文档取数据库表中的值)
string field_docvalue = "";
if (pi_isnewdoc == "0") //新文档
{
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "-1")
{
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "0")
{
field_docvalue = dtfield.Rows[0]["hy_defaultvalue"].ToString(); //手工配置
}
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "1")
{
DataTable dt_getfieldvalue = Hyoa_global.GetDataTable(dtfield.Rows[0]["hy_defaultvalue"].ToString());
field_docvalue = dt_getfieldvalue.Rows[0][0].ToString(); //SQL语句
}
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "2")
{
field_docvalue = Session[dtfield.Rows[0]["hy_defaultvalue"].ToString()].ToString(); //SESSION
}
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "3")
{
if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd"); //当前时间
else
field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd HH:MM:ss"); //当前时间
}
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "4")
{
//自动生成
if (dtfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
{
//得到目前最大的数值,然后+1,未找到则赋值为1
DataTable dt_autovalue = Hyoa_global.GetDataTable("select max(hyc_" + hy_fieldid + ") maxint from hyc_" + this.hy_tableid.Text);
if (dt_autovalue.Rows[0]["maxint"].ToString() == null || dt_autovalue.Rows[0]["maxint"].ToString() == "")
field_docvalue += "1";
else
field_docvalue += (System.Int32.Parse(dt_autovalue.Rows[0]["maxint"].ToString()) + 1).ToString();
}
else
{
field_docvalue += System.Guid.NewGuid().ToString();
//.........这里部分代码省略.........
示例7: GetFieldHtml
//输出一个字段
public void GetFieldHtml(TableRow tRow, int li_colnums_show, string hy_fieldid)
{
HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
//得到字段属性
DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, hy_fieldid, this.txttableid.Value);
if (dtfield.Rows.Count > 0)
{
string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString();
//插入单元格(左侧)
TableCell tCell = new TableCell();
tRow.Cells.Add(tCell);
tCell.Width = Unit.Percentage((30 / li_colnums_show));
tCell.Height = Unit.Pixel(30);
tCell.CssClass = "Tdcellleft";
tCell.HorizontalAlign = HorizontalAlign.Center;
tCell.Controls.Add(new LiteralControl(dtfield.Rows[0]["hy_fieldname"].ToString()));
//插入单元格(右侧)
TableCell tCell2 = new TableCell();
tRow.Cells.Add(tCell2);
tCell2.Width = Unit.Percentage((70 / li_colnums_show));
tCell2.Height = Unit.Pixel(30);
tCell2.CssClass = "Tdcellright";
tCell2.HorizontalAlign = HorizontalAlign.Left;
//单行文本
if (field_type == "文本")
{
TextBox txtTextBox = new TextBox();
txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
//if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
//{
// txtTextBox.ReadOnly = true;
//}
if (dtfield.Rows[0]["hy_class"].ToString() != "")
{
txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
}
if (dtfield.Rows[0]["hy_width"].ToString() != "")
{
txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
}
if (dtfield.Rows[0]["hy_height"].ToString() != "")
{
txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
}
if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
{
txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
}
if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
{
txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
}
if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
{
txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
}
if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
{
txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
}
if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
{
txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
}
tCell2.Controls.Add(txtTextBox);
//插入字段:共有哪几个查询条件
addsearchfields(dtfield.Rows[0]["hy_fieldid"].ToString(), "0");
}
//多行文本
if (field_type == "多行文本")
{
TextBox txtTextBox = new TextBox();
txtTextBox.TextMode = TextBoxMode.MultiLine;
txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
//if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
//{
// txtTextBox.ReadOnly = true;
//}
if (dtfield.Rows[0]["hy_class"].ToString() != "")
{
txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
}
if (dtfield.Rows[0]["hy_width"].ToString() != "")
{
txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
}
if (dtfield.Rows[0]["hy_height"].ToString() != "")
{
txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
}
if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
{
txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
}
if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
{
//.........这里部分代码省略.........
示例8: DataPlay
//.........这里部分代码省略.........
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++)
{
this.ddlcolumnshowselect.Items.Insert(j, new ListItem(lv_columnshowselect[j], lv_columnshowselectid[j]));
}
//根据模块信息得到对应的选择表单值
if (dt.Rows[0]["hy_tableid"] != "" && dt.Rows[0]["hy_tableid"] != null)
{
this.ddltableid.Items.Clear();
//根据模块ID得到表单ID
HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig();
DataTable dtgettableid = Hyoa_tableconfig.GetTablesbymudelid(dt.Rows[0]["hy_mudelid"].ToString());
if (dtgettableid.Rows.Count > 0)
{
for (var i = 0; i < dtgettableid.Rows.Count; i++)
{
this.ddltableid.Items.Insert(i, new ListItem(dtgettableid.Rows[i]["hy_name"].ToString(), dtgettableid.Rows[i]["ID"].ToString()));
}
this.ddltableid.Items.Insert(0, new ListItem("--请选择--", ""));
this.ddltableid.Attributes.Add("onchange ", "mudelidonchang() ");
//定位
this.ddltableid.SelectedValue = dt.Rows[0]["hy_tableid"].ToString();
}
}
//排序的字段
//根据模块ID+表单ID+字段ID得到字段中文名
DataTable dt_flowfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_sortfield1"].ToString(), dt.Rows[0]["hy_tableid"].ToString());
if (dt_flowfield.Rows.Count > 0)
{
this.searchsort1.Items.Insert(0, new ListItem(dt_flowfield.Rows[0]["hy_fieldname"].ToString(), dt.Rows[0]["hy_sortfield1"].ToString()));
}
this.ddlsorttype1.SelectedValue = dt.Rows[0]["hy_sorttype1"].ToString();
dt_flowfield.Clear();
dt_flowfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_sortfield2"].ToString(), dt.Rows[0]["hy_tableid"].ToString());
if (dt_flowfield.Rows.Count > 0)
{
this.searchsort2.Items.Insert(0, new ListItem(dt_flowfield.Rows[0]["hy_fieldname"].ToString(), dt.Rows[0]["hy_sortfield2"].ToString()));
}
this.ddlsorttype2.SelectedValue = dt.Rows[0]["hy_sorttype2"].ToString();
dt_flowfield.Clear();
dt_flowfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(dt.Rows[0]["hy_mudelid"].ToString(), dt.Rows[0]["hy_sortfield3"].ToString(), dt.Rows[0]["hy_tableid"].ToString());
if (dt_flowfield.Rows.Count > 0)
{
this.searchsort3.Items.Insert(0, new ListItem(dt_flowfield.Rows[0]["hy_fieldname"].ToString(), dt.Rows[0]["hy_sortfield3"].ToString()));
}
this.ddlsorttype3.SelectedValue = dt.Rows[0]["hy_sorttype3"].ToString();
dt_flowfield.Clear();
//分类的字段
this.txthy_field_fl1.Text = dt.Rows[0]["hy_sql_fl1"].ToString();
if (dt.Rows[0]["hy_fieldid_fl1"].ToString() != "")
{
this.flfield1.Items.Insert(0, new ListItem(dt.Rows[0]["hy_fieldname_fl1"].ToString(), dt.Rows[0]["hy_fieldid_fl1"].ToString()));
}
this.txthy_field_fl2.Text = dt.Rows[0]["hy_sql_fl2"].ToString();
if (dt.Rows[0]["hy_fieldid_fl2"].ToString() != "")
{
this.flfield2.Items.Insert(0, new ListItem(dt.Rows[0]["hy_fieldname_fl2"].ToString(), dt.Rows[0]["hy_fieldid_fl2"].ToString()));
}
this.txthy_field_fl3.Text = dt.Rows[0]["hy_sql_fl3"].ToString();
if (dt.Rows[0]["hy_fieldid_fl3"].ToString() != "")
{
this.flfield3.Items.Insert(0, new ListItem(dt.Rows[0]["hy_fieldname_fl3"].ToString(), dt.Rows[0]["hy_fieldid_fl3"].ToString()));
}
}
dt.Clear();
HyoaClass.Hyoa_listsearchfield Hyoa_listsearchfield = new HyoaClass.Hyoa_listsearchfield();
DataTable dt5 = Hyoa_listsearchfield.Getlistsearchfieldsbylistid(this.txtdocid.Value);
if (dt5.Rows.Count > 0)
{
for (int m = 0; m < dt5.Rows.Count; m++)
{
this.searchselect.Items.Insert(m, new ListItem(dt5.Rows[m]["hy_field"].ToString(), dt5.Rows[m]["hy_fieldid"].ToString()));
}
}
}
}
else
{
//自动获取最大排序号,然后+2
DataTable dt_maxsort = Hyoa_listconfig.GetMaxlistconfigsort();
if (dt_maxsort.Rows.Count > 0)
txtsort.Text = (int.Parse(dt_maxsort.Rows[0]["hy_sort"].ToString()) + 2).ToString();
else
txtsort.Text = "1";
}
}
}
示例9: GetFieldHtml
//得到某一个字段的HTML Written by xf 20110515
//pi_flag 0:不赋值 1:需赋值
//ifsearch:是否查询时使用 0:非查询时使用 1:查询时使用
//docid:旧文档使用时,文档ID,新文档则为空就可以
//ifhavarole:是否有权限 0:lable输出 1:input输出
public string GetFieldHtml(string hy_mudelid, string hy_fieldid, string pi_flag, string hy_tableid, string ifsearch, string docid, string ifhavarole)
{
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(hy_mudelid, hy_fieldid, hy_tableid);
HyoaClass.DAO db = new HyoaClass.DAO();
string lsField = "";
string field_css = "";
string field_value = "";
string field_functionhy_onclick = "";
string field_functionhy_ondblclick = "";
string field_functionhy_onchange = "";
string field_functionhy_onkeydown = "";
string field_functionhy_onkeyup = "";
string field_wordlimit = "";
if (dtfield.Rows.Count > 0)
{
//得到该字段的样式start
if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
{
if (ifsearch == "0")
field_css += " readonly ";
}
if (dtfield.Rows[0]["hy_class"].ToString() != "")
{
field_css += " class='" + dtfield.Rows[0]["hy_class"].ToString() + "' ";
}
if (dtfield.Rows[0]["hy_width"].ToString() != "")
{
field_css += " style='width:" + dtfield.Rows[0]["hy_width"].ToString() + ";";
}
else
{
field_css += " style='";
}
if (dtfield.Rows[0]["hy_height"].ToString() != "")
{
field_css += " height:" + dtfield.Rows[0]["hy_height"].ToString() + "'";
}
else
{
field_css += "'";
}
//得到字数限制
if (dtfield.Rows[0]["hy_wordlimit"].ToString() != "")
{
field_wordlimit += " maxlength='" + dtfield.Rows[0]["hy_wordlimit"].ToString() + "' ";
}
//默认值
//默认值取值的方式,查询时不使用默认值
if (ifsearch == "0")
{
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "")
{
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "0")
field_value += dtfield.Rows[0]["hy_defaultvalue"].ToString();
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "1")
{
DataTable dtdefault = db.GetDataTable(dtfield.Rows[0]["hy_defaultvalue"].ToString());
if (dtdefault.Rows.Count > 0)
field_value += dtdefault.Rows[0][0].ToString();
}
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "2")
{
field_value += Session[dtfield.Rows[0]["hy_defaultvalue"].ToString()].ToString();
}
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "3")
{
if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
field_value += System.DateTime.Now.ToShortDateString();
else
field_value += System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
//自动生成值的情况 Added by xf 20110719
if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "4")
{
if (dtfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
{
//得到目前最大的数值,然后+1,未找到则赋值为1
HyoaClass.DAO db_autovalue = new HyoaClass.DAO();
DataTable dt_autovalue = db_autovalue.GetDataTable("select max(hy_field36) as maxint from hyp_flowmain where hy_tableid='" + dtfield.Rows[0]["hy_tableid"].ToString() + "'");
if (dt_autovalue.Rows[0]["maxint"].ToString() == null || dt_autovalue.Rows[0]["maxint"].ToString() == "")
field_value += "1";
else
field_value += (System.Int32.Parse(dt_autovalue.Rows[0]["maxint"].ToString()) + 1).ToString();
}
else
{
field_value += System.Guid.NewGuid().ToString();
}
//.........这里部分代码省略.........
示例10: getExcelContent
//.........这里部分代码省略.........
string[] lvcolname;
string[] lvcolnameid;
string[] lvcolwidth;
string lscolwidthper;
lscolname = dtlist.Rows[0]["hy_columnshow"].ToString(); //要显示的列名:附件,标题,收文来源
lscolnameid = dtlist.Rows[0]["hy_columnshowid"].ToString(); //要显示的列名id:uploadfile1,Hy_bt,Hy_swly
lscolwidth = dtlist.Rows[0]["hy_width"].ToString(); //要显示的列名id:10,20,30
lvcolname = lscolname.Split(',');
lvcolnameid = lscolnameid.Split(',');
lvcolwidth = lscolwidth.Split(',');
string ls_colspan = (lvcolname.Length + 1).ToString();
sb.Append("<table border='1'>");
sb.Append("<thead><tr><th colSpan='" + ls_colspan + "' class='ztitle'>" + this.lblcurtachenameshow.Text + "</th></tr>");
sb.Append("<tr><th colSpan='" + ls_colspan + "' class='tdheight20'></th></tr>");
sb.Append("<tr>");
sb.Append("<th style='width:70px;' class='tdcenter'>序号</th>");
//如果没有数据则输出表头
for (int n = 0; n < lvcolname.Length; n++)
{
if (n >= lvcolwidth.Length)
{
//此判断是为了防止对应宽度没有输入时,会溢出报错。
lscolwidthper = "100";
}
else
{
lscolwidthper = (int.Parse(lvcolwidth[n]) * 20).ToString();
}
sb.Append("<th style='width:" + lscolwidthper + "px;' class='tdcenter'>" + lvcolname[n] + "</th>");
}
sb.Append("</tr></thead>");
if (dt.Rows.Count <= 0)
{
sb.Append("</table>");
}
else
{
//如果有数据,则输出数据
sb.Append("<tbody>");
for (int i = 0; i < dt.Rows.Count; i++)
{
sb.Append("<tr>");
sb.Append("<td class='tdcenter'>" + (i + 1).ToString() + "</td>"); //序号
//////开始得到列的值
DataTable dtgetsqlfield;
for (int m = 0; m < lvcolname.Length; m++)
{
//根据字段英文名,得到数据库中对应的字段
dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m], this.txttableid.Value);
string lsgetsqlfield = "hyc_" + dtgetsqlfield.Rows[0]["hy_fieldid"].ToString();
//根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换)
string lsgetputfiled = "";
if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
{
if (dt.Rows[i][lsgetsqlfield].ToString() != "")
lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("yyyy-MM-dd");
}
else
{
//解决Float小数点后面出现N位小数乱码的问题
if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
{
if (dt.Rows[i][lsgetsqlfield].ToString() != "")
{
//是否包含小数点,包含的话,取小数点后两位
if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true)
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2");
}
else
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString();
}
}
else
{
lsgetputfiled = "0";
}
//lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString();
}
else
{
lsgetputfiled = dt.Rows[i][lsgetsqlfield].ToString();
}
}
if (lsgetputfiled == "")
lsgetputfiled = " ";
sb.Append("<td class='tdcenter'>" + lsgetputfiled + "</td>");
}
sb.Append("</tr>");
}
sb.Append("</tbody></table>");
}
return sb.ToString();
}
示例11: DataPlay
//.........这里部分代码省略.........
lvcolwidth = lscolwidth.Split(',');
if (dt.Rows.Count <= 0)
{
//如果没有数据则输出表头
for (int n = 0; n < lvcolname.Length; n++)
{
if (n >= lvcolwidth.Length)
{ lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
else
{ lscolwidthper = lvcolwidth[n]; }
this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[n] + "</td>";
}
}
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = tempTable.NewRow();
//输出主表所有字段,start
for (int j = 0; j < dt.Columns.Count; j++)
{
dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
}
//输出主表所有字段,end
//////开始得到列的值
DataTable dtgetsqlfield;
for (int m = 0; m < lvcolname.Length; m++)
{
//如果有数据,则输出数据
if (m >= lvcolwidth.Length)
{ lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
else
{ lscolwidthper = lvcolwidth[m]; }
dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m], this.txttableid.Value);
if (i % System.Int32.Parse(PageSize.Text) == 0)
this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\"><a href=\"#\" title=\"点击可排序\" onclick=\"fun_sort('" + lvcolnameid[m] + "');\">" + lvcolname[m] + "</a></p></td>";
//根据字段英文名,得到数据库中对应的字段
string lsgetsqlfield = "hyc_" + dtgetsqlfield.Rows[0]["hy_fieldid"].ToString();
//根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换)
string lsgetputfiled = "";
if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
{
if (dt.Rows[i][lsgetsqlfield].ToString() != "")
lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToShortDateString();
}
else
{
//解决Float小数点后面出现N位小数乱码的问题
if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
{
if (dt.Rows[i][lsgetsqlfield].ToString() != "")
{
//是否包含小数点,包含的话,取小数点后两位
if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true)
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2");
}
else
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString();
}
}
else
{
示例12: DataPlay
//.........这里部分代码省略.........
lvcolwidth = lscolwidth.Split(',');
if (dt.Rows.Count <= 0)
{
//如果没有数据则输出表头
for (int n = 0; n < lvcolname.Length; n++)
{
if (n >= lvcolwidth.Length)
{ lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
else
{ lscolwidthper = lvcolwidth[n]; }
this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[n] + "</td>";
}
}
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = tempTable.NewRow();
//输出主表所有字段,start
for (int j = 0; j < dt.Columns.Count; j++)
{
dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
}
//输出主表所有字段,end
//////开始得到列的值
DataTable dtgetsqlfield;
for (int m = 0; m < lvcolname.Length; m++)
{
//如果有数据,则输出数据
if (m >= lvcolwidth.Length)
{ lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
else
{ lscolwidthper = lvcolwidth[m]; }
dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m], this.txttableid.Value);
if (i % System.Int32.Parse(PageSize.Text) == 0)
this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\"><a href=\"#\" title=\"点击可排序\" onclick=\"fun_sort('" + lvcolnameid[m] + "');\">" + lvcolname[m] + "</a></p></td>";
//根据字段英文名,得到数据库中对应的字段
string lsgetsqlfield = "hyc_" + dtgetsqlfield.Rows[0]["hy_fieldid"].ToString();
//根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换)
string lsgetputfiled = "";
if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
{
if (dt.Rows[i][lsgetsqlfield].ToString() != "")
lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToShortDateString();
}
else
{
//解决Float小数点后面出现N位小数乱码的问题
if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
{
if (dt.Rows[i][lsgetsqlfield].ToString() != "")
{
//是否包含小数点,包含的话,取小数点后两位
if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true)
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2");
}
else
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString();
}
}
else
{
示例13: Button_Save_Click
//保存
protected void Button_Save_Click(object sender, EventArgs e)
{
if (this.Session["hyuid"].ToString() == "")
this.Response.Redirect("../login.aspx");
string ls_tip = "保存成功!";
HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
//判断是否已存在该字段
HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
Hyoa_flowfield.hy_tableid = this.txttableid.Text;
Hyoa_flowfield.hy_mudelid = this.txtmudelid.Text;
Hyoa_flowfield.hy_flowid = this.txtflowid.Text;
Hyoa_flowfield.hy_fieldid = this.txtfieldid.Text;
Hyoa_flowfield.hy_fieldname = this.txtfieldname.Text;
Hyoa_flowfield.hy_fieldtype = this.ddlfieldtype.SelectedValue;
Hyoa_flowfield.hy_ifreadonly = this.ddlifreadonly.SelectedValue;
Hyoa_flowfield.hy_defaultvaluetype = System.Int32.Parse(this.ddldefaultvaluetype.SelectedValue);
Hyoa_flowfield.hy_defaultvalue = this.txtdefaultvalue.Text;
Hyoa_flowfield.hy_optiontype = System.Int32.Parse(this.ddloptiontype.SelectedValue);
Hyoa_flowfield.hy_options = this.txtoptions.Text;
Hyoa_flowfield.hy_onclick = this.txtonclick.Text;
Hyoa_flowfield.hy_ondblclick = this.txtondblclick.Text;
Hyoa_flowfield.hy_onchange = this.txtonchange.Text;
Hyoa_flowfield.hy_onkeydown = this.txtonkeydown.Text;
Hyoa_flowfield.hy_onkeyup = this.txtonkeyup.Text;
Hyoa_flowfield.hy_onfocus = this.txtonfocus.Text;
Hyoa_flowfield.hy_onblur = this.txtonblur.Text;
Hyoa_flowfield.hy_sqlfield = "";
Hyoa_flowfield.hy_class = this.txtclass.Text;
Hyoa_flowfield.hy_width = this.txtwidth.Text;
Hyoa_flowfield.hy_height = this.txtheight.Text;
Hyoa_flowfield.hy_tdnums = System.Int32.Parse(this.ddltdnums.SelectedValue);
Hyoa_flowfield.hy_config = "";
Hyoa_flowfield.hy_sort = float.Parse(this.txtsort.Text);
Hyoa_flowfield.hy_wordlimit = System.Int32.Parse(this.txtwordlimit.Text);
Hyoa_flowfield.hy_required = this.ddlrequired.SelectedValue;
Hyoa_flowfield.hy_align = this.ddlalign.SelectedValue;
Hyoa_flowfield.hy_ifhiddle = this.ddlifhiddle.SelectedValue;
Hyoa_flowfield.hy_ifdbsybt = this.ddlifdbsybt.SelectedValue;
Hyoa_flowfield.hy_field1 = "";
Hyoa_flowfield.hy_field2 = "";
Hyoa_flowfield.hy_field3 = "";
Hyoa_flowfield.hy_field4 = "";
Hyoa_flowfield.hy_field5 = "";
//新文档时
if (this.txtop.Value == "add")
{
DataTable dt = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Text, this.txtfieldid.Text, this.txttableid.Text);
if (dt.Rows.Count > 0)
{
Response.Write("<script>alert('该字段ID在当前表单中已存在,请重新输入!');</script>");
return;
}
Hyoa_flowfield.ID = Hyoa_global.GetRandom();
Hyoa_flowfield.Insert();
CreateSQLField();
}
else
{
Hyoa_flowfield.ID = this.txtdocid.Value;
Hyoa_flowfield.Update();
EditSQLField();
}
//处理完成后的提示及跳转
if (this.txtifpop.Value == "")
{
Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
}
else
{
Response.Write("<script>alert('" + ls_tip + "');self.close();</script>");
}
}
示例14: DataPlay
//.........这里部分代码省略.........
lvcolwidth = lscolwidth.Split(',');
if (dt.Rows.Count <= 0)
{
//如果没有数据则输出表头
for (int n = 0; n < lvcolname.Length; n++)
{
if (n >= lvcolwidth.Length)
{ lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
else
{ lscolwidthper = lvcolwidth[n]; }
this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[n] + "</td>";
}
}
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = tempTable.NewRow();
//输出主表所有字段,start
for (int j = 0; j < dt.Columns.Count; j++)
{
dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
}
//输出主表所有字段,end
//////开始得到列的值
DataTable dtgetsqlfield;
for (int m = 0; m < lvcolname.Length; m++)
{
//如果有数据,则输出数据
if (m >= lvcolwidth.Length)
{ lscolwidthper = ""; }//此判断是为了防止对应宽度没有输入时,会溢出报错。
else
{ lscolwidthper = lvcolwidth[m]; }
dtgetsqlfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.txtmudelid.Value, lvcolnameid[m], this.txttableid.Value);
//输出第一行的同时顺便把头部输出
if (i == 0)
{
this.lbdisplaytitle.Text += "<td width=\"" + lscolwidthper + "%\" class=\"TdcellHead\"><p align=\"center\">" + lvcolname[m] + "</td>";
}
//根据字段英文名,得到数据库中对应的字段
string lsgetsqlfield = "hyc_" + dtgetsqlfield.Rows[0]["hy_fieldid"].ToString();
//根据数据库中对应的字段,得到输出字段的值start (日期型根据格式进行了转换)
string lsgetputfiled = "";
if (dtgetsqlfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
{
if (dt.Rows[i][lsgetsqlfield].ToString() != "")
lsgetputfiled = System.DateTime.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToShortDateString();
}
else
{
//解决Float小数点后面出现N位小数乱码的问题
if (dtgetsqlfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
{
if (dt.Rows[i][lsgetsqlfield].ToString() != "")
{
//是否包含小数点,包含的话,取小数点后两位
if (dt.Rows[i][lsgetsqlfield].ToString().Contains(".") == true)
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString("F2");
}
else
{
lsgetputfiled = float.Parse(dt.Rows[i][lsgetsqlfield].ToString()).ToString();
}