Esempio n. 1
0
        private bool DoAdd()
        {
            bool result = false;

            Model.plugins.advert_banner model = new Model.plugins.advert_banner();
            BLL.plugins.advert_banner   bll   = new BLL.plugins.advert_banner();

            model.aid        = int.Parse(ddlAdvertId.SelectedValue);
            model.title      = txtTitle.Text.Trim();
            model.start_time = DateTime.Parse(this.txtStartTime.Text.Trim());
            model.end_time   = DateTime.Parse(this.txtEndTime.Text.Trim());
            model.file_path  = txtFilePath.Text.Trim();
            model.link_url   = txtLinkUrl.Text.Trim();
            model.content    = txtContent.Text;
            model.sort_id    = int.Parse(txtSortId.Text.Trim());
            model.is_lock    = int.Parse(rblIsLock.SelectedValue);
            model.add_time   = DateTime.Now;
            this.aid         = model.aid;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加广告内容:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.plugins.advert_banner model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + databaseprefix + "advert_banner set ");
            strSql.Append("aid=@aid,");
            strSql.Append("title=@title,");
            strSql.Append("start_time=@start_time,");
            strSql.Append("end_time=@end_time,");
            strSql.Append("file_path=@file_path,");
            strSql.Append("link_url=@link_url,");
            strSql.Append("content=@content,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("is_lock=@is_lock,");
            strSql.Append("add_time=@add_time");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@aid",        SqlDbType.Int,         4),
                new SqlParameter("@title",      SqlDbType.NVarChar,  100),
                new SqlParameter("@start_time", SqlDbType.DateTime),
                new SqlParameter("@end_time",   SqlDbType.DateTime),
                new SqlParameter("@file_path",  SqlDbType.NVarChar,  255),
                new SqlParameter("@link_url",   SqlDbType.NVarChar,  255),
                new SqlParameter("@content",    SqlDbType.NText),
                new SqlParameter("@sort_id",    SqlDbType.Int,         4),
                new SqlParameter("@is_lock",    SqlDbType.TinyInt,     1),
                new SqlParameter("@add_time",   SqlDbType.DateTime),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.aid;
            parameters[1].Value  = model.title;
            parameters[2].Value  = model.start_time;
            parameters[3].Value  = model.end_time;
            parameters[4].Value  = model.file_path;
            parameters[5].Value  = model.link_url;
            parameters[6].Value  = model.content;
            parameters[7].Value  = model.sort_id;
            parameters[8].Value  = model.is_lock;
            parameters[9].Value  = model.add_time;
            parameters[10].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        private void ShowInfo(int _id)
        {
            BLL.plugins.advert_banner   bll   = new BLL.plugins.advert_banner();
            Model.plugins.advert_banner model = bll.GetModel(_id);

            this.aid = model.aid;
            ddlAdvertId.SelectedValue = model.aid.ToString();
            txtTitle.Text             = model.title;
            rblIsLock.SelectedValue   = model.is_lock.ToString();
            txtSortId.Text            = model.sort_id.ToString();
            txtStartTime.Text         = model.start_time.ToString("yyyy-MM-dd");
            txtEndTime.Text           = model.end_time.ToString("yyyy-MM-dd");
            txtLinkUrl.Text           = model.link_url;
            txtFilePath.Text          = model.file_path;
            txtContent.Text           = model.content;
        }
Esempio n. 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.plugins.advert_banner model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into " + databaseprefix + "advert_banner(");
            strSql.Append("aid,title,start_time,end_time,file_path,link_url,content,sort_id,is_lock,add_time)");
            strSql.Append(" values (");
            strSql.Append("@aid,@title,@start_time,@end_time,@file_path,@link_url,@content,@sort_id,@is_lock,@add_time)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@aid",        SqlDbType.Int,         4),
                new SqlParameter("@title",      SqlDbType.NVarChar,  100),
                new SqlParameter("@start_time", SqlDbType.DateTime),
                new SqlParameter("@end_time",   SqlDbType.DateTime),
                new SqlParameter("@file_path",  SqlDbType.NVarChar,  255),
                new SqlParameter("@link_url",   SqlDbType.NVarChar,  255),
                new SqlParameter("@content",    SqlDbType.NText),
                new SqlParameter("@sort_id",    SqlDbType.Int,         4),
                new SqlParameter("@is_lock",    SqlDbType.TinyInt,     1),
                new SqlParameter("@add_time",   SqlDbType.DateTime)
            };
            parameters[0].Value = model.aid;
            parameters[1].Value = model.title;
            parameters[2].Value = model.start_time;
            parameters[3].Value = model.end_time;
            parameters[4].Value = model.file_path;
            parameters[5].Value = model.link_url;
            parameters[6].Value = model.content;
            parameters[7].Value = model.sort_id;
            parameters[8].Value = model.is_lock;
            parameters[9].Value = model.add_time;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.plugins.advert_banner model)
 {
     return(dal.Update(model));
 }
