Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ECommerce.Admin.Model.BenchmarkCriteria model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BenchmarkCriteria set ");
            strSql.Append("ComID=@ComID,");
            strSql.Append("UId=@UId,");
            strSql.Append("Country_Regions=@Country_Regions,");
            strSql.Append("EMP1=@EMP1,");
            strSql.Append("EMP2=@EMP2,");
            strSql.Append("TURN1=@TURN1,");
            strSql.Append("TURN2=@TURN2,");
            strSql.Append("INDUSTRY=@INDUSTRY,");
            strSql.Append("List1=@List1,");
            strSql.Append("List2=@List2,");
            strSql.Append("SicCode=@SicCode,");
            strSql.Append("SelectedSicCodes=@SelectedSicCodes,");
            strSql.Append("PROBE_SIC=@PROBE_SIC,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("UpdateDate=@UpdateDate");
            strSql.Append(" where ID=@ID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ID", DbType.Int32, model.ID);
            db.AddInParameter(dbCommand, "ComID", DbType.String, model.ComID);
            db.AddInParameter(dbCommand, "UId", DbType.Int32, model.UId);
            db.AddInParameter(dbCommand, "Country_Regions", DbType.AnsiString, model.Country_Regions);
            db.AddInParameter(dbCommand, "EMP1", DbType.String, model.EMP1);
            db.AddInParameter(dbCommand, "EMP2", DbType.String, model.EMP2);
            db.AddInParameter(dbCommand, "TURN1", DbType.String, model.TURN1);
            db.AddInParameter(dbCommand, "TURN2", DbType.String, model.TURN2);
            db.AddInParameter(dbCommand, "INDUSTRY", DbType.AnsiString, model.INDUSTRY);
            db.AddInParameter(dbCommand, "List1", DbType.String, model.List1);
            db.AddInParameter(dbCommand, "List2", DbType.String, model.List2);
            db.AddInParameter(dbCommand, "SicCode", DbType.AnsiString, model.SicCode);
            db.AddInParameter(dbCommand, "SelectedSicCodes", DbType.AnsiString, model.SelectedSicCodes);
            db.AddInParameter(dbCommand, "PROBE_SIC", DbType.String, model.PROBE_SIC);
            db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, model.CreateDate);
            db.AddInParameter(dbCommand, "UpdateDate", DbType.DateTime, model.UpdateDate);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ECommerce.Admin.Model.BenchmarkCriteria GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,ComID,UId,Country_Regions,EMP1,EMP2,TURN1,TURN2,INDUSTRY,List1,List2,SicCode,SelectedSicCodes,PROBE_SIC,CreateDate,UpdateDate from BenchmarkCriteria ");
            strSql.Append(" where ID=@ID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ID", DbType.Int32, ID);
            ECommerce.Admin.Model.BenchmarkCriteria model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
