Example #1
0
        private void pgPara_SelectionChanged(object sender, DataRowSelectionChangedArgs e)
        {
            try
            {
                if (e.Row == null)
                {
                    return;
                }

                var group = ((ConfigParaKeyValue)e.Row).Group;
                if (group == null)
                {
                    ((ConfigParaKeyValue)e.Row).Group = DropdownBoxHelper.GetGenericFromComboBox <ConfigParaGroup>(comboBoxParaGroup);
                }
                else
                {
                    DropdownBoxHelper.SetGenericToComboBox(comboBoxParaGroup, group);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Loger.Error(ex);
            }
        }
Example #2
0
        private void btnTableInfo_Click(object sender, EventArgs e)
        {
            try
            {
                var           config        = DropdownBoxHelper.GetGenericFromComboBox <DatabaseConfig>(comboBoxDB);
                IDBAccess     dbAccess      = DBAccessManager.GetDBAccessInstance(config.DBID);
                var           tableInfoList = dbAccess.Database.GetTableInfoList(ckGetFieldInfo.Checked);
                StringBuilder sb            = new StringBuilder();
                sb.AppendLine("----------------------------------------------------------------------------");
                sb.AppendLine($"[{config.ConName}] [{tableInfoList.Count}]");
                sb.AppendLine("----------------------------------------------------------------------------");

                foreach (var tableInfo in tableInfoList)
                {
                    sb.AppendLine($"[TableName:{tableInfo.Name}]");
                    sb.AppendLine($"[Comments:{tableInfo.Comments}]");
                    sb.AppendLine($"[PriKeyField:{string.Join(";", tableInfo.PriKeyFieldInfos.Select(t => { return t.FieldName; })) }]");
                    sb.AppendLine($"[Field:{string.Join(";", tableInfo.DbFieldInfos.Select(t => { return t.FieldName; })) }]");
                    string tmp = tableInfo.Indexs == null ? string.Empty : string.Join("; ", tableInfo.Indexs.Select(t => { return($"{t.IndexName}:{t.FieldName}"); }));
                    sb.AppendLine($"[Index:{tmp }]");
                    sb.AppendLine("----------------------------------------------------------------------------");
                }

                Loger.Info(sb.ToString());
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
            }
        }
Example #3
0
        private void FWave22_Load(object sender, EventArgs e)
        {
            try
            {
                DropdownBoxHelper.BindingEnumToComboBox <BASSAttribute>(comboBoxBASSAttribute, BASSAttribute.BASS_ATTRIB_EAXMIX);

                this.trackBarQualityCoefficient.ValueChanged += new System.EventHandler(this.trackBarQualityCoefficient_ValueChanged);

                cbIsMergeChanel.Checked = wavePlayer1.IsMergeChanel;
                cbRingHear.Checked      = wavePlayer1.IsRingHear;
                var ret = UtilZ.Dotnet.Wav.ExBass.Bass.BASS_GetVolume();
                if (ret <= 0)
                {
                    wavePlayer1.Volume = 80;
                }
                else
                {
                    trackBarVolume.Value = wavePlayer1.Volume;
                }

                trackBarQualityCoefficient.Value = wavePlayer1.QualityCoefficient;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #4
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            try
            {
                //string pluginAssemblyPath = @"D:\qwe\abc.dll";
                //DBAccessManager.LoadDBPlugin(pluginAssemblyPath);

                //pluginAssemblyPath = @"qwe\abc.dll";
                //DBAccessManager.LoadDBPlugin(pluginAssemblyPath);

                var config = DropdownBoxHelper.GetGenericFromComboBox <DatabaseConfig>(comboBoxDB);
                //IDBAccess dbAccess = DBAccessManager.GetDBAccessInstance(config.DBID);
                //string sql = @"SELECT A.* FROM user_indexes A WHERE TABLE_NAME='STU'";
                //DataTable dt = dbAccess.QueryDataToDataTable(sql);
                //DataColumn[] colArr = new DataColumn[dt.Columns.Count];
                //dt.Columns.CopyTo(colArr, 0);
                //string[] colNameArr = colArr.Select(t => { return t.ColumnName; }).ToArray();
                //string str = string.Join(",A.", colNameArr);
                //Loger.Info(str);

                //IDBInteraction interaction = DBFactoryManager.GetDBFactory(config).GetDBInteraction();
                //string conStr = interaction.GenerateDBConStr(config, DBVisitType.R);
                //Port=5432;Host=localhost;Username=postgres;Password=qwe123;Database=postgres
                //using (var con = new Npgsql.NpgsqlConnection(conStr))
                //{
                //    con.Open();
                //    var cmd = con.CreateCommand();
                //    cmd.CommandText = "select CURRENT_TIMESTAMP";
                //    object obj = cmd.ExecuteScalar();
                //}


                bool ret;
                try
                {
                    //var config = DatabaseConfigManager.GetConfig(Config.Instance.DBID);
                    UtilZ.Dotnet.DBIBase.Factory.IDBFactory         dbFactory     = UtilZ.Dotnet.DBIBase.Factory.DBFactoryManager.GetDBFactory(config);
                    UtilZ.Dotnet.DBIBase.Interaction.IDBInteraction dbInteraction = dbFactory.GetDBInteraction();
                    using (var con = dbInteraction.GetProviderFactory().CreateConnection())
                    {
                        string confStr = dbInteraction.GenerateDBConStr(config, DBVisitType.R);
                        con.ConnectionString = confStr;
                        con.Open();
                        ret = con.State == ConnectionState.Open;
                    }
                }
                catch (Exception exi)
                {
                    ret = false;
                    Loger.Error(exi);
                }
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
            }
        }
Example #5
0
 private void btnGetValue_Click(object sender, EventArgs e)
 {
     try
     {
         BASSAttribute attri = DropdownBoxHelper.GetEnumFromComboBox <BASSAttribute>(comboBoxBASSAttribute);
         txtInfo.Text = wavePlayer1.GetChannelAttribute(attri).ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #6
0
 private void btnPagingQuery_Click(object sender, EventArgs e)
 {
     try
     {
         var config = DropdownBoxHelper.GetGenericFromComboBox <DatabaseConfig>(comboBoxDB);
         this._dbAccess = DBAccessManager.GetDBAccessInstance(config.DBID);
         this.QueryPageInfo(this._dbAccess);
     }
     catch (Exception ex)
     {
         Loger.Error(ex);
     }
 }
        private void FTestPartAsynWait_Load(object sender, EventArgs e)
        {
            items.Add(new CobITemInfo("yf", 23));
            items.Add(new CobITemInfo("zhn", 31));
            items.Add(new CobITemInfo("tq", 18));
            DropdownBoxHelper.BindingIEnumerableGenericToComboBox <CobITemInfo>(comboBox1, items);
            //DropdownBoxHelper.BindingIEnumerableGenericToComboBox<CobITemInfo>(comboBox1, items, string.Empty);
            //DropdownBoxHelper.BindingIEnumerableGenericToComboBox<CobITemInfo>(comboBox1, t => { return t.Name; }, items);

            //DropdownBoxHelper.BindingIEnumerableGenericToToolStripComboBox<CobITemInfo>(toolStripComboBox1, items, nameof(CobITemInfo.Name));
            //DropdownBoxHelper.BindingIEnumerableGenericToToolStripComboBox<CobITemInfo>(toolStripComboBox1, items);
            DropdownBoxHelper.BindingIEnumerableGenericToToolStripComboBox <CobITemInfo>(toolStripComboBox1, t => { return(t.Name); }, items);
        }
Example #8
0
 private void btnSetValue_Click(object sender, EventArgs e)
 {
     try
     {
         BASSAttribute attri = DropdownBoxHelper.GetEnumFromComboBox <BASSAttribute>(comboBoxBASSAttribute);
         float         value = (float)(numAttriValue.Value / 100);
         wavePlayer1.SetChannelAttribute(attri, value);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #9
0
 private void btnDataBaseName_Click(object sender, EventArgs e)
 {
     try
     {
         var       config       = DropdownBoxHelper.GetGenericFromComboBox <DatabaseConfig>(comboBoxDB);
         IDBAccess dbAccess     = DBAccessManager.GetDBAccessInstance(config.DBID);
         string    databaseName = dbAccess.Database.GetDatabaseName();
         Loger.Info($"[{config.ConName}] [DatabaseName:{databaseName}]");
     }
     catch (Exception ex)
     {
         Loger.Error(ex);
     }
 }
Example #10
0
 private void btnQuery_Click(object sender, EventArgs e)
 {
     try
     {
         var       config   = DropdownBoxHelper.GetGenericFromComboBox <DatabaseConfig>(comboBoxDB);
         IDBAccess dbAccess = DBAccessManager.GetDBAccessInstance(config.DBID);
         string    sql      = @"SELECT  ID,SensNo,SensLocation,SensType,AddTime FROM Sensors";
         DataTable dt       = dbAccess.QueryDataToDataTable(sql);
         dgv.ShowData(dt);
     }
     catch (Exception ex)
     {
         Loger.Error(ex);
     }
 }
Example #11
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            try
            {
                var dbConfig = DropdownBoxHelper.GetGenericFromComboBox <DatabaseConfig>(comboBoxDB);
                var para     = new PartAsynWaitPara <DatabaseConfig, object>();
                para.Caption      = "查询数据库结构";
                para.IsShowCancel = false;
                para.Para         = dbConfig;
                para.Function     = (p) =>
                {
                    p.AsynWait.Hint = $"正在查询数据库[{dbConfig.ConName}]结构,请稍候...";
                    IDBAccess dbAccess = DBAccessManager.GetDBAccessInstance(p.Para.DBID);
                    this._tableList = dbAccess.Database.GetTableInfoList(true).OrderBy(t => { return(t.Name); }).Select(t => { return(new DBTableInfoEx(t)); }).ToList();
                    if (p.AsynWait.InvokeRequired)
                    {
                        p.AsynWait.Invoke(new Action(() =>
                        {
                            this._tableBindingList.Clear();
                            this._tableBindingList.AddRange(this._tableList);
                        }));
                    }
                    else
                    {
                        this._tableBindingList.Clear();
                        this._tableBindingList.AddRange(this._tableList);
                    }

                    return(null);
                };

                para.Completed = (ret) =>
                {
                    if (ret.Status == PartAsynExcuteStatus.Exception)
                    {
                        Loger.Error(ret.Exception);
                    }
                };

                PartAsynWaitHelper.Wait(para, this);
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
                MessageBox.Show(ex.Message);
            }
        }
Example #12
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        public override void RefreshData()
        {
            try
            {
                List <ConfigParaGroup> groups = this._configLogic.GetAllConfigParaGroup();
                groups.Insert(0, this._allGroup);
                ConfigParaGroup selectedItem = null;
                if (comGroup.Items.Count > 0)
                {
                    var oldSelectedItem = DropdownBoxHelper.GetGenericFromComboBox <ConfigParaGroup>(comGroup);
                    if (oldSelectedItem != null)
                    {
                        var ret = (from tmpItem in groups where oldSelectedItem.ID == tmpItem.ID select tmpItem).ToList();
                        if (ret.Count > 0)
                        {
                            selectedItem = ret[0];
                        }
                    }
                }

                if (selectedItem == null && groups.Count > 0)
                {
                    selectedItem = groups[0];
                }

                this.comGroup.SelectedIndexChanged -= this.comGroup_SelectedIndexChanged;
                try
                {
                    DropdownBoxHelper.BindingIEnumerableGenericToComboBox <ConfigParaGroup>(comGroup, groups, nameof(ConfigParaGroup.Name), null);
                }
                finally
                {
                    this.comGroup.SelectedIndex         = -1;
                    this.comGroup.SelectedIndexChanged += this.comGroup_SelectedIndexChanged;
                    DropdownBoxHelper.SetGenericToComboBox(comGroup, selectedItem);
                }
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
            }
        }
Example #13
0
        private void btnExistTable_Click(object sender, EventArgs e)
        {
            try
            {
                string tblName = txtTblName.Text;
                if (checkBoxIgnoreCase.Checked)
                {
                    tblName = tblName.ToUpper();
                }

                var       config   = DropdownBoxHelper.GetGenericFromComboBox <DatabaseConfig>(comboBoxDB);
                IDBAccess dbAccess = DBAccessManager.GetDBAccessInstance(config.DBID);
                var       isExist  = dbAccess.Database.ExistTable(tblName);
                Loger.Info($"[{config.ConName}] [{txtTblName.Text}] [{isExist}]");
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
            }
        }
Example #14
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                var selectedItem = DropdownBoxHelper.GetGenericFromComboBox <ConfigParaGroup>(comGroup);
                if (selectedItem == null)
                {
                    MessageBox.Show("参数所属组不能为空");
                    return;
                }

                List <int> validDomainIds = (from tmpItem in this._serviceList where tmpItem.IsSelected select tmpItem.ID).ToList();
                if (validDomainIds.Count == 0)
                {
                    MessageBox.Show("参数作用域范围至少需要有一个服务");
                    return;
                }

                var configParaKeyValue = new ConfigParaKeyValue();
                configParaKeyValue.ID    = this._configParaKeyValue.ID;
                configParaKeyValue.Key   = this._configParaKeyValue.Key;
                configParaKeyValue.Value = rtxtValue.Text;
                configParaKeyValue.GID   = selectedItem.ID;
                configParaKeyValue.Des   = rtxtDes.Text;

                //修改
                this._configLogic.ModifyConfigParaKeyValue(configParaKeyValue, validDomainIds);

                //更新数据源
                this._configParaKeyValue.Value = configParaKeyValue.Value;
                this._configParaKeyValue.Des   = configParaKeyValue.Des;
                this._configParaKeyValue.Group = selectedItem;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Loger.Error(ex);
            }
        }
Example #15
0
        private void FParaManager_Load(object sender, EventArgs e)
        {
            if (this.DesignMode)
            {
                return;
            }

            try
            {
                List <ConfigParaGroup> groups = this._configLogic.GetAllConfigParaGroup();
                DropdownBoxHelper.BindingIEnumerableGenericToComboBox <ConfigParaGroup>(comboBoxParaGroup, groups, nameof(ConfigParaGroup.Name), null);
                this._srcItems = this._configLogic.GetAllConfigParaKeyValue();
                this._bindItems.AddRange(this._srcItems);
                this.pgPara.ShowData(this._bindItems, "FParaManager.ConfigParaKeyValue", null, null, new ConfigParaKeyValue().GetAllowEditColumns());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Loger.Error(ex);
            }
        }
Example #16
0
        private void comboBoxParaGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (pgPara.SelectedRows.Length == 0)
                {
                    return;
                }

                var group = DropdownBoxHelper.GetGenericFromComboBox <ConfigParaGroup>(comboBoxParaGroup);
                foreach (var selectedRow in this.pgPara.SelectedRows)
                {
                    ((ConfigParaKeyValue)((DataGridViewRow)selectedRow).DataBoundItem).Group = group;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Loger.Error(ex);
            }
        }
Example #17
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public PropertyGridEnumControl(object value)
        {
            InitializeComponent();

            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            Type valueType = value.GetType();

            if (!valueType.IsEnum)
            {
                throw new ArgumentException(string.Format("类型:{0}不是枚举类型", valueType.FullName));
            }

            List <FieldInfoEx> dbiItems     = EnumEx.GetEnumFieldInfoExList(valueType);
            FieldInfoEx        selectedItem = (from item in dbiItems where value.Equals(item.Value) select item).FirstOrDefault();

            DropdownBoxHelper.BindingIEnumerableGenericToComboBox <FieldInfoEx>(comboBoxEnum, dbiItems, "Text", selectedItem);
        }
Example #18
0
        private void FConfigParaKeyValueEdit_Load(object sender, EventArgs e)
        {
            if (this.DesignMode)
            {
                return;
            }

            try
            {
                this._serviceList.AddRange(this._configLogic.GetConfigParaServiceMap(this._configParaKeyValue.ID));
                pgValidDomain.ShowData(this._serviceList, "FConfigParaKeyValueEdit.ConfigParaServiceMap", null, null, new string[] { nameof(ConfigParaServiceMap3.IsSelected) });
                List <ConfigParaGroup> groups = this._configLogic.GetAllConfigParaGroup();
                DropdownBoxHelper.BindingIEnumerableGenericToComboBox <ConfigParaGroup>(comGroup, groups, nameof(ConfigParaGroup.Name), this._configParaKeyValue.Group);
                this.txtKey.Text    = this._configParaKeyValue.Key;
                this.rtxtValue.Text = this._configParaKeyValue.Value;
                this.rtxtDes.Text   = this._configParaKeyValue.Des;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Loger.Error(ex);
            }
        }
Example #19
0
        private void UCDBStructControl_Load(object sender, EventArgs e)
        {
            if (this.DesignMode)
            {
                return;
            }

            try
            {
                DBTableInfoEx.ShowFieldChanged = this.ShowFieldChanged;
                List <DatabaseConfig> items = DatabaseConfigManager.GetAllConfigItems();
                DropdownBoxHelper.BindingIEnumerableGenericToComboBox <DatabaseConfig>(comboBoxDB, items, nameof(DatabaseConfig.ConName));
                dgvTables.ShowData(this._tableBindingList.DataSource, "UCDBStructControl.dgvTables", null, null, new string[] { nameof(DBTableInfoEx.ShowField) });
                dgvTableFields.ShowData(this._fieldInfoBindingList.DataSource, "UCDBStructControl.dgvTableFields");
                dgvIndex.ShowData(this._indexInfoBindingList.DataSource, "UCDBStructControl.dgvIndex");
                this.checkMultTable_CheckedChanged(sender, e);
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
                MessageBox.Show(ex.Message);
            }
        }
Example #20
0
        private void comGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                var selectedItem = DropdownBoxHelper.GetGenericFromComboBox <ConfigParaGroup>(comGroup);
                if (selectedItem == null)
                {
                    return;
                }

                if (this._allGroup == selectedItem)
                {
                    selectedItem = null;
                }

                List <ConfigParaKeyValue> paras = this._configLogic.GetGroupConfigParaKeyValue(selectedItem);
                pgConfigParaKeyValue.ShowData(paras, "ConfigParaKeyValue");
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
            }
        }
