Beispiel #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BWJS.Model.AdRelease GetModel(int AdReleaseID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select AdReleaseID, Remark, BeginTime, EndTime, ResourceID, CreatUserID, RecordUpdateUserID, RecordIsDelete, RecordUpdateTime, RecordCreateTime,AdReleaseName ");
            strSql.Append("  from AdRelease ");
            strSql.Append(" where AdReleaseID=@AdReleaseID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AdReleaseID", SqlDbType.Int, 4)
            };
            parameters[0].Value = AdReleaseID;


            BWJS.Model.AdRelease model = new BWJS.Model.AdRelease();
            DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BWJS.Model.AdRelease model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update AdRelease set ");
            strSql.Append(" AdReleaseName = @AdReleaseName , ");
            strSql.Append(" Remark = @Remark , ");
            strSql.Append(" BeginTime = @BeginTime , ");
            strSql.Append(" EndTime = @EndTime , ");
            strSql.Append(" ResourceID = @ResourceID , ");
            strSql.Append(" CreatUserID = @CreatUserID , ");
            strSql.Append(" RecordUpdateUserID = @RecordUpdateUserID , ");
            strSql.Append(" RecordIsDelete = @RecordIsDelete , ");
            strSql.Append(" RecordUpdateTime = @RecordUpdateTime , ");
            strSql.Append(" RecordCreateTime = @RecordCreateTime  ");
            strSql.Append(" where AdReleaseID=@AdReleaseID ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@AdReleaseID",        model.AdReleaseID),
                new SqlParameter("@AdReleaseName",      model.AdReleaseName),
                new SqlParameter("@Remark",             model.Remark),
                new SqlParameter("@BeginTime",          model.BeginTime),
                new SqlParameter("@EndTime",            model.EndTime),
                new SqlParameter("@ResourceID",         model.ResourceID),
                new SqlParameter("@CreatUserID",        model.CreatUserID),
                new SqlParameter("@RecordUpdateUserID", model.RecordUpdateUserID),
                new SqlParameter("@RecordIsDelete",     model.RecordIsDelete),
                new SqlParameter("@RecordUpdateTime",   model.RecordUpdateTime),
                new SqlParameter("@RecordCreateTime",   model.RecordCreateTime)
            };

            int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BWJS.Model.AdRelease model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into AdRelease(");
            strSql.Append("Remark,BeginTime,EndTime,ResourceID,CreatUserID,RecordUpdateUserID,RecordIsDelete,RecordUpdateTime,RecordCreateTime,AdReleaseName");
            strSql.Append(") values (");
            strSql.Append("@Remark,@BeginTime,@EndTime,@ResourceID,@CreatUserID,@RecordUpdateUserID,@RecordIsDelete,@RecordUpdateTime,@RecordCreateTime,@AdReleaseName");
            strSql.Append(") ");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Remark",             model.Remark),
                new SqlParameter("@BeginTime",          model.BeginTime),
                new SqlParameter("@EndTime",            model.EndTime),
                new SqlParameter("@ResourceID",         model.ResourceID),
                new SqlParameter("@CreatUserID",        model.CreatUserID),
                new SqlParameter("@RecordUpdateUserID", model.RecordUpdateUserID),
                new SqlParameter("@RecordIsDelete",     model.RecordIsDelete),
                new SqlParameter("@RecordUpdateTime",   model.RecordUpdateTime),
                new SqlParameter("@AdReleaseName",      model.AdReleaseName),
                new SqlParameter("@RecordCreateTime",   model.RecordCreateTime)
            };


            object obj = BWJSHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Beispiel #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BWJS.Model.AdRelease model)
 {
     return(dal.Update(model));
 }
Beispiel #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(BWJS.Model.AdRelease model)
 {
     return(dal.Add(model));
 }
Beispiel #6
0
        /// <summary>
        /// datarow转成对象实体
        /// </summary>
        public BWJS.Model.AdRelease DataRowToModel(DataRow row)
        {
            BWJS.Model.AdRelease model = new BWJS.Model.AdRelease();

            if (row != null)
            {
                if (row["AdReleaseID"].ToString() != "")
                {
                    model.AdReleaseID = int.Parse(row["AdReleaseID"].ToString());
                }
                model.Remark = row["Remark"].ToString();
                if (row["AdReleaseName"].ToString() != "")
                {
                    model.AdReleaseName = row["AdReleaseName"].ToString();
                }
                if (row["BeginTime"].ToString() != "")
                {
                    model.BeginTime = DateTime.Parse(row["BeginTime"].ToString());
                }
                if (row["EndTime"].ToString() != "")
                {
                    model.EndTime = DateTime.Parse(row["EndTime"].ToString());
                }
                if (row["ResourceID"].ToString() != "")
                {
                    model.ResourceID = int.Parse(row["ResourceID"].ToString());
                }
                if (row["CreatUserID"].ToString() != "")
                {
                    model.CreatUserID = int.Parse(row["CreatUserID"].ToString());
                }
                if (row["RecordUpdateUserID"].ToString() != "")
                {
                    model.RecordUpdateUserID = int.Parse(row["RecordUpdateUserID"].ToString());
                }
                if (row["RecordIsDelete"].ToString() != "")
                {
                    if ((row["RecordIsDelete"].ToString() == "1") || (row["RecordIsDelete"].ToString().ToLower() == "true"))
                    {
                        model.RecordIsDelete = true;
                    }
                    else
                    {
                        model.RecordIsDelete = false;
                    }
                }
                if (row["RecordUpdateTime"].ToString() != "")
                {
                    model.RecordUpdateTime = DateTime.Parse(row["RecordUpdateTime"].ToString());
                }
                if (row["RecordCreateTime"].ToString() != "")
                {
                    model.RecordCreateTime = DateTime.Parse(row["RecordCreateTime"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }