Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.SYS_UserForConsultant model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SYS_UserForConsultant set ");
            strSql.Append("Adn_Id=@Adn_Id,");
            strSql.Append("Adn_ConId=@Adn_ConId");
            strSql.Append(" where CON_Id=@CON_Id ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "UFR_Id", DbType.Int32, model.Con_Id);
            db.AddInParameter(dbCommand, "Adn_Id", DbType.Int32, model.Adn_Id);
            db.AddInParameter(dbCommand, "Adn_ConId", DbType.Int32, model.Adn_ConId);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.SYS_UserForConsultant DataRowToModel(DataRow row)
 {
     Model.SYS_UserForConsultant model = new Model.SYS_UserForConsultant();
     if (row != null)
     {
         if (row["Con_Id"] != null && row["Con_Id"].ToString() != "")
         {
             model.Con_Id = int.Parse(row["Con_Id"].ToString());
         }
         if (row["Adn_Id"] != null && row["Adn_Id"].ToString() != "")
         {
             model.Adn_Id = int.Parse(row["Adn_Id"].ToString());
         }
         if (row["Adn_ConId"] != null && row["Adn_ConId"].ToString() != "")
         {
             model.Adn_ConId = int.Parse(row["Adn_ConId"].ToString());
         }
     }
     return(model);
 }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.SYS_UserForConsultant GetModel(int Con_Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Con_Id,Adn_Id,Adn_ConId from SYS_UserForConsultant ");
            strSql.Append(" where Con_Id=@Con_Id ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "Con_Id", DbType.Int32, Con_Id);
            Model.SYS_UserForConsultant model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.SYS_UserForConsultant DataRowToModel(DataRow row)
 {
     Model.SYS_UserForConsultant model = new Model.SYS_UserForConsultant();
     if (row != null)
     {
         if (row["Con_Id"] != null && row["Con_Id"].ToString() != "")
         {
             model.Con_Id = int.Parse(row["Con_Id"].ToString());
         }
         if (row["Adn_Id"] != null && row["Adn_Id"].ToString() != "")
         {
             model.Adn_Id = int.Parse(row["Adn_Id"].ToString());
         }
         if (row["Adn_ConId"] != null && row["Adn_ConId"].ToString() != "")
         {
             model.Adn_ConId = int.Parse(row["Adn_ConId"].ToString());
         }
     }
     return model;
 }
Пример #5
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public Model.SYS_UserForConsultant ReaderBind(IDataReader dataReader)
        {
            Model.SYS_UserForConsultant model = new Model.SYS_UserForConsultant();
            object ojb;

            ojb = dataReader["Con_Id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Con_Id = (int)ojb;
            }
            ojb = dataReader["Adn_Id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Adn_Id = (int)ojb;
            }
            ojb = dataReader["Adn_ConId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Adn_ConId = (int)ojb;
            }
            return(model);
        }
Пример #6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.SYS_UserForConsultant model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SYS_UserForConsultant(");
            strSql.Append("Adn_Id,Adn_ConId)");

            strSql.Append(" values (");
            strSql.Append("@Adn_Id,@Adn_ConId)");
            strSql.Append(";select @@IDENTITY");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "Adn_Id", DbType.Int32, model.Adn_Id);
            db.AddInParameter(dbCommand, "Adn_ConId", DbType.Int32, model.Adn_ConId);
            int    result;
            object obj = db.ExecuteScalar(dbCommand);

            if (!int.TryParse(obj.ToString(), out result))
            {
                return(0);
            }
            return(result);
        }
 /// <summary>
 /// 对象实体绑定数据
 /// </summary>
 public Model.SYS_UserForConsultant ReaderBind(IDataReader dataReader)
 {
     Model.SYS_UserForConsultant model = new Model.SYS_UserForConsultant();
     object ojb;
     ojb = dataReader["Con_Id"];
     if (ojb != null && ojb != DBNull.Value)
     {
         model.Con_Id = (int)ojb;
     }
     ojb = dataReader["Adn_Id"];
     if (ojb != null && ojb != DBNull.Value)
     {
         model.Adn_Id = (int)ojb;
     }
     ojb = dataReader["Adn_ConId"];
     if (ojb != null && ojb != DBNull.Value)
     {
         model.Adn_ConId = (int)ojb;
     }
     return model;
 }