예제 #1
0
 public ConsumerManager()
 {
     _helper = DBFactory.CreateDBHelper();
     _helper.AutoCloseConnection = false;
     _helper.Lockable            = true;
     Common.CreateFileWatcher(new FileInfo(MQFactory.Consumeconfigpath).Directory.FullName);
 }
예제 #2
0
        private void btnSQL_Click(object sender, EventArgs e)
        {
            IDBHelper helper = DBFactory.CreateDBHelper();

            helper.ExecNoneQueryWithSQL(txbSQL.Text);
            MessageBox.Show("ok");
        }
예제 #3
0
        public T[] GetModels(int PageIndex, int PageSize, string IDColumnName, string DBEx)
        {
            DBHelper objHelper = DBFactory.CreateDBHelper();

            T[]         objReturn     = null;
            Parameter[] objParameters = null;
            DataTable   dtModels      = null;
            int         intStartIndex = -1;
            int         intEndIndex   = -1;

            if (PageIndex > 0 && PageSize > 0)
            {
                intStartIndex = (PageIndex - 1) * PageSize;
                intEndIndex   = PageIndex * PageSize;
            }
            string strSQL = GetSQL(DBEx, "", "", out objParameters);

            dtModels = objHelper.GetTableWithSQL(strSQL, objParameters, intStartIndex, intEndIndex, IDColumnName);
            if (dtModels != null && dtModels.Rows.Count > 0)
            {
                objReturn = new T[dtModels.Rows.Count];
                objReturn = AssignData(dtModels);
            }
            return(objReturn);
        }
예제 #4
0
        private void btnData_Click(object sender, EventArgs e)
        {
            IDBHelper helper = DBFactory.CreateDBHelper();
            DataTable table  = helper.GetTableWithSQL(txbSQL.Text);

            MessageBox.Show(JsonHelper.Serialize(table));
        }
예제 #5
0
        public DataTable RunSQLWithTable(string sql)
        {
            IDBHelper helper = DBFactory.CreateDBHelper();
            DataTable table  = helper.GetTableWithSQL(sql);

            return(table);
        }
예제 #6
0
        /// <summary>
        /// 查询topn条数据
        /// </summary>
        /// <param name="topN"></param>
        /// <param name="entityType"></param>
        /// <param name="where"></param>
        /// <param name="orderby"></param>
        /// <returns></returns>
        private DataTable GetTopNData(int topN)
        {
            IDBHelper     helper = DBFactory.CreateDBHelper();
            StringBuilder sql    = new StringBuilder();

            sql.AppendFormat(" SELECT TOP {0} * FROM T_Sync_Temp ", topN);
            return(helper.GetTableWithSQL(sql.ToString()));
        }
예제 #7
0
        public void insertAndQueryTest()
        {
            helper = DBFactory.CreateDBHelper();
            StringBuilder builder = new StringBuilder();

            builder.Append("INSERT INTO Test ('100','unit test','1')");
            Assert.AreEqual(1, helper.ExecNoneQueryWithSQL(builder.ToString()));
        }
예제 #8
0
        /// <summary>
        /// 查询topn条数据
        /// </summary>
        /// <param name="topN"></param>
        /// <param name="entityType"></param>
        /// <param name="where"></param>
        /// <param name="orderby"></param>
        /// <returns></returns>
        protected DataTable GetTopNData(int topN, List <WhereClause> where, OrderByClause orderby)
        {
            IDBHelper  helper = DBFactory.CreateDBHelper();
            ISQLAction action = Factory.CreateAction(_tableconfig.Tag, _tableconfig, helper);
            var        entity = Activator.CreateInstance <Dictionary <string, object> >();

            return(action.SelectTopN(topN, entity, where, orderby));
        }
예제 #9
0
 public DictService(IDictFor dictFor, INameConverter nameConverter, DictSettings settings)
 {
     _dictFor            = dictFor;
     _db                 = DBFactory.CreateDBHelper("Default");
     _db.DbNameConverter = null; //不转换字典sql中输出的字段名
     _nameConverter      = nameConverter;
     _settings           = settings;
 }
예제 #10
0
        private int Consume(PipeWorker workder, bool stop = false)
        {
            int           count = 0;
            StringBuilder sql   = new StringBuilder();

            sql.Append("SELECT TOP 1000 * FROM MQCache WHERE [HasError]=0 AND Enabled=1 ORDER BY [CreateTime] ASC");
            IDBHelper helper = DBFactory.CreateDBHelper();
            DataTable table  = helper.GetTableWithSQL(sql.ToString());

            while (table.Rows.Count > 0)
            {
                foreach (DataRow row in table.Rows)
                {
                    if (stop)
                    {
                        return(count);
                    }
                    string   id       = row["ID"].ToString();
                    string   group    = row["Group"].ToString();
                    Contract contract = new Contract
                    {
                        Command = MessageTypeEnum.Work,
                        Data    = row["Body"].ToString(),
                        Keys    = row["Key"].ToString(),
                        Tags    = row["Tag"].ToString(),
                    };

                    var response = SendMessage(group, contract, workder);
                    if (response.Command == MessageTypeEnum.Error)
                    {
                        StringBuilder update = new StringBuilder();
                        update.Append("UPDATE MQCache SET [HasError]=1,[ErrorMessage]=@Message WHERE ID=@ID");
                        List <Parameter> parameter = new List <Parameter>
                        {
                            new Parameter {
                                Name = "@Message", Value = response.Message
                            },
                            new Parameter {
                                Name = "@ID", Value = id
                            }
                        };
                        helper.ExecNoneQueryWithSQL(update.ToString());
                    }
                    else
                    {
                        StringBuilder delete = new StringBuilder();
                        delete.Append("UPDATE MQCache SET [Enabled]=0 WHERE ID=" + id);
                        helper.ExecNoneQueryWithSQL(delete.ToString());
                        count++;
                    }
                }
                table = helper.GetTableWithSQL(sql.ToString());
            }
            _logger.Write("发送了" + count + "条消费数据到主机");
            return(count);
        }