Example #21
0
        private void FTest_Load(object sender, EventArgs e)
        {
            if (this.DesignMode)
            {
                return;
            }

            var redirectAppenderToUI = (RedirectAppender)Loger.GetAppenderByName(null, "RedirectToUI");

            if (redirectAppenderToUI != null)
            {
                redirectAppenderToUI.RedirectOuput += RedirectAppenderToUI_RedirectOuput;;
            }


            List <DatabaseConfig> itemList = DatabaseConfigManager.GetAllConfigItems();

            DropdownBoxHelper.BindingIEnumerableGenericToComboBox <DatabaseConfig>(comboBoxDB, itemList, nameof(DatabaseConfig.ConName), itemList.Where(t => { return(t.DBID == _pssqlDbid); }).FirstOrDefault());

            EFDbContext.OutputLog = true;

            EFEntityTypeManager.RegisterEntityType(3, typeof(DotnetWinFormApp.DB.Stu));
            EFEntityTypeManager.RegisterEntityType(5, typeof(DotnetWinFormApp.DB.Stu));
        }
Example #22
0
        private void btnEF_Click(object sender, EventArgs e)
        {
            try
            {
                var config = DropdownBoxHelper.GetGenericFromComboBox <DatabaseConfig>(comboBoxDB);
                using (var ef = new DotnetWinFormApp.DB.EFModelContext(config.DBID))
                {
                    var actionArr = ef.Action.ToArray();
                    var roleArr   = ef.Role.ToArray();

                    //Action
                    var roles   = ef.Query <DotnetWinFormApp.DB.Role>(r => r.ID == 2).ToArray();
                    var newRole = new DotnetWinFormApp.DB.Role();
                    newRole.Name = "员工";
                    newRole.Des  = "打酱油的员工";
                    if (newRole.Action == null)
                    {
                        newRole.Action = new List <DotnetWinFormApp.DB.Action>();
                    }

                    foreach (var action in actionArr)
                    {
                        newRole.Action.Add(action);
                    }

                    ef.Insert(newRole);

                    var actionArr2 = ef.Action.ToArray();
                    var roleArr2   = ef.Role.ToArray();
                }
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
            }
        }
 private void btnSetGenericToComboBox_Click(object sender, EventArgs e)
 {
     DropdownBoxHelper.SetGenericToComboBox(comboBox1, items[1]);
 }
