本文整理汇总了C#中Srvtools.InfoCommand类的典型用法代码示例。如果您正苦于以下问题:C# InfoCommand类的具体用法?C# InfoCommand怎么用?C# InfoCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InfoCommand类属于Srvtools命名空间,在下文中一共展示了InfoCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnOK_Click
private void btnOK_Click(object sender, EventArgs e)
{
string DBName = this.cmbDB.Text;
string DBString = this.cmbDB.SelectedValue.ToString();
string DBType = "";
string itemType = "";
foreach (DataRow dr in table.Rows)
{
if (dr["DBName"].ToString() == DBName)
{
DBType = dr["DBType"].ToString();
break;
}
}
IDbConnection connection = AllocateConnection(DBType, DBString);
InfoCommand cmd = new InfoCommand();
string strSql = "select * from MENUITEMTYPE";
cmd.CommandText = strSql;
cmd.Connection = connection;
connection.Open();
IDataReader dreader = cmd.ExecuteReader();
bool bItemTypeExisted = false;
while (dreader.Read())
{
if (dreader["ITEMNAME"].ToString() == this.itemName)
{
bItemTypeExisted = true;
itemType = dreader["ITEMTYPE"].ToString();
}
}
dreader.Close();
if (!bItemTypeExisted)
{
//Solution原本不存在,新建一个Solution
strSql = "insert into MENUITEMTYPE (ITEMTYPE, ITEMNAME) values ('" + this.itemName + "', '" + this.itemName + "')";
cmd.CommandText = strSql;
cmd.Connection = connection;
cmd.ExecuteNonQuery();
itemType = this.itemName;
}
foreach (string menu in this.menuList)
{
strSql = "select count(*) from MENUTABLE where PACKAGE = '" + menu + "' and MODULETYPE = 'S' and ITEMTYPE = '" + itemType + "'";
cmd.CommandText = strSql;
cmd.Connection = connection;
int count = (int)cmd.ExecuteScalar();
if (count == 0)
{
strSql = "insert into MENUTABLE (MENUID, CAPTION, PACKAGE, MODULETYPE, ITEMTYPE) " +
"values ('" + menu + "id', '" + menu + "', '" + menu + "', 'S', '" + itemType + "')";
cmd.CommandText = strSql;
cmd.Connection = connection;
cmd.ExecuteNonQuery();
}
}
this.Close();
}
示例2: fmRefVal
public fmRefVal(DbConnection aConnection, ClientType DatabaseType, String EEPAlias)
{
InitializeComponent();
FConnection = aConnection;
FInfoCommand = new InfoCommand(DatabaseType);
FDatabaseType = DatabaseType;
DBAlias = EEPAlias;
InitData();
lvwColumnSorter = new ListViewColumnSorter();
this.lvFieldName.ListViewItemSorter = lvwColumnSorter;
}
示例3: fmFieldSetting
public fmFieldSetting(DbConnection aConnection, ClientType DatabaseType, ListView aListView, TWizardType aWizardType, String EEPAlias)
{
InitializeComponent();
FConnection = aConnection;
FInfoCommand = new InfoCommand(DatabaseType);
FDatabaseType = DatabaseType;
FListView = aListView;
FSelectedBlockFieldItem = null;
FSelectedListViewItem = null;
FDisplayValue = false;
FWizardType = aWizardType;
DBAlias = EEPAlias;
InitData();
lvwColumnSorter = new ListViewColumnSorter();
this.lvFields.ListViewItemSorter = lvwColumnSorter;
}
示例4: WriteWebDataSourceHTML
private void WriteWebDataSourceHTML()
{
//if (FWebDataSourceList.Count == 0)
// return;
String FileName = FDesignWindow.Document.FullName;
FDesignWindow.Close(vsSaveChanges.vsSaveChangesYes);
#if VS90
#else
String UpdateHTML = "";
//WebNavigator.QueryFields
WebNavigator navigator1 = FPage.FindControl("WebNavigator1") as WebNavigator;
TBlockItem aBlockItem = null;
TBlockItem bBlockItem = null;
if (navigator1 != null)
{
if (FClientData.IsMasterDetailBaseForm())
{
aBlockItem = FClientData.Blocks.FindItem("Master");
foreach (MWizard.TBlockItem var in FClientData.Blocks)
{
if (var.ParentItemName == aBlockItem.Name)
bBlockItem = var;
}
}
else
aBlockItem = FClientData.Blocks.FindItem("Main");
foreach (WebQueryField QF in navigator1.QueryFields)
{
if (QF.RefVal != null && QF.RefVal != "")
{
TBlockFieldItem aFieldItem = aBlockItem.BlockFieldItems.FindItem(QF.FieldName);
if (QF.Mode == "RefVal")
{
String DataSourceID = GenWebDataSource(aFieldItem, aBlockItem.TableName, "RefVal", "QF");
InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType);
aInfoCommand.Connection = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, true);
//aInfoCommand.Connection = FClientData.Owner.GlobalConnection;
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand);
DataSet aDataSet = new DataSet();
aInfoCommand.CommandText = String.Format("Select * from SYS_REFVAL where REFVAL_NO = '{0}'", aFieldItem.RefValNo);
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, aDataSet, aFieldItem.RefValNo);
String S1 = String.Format("<InfoLight:WebRefVal ID=\"{0}\" runat=\"server\" BindingValue='<%# Bind(\"{1}\") %>' " +
"ButtonImageUrl=\"../Image/refval/RefVal.gif\" DataBindingField=\"{1}\" DataSourceID=\"{2}\" " +
"DataTextField=\"{3}\" DataValueField=\"{4}\" ReadOnly=\"False\" ResxDataSet=\"\" " +
"ResxFilePath=\"\" UseButtonImage=\"True\" Visible=\"False\">" +
"</InfoLight:WebRefVal>",
"wrv" + aBlockItem.TableName + aFieldItem.DataField + "QF",
aFieldItem.DataField,
DataSourceID,
aDataSet.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString(),
aDataSet.Tables[0].Rows[0]["VALUE_MEMBER"].ToString());
UpdateHTML = UpdateHTML + S1;
}
if (QF.Mode == "ComboBox")
{
String DataSourceID = GenWebDataSource(aFieldItem, aBlockItem.TableName, "ComboBox", "QF");
String S2 = String.Format("<InfoLight:WebRefVal ID=\"{0}\" runat=\"server\" BindingValue='<%# Bind(\"{1}\") %>' " +
"ButtonImageUrl=\"../Image/refval/RefVal.gif\" DataBindingField=\"{1}\" DataSourceID=\"{2}\" " +
"DataTextField=\"{3}\" DataValueField=\"{4}\" ReadOnly=\"False\" ResxDataSet=\"\" " +
"ResxFilePath=\"\" UseButtonImage=\"True\" Visible=\"False\"> " +
"</InfoLight:WebRefVal>",
"wrv" + aBlockItem.TableName + aFieldItem.DataField + "QF",
aFieldItem.DataField,
DataSourceID,
aFieldItem.ComboTextField,
aFieldItem.ComboValueField);
UpdateHTML = UpdateHTML + S2;
}
}
}
}
//WebDataSource
foreach (WebDataSource aWebDataSource in FWebDataSourceList)
{
UpdateHTML = UpdateHTML + String.Format(
"<InfoLight:WebDataSource ID=\"{0}\" runat=\"server\" SelectAlias=\"{1}\" SelectCommand=\"{2}\" cachedataset=\"{3}\">\n",
aWebDataSource.ID, aWebDataSource.SelectAlias, aWebDataSource.SelectCommand, aWebDataSource.CacheDataSet);
UpdateHTML = UpdateHTML + "</InfoLight:WebDataSource>\n";
}
//WebDefault
if (!FClientData.BaseFormName.Contains("WQuery"))
{
foreach (WebDefault aDefault in FWebDefaultList)
{
if (aDefault.Fields.Count > 0)
{
UpdateHTML = UpdateHTML + String.Format(
"<InfoLight:WebDefault ID=\"{0}\" runat=\"server\" DataMember=\"{1}\" DataSourceID=\"{2}\">\n",
aDefault.ID, aDefault.DataMember, aDefault.DataSourceID);
UpdateHTML = UpdateHTML + " <Fields>\n";
}
foreach (DefaultFieldItem DFI in aDefault.Fields)
{
//.........这里部分代码省略.........
示例5: GenExtComboBox
private String GenExtComboBox(TBlockFieldItem FieldItem, String TableName, String Kind, String ExtraName, String DSID)
{
String Name = "ext" + TableName + FieldItem.DataField + ExtraName;
bool isExist = false;
foreach (ExtComboBox bExtComboBox in FExtComboBoxList)
{
if (String.Compare(bExtComboBox.ID, Name) == 0)
{
isExist = true;
break;
}
}
ExtComboBox aExtComboBox = new ExtComboBox();
aExtComboBox.ID = Name;
aExtComboBox.DataSourceID = DSID;
aExtComboBox.AutoRender = false;
if (Kind == "ExtRefVal")
{
DataSet aDataSet = new DataSet();
try
{
InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType);
aInfoCommand.Connection = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, true);
if (aInfoCommand.Connection.State != ConnectionState.Open) aInfoCommand.Connection.Open();
aInfoCommand.CommandText = String.Format("Select * from SYS_REFVAL where REFVAL_NO = '{0}'", FieldItem.RefValNo);
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand);
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, aDataSet, FieldItem.RefValNo);
aExtComboBox.DisplayField = aDataSet.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString();
aExtComboBox.ValueField = aDataSet.Tables[0].Rows[0]["VALUE_MEMBER"].ToString();
ExtSimpleColumn aExtSimpleColumn = new ExtSimpleColumn();
aExtSimpleColumn.DataField = aDataSet.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString();
aExtComboBox.Columns.Add(aExtSimpleColumn);
ExtSimpleColumn bExtSimpleColumn = new ExtSimpleColumn();
bExtSimpleColumn.DataField = aDataSet.Tables[0].Rows[0]["VALUE_MEMBER"].ToString();
aExtComboBox.Columns.Add(bExtSimpleColumn);
}
catch (SqlException sex)
{
if (sex.Number == 208)
{
string sSysDBAlias = WzdUtils.GetSystemDBName();
ClientType sSysDBType = WzdUtils.GetSystemDBType();
DbConnection sysConn = WzdUtils.AllocateConnection(sSysDBAlias, sSysDBType, false);
if (sysConn.State != ConnectionState.Open) sysConn.Open();
DbCommand comm = sysConn.CreateCommand();
comm.CommandText = String.Format("Select * from SYS_REFVAL where REFVAL_NO = '{0}'", FieldItem.RefValNo);
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(comm);
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, aDataSet, FieldItem.RefValNo);
aExtComboBox.DisplayField = aDataSet.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString();
aExtComboBox.ValueField = aDataSet.Tables[0].Rows[0]["VALUE_MEMBER"].ToString();
ExtSimpleColumn aExtSimpleColumn = new ExtSimpleColumn();
aExtSimpleColumn.DataField = aDataSet.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString();
aExtComboBox.Columns.Add(aExtSimpleColumn);
ExtSimpleColumn bExtSimpleColumn = new ExtSimpleColumn();
bExtSimpleColumn.DataField = aDataSet.Tables[0].Rows[0]["VALUE_MEMBER"].ToString();
aExtComboBox.Columns.Add(bExtSimpleColumn);
}
}
}
else if (Kind == "ExtComboBox")
{
aExtComboBox.DisplayField = FieldItem.ComboTextField;
aExtComboBox.ValueField = FieldItem.ComboValueField;
ExtSimpleColumn aExtSimpleColumn = new ExtSimpleColumn();
aExtSimpleColumn.DataField = FieldItem.ComboTextField;
aExtComboBox.Columns.Add(aExtSimpleColumn);
ExtSimpleColumn bExtSimpleColumn = new ExtSimpleColumn();
bExtSimpleColumn.DataField = FieldItem.ComboValueField;
aExtComboBox.Columns.Add(bExtSimpleColumn);
aExtComboBox.AutoRender = false;
}
if (!isExist)
FExtComboBoxList.Add(aExtComboBox);
#if VS90
if (!isExist)
{
WebDevPage.IHTMLElement Page = FDesignerDocument.pageContentElement;
////InsertControl(Page, aExtComboBox);
}
#endif
return aExtComboBox.ID;
}
示例6: SetFieldNames
private void SetFieldNames(String TableName, ListView LV)
{
int I;
DataRow[] DRs;
DataRow DR;
InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType);
aInfoCommand.Connection = InternalConnection;
String OWNER = String.Empty, SS = TableName;
if (SS.Contains("."))
{
OWNER = WzdUtils.GetToken(ref SS, new char[] { '.' });
TableName = SS;
}
aInfoCommand.CommandText = "Select * from COLDEF where TABLE_NAME='" + TableName + "' OR TABLE_NAME='" + OWNER + "." + TableName + "'";
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand);
DataSet dsColdef = new DataSet();
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, dsColdef, TableName);
DataTable dtTableSchema = FInfoDataSet.RealDataSet.Tables[0];
for (I = 0; I < dtTableSchema.Columns.Count; I++)
{
ListViewItem lvi = new ListViewItem();
lvi.Text = dtTableSchema.Columns[I].ColumnName;
DRs = dsColdef.Tables[0].Select("FIELD_NAME='" + lvi.Text + "'");
TBlockFieldItem aBlockFieldItem = new TBlockFieldItem();
aBlockFieldItem.DataField = lvi.Text;
aBlockFieldItem.DataType = dtTableSchema.Columns[I].DataType;
lvi.Tag = aBlockFieldItem;
if (DRs.Length > 0)
{
DR = DRs[0];
lvi.SubItems.Add(DR["CAPTION"].ToString());
aBlockFieldItem.Description = DR["CAPTION"].ToString();
aBlockFieldItem.CheckNull = DR["CHECK_NULL"].ToString().ToUpper();
aBlockFieldItem.DefaultValue = DR["DEFAULT_VALUE"].ToString();
aBlockFieldItem.ControlType = DR["NEEDBOX"].ToString();
aBlockFieldItem.EditMask = DR["EDITMASK"].ToString();
if (aBlockFieldItem.DataType == typeof(DateTime))
{
if (aBlockFieldItem.ControlType == null || aBlockFieldItem.ControlType == "")
aBlockFieldItem.ControlType = "DateTimeBox";
}
else if (aBlockFieldItem.DataType == typeof(Int16) || aBlockFieldItem.DataType == typeof(Int32)
|| aBlockFieldItem.DataType == typeof(Int64) || aBlockFieldItem.DataType == typeof(float)
|| aBlockFieldItem.DataType == typeof(double) || aBlockFieldItem.DataType == typeof(decimal))
{
if (aBlockFieldItem.ControlType == null || aBlockFieldItem.ControlType == "")
aBlockFieldItem.ControlType = "NumberBox";
}
aBlockFieldItem.QueryMode = DR["QUERYMODE"].ToString();
if (DR["FIELD_LENGTH"] != null && DR["FIELD_LENGTH"].ToString() != "")
aBlockFieldItem.Length = Convert.ToInt32(DR["FIELD_LENGTH"]);
if (DR["IS_KEY"] != null && DR["IS_KEY"].ToString() == "Y")
aBlockFieldItem.IsKey = true;
}
LV.Items.Add(lvi);
}
/*
string[] S = new string[4];
S[2] = TableName;
DataTable dtTableSchema = InternalConnection.GetSchema("Columns", S);
DataRow[] DRs1 = dtTableSchema.Select("", "ORDINAL_POSITION ASC");
for (I = 0; I < DRs1.Length; I++)
{
ListViewItem lvi = new ListViewItem();
lvi.Text = DRs1[I][3].ToString();
DRs = dsColdef.Tables[0].Select("FIELD_NAME='" + lvi.Text + "'");
if (DRs.Length == 1)
{
DR = DRs[0];
lvi.SubItems.Add(DR["CAPTION"].ToString());
}
LV.Items.Add(lvi);
}
*/
}
示例7: cbRefValNo_SelectedIndexChanged
private void cbRefValNo_SelectedIndexChanged(object sender, EventArgs e)
{
String sRefValNo = (sender as ComboBox).Text;
if (cbControlType.Text == "ComboBox" && !String.IsNullOrEmpty(sRefValNo))
{
try
{
InfoCommand FInfoCommand = new InfoCommand(FClientData.DatabaseType);
FInfoCommand.Connection = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, true);
FInfoCommand.CommandText = String.Format("Select * from SYS_REFVAL WHERE REFVAL_NO='{0}'", sRefValNo);
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(FInfoCommand);
DataSet aDataSet = new DataSet();
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, aDataSet, "SYS_REFVAL");
DataTable aDataTable = aDataSet.Tables[0];
foreach (DataRow DR in aDataTable.Rows)
{
cbComboTableName.Text = DR["TABLE_NAME"].ToString();
cbDataValueField.Text = DR["VALUE_MEMBER"].ToString();
cbDataTextField.Text = DR["DISPLAY_MEMBER"].ToString();
}
}
catch (SqlException sex)
{
if (sex.Number == 208)
{
string sSysDBAlias = WzdUtils.GetSystemDBName();
ClientType sSysDBType = WzdUtils.GetSystemDBType();
DbConnection sysConn = WzdUtils.AllocateConnection(sSysDBAlias, sSysDBType, false);
if (sysConn.State != ConnectionState.Open) sysConn.Open();
DbCommand comm = sysConn.CreateCommand();
comm.CommandText = String.Format("Select * from SYS_REFVAL WHERE REFVAL_NO='{0}'", sRefValNo);
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(comm);
DataSet aDataSet = new DataSet();
WzdUtils.FillDataAdapter(sSysDBType, DA, aDataSet, "SYS_REFVAL");
DataTable aDataTable = aDataSet.Tables[0];
foreach (DataRow DR in aDataTable.Rows)
{
cbComboTableName.Text = DR["TABLE_NAME"].ToString();
cbDataValueField.Text = DR["VALUE_MEMBER"].ToString();
cbDataTextField.Text = DR["DISPLAY_MEMBER"].ToString();
}
}
}
}
}
示例8: cbComboTableName_SelectedIndexChanged
private void cbComboTableName_SelectedIndexChanged(object sender, EventArgs e)
{
String strTabelName = cbComboTableName.Text;
if (strTabelName == "")
return;
else
{
if (strTabelName.Contains(" "))
{
if (FClientData.DatabaseType == ClientType.ctMsSql)
strTabelName = String.Format("[{0}]", strTabelName);
}
}
cbDataTextField.Items.Clear();
cbDataValueField.Items.Clear();
InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType);
aInfoCommand.Connection = InternalConnection;
aInfoCommand.CommandText = String.Format("Select * from {0} where 1=0", strTabelName);
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand);
DataSet aDataSet = new DataSet();
try
{
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, aDataSet, strTabelName);
foreach (DataColumn DC in aDataSet.Tables[0].Columns)
{
cbDataTextField.Items.Add(DC.ColumnName);
cbDataValueField.Items.Add(DC.ColumnName);
}
cbDataTextField.Items.Add("");
cbDataValueField.Items.Add("");
}
catch
{
MessageBox.Show(cbComboTableName.Text + " is a illegal table.");
strTabelName = String.Empty;
}
}
示例9: GenMainBlockControl_3
private void GenMainBlockControl_3(TBlockItem BlockItem, String FormViewName)
{
bool isAjaxPage = false;
if (FPage.FindControl("AjaxScriptManager1") != null)
isAjaxPage = true;
WebDataSource Master = (WebDataSource)FPage.FindControl("Master");
Master.DataMember = FClientData.ProviderName;
Master.DataMember = Master.DataMember.Substring(Master.DataMember.IndexOf('.') + 1, Master.DataMember.Length -
Master.DataMember.IndexOf('.') - 1);
if (FormViewName == "wfvMaster")
Master.AutoApply = true;
BlockItem.wDataSource = Master;
WebFormView wfvMaster = (WebFormView)FPage.FindControl(FormViewName);
WebDefault aDefault = new WebDefault();
aDefault.ID = "wd" + BlockItem.TableName;
aDefault.DataSourceID = Master.ID;
aDefault.DataMember = Master.DataMember;
WebValidate aValidate = new WebValidate();
aValidate.ID = "wv" + BlockItem.TableName;
aValidate.DataSourceID = Master.ID;
aValidate.DataMember = Master.DataMember;
Boolean Done = false;
//Generate RESX
WebGridView aGridView = (WebGridView)FPage.FindControl("WgView");
if (aGridView == null)
aGridView = (WebGridView)FPage.FindControl("WebGridView1");
if (aGridView == null)
aGridView = (WebGridView)FPage.FindControl("wgvMaster");
if (aGridView != null)
aGridView.WizardDesignMode = true;
GenResx(Master);
if (aGridView != null)
aGridView.WizardDesignMode = false;
if (FClientData.BaseFormName == "WSingle3" || FClientData.BaseFormName == "WSingle4" || FClientData.BaseFormName == "WMasterDetail3"
|| FClientData.BaseFormName == "WMasterDetail8" || FClientData.BaseFormName == "VBWebCMasterDetail8")
{
aGridView = null;
}
//DataSet Dset = new DataSet();
//if (FPage.Site.DesignMode)
//{
// Dset = GetDD(wfvMaster);
//}
IDbConnection conn = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, false);
InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType);
aInfoCommand.Connection = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, true);
//aInfoCommand.Connection = conn;
String OWNER = String.Empty, SS = this.FClientData.RealTableName, TableName = String.Empty;
if (SS.Contains("."))
{
OWNER = WzdUtils.GetToken(ref SS, new char[] { '.' });
TableName = SS;
}
aInfoCommand.CommandText = "Select * from COLDEF where TABLE_NAME='" + TableName + "' OR TABLE_NAME='" + OWNER + "." + TableName + "'";
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand);
DataSet dsColdef = new DataSet();
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, dsColdef, this.FClientData.TableName);
foreach (TBlockFieldItem aFieldItem in BlockItem.BlockFieldItems)
{
if (!Done)
{
GenDefault(aFieldItem, aDefault, aValidate);
CreateQueryField(aFieldItem, "", null, BlockItem.TableName);
}
}
Done = true;
//GridView
System.Web.UI.WebControls.BoundField aBoundField = null;
System.Web.UI.WebControls.TemplateField aTemplateField = null;
List<string> KeyFields = new List<string>();
if (aGridView != null)
{
while (aGridView.Columns.Count > 1)
aGridView.Columns.RemoveAt(1);
foreach (TBlockFieldItem BFI in BlockItem.BlockFieldItems)
{
if ((BFI.RefValNo != null && BFI.RefValNo != "") || BFI.RefField != null)
{
String DataSourceID = GenWebDataSource(BFI, BlockItem.TableName, "RefVal", "");
aTemplateField = new System.Web.UI.WebControls.TemplateField();
aTemplateField.HeaderText = BFI.Description;
aTemplateField.SortExpression = BFI.DataField;
if (aTemplateField.HeaderText == "")
aTemplateField.HeaderText = BFI.DataField;
if (isAjaxPage)
{
aTemplateField.EditItemTemplate = new WebControlTemplate("WebGridViewAjaxRefValEditItemTemplate", BFI, BlockItem.TableName, DataSourceID, FClientData.Owner.GlobalConnection, FAjaxRefValList, FClientData.DatabaseType, aGridView, FLabelList);
aTemplateField.ItemTemplate = new WebControlTemplate("WebGridViewAjaxRefValItemTemplate", BFI, BlockItem.TableName, DataSourceID, FClientData.Owner.GlobalConnection, FAjaxRefValList, FClientData.DatabaseType, aGridView, FLabelList);
aTemplateField.FooterTemplate = new WebControlTemplate("WebGridViewAjaxRefValFooterItemTemplate", BFI, BlockItem.TableName, DataSourceID, FClientData.Owner.GlobalConnection, FAjaxRefValList, FClientData.DatabaseType, aGridView, FLabelList);
}
else
//.........这里部分代码省略.........
示例10: SetFieldNames
private void SetFieldNames(string TableName, ListView LV, String DataSetName)
{
int I;
DataRow[] DRs;
DataRow DR;
InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType);
aInfoCommand.Connection = InternalConnection;
TableName = WzdUtils.RemoveQuote(TableName, FClientData.DatabaseType);
aInfoCommand.CommandText = "Select * from COLDEF where TABLE_NAME = '" + TableName + "'";
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand);
DataSet dsColdef = new DataSet();
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, dsColdef, TableName);
InfoDataSet aDataSet = GetRootInfoDataSet(DataSetName);
DataTable dtTableSchema = aDataSet.RealDataSet.Tables[0];
for (I = 0; I < dtTableSchema.Columns.Count; I++)
{
ListViewItem lvi = new ListViewItem();
lvi.Text = dtTableSchema.Columns[I].ColumnName;
DRs = dsColdef.Tables[0].Select("FIELD_NAME='" + lvi.Text + "'");
TBlockFieldItem aBlockFieldItem = new TBlockFieldItem();
aBlockFieldItem.DataField = lvi.Text;
aBlockFieldItem.DataType = dtTableSchema.Columns[I].DataType;
lvi.Tag = aBlockFieldItem;
if (DRs.Length == 1)
{
DR = DRs[0];
lvi.SubItems.Add(DR["CAPTION"].ToString());
aBlockFieldItem.Description = DR["CAPTION"].ToString();
aBlockFieldItem.CheckNull = DR["CHECK_NULL"].ToString().ToUpper();
aBlockFieldItem.DefaultValue = DR["DEFAULT_VALUE"].ToString();
aBlockFieldItem.ControlType = DR["NEEDBOX"].ToString();
aBlockFieldItem.EditMask = DR["EDITMASK"].ToString();
if (aBlockFieldItem.DataType == typeof(DateTime))
{
if (aBlockFieldItem.ControlType == null || aBlockFieldItem.ControlType == "")
aBlockFieldItem.ControlType = "DateTimeBox";
}
aBlockFieldItem.QueryMode = DR["QUERYMODE"].ToString();
}
LV.Items.Add(lvi);
}
/*
string[] S = new string[4];
S[2] = TableName;
DataTable dtTableSchema = InternalConnection.GetSchema("Columns", S);
DataRow[] DRs1 = dtTableSchema.Select("", "ORDINAL_POSITION ASC");
for (I = 0; I < DRs1.Length; I++)
{
ListViewItem lvi = new ListViewItem();
lvi.Text = DRs1[I][3].ToString();
DRs = dsColdef.Tables[0].Select("FIELD_NAME='" + lvi.Text + "'");
if (DRs.Length == 1)
{
DR = DRs[0];
lvi.SubItems.Add(DR["CAPTION"].ToString());
}
LV.Items.Add(lvi);
}
*/
}
示例11: SetDataToSYS_REFVAL
private void SetDataToSYS_REFVAL(String tableName, String displayMember, String valueMember, String selectAlias, String selectCommand)
{
InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType);
aInfoCommand.Connection = InternalConnection;
aInfoCommand.CommandText = String.Format("DELETE FROM SYS_REFVAL WHERE REFVAL_NO='{0}'", "SL." + tableName);
if (InternalConnection.State != ConnectionState.Open)
InternalConnection.Open();
aInfoCommand.ExecuteNonQuery();
aInfoCommand.CommandText = String.Format("INSERT INTO SYS_REFVAL (REFVAL_NO,TABLE_NAME,DISPLAY_MEMBER,SELECT_ALIAS,SELECT_COMMAND,VALUE_MEMBER) VALUES('{0}','{1}','{2}','{3}','{4}','{5}')",
"SL." + tableName, tableName, displayMember, selectAlias, selectCommand, valueMember);
aInfoCommand.ExecuteNonQuery();
}
示例12: GetDataFromSYS_REFVAL
private DataSet GetDataFromSYS_REFVAL(String tableName, String valueMember)
{
InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType);
aInfoCommand.Connection = InternalConnection;
aInfoCommand.CommandText = String.Format("SELECT * FROM SYS_REFVAL WHERE REFVAL_NO='{0}' AND VALUE_MEMBER='{1}'", "SL." + tableName, valueMember);
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand);
DataSet dsSYS_REFVAL = new DataSet();
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, dsSYS_REFVAL, tableName);
return dsSYS_REFVAL;
}
示例13: GetDataFromCOLDEF
private DataSet GetDataFromCOLDEF(String tableName)
{
InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType);
aInfoCommand.Connection = InternalConnection;
aInfoCommand.CommandText = String.Format("SELECT * FROM COLDEF WHERE TABLE_NAME='{0}'", tableName);
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand);
DataSet dsCOLDEF = new DataSet();
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, dsCOLDEF, tableName);
return dsCOLDEF;
}
示例14: GetControlXml
/// <summary>
/// 取得Control对应的xml
/// </summary>
/// <param name="item">blockfielditem</param>
/// <param name="tableName">tablename</param>
/// <param name="id">控件的id</param>
/// <returns>xml</returns>
private string GetControlXml(TBlockFieldItem item, string tableName, ref string id)
{
WebControl control = null;
PropertyInfo info = null;
#region DropDownList
if (string.Compare(item.ControlType, "combobox", true) == 0)
{
control = new WebDropDownList();
control.ID = string.Format("{0}DropDownList", item.DataField);
control.Width = new Unit(130, UnitType.Pixel);
(control as WebDropDownList).DataSourceID = GenWebDataSource(item, tableName, "ComboBox", string.Empty);
(control as WebDropDownList).DataMember = item.ComboEntityName;
(control as WebDropDownList).DataTextField = item.ComboTextField;
(control as WebDropDownList).DataValueField = item.ComboValueField;
info = control.GetType().GetProperty("SelectedValue");
}
#endregion
#region RefVal
else if (string.Compare(item.ControlType, "refvalbox", true) == 0)
{
#warning GenWebDataSource未完成FSYS_REFVAL部分
control = new WebRefVal();
control.ID = string.Format("{0}RefVal", item.DataField);
if (!string.IsNullOrEmpty(item.RefValNo) || (item.RefField != null))
{
(control as WebRefVal).DataSourceID = GenWebDataSource(item, tableName, "RefVal", string.Empty);
(control as WebRefVal).DataBindingField = item.DataField;
(control as WebRefVal).DataTextField = FSYS_REFVAL.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString();
(control as WebRefVal).DataValueField = FSYS_REFVAL.Tables[0].Rows[0]["VALUE_MEMBER"].ToString();
if (!string.IsNullOrEmpty(item.RefValNo))
{
IDbConnection conn = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, false);
InfoCommand command = new InfoCommand(FClientData.DatabaseType);
command.Connection = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, true);
//command.Connection = conn;
command.CommandText = String.Format("Select * from SYS_REFVAL_D1 where REFVAL_NO = '{0}'", item.RefValNo);
IDbDataAdapter adapter = WzdUtils.AllocateDataAdapter(FClientData.DatabaseType);
adapter.SelectCommand = command.GetInternalCommand();
DataSet dataset = new DataSet();
WzdUtils.FillDataAdapter(FClientData.DatabaseType, adapter, dataset, item.RefValNo);
if (dataset != null && dataset.Tables.Count > 0 && dataset.Tables[0].Rows.Count > 0)
{
foreach (DataRow DR in dataset.Tables[0].Rows)
{
WebRefColumn refcolumn = new WebRefColumn();
refcolumn.ColumnName = DR["FIELD_NAME"].ToString();
refcolumn.HeadText = DR["HEADER_TEXT"].ToString();
refcolumn.Width = 100;
(control as WebRefVal).Columns.Add(refcolumn);
}
}
}
info = control.GetType().GetProperty("BindingValue");
}
else
{
control = new TextBox();
control.ID = string.Format("{0}TextBox", item.DataField);
(control as TextBox).MaxLength = item.Length;
info = control.GetType().GetProperty("Text");
}
}
#endregion
#region DateTimePicker
else if (string.Compare(item.ControlType, "datetimebox", true) == 0)
{
control = new WebDateTimePicker();
control.ID = string.Format("{0}DateTimePicker", item.DataField);
(control as WebDateTimePicker).MaxLength = item.Length;
if (string.IsNullOrEmpty(item.EditMask))
{
(control as WebDateTimePicker).DateFormat = dateFormat.ShortDate;
}
if (item.DataType == typeof(DateTime))
{
info = control.GetType().GetProperty("Text");
}
else if (item.DataType == typeof(string))
{
(control as WebDateTimePicker).DateTimeType = dateTimeType.VarChar;
info = control.GetType().GetProperty("DataString");
}
}
#endregion
#region ValidateBox
else if (string.Compare(item.ControlType, "validatebox", true) == 0)
{
control = new WebValidateBox();
//.........这里部分代码省略.........
示例15: GenMainBlockControl_3
private void GenMainBlockControl_3(TBlockItem blockItem, String formViewName)
{
WebDevPage.IHTMLElement Master = (WebDevPage.IHTMLElement)FDesignerDocument.webControls.item("Master", 0);
string mastertablename = string.Empty;
if (Master != null)
{
mastertablename = FClientData.ProviderName.Split('.')[1];
Master.setAttribute("DataMember", mastertablename, 0);
if (formViewName == "wfvMaster")
{
Master.setAttribute("AutoApply", "true", 0);
}
}
blockItem.wDataSource = new WebDataSource();
WebDevPage.IHTMLElement Page = FDesignerDocument.pageContentElement;
WebDefault Default = new WebDefault();
Default.ID = "wd" + blockItem.TableName;
Default.DataSourceID = Master.getAttribute("ID", 0).ToString();
Default.DataMember = mastertablename;
WebValidate Validate = new WebValidate();
Validate.ID = "wv" + blockItem.TableName;
Validate.DataSourceID = Master.getAttribute("ID", 0).ToString();
Validate.DataMember = mastertablename;
WebQueryFiledsCollection QueryFields = new WebQueryFiledsCollection(null, typeof(QueryField));
WebQueryColumnsCollection QueryColumns = new WebQueryColumnsCollection(null, typeof(QueryColumns));
foreach (TBlockFieldItem fielditem in blockItem.BlockFieldItems)
{
//GenDefault(fielditem, Default, Validate);
GenQuery(fielditem, QueryFields, QueryColumns, blockItem.TableName);
}
InsertControl(Page, Default);
InsertControl(Page, Validate);
foreach (TBlockFieldItem fielditem in blockItem.BlockFieldItems)
{
foreach (WebQueryColumns wqc in QueryColumns)
{
if (wqc.ColumnType == "ClientQueryRefValColumn" && wqc.Column == fielditem.DataField)
{
WebDataSource aWebDataSource = new WebDataSource();
InfoCommand aInfoCommand = new InfoCommand(FClientData.DatabaseType);
aInfoCommand.Connection = WzdUtils.AllocateConnection(FClientData.DatabaseName, FClientData.DatabaseType, true);
//aInfoCommand.Connection = FClientData.Owner.GlobalConnection;
IDbDataAdapter DA = DBUtils.CreateDbDataAdapter(aInfoCommand);
if (FSYS_REFVAL != null)
FSYS_REFVAL.Dispose();
FSYS_REFVAL = new DataSet();
aInfoCommand.CommandText = String.Format("Select * from SYS_REFVAL where REFVAL_NO = '{0}'", fielditem.RefValNo);
WzdUtils.FillDataAdapter(FClientData.DatabaseType, DA, FSYS_REFVAL, fielditem.RefValNo);
WebRefVal aWebRefVal = new WebRefVal();
aWebRefVal.ID = wqc.WebRefVal;
aWebRefVal.DataTextField = FSYS_REFVAL.Tables[0].Rows[0]["DISPLAY_MEMBER"].ToString();
aWebRefVal.DataValueField = FSYS_REFVAL.Tables[0].Rows[0]["VALUE_MEMBER"].ToString();
aWebRefVal.DataSourceID = String.Format("wds{0}{1}", blockItem.TableName, wqc.Column);
aWebRefVal.Visible = false;
InsertControl(Page, aWebRefVal);
break;
}
}
}
WebDevPage.IHTMLElement Navigator = (WebDevPage.IHTMLElement)FDesignerDocument.webControls.item("WebNavigator1", 0);
if (Navigator != null)
{
SetCollectionValue(Navigator, typeof(WebNavigator).GetProperty("QueryFields"), QueryFields);
}
WebDevPage.IHTMLElement ClientQuery = (WebDevPage.IHTMLElement)FDesignerDocument.webControls.item("WebClientQuery1", 0);
if (ClientQuery != null)
{
SetCollectionValue(ClientQuery, typeof(WebClientQuery).GetProperty("Columns"), QueryColumns);
}
//刷不了Schema所以直接用写的
WebDevPage.IHTMLElement FormView = (WebDevPage.IHTMLElement)FDesignerDocument.webControls.item(formViewName, 0);
if (FormView != null)
{
RefreshFormView(FormView, blockItem);
}
WebDevPage.IHTMLElement AjaxFromView1 = (WebDevPage.IHTMLElement)FDesignerDocument.webControls.item("AjaxFormView1", 0);
if (AjaxFromView1 != null)
{
AjaxTools.AjaxFormFieldCollection aAjaxFormFieldCollection = new AjaxTools.AjaxFormFieldCollection(new AjaxTools.AjaxFormView(), typeof(AjaxTools.AjaxFormField));
DataTable srcTable = FWizardDataSet.RealDataSet.Tables[blockItem.TableName];
bool flag = true;
foreach (TBlockFieldItem BFI in blockItem.BlockFieldItems)
{
AjaxTools.AjaxFormField extCol = new AjaxTools.AjaxFormField();
if (BFI.CheckNull == "Y")
extCol.AllowNull = false;
else
extCol.AllowNull = true;
if (BFI.Description != null && BFI.Description != String.Empty)
extCol.Caption = BFI.Description;
else
extCol.Caption = BFI.DataField;
//.........这里部分代码省略.........