예제 #11
0
        public bool Delete(Transaction Transaction = null)
        {
            bool             blResult             = false;
            IDBHelper        objHelper            = null;
            DataTable        dtPropertiesAndValue = Reflection.GetClassValues(this, _dt_ClassDef);
            List <Parameter> lstDALParams         = new List <Parameter>();

            if (null != Transaction && null != Transaction.DBHelper)
            {
                objHelper = Transaction.DBHelper;
            }
            else
            {
                objHelper = DBFactory.CreateDBHelper();
            }
            if (dtPropertiesAndValue != null && dtPropertiesAndValue.Rows.Count > 0)
            {
                StringBuilder sbSQL = new StringBuilder();
                sbSQL.Append(" DELETE FROM ");
                sbSQL.Append(_cad_TableDef.GetFullTableName(DBExString));
                sbSQL.Append(" WHERE ");
                int i = 0;
                foreach (DataColumn dcTemp in _dt_ClassDef.Columns)
                {
                    if (i == 0)
                    {
                        if (_dt_ClassDef.Rows[0][dcTemp].ToString() == "1")
                        {
                            sbSQL.Append(dcTemp.ColumnName).Append("=@").Append(dcTemp.ColumnName);
                            Parameter objParam = new Parameter(dcTemp.ColumnName, dtPropertiesAndValue.Rows[0][dcTemp]);
                            lstDALParams.Add(objParam);
                            i++;
                        }
                    }
                    else
                    {
                        if (_dt_ClassDef.Rows[0][dcTemp].ToString() == "1")
                        {
                            sbSQL.Append(" AND").Append(dcTemp.ColumnName).Append("=@").Append(dcTemp.ColumnName);
                            Parameter objParam = new Parameter(dcTemp.ColumnName, dtPropertiesAndValue.Rows[0][dcTemp]);
                            lstDALParams.Add(objParam);
                            i++;
                        }
                    }
                }
                objHelper.ExecNoneQueryWithSQL(sbSQL.ToString(), lstDALParams.ToArray());
            }
            return(blResult);
        }
예제 #12
0
        public int GetCount(string DBEx = null)
        {
            IDBHelper objHelper = DBFactory.CreateDBHelper();
            int       intCount  = 0;

            Parameter[] objParameters = null;
            string      strSQL        = GetSQL(DBEx, "getcount", "", out objParameters);
            DataTable   dtModel       = objHelper.GetTableWithSQL(strSQL, objParameters);

            if (dtModel != null && dtModel.Rows.Count > 0 && dtModel.Rows[0][0] != DBNull.Value)
            {
                intCount = Convert.ToInt32(dtModel.Rows[0][0]);
            }
            return(intCount);
        }
예제 #13
0
파일: Form1.cs 프로젝트: mazhufeng/DataSync
 private void btnLink_Click(object sender, EventArgs e)
 {
     string conn = "Provider=DB2OLEDB;User ID=db2admin;Password=chainway-db2@admin;Initial Catalog=gbnav;Network Transport Library=TCP;Host CCSID=1208;PC Code Page=936;Network Address=117.34.91.127;Network Port=50000;Package Collection=gbnav;Process Binary as Character=False;Units of Work=RUW;DBMS Platform=DB2/MVS;Defer Prepare=False;Rowset Cache Size=0;Persist Security Info=True;Connection Pooling=False;Derive Parameters=False;";
     //var ds = DB2Helper1.GetDataSet(CommandType.Text, txbSQL.Text);
     string    conn2   = "Database=gzgbnav;UserID=db2admin; Password=chainway-db2;Server=14.17.70.141:50000";
     string    conn4   = "Database=gbnav;UserID=db2admin; Password=chainway-db2@admin;Server=117.34.91.127:50000";
     string    conn3   = "Provider=IBMDADB2.DB2COPY1;Data Source=gbnav;Persist Security Info=True;User ID=db2admin;Password=chainway-db2;Location=192.168.10.51:50000;";
     IDBHelper _helper = DBFactory.CreateDBHelper(conn3, DBType.DB2);
     var       table   = _helper.GetTableWithSQL(txbSQL.Text);
     //DB2Connection connection = new DB2Connection(conn2);
     //DB2Command com = new DB2Command(txbSQL.Text);
     //com.Connection = connection;
     //connection.Open();
     //com.ExecuteNonQuery();
     //connection.Close();
 }
예제 #14
0
        /// <summary>
        /// 对某个字段汇总
        /// </summary>
        /// <param name="ColumnName">字段名</param>
        /// <param name="DBEx">数据库前缀</param>
        /// <returns></returns>
        public double GetSum(string ColumnName = null, string DBEx = null)
        {
            IDBHelper objHelper = DBFactory.CreateDBHelper();
            double    dblReturn = 0;

            if (!string.IsNullOrEmpty(ColumnName))
            {
                Parameter[] objParameters = null;
                string      strSQL        = GetSQL(DBEx, "getsum", ColumnName, out objParameters);
                DataTable   dtModel       = objHelper.GetTableWithSQL(strSQL, objParameters);
                if (dtModel != null && dtModel.Rows.Count > 0 && dtModel.Rows[0][0] != DBNull.Value)
                {
                    dblReturn = Convert.ToDouble(dtModel.Rows[0][0]);
                }
            }
            return(dblReturn);
        }
예제 #15
0
        /// <summary>
        /// 获得某个字段的最小值
        /// </summary>
        /// <param name="ColumnName">字段名</param>
        /// <param name="DBEx">数据库前缀</param>
        /// <returns></returns>
        public object GetMin(string ColumnName = null, string DBEx = null)
        {
            IDBHelper objHelper = DBFactory.CreateDBHelper();
            object    objReturn = null;

            if (!string.IsNullOrEmpty(ColumnName))
            {
                Parameter[] objParameters = null;
                string      strSQL        = GetSQL(DBEx, "getmin", ColumnName, out objParameters);
                DataTable   dtModel       = objHelper.GetTableWithSQL(strSQL);
                if (dtModel != null && dtModel.Rows.Count > 0 && dtModel.Rows[0][0] != DBNull.Value)
                {
                    objReturn = dtModel.Rows[0][0];
                }
            }
            return(objReturn);
        }
예제 #16
0
        protected override void Load(ContainerBuilder builder)
        {
            //注册app层
            builder.RegisterAssemblyTypes(typeof(AppUser).Assembly);
            builder.RegisterAssemblyTypes(typeof(AppUser).Assembly)
            .Where(t => typeof(ISingleton).IsAssignableFrom(t))
            .SingleInstance();

            builder.RegisterType <LogInfo>().AsSelf();
            builder.RegisterType <NLogManager>().As <ILogManager>().SingleInstance();

            builder.Register(c =>
            {
                return(DBFactory.CreateDBHelper("Default"));
            })
            .As <DBHelper>();
            //// .SingleInstance(); 由于事务的存在,DBHelper不能单例

            builder.RegisterGeneric(typeof(DBCrud <>));
            builder.RegisterType <MetaService>().As <IMetaService>().SingleInstance();
        }