Example #3
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public ECommerce.Admin.Model.BenchmarkCriteria ReaderBind(IDataReader dataReader)
        {
            ECommerce.Admin.Model.BenchmarkCriteria model = new ECommerce.Admin.Model.BenchmarkCriteria();
            object ojb;

            ojb = dataReader["ID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ID = Convert.ToInt32(ojb);
            }
            model.ComID = dataReader["ComID"].ToString();
            ojb         = dataReader["UId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UId = Convert.ToInt32(ojb);
            }
            model.Country_Regions  = dataReader["Country_Regions"].ToString();
            model.EMP1             = dataReader["EMP1"].ToString();
            model.EMP2             = dataReader["EMP2"].ToString();
            model.TURN1            = dataReader["TURN1"].ToString();
            model.TURN2            = dataReader["TURN2"].ToString();
            model.INDUSTRY         = dataReader["INDUSTRY"].ToString();
            model.List1            = dataReader["List1"].ToString();
            model.List2            = dataReader["List2"].ToString();
            model.SicCode          = dataReader["SicCode"].ToString();
            model.SelectedSicCodes = dataReader["SelectedSicCodes"].ToString();
            model.PROBE_SIC        = dataReader["PROBE_SIC"].ToString();
            ojb = dataReader["CreateDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CreateDate = Convert.ToDateTime(ojb);
            }
            ojb = dataReader["UpdateDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UpdateDate = Convert.ToDateTime(ojb);
            }
            return(model);
        }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ECommerce.Admin.Model.BenchmarkCriteria model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BenchmarkCriteria(");
            strSql.Append("ComID,UId,Country_Regions,EMP1,EMP2,TURN1,TURN2,INDUSTRY,List1,List2,SicCode,SelectedSicCodes,PROBE_SIC,CreateDate,UpdateDate)");

            strSql.Append(" values (");
            strSql.Append("@ComID,@UId,@Country_Regions,@EMP1,@EMP2,@TURN1,@TURN2,@INDUSTRY,@List1,@List2,@SicCode,@SelectedSicCodes,@PROBE_SIC,@CreateDate,@UpdateDate)");
            strSql.Append(";select @@IDENTITY");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ComID", DbType.String, model.ComID);
            db.AddInParameter(dbCommand, "UId", DbType.Int32, model.UId);
            db.AddInParameter(dbCommand, "Country_Regions", DbType.AnsiString, model.Country_Regions);
            db.AddInParameter(dbCommand, "EMP1", DbType.String, model.EMP1);
            db.AddInParameter(dbCommand, "EMP2", DbType.String, model.EMP2);
            db.AddInParameter(dbCommand, "TURN1", DbType.String, model.TURN1);
            db.AddInParameter(dbCommand, "TURN2", DbType.String, model.TURN2);
            db.AddInParameter(dbCommand, "INDUSTRY", DbType.AnsiString, model.INDUSTRY);
            db.AddInParameter(dbCommand, "List1", DbType.String, model.List1);
            db.AddInParameter(dbCommand, "List2", DbType.String, model.List2);
            db.AddInParameter(dbCommand, "SicCode", DbType.AnsiString, model.SicCode);
            db.AddInParameter(dbCommand, "SelectedSicCodes", DbType.AnsiString, model.SelectedSicCodes);
            db.AddInParameter(dbCommand, "PROBE_SIC", DbType.String, model.PROBE_SIC);
            db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, model.CreateDate);
            db.AddInParameter(dbCommand, "UpdateDate", DbType.DateTime, model.UpdateDate);
            int    result;
            object obj = db.ExecuteScalar(dbCommand);

            if (!int.TryParse(obj.ToString(), out result))
            {
                return(0);
            }
            return(result);
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ECommerce.Admin.Model.BenchmarkCriteria DataRowToModel(DataRow row)
 {
     ECommerce.Admin.Model.BenchmarkCriteria model=new ECommerce.Admin.Model.BenchmarkCriteria();
     if (row != null)
     {
         if(row["ID"]!=null && row["ID"].ToString()!="")
         {
             model.ID=Convert.ToInt32(row["ID"].ToString());
         }
         if(row["ComID"]!=null)
         {
             model.ComID=row["ComID"].ToString();
         }
         if(row["UId"]!=null && row["UId"].ToString()!="")
         {
             model.UId=Convert.ToInt32(row["UId"].ToString());
         }
         if(row["Country_Regions"]!=null)
         {
             model.Country_Regions=row["Country_Regions"].ToString();
         }
         if(row["EMP1"]!=null)
         {
             model.EMP1=row["EMP1"].ToString();
         }
         if(row["EMP2"]!=null)
         {
             model.EMP2=row["EMP2"].ToString();
         }
         if(row["TURN1"]!=null)
         {
             model.TURN1=row["TURN1"].ToString();
         }
         if(row["TURN2"]!=null)
         {
             model.TURN2=row["TURN2"].ToString();
         }
         if(row["INDUSTRY"]!=null)
         {
             model.INDUSTRY=row["INDUSTRY"].ToString();
         }
         if(row["List1"]!=null)
         {
             model.List1=row["List1"].ToString();
         }
         if(row["List2"]!=null)
         {
             model.List2=row["List2"].ToString();
         }
         if(row["SicCode"]!=null)
         {
             model.SicCode=row["SicCode"].ToString();
         }
         if(row["SelectedSicCodes"]!=null)
         {
             model.SelectedSicCodes=row["SelectedSicCodes"].ToString();
         }
         if(row["PROBE_SIC"]!=null)
         {
             model.PROBE_SIC=row["PROBE_SIC"].ToString();
         }
         if(row["CreateDate"]!=null && row["CreateDate"].ToString()!="")
         {
             model.CreateDate=Convert.ToDateTime(row["CreateDate"].ToString());
         }
         if(row["UpdateDate"]!=null && row["UpdateDate"].ToString()!="")
         {
             model.UpdateDate=Convert.ToDateTime(row["UpdateDate"].ToString());
         }
     }
     return model;
 }
 /// <summary>
 /// 对象实体绑定数据
 /// </summary>
 public ECommerce.Admin.Model.BenchmarkCriteria ReaderBind(IDataReader dataReader)
 {
     ECommerce.Admin.Model.BenchmarkCriteria model=new ECommerce.Admin.Model.BenchmarkCriteria();
     object ojb;
     ojb = dataReader["ID"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.ID=Convert.ToInt32(ojb);
     }
     model.ComID=dataReader["ComID"].ToString();
     ojb = dataReader["UId"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.UId=Convert.ToInt32(ojb);
     }
     model.Country_Regions=dataReader["Country_Regions"].ToString();
     model.EMP1=dataReader["EMP1"].ToString();
     model.EMP2=dataReader["EMP2"].ToString();
     model.TURN1=dataReader["TURN1"].ToString();
     model.TURN2=dataReader["TURN2"].ToString();
     model.INDUSTRY=dataReader["INDUSTRY"].ToString();
     model.List1=dataReader["List1"].ToString();
     model.List2=dataReader["List2"].ToString();
     model.SicCode=dataReader["SicCode"].ToString();
     model.SelectedSicCodes=dataReader["SelectedSicCodes"].ToString();
     model.PROBE_SIC=dataReader["PROBE_SIC"].ToString();
     ojb = dataReader["CreateDate"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.CreateDate=Convert.ToDateTime(ojb);
     }
     ojb = dataReader["UpdateDate"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.UpdateDate=Convert.ToDateTime(ojb);
     }
     return model;
 }