Esempio n. 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.plugins.advert_banner model)
 {
     return(dal.Add(model));
 }
Esempio n. 7
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public Model.plugins.advert_banner GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,aid,title,start_time,end_time,file_path,link_url,content,sort_id,is_lock,add_time from " + databaseprefix + "advert_banner ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = id;

            Model.plugins.advert_banner model = new Model.plugins.advert_banner();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["aid"] != null && ds.Tables[0].Rows[0]["aid"].ToString() != "")
                {
                    model.aid = int.Parse(ds.Tables[0].Rows[0]["aid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "")
                {
                    model.title = ds.Tables[0].Rows[0]["title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["start_time"] != null && ds.Tables[0].Rows[0]["start_time"].ToString() != "")
                {
                    model.start_time = DateTime.Parse(ds.Tables[0].Rows[0]["start_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["end_time"] != null && ds.Tables[0].Rows[0]["end_time"].ToString() != "")
                {
                    model.end_time = DateTime.Parse(ds.Tables[0].Rows[0]["end_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["file_path"] != null && ds.Tables[0].Rows[0]["file_path"].ToString() != "")
                {
                    model.file_path = ds.Tables[0].Rows[0]["file_path"].ToString();
                }
                if (ds.Tables[0].Rows[0]["link_url"] != null && ds.Tables[0].Rows[0]["link_url"].ToString() != "")
                {
                    model.link_url = ds.Tables[0].Rows[0]["link_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["content"] != null && ds.Tables[0].Rows[0]["content"].ToString() != "")
                {
                    model.content = ds.Tables[0].Rows[0]["content"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sort_id"] != null && ds.Tables[0].Rows[0]["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_lock"] != null && ds.Tables[0].Rows[0]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.plugins.advert_banner GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,aid,title,start_time,end_time,file_path,link_url,content,sort_id,is_lock,add_time from " + databaseprefix + "advert_banner ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Model.plugins.advert_banner model = new Model.plugins.advert_banner();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["aid"] != null && ds.Tables[0].Rows[0]["aid"].ToString() != "")
                {
                    model.aid = int.Parse(ds.Tables[0].Rows[0]["aid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "")
                {
                    model.title = ds.Tables[0].Rows[0]["title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["start_time"] != null && ds.Tables[0].Rows[0]["start_time"].ToString() != "")
                {
                    model.start_time = DateTime.Parse(ds.Tables[0].Rows[0]["start_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["end_time"] != null && ds.Tables[0].Rows[0]["end_time"].ToString() != "")
                {
                    model.end_time = DateTime.Parse(ds.Tables[0].Rows[0]["end_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["file_path"] != null && ds.Tables[0].Rows[0]["file_path"].ToString() != "")
                {
                    model.file_path = ds.Tables[0].Rows[0]["file_path"].ToString();
                }
                if (ds.Tables[0].Rows[0]["link_url"] != null && ds.Tables[0].Rows[0]["link_url"].ToString() != "")
                {
                    model.link_url = ds.Tables[0].Rows[0]["link_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["content"] != null && ds.Tables[0].Rows[0]["content"].ToString() != "")
                {
                    model.content = ds.Tables[0].Rows[0]["content"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sort_id"] != null && ds.Tables[0].Rows[0]["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_lock"] != null && ds.Tables[0].Rows[0]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 9
0
        private bool DoAdd()
        {
            bool result = false;
            Model.plugins.advert_banner model = new Model.plugins.advert_banner();
            BLL.plugins.advert_banner bll = new BLL.plugins.advert_banner();

            model.aid = int.Parse(ddlAdvertId.SelectedValue);
            model.title = txtTitle.Text.Trim();
            model.start_time = DateTime.Parse(this.txtStartTime.Text.Trim());
            model.end_time = DateTime.Parse(this.txtEndTime.Text.Trim());
            model.file_path = txtFilePath.Text.Trim();
            model.link_url = txtLinkUrl.Text.Trim();
            model.content = txtContent.Text;
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.is_lock = int.Parse(rblIsLock.SelectedValue);
            model.add_time = DateTime.Now;
            this.aid = model.aid;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加广告内容:" + model.title); //记录日志
                result = true;
            }
            return result;
        }