예제 #17
0
        private ConsumeConcurrentlyStatus Producer_ConsumeMessage(object obj, ConsumeEventArgs args)
        {
            IDBHelper helper = DBFactory.CreateDBHelper();
            //存储队列
            var generator = IDGeneratorFactory.Create(GeneratorType.SnowFlak);

            foreach (var m in args.Messages)
            {
                try
                {
                    StringBuilder sql       = new StringBuilder();
                    string        ID        = generator.Generate();
                    string        body      = Encoding.UTF8.GetString(m.getBody());
                    string        tableName = m.getKeys();
                    string        tag       = m.getTags();

                    sql.Append("INSERT INTO MQCache([ID],[Key],[Tag],[Body],[CreateTime]) VALUES(@ID, @Key, @Tag, @Body, GETDATE())");
                    List <Parameter> parameters = new List <Parameter>
                    {
                        new Parameter("@ID", ID),
                        new Parameter("@Key", tableName),
                        new Parameter("@Tag", tag),
                        new Parameter("@Body", body),
                    };
                    lock (this)
                    {
                        helper.ExecNoneQueryWithSQL(sql.ToString(), parameters.ToArray());
                    }
                    _logger.Write("插入数据库成功,json:" + body);
                }
                catch (Exception ex)
                {
                    _logger.WriteException(ex);
                    throw ex;
                }
            }


            return(ConsumeConcurrentlyStatus.CONSUME_SUCCESS);
        }
예제 #18
0
        public bool IsExists(string Where = null, ORMParameter[] Parameters = null, string DBEx = null)
        {
            IDBHelper        objHelper        = DBFactory.CreateDBHelper();
            StringBuilder    sbSQL            = new StringBuilder();
            List <Parameter> lstDALParameters = new List <Parameter>();
            bool             blHasValue       = false;
            string           strTableName     = _dt_ClassDef.TableName;

            sbSQL.Append(" SELECT TOP 1 ");
            if (_dt_ClassDef != null)
            {
                sbSQL.Append(_dt_ClassDef.Columns[0].ColumnName);
            }
            else
            {
                sbSQL.Append(" * ");
            }
            sbSQL.Append(" FROM ");
            sbSQL.Append(_cad_TableDef.GetFullTableName(DBEx));
            sbSQL.Append(" WHERE ");
            if (!string.IsNullOrEmpty(Where))
            {
                sbSQL.Append("(" + Where + ")");
            }
            if (Parameters != null && string.IsNullOrEmpty(Where))
            {
                foreach (ORMParameter objParameter in Parameters)
                {
                    Parameter objDALParam = new Parameter(objParameter.Name, objParameter.Value);
                    lstDALParameters.Add(objDALParam);
                }
            }
            DataTable dtModel = objHelper.GetTableWithSQL(sbSQL.ToString(), lstDALParameters.ToArray());

            if (dtModel != null && dtModel.Rows.Count > 0)
            {
                blHasValue = true;
            }
            return(blHasValue);
        }
예제 #19
0
        private void button1_Click(object sender, EventArgs e)
        {
            var           path      = txbPath.Text;
            var           type      = txbType.Text;
            var           prefix    = txbPrefix.Text;
            var           version   = "1.0.0.0";
            DirectoryInfo directory = new DirectoryInfo(path);
            var           files     = directory.GetFiles("*.*", SearchOption.AllDirectories);
            IDBHelper     helper    = DBFactory.CreateDBHelper(DBType.Oracle);

            for (int i = 0; i < files.Length; i++)
            {
                var           file = files[i];
                var           name = file.FullName.Replace(path, "").TrimStart('\\').Replace("modules", "").TrimStart('\\');
                var           id   = string.Format("{0}_{1}", prefix, i);
                StringBuilder sql  = new StringBuilder();
                sql.Append("INSERT INTO TAB_FILEVERSION (FID,FILENAME,VERSION,LASTUPDATEDATE,SYSTYPE) VALUES(:FID,:FILENAME,:VERSION,:LASTUPDATETIME,:SYSTYPE)");
                List <Parameter> parameters = new List <Parameter>();
                parameters.Add(new Parameter {
                    Name = ":FID", Value = id
                });
                parameters.Add(new Parameter {
                    Name = ":FILENAME", Value = name
                });
                parameters.Add(new Parameter {
                    Name = ":VERSION", Value = version
                });
                parameters.Add(new Parameter {
                    Name = ":LASTUPDATETIME", Value = DateTime.Now
                });
                parameters.Add(new Parameter {
                    Name = ":SYSTYPE", Value = type
                });
                helper.ExecNoneQueryWithSQL(sql.ToString(), parameters.ToArray());
            }

            MessageBox.Show("上传完成");
        }
예제 #20
0
        public List <T> GetModelList(int PageIndex = -1, int PageSize = -1, string IDColumnName = null, string DBEx = null)
        {
            List <T>  lstReturn = null;
            IDBHelper objHelper = DBFactory.CreateDBHelper();

            Parameter[] objParameters = null;
            DataTable   dtModels      = null;
            int         intStartIndex = -1;
            int         intEndIndex   = -1;

            if (PageIndex > 0 && PageSize > 0)
            {
                intStartIndex = (PageIndex - 1) * PageSize;
                intEndIndex   = PageIndex * PageSize;
            }
            string strSQL = GetSQL(DBEx, "", "", out objParameters);

            dtModels = objHelper.GetTableWithSQL(strSQL, objParameters, intStartIndex, intEndIndex, IDColumnName);
            if (dtModels != null && dtModels.Rows.Count > 0)
            {
                lstReturn = AssignData(dtModels);
            }
            return(lstReturn);
        }
예제 #21
0
파일: Form1.cs 프로젝트: mazhufeng/DataSync
        private void btnInsert_Click(object sender, EventArgs e)
        {
            IDBHelper helper = DBFactory.CreateDBHelper("Database = SyncDemo; uid=admin; pwd=frank;Server=localhost", DBType.MSSQL2005P);
            //helper.AutoCloseConnection = false;
            SnowFlakGenerator g      = new SnowFlakGenerator(Thread.CurrentThread.ManagedThreadId);
            ISqlMapper        mapper = new InsertMapper(new DB2Convert());
            Stopwatch         watch  = new Stopwatch();

            watch.Start();
            for (int i = 0; i < 10000; i++)
            {
                Dictionary <string, object> t = new Dictionary <string, object>();
                t["ID"]   = g.Generate();
                t["Name"] = "hello world";
                t["Type"] = 3;

                var model = mapper.ObjectToSql(Chainway.Library.SimpleMapper.Common.GetTableName("201707", "dbo", t.GetType(), null, t), t, null);

                helper.ExecNoneQueryWithSQL(model.SQL, model.Parameters.ToArray());
            }
            watch.Stop();
            helper.CloseConnection();
            MessageBox.Show("time:" + watch.ElapsedMilliseconds.ToString());
        }