Example #7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ECommerce.Admin.Model.BenchmarkCriteria DataRowToModel(DataRow row)
 {
     ECommerce.Admin.Model.BenchmarkCriteria model = new ECommerce.Admin.Model.BenchmarkCriteria();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = Convert.ToInt32(row["ID"].ToString());
         }
         if (row["ComID"] != null)
         {
             model.ComID = row["ComID"].ToString();
         }
         if (row["UId"] != null && row["UId"].ToString() != "")
         {
             model.UId = Convert.ToInt32(row["UId"].ToString());
         }
         if (row["Country_Regions"] != null)
         {
             model.Country_Regions = row["Country_Regions"].ToString();
         }
         if (row["EMP1"] != null)
         {
             model.EMP1 = row["EMP1"].ToString();
         }
         if (row["EMP2"] != null)
         {
             model.EMP2 = row["EMP2"].ToString();
         }
         if (row["TURN1"] != null)
         {
             model.TURN1 = row["TURN1"].ToString();
         }
         if (row["TURN2"] != null)
         {
             model.TURN2 = row["TURN2"].ToString();
         }
         if (row["INDUSTRY"] != null)
         {
             model.INDUSTRY = row["INDUSTRY"].ToString();
         }
         if (row["List1"] != null)
         {
             model.List1 = row["List1"].ToString();
         }
         if (row["List2"] != null)
         {
             model.List2 = row["List2"].ToString();
         }
         if (row["SicCode"] != null)
         {
             model.SicCode = row["SicCode"].ToString();
         }
         if (row["SelectedSicCodes"] != null)
         {
             model.SelectedSicCodes = row["SelectedSicCodes"].ToString();
         }
         if (row["PROBE_SIC"] != null)
         {
             model.PROBE_SIC = row["PROBE_SIC"].ToString();
         }
         if (row["CreateDate"] != null && row["CreateDate"].ToString() != "")
         {
             model.CreateDate = Convert.ToDateTime(row["CreateDate"].ToString());
         }
         if (row["UpdateDate"] != null && row["UpdateDate"].ToString() != "")
         {
             model.UpdateDate = Convert.ToDateTime(row["UpdateDate"].ToString());
         }
     }
     return(model);
 }