Example #24
0
        private void btnDBQueryExpression_Click(object sender, EventArgs e)
        {
            try
            {
                //                select treea.ID,treea.Name,treea.Age,treeb.City,treeb.Level From treea INNER JOIN treeb on treea.ID = treeb.AID
                //where treea.Age > 23 AND treeb.Level < 5


                //select A.ID,A.Name,A.Age,B.City,B.Level From treea A INNER JOIN treeb B on A.ID = B.AID
                //where A.Age > 23 AND B.Level < 5

                //string tblA = "TreeA";
                //string tblB = "TreeB";
                string tblA = "treea";
                string tblB = "treeb";

                var queryExpression = new DBQueryExpression();
                queryExpression.QueryFields.Add(new DBQueryField(tblA, "ID"));
                queryExpression.QueryFields.Add(new DBQueryField(tblA, "Name"));
                queryExpression.QueryFields.Add(new DBQueryField(tblA, "Age"));

                queryExpression.QueryFields.Add(new DBQueryField(tblB, "City"));
                queryExpression.QueryFields.Add(new DBQueryField(tblB, "Level"));

                queryExpression.ConditionExpressionNodes.LogicOperaters = LogicOperaters.AND;
                queryExpression.ConditionExpressionNodes.Add(new ExpressionNode(CompareOperater.GreaterThan, tblA, "Age", 23));
                queryExpression.ConditionExpressionNodes.Add(new ExpressionNode(CompareOperater.LessThan, tblB, "Level", 5));

                var tableAliaNameDic = new Dictionary <string, string>();
                tableAliaNameDic.Add("treea", "A");
                tableAliaNameDic.Add("treeb", "B");
                string fieldSql = queryExpression.QueryFields.ToQueryFieldSql(tableAliaNameDic);
                Loger.Info(fieldSql);

                var config   = DropdownBoxHelper.GetGenericFromComboBox <DatabaseConfig>(comboBoxDB);
                var dbAccess = DBAccessManager.GetDBAccessInstance(config.DBID);

                List <DBTableInfo> dbTableInfos = dbAccess.Database.GetTableInfoList(true);
                var dbTableInfoDic = dbTableInfos.ToDictionary(k => { return(k.Name); }, v => { return(v.DbFieldInfos.ToDictionary(t => { return t.FieldName; })); });

                var filedValueConverterCollection = new DBFiledValueConverterCollection();


                Dictionary <string, object> parameterNameValueDic;
                int parameterIndex = 1;
                string where = queryExpression.ConditionExpressionNodes.ToWhere(dbTableInfoDic, tableAliaNameDic,
                                                                                filedValueConverterCollection, dbAccess.ParaSign, ref parameterIndex, out parameterNameValueDic);
                Loger.Info(where);

                ISqlFieldValueFormator fieldValueFormator = DBAccessManager.GetFieldValueFormator(config);
                string whereNoPara = queryExpression.ConditionExpressionNodes.ToWhereNoParameter(dbTableInfoDic, tableAliaNameDic, filedValueConverterCollection, fieldValueFormator);
                Loger.Info(whereNoPara);



                //-------------------------------------------------------------------------------------------------------------------------------------


                //A.Age > 23 AND (B.Level < 4 OR B.Level > 6)
                var expressionNodeCollection = new ExpressionNodeCollection();
                expressionNodeCollection.LogicOperaters = LogicOperaters.AND;
                expressionNodeCollection.Add(new ExpressionNode(CompareOperater.GreaterThan, tblA, "Age", 23));

                var orCondition = new ExpressionNode();
                orCondition.Children.LogicOperaters = LogicOperaters.OR;
                orCondition.Children.Add(new ExpressionNode(CompareOperater.LessThan, tblB, "Level", 4));
                orCondition.Children.Add(new ExpressionNode(CompareOperater.GreaterThan, tblB, "Level", 6));
                expressionNodeCollection.Add(orCondition);

                parameterNameValueDic = null;
                parameterIndex        = 1;
                string where2 = expressionNodeCollection.ToWhere(dbTableInfoDic, tableAliaNameDic, filedValueConverterCollection, dbAccess.ParaSign, ref parameterIndex, out parameterNameValueDic);
                Loger.Info(where2);

                string whereNoPara2 = expressionNodeCollection.ToWhereNoParameter(dbTableInfoDic, tableAliaNameDic, filedValueConverterCollection, fieldValueFormator);
                Loger.Info(whereNoPara2);

                tableAliaNameDic.Clear();
                parameterNameValueDic = null;
                parameterIndex        = 1;
                string where3 = expressionNodeCollection.ToWhere(dbTableInfoDic, tableAliaNameDic, filedValueConverterCollection, dbAccess.ParaSign, ref parameterIndex, out parameterNameValueDic);
                Loger.Info(where3);

                string whereNoPara3 = expressionNodeCollection.ToWhereNoParameter(dbTableInfoDic, tableAliaNameDic, filedValueConverterCollection, fieldValueFormator);
                Loger.Info(whereNoPara3);
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
            }
        }
 private void btnGetGenericFromComboBox_Click(object sender, EventArgs e)
 {
     btnGetGenericFromComboBox.Text = DropdownBoxHelper.GetGenericFromComboBox <CobITemInfo>(comboBox1).Name;
 }
Example #26
0
        private void btnTestEF_Click(object sender, EventArgs e)
        {
            var config = DropdownBoxHelper.GetGenericFromComboBox <DatabaseConfig>(comboBoxDB);

            Task.Factory.StartNew(TestEF, config);
        }