예제 #1
0
        public bool Delete(ActivityApplyInfo model)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("delete from ActivityApply");
            sb.Append(" where Id=@Id");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@Id", DbType.Int32, model.Id);
            return(db.ExecuteNonQuery(dbCommand) < 1 ? false : true);
        }
예제 #2
0
        public bool Update(ActivityApplyInfo model)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("update ActivityApply set ");
            sb.Append("ActivityId=@ActivityId,UserId=@UserId,StarId=@StarId,Status=@Status,CreateDate=@CreateDate,CreateIP=@CreateIP");
            sb.Append(" where Id=@Id");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@Id", DbType.Int32, model.Id);
            db.AddInParameter(dbCommand, "@ActivityId", DbType.Int32, model.ActivityId);
            db.AddInParameter(dbCommand, "@UserId", DbType.Int32, model.UserId);
            db.AddInParameter(dbCommand, "@StarId", DbType.Int32, model.StarId);
            db.AddInParameter(dbCommand, "@Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "@CreateDate", DbType.DateTime, model.CreateDate);
            db.AddInParameter(dbCommand, "@CreateIP", DbType.String, model.CreateIP);
            return(db.ExecuteNonQuery(dbCommand) < 1 ? false : true);
        }
예제 #3
0
        private ActivityApplyInfo  FillList(IDataReader dataReader)
        {
            ActivityApplyInfo model = new ActivityApplyInfo();
            object            ojb;

            ojb = dataReader["Id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Id = ( int)(ojb);
            }
            ojb = dataReader["ActivityId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ActivityId = ( int)(ojb);
            }
            ojb = dataReader["UserId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UserId = ( int)(ojb);
            }
            ojb = dataReader["StarId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StarId = ( int)(ojb);
            }
            ojb = dataReader["Status"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Status = ( int)(ojb);
            }
            ojb = dataReader["CreateDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CreateDate = ( DateTime)(ojb);
            }
            ojb = dataReader["CreateIP"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CreateIP = ( string)(ojb);
            }

            return(model);
        }
예제 #4
0
        public ActivityApplyInfo  Get(int Id)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("select * from ActivityApply where Id=@Id");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@Id", DbType.Int32, Id);

            ActivityApplyInfo model = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = FillList(dataReader);
                }
            }
            return(model);
        }
예제 #5
0
        public int Create(ActivityApplyInfo model)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("insert into ActivityApply(");
            sb.Append("ActivityId,UserId,StarId,Status,CreateDate,CreateIP");
            sb.Append(") values(");
            sb.Append("@ActivityId,@UserId,@StarId,@Status,@CreateDate,@CreateIP);SELECT @@IDENTITY;");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@ActivityId", DbType.Int32, model.ActivityId);
            db.AddInParameter(dbCommand, "@UserId", DbType.Int32, model.UserId);
            db.AddInParameter(dbCommand, "@StarId", DbType.Int32, model.StarId);
            db.AddInParameter(dbCommand, "@Status", DbType.Int32, model.Status);
            db.AddInParameter(dbCommand, "@CreateDate", DbType.DateTime, model.CreateDate);
            db.AddInParameter(dbCommand, "@CreateIP", DbType.String, model.CreateIP);
            int id = Convert.ToInt32(db.ExecuteScalar(dbCommand));

            return(id);
        }
예제 #6
0
 public bool Delete(ActivityApplyInfo model)
 {
     return(dal.Delete(model));
 }
예제 #7
0
 public bool Update(ActivityApplyInfo model)
 {
     return(dal.Update(model));
 }
예제 #8
0
        public int Create(ActivityApplyInfo model)
        {
            int id = dal.Create(model);

            return(id);
        }