예제 #22
0
 public ConsumerManager(string groupName, string nameAddress, string topic, int port, bool enabledLog)
 {
     _helper = DBFactory.CreateDBHelper();
     _helper.AutoCloseConnection = false;
     _helper.Lockable            = true;
 }
예제 #23
0
파일: Form1.cs 프로젝트: mazhufeng/DataSync
        private void btnExec_Click(object sender, EventArgs e)
        {
            IDBHelper helper = DBFactory.CreateDBHelper("Database = Demo; uid=admin; pwd=frank;Server=localhost", DBType.MSSQL2005P);

            helper.ExecNoneQueryWithSQL(txbSQL.Text);
        }
예제 #24
0
 public UserMan() : base(DBFactory.CreateDBHelper("Default"))
 {
 }
예제 #25
0
 public AppDataTest()
 {
     Consts.IsTesting = true;
     _testServer      = new TestServer(WebHost.CreateDefaultBuilder().UseStartup(StartupType));
     _db = DBFactory.CreateDBHelper("Default");
 }
예제 #26
0
        static void Main(string[] args)
        {
            var h  = DBFactory.CreateDBHelper(@"Data Source=E:\git\memberManager\db\membermanager.db;Version=3;", DBType.SQLite);
            var tb = h.GetTableWithSQL("SELECT NAME FROM sqlite_master WHERE type='table'");

            #region id generator
            IIDGenerator  iDGenerator = IDGeneratorFactory.Create(GeneratorType.SnowFlak);
            List <string> idlist      = new List <string>();
            for (int i = 0; i < 10000; i++)
            {
                idlist.Add(iDGenerator.Generate());
            }

            #endregion

            TestClass tc = new TestClass
            {
                tc = new TestClass
                {
                    a  = "hello",
                    b  = "word",
                    tc = new TestClass
                    {
                        a = "deep",
                    }
                },
                test = new List <TestClass>
                {
                    new TestClass
                    {
                        a = "<",
                    }
                },
            };
            #region xml testing
            TestRequest req = new TestRequest
            {
                c = new TestClass
                {
                    a  = "a",
                    b  = "b",
                    d  = "d",
                    dt = DateTime.Now,
                }
            };
            ISerializable serial = new XmlSerializor();
            var           xml    = serial.Serialize(req);

            var obj = serial.Deserialize <TestRequest>(xml);

            Dictionary <string, object> arg = new Dictionary <string, object>();
            arg["a"] = "a";
            arg["b"] = 3;
            arg["c"] = req;
            xml      = serial.Serialize(arg);
            var dicobj = serial.Deserialize <Dictionary <string, object> >(xml);
            #endregion
            //string jsonstring = "{\"Buyers\":[{\"ID\":\"395f7ce8de8340eda2dfd22098c81290\",\"Name\":\"爱的色放\",\"CardType\":\"1\",\"IdentityCode\":\"4444444444\",\"Phone\":\"123123123123\",\"Gender\":\"1\",\"Marrage\":\"1\",\"Address\":\"啊都是法师打发而且额外人\",\"OrignalName\":\"\",\"OrignalIdentityCode\":\"\",\"BankCode\":\"\",\"BankType\":\"1\",\"WorkUnit\":\"\",\"Quotient\":\"222\"},{\"ID\":\"\",\"Name\":\"阿萨法 \",\"CardType\":\"1\",\"IdentityCode\":\"986799283948723984\",\"Phone\":\"123123\",\"Gender\":\"2\",\"Marrage\":\"1\",\"Address\":\"三个地方集团研究研究\",\"OrignalName\":\"\",\"OrignalIdentityCode\":\"\",\"BankCode\":\"\",\"BankType\":\"\",\"WorkUnit\":\"\",\"Quotient\":\"333\"},{\"ID\":\"712feaff6c034244ab3f066268b9fe5a\",\"Name\":\"阿斯顿飞\",\"CardType\":\"1\",\"IdentityCode\":\"12312312312323\",\"Phone\":\"123123123\",\"Gender\":\"1\",\"Marrage\":\"1\",\"Address\":\"嘎达嗦嘎多个地方十多个地方各个\",\"OrignalName\":\"\",\"OrignalIdentityCode\":\"\",\"BankCode\":\"\",\"BankType\":\"1\",\"WorkUnit\":\"\",\"Quotient\":\"222\"}],\"Sellers\":[{\"ID\":\"55b71c225dc841a7b99ead4cecc601c5\",\"Name\":\"aeeboo\",\"CardType\":\"1\",\"IdentityCode\":\"234234235235\",\"Phone\":\"324234234234\",\"Gender\":\"1\",\"Marrage\":\"2\",\"Address\":\"的方式购房合同和投入和\",\"OrignalName\":\"\",\"OrignalIdentityCode\":\"\",\"BankCode\":\"\",\"BankType\":\"2\",\"WorkUnit\":\"\",\"Quotient\":\"111\"},{\"ID\":\"\",\"Name\":\"阿萨德飞44\",\"CardType\":\"1\",\"IdentityCode\":\"237856234\",\"Phone\":\"34234234\",\"Gender\":\"1\",\"Marrage\":\"1\",\"Address\":\"然后统一集团研究与\",\"OrignalName\":\"\",\"OrignalIdentityCode\":\"\",\"BankCode\":\"\",\"BankType\":\"\",\"WorkUnit\":\"\",\"Quotient\":\"123\"}],\"Assets\":[{\"ID\":\"\",\"Code\":\"44444444\",\"Usage\":\"1\",\"Position\":\"2\",\"Address\":\"景田西路八个道路\",\"Area\":\"123\",\"RegPrice\":\"44232\"},{\"ID\":\"\",\"Code\":\"1412412132\",\"Usage\":\"1\",\"Position\":\"1\",\"Address\":\"水电费个人个人高\",\"Area\":\"234324\",\"RegPrice\":\"123123\"}],\"Project\":{\"Source\":\"1\",\"AgentName\":\"213213\",\"CertificateData\":\"2015-08-05\",\"AgentContact\":\"\",\"Rebater\":\"\",\"RebateAccount\":\"\",\"OtherRebateInfo\":\"\",\"OrignalMortgageBank\":\"1\",\"OrignalMortgageBranch\":\"阿斯顿发顺丰\",\"OrignalFundCenter\":\"1\",\"OrignalFundBranch\":\"\",\"SupplyCardCopy\":\"\",\"OrignalCreditPI\":\"123123\",\"OrignalCreditCommerceMoney\":\"123\",\"OrignalCreditFundMoney\":\"123\",\"AssetRansomCustomerManager\":\"124142\",\"AssetRansomContactPhone\":\"24124\",\"NewCreditBank\":\"1\",\"NewCreditBranch\":\"2r323\",\"ShortTermAssetRansomBank\":\"1\",\"ShortTermAssetRansomBranch\":\"\",\"GuaranteeMoney\":\"123\",\"GuaranteeMonth\":\"1231\",\"BuyerCreditCommerceMoney\":\"213\",\"BuyerCreditFundMoney\":\"2\",\"LoanMoney\":\"123123\",\"DealMoney\":\"123123\",\"EarnestMoney\":\"123123\",\"SupervisionMoney\":\"123123\",\"SupervisionBank\":\"12123\",\"AssetRansomMoney\":\"122323\",\"CustomerPredepositMoney\":\"323232\",\"CreditReceiverName\":\"23123\",\"CreditReceiverBank\":\"2323\",\"CreditReceiverAccount\":\"2323\",\"TrusteeshipAccount\":\"\",\"AssetRansomPredictMoney\":\"2323\",\"AssetRansomer\":\"232323\",\"AssetRansomType\":\"1\",\"PredictDays\":\"2323\",\"ChargeType\":\"1\",\"CheckNumbersAndLimit\":\"123123\",\"Stagnationer\":\"\"},\"token\":\"0cbbd08b6b694428a30afe52098e5f7a\"}";
            //var json = JsonHelper.Deserialize<AddProjectServiceForm>(jsonstring);
            #region domain
            //AppDomain.CurrentDomain.AssemblyLoad += CurrentDomain_AssemblyLoad;
            //AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve1;
            //AppDomainSetup info = new AppDomainSetup();
            //info.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory + "Modules";
            //AppDomain domain = AppDomain.CreateDomain("mydomain", null, info);
            //Console.WriteLine(domain.BaseDirectory);
            //var allass = domain.GetAssemblies();
            //var ass = domain.Load(new AssemblyName("Controller"));
            //allass = domain.GetAssemblies();
            //var type = ass.GetType("SOAFramework.Library.HttpServer");
            //var instance = Activator.CreateInstance(type, null);
            //var start = type.GetMethod("Start");
            //start.Invoke(instance, new object[] { new string[] { "http://10.1.50.195:8094/c" } });
            //domain.AssemblyLoad += Domain_AssemblyLoad;
            #endregion

            #region http server
            Console.WriteLine("begin");
            NodeServer nodeserver = new NodeServer("http://10.1.50.195:8094/");
            nodeserver.Start();
            Console.ReadLine();
            //nodeserver.Close();

            HttpServer server = new HttpServer(new string[] { "http://10.1.50.195:8094/a" });
            server.Executing += new HttpExecutingHandler((a, b) =>
            {
                StreamReader reder = new StreamReader(b.Request.InputStream, System.Text.Encoding.UTF8);
                string post        = reder.ReadToEnd();
                Console.WriteLine("key:" + post);
                return("");
            });
            server.Start();

            //HttpServer server2 = new HttpServer(new string[] { "http://10.1.50.195:8094/b" });
            //server2.Start();
            Console.ReadLine();

            string[] prefix = new string[] { "http://*****:*****@"http://localhost/Service/Execute/SOAFramework.Service.Server.DefaultService/DiscoverService", data);
            testresult = ZipHelper.UnZip(testresult);
            List <ServiceInfo>          serviceList   = JsonHelper.Deserialize <List <ServiceInfo> >(testresult);
            string                      path          = AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\') + @"\Templates\SDKRequest.cst";
            Dictionary <string, object> argsCodeSmith = new Dictionary <string, object>();
            argsCodeSmith["RequestNameSpace"] = "a.b.c";
            argsCodeSmith["ServiceInfo"]      = serviceList[0];
            string render = CodeSmithHelper.GenerateString(path, argsCodeSmith);

            string  fileName = AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\') + "\\SOAFramework.Library.CodeSmithConsole.exe ";
            Process p        = new Process();
            p.StartInfo.UseShellExecute        = false;
            p.StartInfo.FileName               = fileName;
            p.StartInfo.Arguments              = " " + path.Replace(@"\\", @"\" + " ") + " " + JsonHelper.Serialize(argsCodeSmith).Replace("\"", "\\\"") + " ";
            p.StartInfo.RedirectStandardInput  = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.Start();
            p.WaitForExit();
            return;

            #endregion

            #region razor
            //string strr = File.ReadAllText("Temp.txt");
            //Dictionary<string, object> dicargs = new Dictionary<string, object>();
            //dicargs["a"] = "22222";
            //string r = Razor.Parse(strr, dicargs);
            #endregion

            #region json tester
            //List<TestClass> list = new List<TestClass>();
            //for (int i = 0; i < 10; i++)
            //{
            //    TestClass c = new TestClass
            //    {
            //        a = "a" + i.ToString(),
            //        b = "b" + i.ToString(),
            //        dic = new Dictionary<string, string>(),
            //    };
            //    c.dic["dic1"] = "dic1" + i.ToString();
            //    c.dic["dic2"] = "dic2" + i.ToString();
            //    c.dic["dic3"] = "dic3" + i.ToString();
            //    c.test = new List<TestClass>();
            //    c.test.Add(new TestClass { a = "aa" + i.ToString(), b = "bb" + i.ToString() });
            //    c.test.Add(new TestClass { a = "cc" + i.ToString(), b = "dd" + i.ToString() });
            //    list.Add(c);
            //}
            //watch.Start();
            //string strjson = JsonHelper.Serialize(list, false);
            //watch.Stop();
            //Console.WriteLine("序列化:{0}", watch.ElapsedMilliseconds);
            //watch.Reset();
            //watch.Start();
            //List<TestClass> list1 = JsonHelper.Deserialize<List<TestClass>>(strjson);
            //watch.Stop();
            //Console.WriteLine("反序列化:{0}", watch.ElapsedMilliseconds);
            //TestResponse re = JsonHelper.Deserialize<TestResponse>("{\"IsError\":false,\"Data\":[{\"InterfaceName\":\"SOAFramework.Service.Server.DefaultService.DiscoverService\"}]}");
            #endregion

            #region custom wcf binding
            //string baseAddress = "Http://localhost/Service";
            //ServiceHost host = new WebServiceHost(typeof(SOAService), new Uri(baseAddress));
            //host.AddServiceEndpoint(typeof(IService), new BasicHttpBinding(), "soap");
            //WebHttpBinding webBinding = new WebHttpBinding();
            //webBinding.ContentTypeMapper = new MyRawMapper();
            //host.AddServiceEndpoint(typeof(IService), webBinding, "json").Behaviors.Add(new NewtonsoftJsonBehavior());
            //Console.WriteLine("Opening the host");
            //host.Open();

            //ChannelFactory<IService> factory = new ChannelFactory<IService>(new BasicHttpBinding(), new EndpointAddress(baseAddress + "/soap"));
            //IService proxy = factory.CreateChannel();
            //byte[] newdata;
            //TestClass c1 = new TestClass();
            //c1.a = "a";
            //List<TestClass> list1 = new List<TestClass>();
            //list1.Add(c1);
            //string strnewdata = JsonHelper.Serialize(list1);
            //newdata = Encoding.UTF8.GetBytes(strnewdata);
            //string newtestresult = HttpHelper.Post(@"http://localhost/Service/SOAFramework.Service.Server.DefaultService/DiscoverService", newdata);

            //Console.WriteLine("Now using the client formatter");
            //ChannelFactory<IService> newFactory = new ChannelFactory<IService>(webBinding, new EndpointAddress(baseAddress + "/json"));
            //newFactory.Endpoint.Behaviors.Add(new NewtonsoftJsonBehavior());
            //IService newProxy = newFactory.CreateChannel();

            //Console.WriteLine("Press ENTER to close");
            //Console.ReadLine();
            //host.Close();
            //Console.WriteLine("Host closed");
            #endregion

            #region wcf host
            WebServiceHost newhost = new WebServiceHost(typeof(SOAService));
            newhost.Open();
            newhost.Ping();
            #endregion

            #region zip tester
            string zip    = "i am a string, to be zipped!";
            string zipped = ZipHelper.Zip(zip, System.Text.Encoding.Default);
            zip = ZipHelper.UnZip(zipped);
            #endregion

            #region orm
            //string abc = Model.Users.Mapping.ColumnsMapping["PK_UserID"].ToString();
            //a c = new a();
            //c.b = "haha ";
            //c.t = new a();
            //c.t.b = "aaaaaa";
            //string str1 = JsonHelper.Serialize(c);

            //c = JsonHelper.Deserialize<a>(str1);

            //FTPClient f = new FTPClient();
            //f.FtpUrl = "ftp://localhost/";
            //f.FileName = "ha.txt";
            //f.UserName = "******";
            //f.Password = "******";
            //f.BufferSize = 10;
            //f.LocalFilePath = "e:";
            //f.Download();

            //sw.Stop();
            //Console.WriteLine("linq:" + sw.ElapsedTicks);
            //Model.Users objUser = new Model.Users();
            //Hashtable htArgs = new Hashtable();
            //htArgs["str"] = "ok";
            //WebServiceCaller wsCaller = new WebServiceCaller();
            //wsCaller.Action = "PostTest";
            //wsCaller.Args = htArgs;
            //wsCaller.Action = "GetTest";
            //wsCaller.WSUrl = @"http://*****:*****@"F:\TestOut.docx";
            //List<MethodArg> lstArg = new List<MethodArg>();
            //lstArg.Add(new MethodArg("there"));
            //cr.RequestData.MethodArgs = lstArg.ToArray();
            //cr.RequestType = WSDataType.JSON;
            //string str = cr.GetRequestString();
            //cr.ResponseType = WSDataType.JSON;
            //string strReturn = cr.SendRequest();
            //ServerResponse response = cr.GetResponse();
            //byte[] bytTemp = response.ResponseData;
            //Stream sw = File.Open(strFileName, FileMode.OpenOrCreate, FileAccess.Write);
            //sw.Write(bytTemp, 0, bytTemp.Length);
            //sw.Close();

            //Model.Users u = new Model.Users();
            //Model.Customer_AutoIncrease t = new Model.Customer_AutoIncrease();
            #endregion

            #region soa tester

            //testresult = HttpUtility.Get("http://localhost/Service/GetTest");

            argslist.Add(new SOAFramework.Service.SDK.Core.PostArgItem {
                Key = "url", Value = "http://localhost/"
            });
            //argslist.Add(new PostArgItem { Key = "usage", Value = "1.00" });
            strData = JsonHelper.Serialize("http://localhost/");
            //strData = "\"" + strData + "\"";
            data       = System.Text.Encoding.UTF8.GetBytes(strData);
            testresult = HttpHelper.Post(@"http://*****:*****@"http://localhost/Service/Execute/SOAFramework.Service.Server.DefaultService/DiscoverService", data);
            testresult = ZipHelper.UnZip(testresult);
            watch.Stop();
            Console.WriteLine("发现服务测试耗时{0}", watch.ElapsedMilliseconds);


            watch.Restart();
            argslist.Clear();
            strData    = JsonHelper.Serialize(argslist);
            data       = System.Text.Encoding.UTF8.GetBytes(strData);
            testresult = HttpHelper.Post(@"http://localhost/Service/Execute/SOAFramework.Service.Server.DefaultService/BigDataTest", data);
            watch.Stop();
            Console.WriteLine("大数据测试耗时{0}", watch.ElapsedMilliseconds);

            watch.Restart();
            //download test
            string filename = "预付款类型批量导入.xls";
            testresult = HttpHelper.Get(@"http://localhost/Service/Download/" + filename);
            //testresult = ZipHelper.UnZip(testresult);
            testresult.ToFile("D:\\" + filename);
            watch.Stop();
            Console.WriteLine("下载测试耗时{0}", watch.ElapsedMilliseconds);

            watch.Restart();
            //uploadtest
            string   uploadFileName = "D:\\预付款类型批量导入.xls";
            FileInfo file           = new FileInfo(uploadFileName);
            string   fileString     = file.FileToString();
            data       = System.Text.Encoding.UTF8.GetBytes(fileString);
            testresult = HttpHelper.Post(@"http://localhost/Service/Upload/" + file.Name, data);
            watch.Stop();
            Console.WriteLine("上传测试耗时{0}", watch.ElapsedMilliseconds);

            watch.Restart();
            int count = 10000;
            //for (int i = 0; i < count; i++)
            //{
            //    List<SOAFramework.Service.SDK.Core.PostArgItem> list = new List<SOAFramework.Service.SDK.Core.PostArgItem>();
            //    list.Add(new SOAFramework.Service.SDK.Core.PostArgItem { Key = "a", Value = JsonHelper.Serialize("hello world") });
            //    list.Add(new SOAFramework.Service.SDK.Core.PostArgItem { Key = "b", Value = JsonHelper.Serialize(new TestClass { a = "a", b = "b" }) });
            //    //list.Add(new PostArgItem { Key = "a", Value = "hello world" });
            //    //list.Add(new PostArgItem { Key = "b", Value = new TestClass { a = "a", b = "b" } });
            //    strData = JsonHelper.Serialize(list);
            //    data = System.Text.Encoding.UTF8.GetBytes(strData);
            //    //testresult = HttpHelper.Post(@"http://localhost/Service/Execute/SOAFramework.Service.Server.SOAService/Test", data);
            //    testresult = ZipHelper.UnZip(testresult);

            //    PerformanceRequest prequest = new PerformanceRequest();
            //    prequest.a = "hello world";
            //    prequest.b = new TestClass { a = "a", b = "b" };
            //    PerformanceResponse presponse = SDKFactory.Client.Execute(prequest);
            //}
            watch.Stop();
            Console.WriteLine("{1}次测试耗时{0}", watch.ElapsedMilliseconds, count);
            #endregion

            #region sdk testing
            //TestRequest request = new TestRequest();
            //TestResponse reseponse = SDKFactory.Client.Execute(request);
            #endregion

            Console.ReadLine();
        }
예제 #27
0
        public bool Update(string Where = null, ORMParameter[] Parameters = null, Transaction Transaction = null)
        {
            bool          blResult  = true;
            StringBuilder sbSQL     = new StringBuilder();
            IDBHelper     objHelper = null;

            if (null != Transaction && null != Transaction.DBHelper)
            {
                objHelper = Transaction.DBHelper;
            }
            else
            {
                objHelper = DBFactory.CreateDBHelper();
            }
            DataTable dtProperties = Reflection.GetClassValues(this, _dt_ClassDef);

            if (dtProperties != null && dtProperties.Columns.Count > 0 && dtProperties.Rows.Count > 0)
            {
                DataRow drProperty = dtProperties.Rows[0];
                sbSQL.Append(" UPDATE ");
                sbSQL.Append(_cad_TableDef.GetFullTableName(DBExString));
                sbSQL.Append(" SET ");
                for (int i = 0, x = 0; i < _dt_ClassDef.Columns.Count; i++)
                {
                    if (x == 0)
                    {
                        if (drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value && _dt_ClassDef.Rows[0][i].ToString() == "0")
                        {
                            sbSQL.Append(_dt_ClassDef.Columns[i].ColumnName + "=@" + _dt_ClassDef.Columns[i].ColumnName);
                            x++;
                        }
                    }
                    else
                    {
                        if (drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value && _dt_ClassDef.Rows[0][i].ToString() == "0")
                        {
                            sbSQL.Append("," + _dt_ClassDef.Columns[i].ColumnName + "=@" + _dt_ClassDef.Columns[i].ColumnName);
                            x++;
                        }
                    }
                }
                sbSQL.Append(" WHERE ");
                if (!string.IsNullOrEmpty(Where))
                {
                    sbSQL.Append((" " + Where.ToLower()).Replace(" where ", ""));//È¥µôÀïÃæµÄwhere
                }
                else
                {
                    for (int i = 0, x = 0; i < _dt_ClassDef.Columns.Count; i++)
                    {
                        if (_dt_ClassDef.Rows[0][i].ToString() == "1")
                        {
                            if (x == 0)
                            {
                                if (drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value)
                                {
                                    sbSQL.Append(_dt_ClassDef.Columns[i].ColumnName + "=@" + _dt_ClassDef.Columns[i].ColumnName + "");
                                    x++;
                                }
                            }
                            else
                            {
                                if (drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value)
                                {
                                    sbSQL.Append(" AND " + _dt_ClassDef.Columns[i].ColumnName + "=@" + _dt_ClassDef.Columns[i].ColumnName + "");
                                    x++;
                                }
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(sbSQL.ToString()))
            {
                List <Parameter> lstParameter = new List <Parameter>();
                if (dtProperties != null && dtProperties.Rows.Count > 0 && dtProperties.Columns.Count > 0)
                {
                    for (int i = 0; i < dtProperties.Columns.Count; i++)
                    {
                        Parameter objParameter = new Parameter();
                        objParameter.Name  = "@" + dtProperties.Columns[i].ColumnName;
                        objParameter.Value = dtProperties.Rows[0][i];
                        lstParameter.Add(objParameter);
                    }
                }
                lstParameter.AddRange(ORMParameter.ToDALParameter(Parameters));
                objHelper.ExecNoneQueryWithSQL(sbSQL.ToString(), lstParameter.ToArray());
            }
            return(blResult);
        }
예제 #28
0
파일: Form1.cs 프로젝트: mazhufeng/DataSync
 private void btndb2_Click(object sender, EventArgs e)
 {
     IDBHelper helper = DBFactory.CreateDBHelper();
     var       table  = helper.GetTableWithSQL(txbSQL.Text);
 }
예제 #29
0
 public Transaction(DBType DBType)
 {
     _iHelper = DBFactory.CreateDBHelper(DBType);
 }
예제 #30
0
        /// <summary>
        /// 保存数据,自动判断是新增还是更新
        /// </summary>
        /// <returns>主键ID,主键必须要整型</returns>
        public object Save(Transaction Transaction = null)
        {
            StringBuilder sbSQL         = new StringBuilder();
            StringBuilder sbSQL_Value   = new StringBuilder();
            StringBuilder sbSQL_Columns = new StringBuilder();
            IDBHelper     objHelper     = null;

            if (null != Transaction && null != Transaction.DBHelper)
            {
                objHelper = Transaction.DBHelper;
            }
            else
            {
                objHelper = DBFactory.CreateDBHelper();
            }
            DataTable dtProperties = Reflection.GetClassValues(this, _dt_ClassDef);
            object    objReturn    = null;

            if (_bl_IsNew)
            {
                if (dtProperties != null && dtProperties.Columns.Count > 0 && dtProperties.Rows.Count > 0)
                {
                    DataRow drProperty = dtProperties.Rows[0];
                    sbSQL.Append(" INSERT INTO ");
                    sbSQL.Append(_cad_TableDef.GetFullTableName(DBExString));
                    sbSQL.Append("(");
                    int x = 0;
                    for (int i = 0; i < _dt_ClassDef.Columns.Count; i++)
                    {
                        if ((drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value && !Convert.ToBoolean(_dt_ClassDef.Rows[3][i]) &&
                             null != _dt_ValueCopy &&
                             !drProperty[_dt_ClassDef.Columns[i].ColumnName].Equals(_dt_ValueCopy.Rows[0][_dt_ClassDef.Columns[i].ColumnName])) ||
                            (drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value && !Convert.ToBoolean(_dt_ClassDef.Rows[3][i]) &&
                             null == _dt_ValueCopy))
                        {
                            if (x == 0)
                            {
                                sbSQL_Columns.Append("[");
                                sbSQL_Columns.Append(_dt_ClassDef.Columns[i].ColumnName);
                                sbSQL_Columns.Append("]");

                                sbSQL_Value.Append("@");
                                sbSQL_Value.Append(_dt_ClassDef.Columns[i].ColumnName);
                                x++;
                            }
                            else
                            {
                                sbSQL_Columns.Append(",[");
                                sbSQL_Columns.Append(_dt_ClassDef.Columns[i].ColumnName);
                                sbSQL_Columns.Append("]");

                                sbSQL_Value.Append(",@");
                                sbSQL_Value.Append(_dt_ClassDef.Columns[i].ColumnName);
                                x++;
                            }
                        }
                    }
                    if (0 == x)//x=0说明没有赋值便进行保存
                    {
                        return(-1);
                    }
                    sbSQL.Append(sbSQL_Columns.ToString());
                    sbSQL.Append(") VALUES(");
                    sbSQL.Append(sbSQL_Value.ToString());
                    sbSQL.Append(")");
                }
            }
            else
            {
                if (dtProperties != null && dtProperties.Columns.Count > 0 && dtProperties.Rows.Count > 0)
                {
                    DataRow drProperty = dtProperties.Rows[0];
                    sbSQL.Append(" UPDATE ");
                    sbSQL.Append(_cad_TableDef.GetFullTableName(DBExString));
                    sbSQL.Append(" SET ");
                    int x = 0;
                    for (int i = 0; i < _dt_ClassDef.Columns.Count; i++)
                    {
                        if (x == 0)
                        {
                            if ((_dt_ClassDef.Rows[0][i].ToString() == "0" && drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value &&
                                 null != _dt_ValueCopy &&
                                 !drProperty[_dt_ClassDef.Columns[i].ColumnName].Equals(_dt_ValueCopy.Rows[0][_dt_ClassDef.Columns[i].ColumnName])) ||
                                (_dt_ClassDef.Rows[0][i].ToString() == "0" && drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value &&
                                 null == _dt_ValueCopy))
                            {
                                sbSQL.Append("[");
                                sbSQL.Append(_dt_ClassDef.Columns[i].ColumnName);
                                sbSQL.Append("]");
                                sbSQL.Append("=");
                                sbSQL.Append("@");
                                sbSQL.Append(_dt_ClassDef.Columns[i].ColumnName);
                                x++;
                            }
                        }
                        else
                        {
                            if ((_dt_ClassDef.Rows[0][i].ToString() == "0" && drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value &&
                                 null != _dt_ValueCopy &&
                                 !drProperty[_dt_ClassDef.Columns[i].ColumnName].Equals(_dt_ValueCopy.Rows[0][_dt_ClassDef.Columns[i].ColumnName])) ||
                                (_dt_ClassDef.Rows[0][i].ToString() == "0" && drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value &&
                                 null == _dt_ValueCopy))
                            {
                                sbSQL.Append(", [");
                                sbSQL.Append(_dt_ClassDef.Columns[i].ColumnName);
                                sbSQL.Append("]");
                                sbSQL.Append("=");
                                sbSQL.Append("@");
                                sbSQL.Append(_dt_ClassDef.Columns[i].ColumnName);
                                x++;
                            }
                        }
                    }
                    if (0 == x)//x=0说明没有赋新值便进行保存
                    {
                        return(-1);
                    }
                    sbSQL.Append(" WHERE ");
                    for (int i = 0, y = 0; i < _dt_ClassDef.Columns.Count; i++)
                    {
                        if (_dt_ClassDef.Rows[0][i].ToString() == "1")
                        {
                            if (y == 0)
                            {
                                if (drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value)
                                {
                                    sbSQL.Append("[");
                                    sbSQL.Append(_dt_ClassDef.Columns[i].ColumnName);
                                    sbSQL.Append("=@");
                                    sbSQL.Append(_dt_ClassDef.Columns[i].ColumnName);
                                    objReturn = drProperty[_dt_ClassDef.Columns[i].ColumnName];
                                    y++;
                                }
                            }
                            else
                            {
                                if (drProperty[_dt_ClassDef.Columns[i].ColumnName] != DBNull.Value)
                                {
                                    sbSQL.Append(" AND ");
                                    sbSQL.Append("[");
                                    sbSQL.Append(_dt_ClassDef.Columns[i].ColumnName);
                                    sbSQL.Append("]=@");
                                    sbSQL.Append(_dt_ClassDef.Columns[i].ColumnName);
                                    y++;
                                }
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(sbSQL.ToString()))
            {
                Parameter[] objParameters = null;
                if (dtProperties != null && dtProperties.Rows.Count > 0 && dtProperties.Columns.Count > 0)
                {
                    objParameters = new Parameter[dtProperties.Columns.Count];
                    for (int i = 0; i < dtProperties.Columns.Count; i++)
                    {
                        objParameters[i]       = new Parameter();
                        objParameters[i].Name  = "@" + dtProperties.Columns[i].ColumnName;
                        objParameters[i].Value = dtProperties.Rows[0][i];
                    }
                }
                DataTable dtReturn = objHelper.GetTableWithSQL(sbSQL.ToString(), objParameters);
                if (null != dtReturn && dtReturn.Rows.Count > 0)
                {
                    objReturn = Convert.ToInt32(dtReturn.Rows[0][0]);
                }
            }
            //更新完以后复制一份数据以用来接下来的更新或者保存方面的比较
            this.CopyValue();
            return(objReturn);
        }