////''' <summary> ////''' 显示DataDic窗体,并把选择结果返回到spreadObj控件 ////''' </summary> ////''' <param name="spreadObj"></param> ////''' <param name="rControl">保存返回值的控件集合</param> ////''' <param name="fControl">每一个控件对应的字段名称</param> ////''' <param name="sQuery">查询语句</param> ////''' <param name="sProcName">存储过程名称</param> ////''' <param name="sFilter">筛选条件(存储过程时不需要)</param> ////''' <param name="iActiveColumn">DataDic窗体Where条件Spread默认活动列</param> ////''' <returns></returns> ////''' <remarks></remarks> public static void Gf_Spread_DD(Control spreadObj, Collection rControl, Collection fControl, string sQuery, string sProcName, int iParaCount, string sFilter, int iActiveColumn) { DataDic dd = new DataDic(); dd.IsSpreadCaller = true; dd.SpreadObj = spreadObj; dd.rControl = rControl; dd.fControl = fControl; dd.QuerySQL = sQuery.ToUpper(); dd.ProcName = sProcName; dd.ParamCount = iParaCount; dd.sFilter = sFilter; dd.ActiveColumnIndex = iActiveColumn; //dd.ShowDialog(); //dd.Show(); dd.ShowDialog();//20121231 }
//// ''' <summary> ////''' 显示DataDic窗体,并把选择结果返回到非Spread的控件 ////''' </summary> ////''' <param name="rControl">保存返回值的控件集合</param> ////''' <param name="fControl">每一个控件对应的字段名称</param> ////''' <param name="sQuery">查询语句</param> ////''' <param name="sProcName">存储过程名称</param> ////''' <param name="sFilter">筛选条件(存储过程时不需要)</param> ////''' <param name="iActiveColumn">DataDic窗体Where条件Spread默认活动列</param> ////''' <returns></returns> ////''' <remarks></remarks> public static void Gf_Master_DD(Collection rControl, Collection fControl, string sQuery, string sProcName, int iParaCount, string sFilter, int iActiveColumn) { DataDic dd = new DataDic(); //dd.ShowDialog(); //return; dd.IsSpreadCaller = false; dd.rControl = rControl; dd.fControl = fControl; dd.QuerySQL = sQuery.ToUpper(); dd.ProcName = sProcName; dd.ParamCount = iParaCount; dd.sFilter = sFilter; dd.ActiveColumnIndex = iActiveColumn; try { // dd.Show(); dd.ShowDialog();//20121231 } catch { } }
//--------------------------------------------------------------------------------------- // 1.ID : Gf_DD_Display // 2.Input Value : Conn Connection, sQuery String, [MsgChk Boolean] // 3.Return Value : Boolean // 4.Create Date : // 5.Modify Date : // 6.Comment : Data Dictionary Result Data Display //--------------------------------------------------------------------------------------- public static bool Gf_DD_Display(System.Data.OleDb.OleDbConnection Conn, string sQuery, bool MsgChk) { bool functionReturnValue = false; DataDic DataDic = new DataDic(); int iCollCnt = 0; int iColcount = 0; if (Conn.State == 0) { if (GeneralCommon.GF_DbConnect() == false) { functionReturnValue = false; GeneralCommon.Gp_DD_Clear(); int rCount = GeneralCommon.rControl.Count; for (iCollCnt = 0; iCollCnt < rCount; iCollCnt++) { GeneralCommon.rControl.Remove(0); } GeneralCommon.DD.sPname = ""; return(functionReturnValue); } } System.Data.DataSet DS = new System.Data.DataSet(); try { System.Data.OleDb.OleDbDataAdapter OleDA = new System.Data.OleDb.OleDbDataAdapter(sQuery, Conn); OleDA.Fill(DS); if (DS.Tables[0].Rows.Count == 0) { if (MsgChk) { GeneralCommon.Gp_MsgBoxDisplay("无法找到该资料...!!!", "I"); } DataDic.ssResult.Cols.Count = DS.Tables[0].Columns.Count; DataDic.ssWhere.Cols.Count = DS.Tables[0].Columns.Count; //DataDic.ssResult.Sheets[0].ColumnCount = DS.Tables[0].Columns.Count;// AdoRs.Fields.Count; //DataDic.ssWhere.Sheets[0].ColumnCount = DS.Tables[0].Columns.Count;//AdoRs.Fields.Count; DataDic.ssResult.Rows.Count = 0; DataDic.ssWhere.Rows.Count = 1; //DataDic.ssResult.Sheets[0].RowCount = 0; //DataDic.ssWhere.Sheets[0].RowCount = 1; DataDic.ssResult.DataSource = DS; DataDic.ssWhere_setting(); //DataDic.ssResult.DataSource = DS; //DataDic.ssWhere_setting(); for (iColcount = 0; iColcount < DataDic.ssResult.Cols.Count; iColcount++) { DataDic.ssResult.Cols.MinSize = 80; DataDic.ssWhere.Cols.MinSize = 80; DataDic.ssResult.AllowEditing = false; if (GeneralCommon.DD.DataDicType == "E") { DataDic.ssWhere[0, iColcount] = GeneralCommon.rControl[iColcount].ToString(); } } if (GeneralCommon.DD.DicRefType == "C") { DataDic.ShowDialog(); } functionReturnValue = false; return(functionReturnValue); } Cursor.Current = Cursors.WaitCursor; functionReturnValue = true; //DataDic.ssResult.Cols.Count = DS.Tables[0].Columns.Count; DataDic.ssWhere.Cols.Count = DS.Tables[0].Columns.Count + 1; // DataDic.ssWhere.Cols[0].Width = 80; // DataDic.ssResult.Rows.Count = 1; DataDic.ssWhere.Rows.Count = 2; DataDic.ssResult.DataSource = DS.Tables[0]; DataDic.ssResult.Cols.Count = DS.Tables[0].Columns.Count + 1; DataDic.ssWhere_setting(); for (iColcount = 0; iColcount < DataDic.ssResult.Cols.Count - 1; iColcount++) { DataDic.ssWhere.Cols[iColcount + 1].Caption = DS.Tables[0].Columns[iColcount].ColumnName; DataDic.ssResult.Cols[iColcount].Width = 80; DataDic.ssWhere.Cols[iColcount + 1].Width = 80; DataDic.ssResult.Cols[iColcount].AllowEditing = false; if (GeneralCommon.DD.DataDicType == "E") { DataDic.ssWhere.Cols[iColcount].Caption = GeneralCommon.rControl[iColcount].ToString(); } } Cursor.Current = Cursors.Default; if (GeneralCommon.DD.DicRefType == "C") { DataDic.ShowDialog(); } } catch (Exception ex) { functionReturnValue = false; GeneralCommon.Gp_DD_Clear(); GeneralCommon.rControl.RemoveRange(0, GeneralCommon.rControl.Count); GeneralCommon.DD.sPname = ""; functionReturnValue = false; GeneralCommon.Gp_MsgBoxDisplay("DD_Display Error : " + ex.Message); Cursor.Current = Cursors.Default; } return(functionReturnValue); }