public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { ListBoxControl dbs = new ListBoxControl(); dbs.Click += Dbs_Click; try { QDatabaseName dbName = (QDatabaseName)context.Instance.GetType().GetProperty("DatabaseName").GetValue(context.Instance, null); string sql = "SELECT NAME FROM sysobjects WHERE xtype = 'V'"; QDatabase db = QInstance.Environments.GetDatabase(dbName); DataSet dbSet = db.ExecuteQuery(sql); dbs.DisplayMember = "NAME"; dbs.DataSource = dbSet.Tables[0]; edSvc.DropDownControl(dbs); value = ((DataRowView)dbs.SelectedItem).Row["NAME"]; } catch (Exception ex) { } } } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { ListBoxControl dbs = new ListBoxControl(); dbs.Click += Dbs_Click; try { QDatabaseName dbName = (QDatabaseName)context.Instance.GetType().GetProperty("DatabaseName").GetValue(context.Instance, null); string sql = "select LOV_CODE, LOV_DESC from vw_at_lst_of_val where lov_type='CRITERIA_CATEGORIES' order by lov_desc"; QDatabase db = QInstance.Environments.GetDatabase(dbName); DataSet dbSet = db.ExecuteQuery(sql); dbs.DisplayMember = "LOV_DESC"; dbs.DataSource = dbSet.Tables[0]; edSvc.DropDownControl(dbs); value = ((DataRowView)dbs.SelectedItem).Row["LOV_DESC"]; } catch (Exception ex) { } } } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { instCode = Convert.ToString(value); GridControl grd = new GridControl(); GridView gview = new GridView(grd); GridColumn colCode = new GridColumn(); GridColumn colDesc = new GridColumn(); colCode.FieldName = "INST_CODE"; colDesc.FieldName = "INST_DESC"; colCode.Caption = "Code"; colDesc.Caption = "Description"; colCode.Width = 30; colCode.Visible = true; colDesc.Visible = true; gview.Columns.AddRange(new GridColumn[] { colDesc, colCode }); //gview.OptionsBehavior.ReadOnly = true; grd.MainView = gview; grd.Click += Dbs_Click; gview.OptionsCustomization.AllowGroup = false; gview.OptionsView.ShowGroupPanel = false; //gview.FocusRectStyle = DrawFocusRectStyle.RowFullFocus; gview.OptionsBehavior.Editable = false; //ListBoxControl dbs = new ListBoxControl(); //dbs.Click += Dbs_Click; try { QDatabaseName dbName = (QDatabaseName)context.Instance.GetType().GetProperty("DatabaseName").GetValue(context.Instance, null); string sql = "SELECT INST_CODE, INST_DESC FROM AT_INSTALLATIONS ORDER BY INST_DESC"; QDatabase db = QInstance.Environments.GetDatabase(dbName); DataSet dbSet = db.ExecuteQuery(sql); //dbs.DisplayMember = "INST_DESC"; grd.DataSource = dbSet.Tables[0]; edSvc.DropDownControl(grd); value = instCode; } catch (Exception ex) { } } } return(value); }
//Try to apply transform to msi package and return a list of product codes public static HashSet <String> GetTransformProductCode(string msi) { HashSet <string> productCodes = new HashSet <string>(); using (var db = new QDatabase(msi.ToLower(), DatabaseOpenMode.ReadOnly)) { Logger.LogMsg("******" + msi); try { int cnt = 0; foreach (string run in SqlRuns) { db.ApplyTransform(run, (TransformErrors)319); cnt++; //example: //"SELECT `Table`, `Column`, `Row`, `Data`, `Current` FROM `_TransformView`"; //table="Property",Column="Value",Row="SqlRun",Data="SqlRun01.mst",Current="SqlRun00" //table="Property",Column="Value",Row="ProductCode",Data="{C2D85992-11D5-4BC8-A8BF-77B6749FA9AC}",Current="{18B3B793-092C-4D03-BD6B-D388676CA997}" string SqlSelectString = "SELECT `Table`, `Column`, `Row`, `Data`, `Current` FROM `_TransformView`"; string codeStr = SqlSelectString + " WHERE Row='ProductCode' "; var ts = db.ExecuteQuery(codeStr); if (ts.Count == 5) { string productCode = ts[3].ToString(); productCodes.Add(productCode); //Logger.LogMsg("ApplyTransform:ProductCode=" + productCode); } } Logger.LogMsg("ApplyTransform to \"" + msi + "\",Count:" + cnt + " "); } catch (Exception ex) { //it is warning instead of error, some msi doesn't have transform Logger.LogWarning("ApplyTransform:\"" + msi + "\":" + ex.Message); } } return(productCodes); }
private object InitDropDown_Criterio(ITypeDescriptorContext context, ListBoxControl dbs) { object retval = null; try { QDatabaseName dbName = (QDatabaseName)context.Instance.GetType().GetProperty("DatabaseName").GetValue(context.Instance, null); string tableName = (string)context.Instance.GetType().GetProperty("WhereTable").GetValue(context.Instance, null); string sql = string.Format(@"SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'{0}' ORDER BY COLUMN_NAME", tableName); QDatabase db = QInstance.Environments.GetDatabase(dbName); DataSet dbSet = db.ExecuteQuery(sql); dbs.DisplayMember = "COLUMN_NAME"; dbs.DataSource = dbSet.Tables[0]; edSvc.DropDownControl(dbs); retval = ((DataRowView)dbs.SelectedItem).Row["COLUMN_NAME"]; } catch (Exception ex) { } return(retval); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { crjCode = Convert.ToString(value); GridControl grd = new GridControl(); GridView gview = new GridView(grd); GridColumn colCode = new GridColumn(); GridColumn colSourceTable = new GridColumn(); GridColumn colJoin = new GridColumn(); colCode.FieldName = "CRJ_CODE"; colSourceTable.FieldName = "CRJ_SOURCE_TABLE"; colJoin.FieldName = "CRJ_JOIN"; colCode.Caption = "Code"; colSourceTable.Caption = "Source Table"; colJoin.Caption = "Join"; colCode.Width = 30; colCode.Visible = true; colSourceTable.Visible = true; colJoin.Visible = true; gview.Columns.AddRange(new GridColumn[] { colCode, colSourceTable, colJoin }); //gview.OptionsBehavior.ReadOnly = true; grd.MainView = gview; grd.Click += Dbs_Click; gview.OptionsCustomization.AllowGroup = false; gview.OptionsView.ShowGroupPanel = false; //gview.FocusRectStyle = DrawFocusRectStyle.RowFullFocus; gview.OptionsBehavior.Editable = false; //ListBoxControl dbs = new ListBoxControl(); //dbs.Click += Dbs_Click; try { QDatabaseName dbName = (QDatabaseName)context.Instance.GetType().GetProperty("DatabaseName").GetValue(context.Instance, null); string sql = "SELECT CRJ_CODE, CRJ_SOURCE_TABLE, CRJ_JOIN FROM AT_CRITERIA_JOINS ORDER BY CRJ_SOURCE_TABLE"; object inst = context.Instance; if (inst.GetType() == typeof(QAddCriterioCR)) { string tableName = (string)context.Instance.GetType().GetProperty("WhereTable").GetValue(context.Instance, null); sql = string.Format("SELECT CRJ_CODE, CRJ_SOURCE_TABLE, CRJ_JOIN FROM AT_CRITERIA_JOINS WHERE CRJ_SOURCE_TABLE='{0}' ORDER BY CRJ_SOURCE_TABLE", tableName); } QDatabase db = QInstance.Environments.GetDatabase(dbName); DataSet dbSet = db.ExecuteQuery(sql); //dbs.DisplayMember = "INST_DESC"; grd.DataSource = dbSet.Tables[0]; edSvc.DropDownControl(grd); value = crjCode; } catch (Exception ex) { } } } return(value); }