예제 #1
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public ECommerce.Admin.Model.ProdAnswer ReaderBind(IDataReader dataReader)
        {
            ECommerce.Admin.Model.ProdAnswer model = new ECommerce.Admin.Model.ProdAnswer();
            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.Question_answer_48 = dataReader["Question_answer_48"].ToString();
            model.Question_answer_49 = dataReader["Question_answer_49"].ToString();
            model.Question_answer_50 = dataReader["Question_answer_50"].ToString();
            model.Question_answer_51 = dataReader["Question_answer_51"].ToString();
            model.Question_answer_52 = dataReader["Question_answer_52"].ToString();
            model.Question_answer_53 = dataReader["Question_answer_53"].ToString();
            model.Question_answer_54 = dataReader["Question_answer_54"].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);
        }
예제 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ECommerce.Admin.Model.ProdAnswer model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProdAnswer(");
            strSql.Append("ComID,UId,Question_answer_48,Question_answer_49,Question_answer_50,Question_answer_51,Question_answer_52,Question_answer_53,Question_answer_54,CreateDate,UpdateDate)");

            strSql.Append(" values (");
            strSql.Append("@ComID,@UId,@Question_answer_48,@Question_answer_49,@Question_answer_50,@Question_answer_51,@Question_answer_52,@Question_answer_53,@Question_answer_54,@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, "Question_answer_48", DbType.String, model.Question_answer_48);
            db.AddInParameter(dbCommand, "Question_answer_49", DbType.String, model.Question_answer_49);
            db.AddInParameter(dbCommand, "Question_answer_50", DbType.String, model.Question_answer_50);
            db.AddInParameter(dbCommand, "Question_answer_51", DbType.String, model.Question_answer_51);
            db.AddInParameter(dbCommand, "Question_answer_52", DbType.String, model.Question_answer_52);
            db.AddInParameter(dbCommand, "Question_answer_53", DbType.String, model.Question_answer_53);
            db.AddInParameter(dbCommand, "Question_answer_54", DbType.String, model.Question_answer_54);
            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);
        }
예제 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ECommerce.Admin.Model.ProdAnswer DataRowToModel(DataRow row)
 {
     ECommerce.Admin.Model.ProdAnswer model = new ECommerce.Admin.Model.ProdAnswer();
     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["Question_answer_48"] != null)
         {
             model.Question_answer_48 = row["Question_answer_48"].ToString();
         }
         if (row["Question_answer_49"] != null)
         {
             model.Question_answer_49 = row["Question_answer_49"].ToString();
         }
         if (row["Question_answer_50"] != null)
         {
             model.Question_answer_50 = row["Question_answer_50"].ToString();
         }
         if (row["Question_answer_51"] != null)
         {
             model.Question_answer_51 = row["Question_answer_51"].ToString();
         }
         if (row["Question_answer_52"] != null)
         {
             model.Question_answer_52 = row["Question_answer_52"].ToString();
         }
         if (row["Question_answer_53"] != null)
         {
             model.Question_answer_53 = row["Question_answer_53"].ToString();
         }
         if (row["Question_answer_54"] != null)
         {
             model.Question_answer_54 = row["Question_answer_54"].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);
 }
예제 #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ECommerce.Admin.Model.ProdAnswer DataRowToModel(DataRow row)
 {
     ECommerce.Admin.Model.ProdAnswer model=new ECommerce.Admin.Model.ProdAnswer();
     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["Question_answer_48"]!=null)
         {
             model.Question_answer_48=row["Question_answer_48"].ToString();
         }
         if(row["Question_answer_49"]!=null)
         {
             model.Question_answer_49=row["Question_answer_49"].ToString();
         }
         if(row["Question_answer_50"]!=null)
         {
             model.Question_answer_50=row["Question_answer_50"].ToString();
         }
         if(row["Question_answer_51"]!=null)
         {
             model.Question_answer_51=row["Question_answer_51"].ToString();
         }
         if(row["Question_answer_52"]!=null)
         {
             model.Question_answer_52=row["Question_answer_52"].ToString();
         }
         if(row["Question_answer_53"]!=null)
         {
             model.Question_answer_53=row["Question_answer_53"].ToString();
         }
         if(row["Question_answer_54"]!=null)
         {
             model.Question_answer_54=row["Question_answer_54"].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;
 }
예제 #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ECommerce.Admin.Model.ProdAnswer model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProdAnswer set ");
            strSql.Append("ComID=@ComID,");
            strSql.Append("UId=@UId,");
            strSql.Append("Question_answer_48=@Question_answer_48,");
            strSql.Append("Question_answer_49=@Question_answer_49,");
            strSql.Append("Question_answer_50=@Question_answer_50,");
            strSql.Append("Question_answer_51=@Question_answer_51,");
            strSql.Append("Question_answer_52=@Question_answer_52,");
            strSql.Append("Question_answer_53=@Question_answer_53,");
            strSql.Append("Question_answer_54=@Question_answer_54,");
            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, "Question_answer_48", DbType.String, model.Question_answer_48);
            db.AddInParameter(dbCommand, "Question_answer_49", DbType.String, model.Question_answer_49);
            db.AddInParameter(dbCommand, "Question_answer_50", DbType.String, model.Question_answer_50);
            db.AddInParameter(dbCommand, "Question_answer_51", DbType.String, model.Question_answer_51);
            db.AddInParameter(dbCommand, "Question_answer_52", DbType.String, model.Question_answer_52);
            db.AddInParameter(dbCommand, "Question_answer_53", DbType.String, model.Question_answer_53);
            db.AddInParameter(dbCommand, "Question_answer_54", DbType.String, model.Question_answer_54);
            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);
            }
        }
예제 #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ECommerce.Admin.Model.ProdAnswer GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,ComID,UId,Question_answer_48,Question_answer_49,Question_answer_50,Question_answer_51,Question_answer_52,Question_answer_53,Question_answer_54,CreateDate,UpdateDate from ProdAnswer ");
            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.ProdAnswer model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
예제 #7
0
 /// <summary>
 /// 对象实体绑定数据
 /// </summary>
 public ECommerce.Admin.Model.ProdAnswer ReaderBind(IDataReader dataReader)
 {
     ECommerce.Admin.Model.ProdAnswer model=new ECommerce.Admin.Model.ProdAnswer();
     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.Question_answer_48=dataReader["Question_answer_48"].ToString();
     model.Question_answer_49=dataReader["Question_answer_49"].ToString();
     model.Question_answer_50=dataReader["Question_answer_50"].ToString();
     model.Question_answer_51=dataReader["Question_answer_51"].ToString();
     model.Question_answer_52=dataReader["Question_answer_52"].ToString();
     model.Question_answer_53=dataReader["Question_answer_53"].ToString();
     model.Question_answer_54=dataReader["Question_answer_54"].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;
 }