Ejemplo n.º 1
0
        public int Insert(AlbumContentInfo albumContentInfo)
        {
            var albumId = 0;

            IDataParameter[] parms = null;

            var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(albumContentInfo.ToNameValueCollection(), ConnectionString, TableName, out parms);

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        albumId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms);

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            return(albumId);
        }
Ejemplo n.º 2
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            try
            {
                if (id == 0)
                {
                    var albumContentInfo = new AlbumContentInfo();
                    albumContentInfo.PublishmentSystemID = PublishmentSystemId;
                    albumContentInfo.AlbumID             = albumID;
                    albumContentInfo.ParentID            = 0;
                    albumContentInfo.Title         = tbTitle.Text;
                    albumContentInfo.LargeImageUrl = imageUrl.Value;

                    DataProviderWX.AlbumContentDAO.Insert(albumContentInfo);
                }
                else
                {
                    var albumContentInfo = DataProviderWX.AlbumContentDAO.GetAlbumContentInfo(id);
                    albumContentInfo.Title         = tbTitle.Text;
                    albumContentInfo.LargeImageUrl = imageUrl.Value;

                    DataProviderWX.AlbumContentDAO.Update(albumContentInfo);
                }

                PageUtils.CloseModalPage(Page);
            }
            catch (Exception ex)
            {
                FailMessage(ex, "失败:" + ex.Message);
            }
        }
Ejemplo n.º 3
0
        public void Update(AlbumContentInfo albumContentInfo)
        {
            IDataParameter[] parms = null;
            var sqlUpdate          = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(albumContentInfo.ToNameValueCollection(), ConnectionString, TableName, out parms);

            ExecuteNonQuery(sqlUpdate, parms);
        }
Ejemplo n.º 4
0
        public int Insert(AlbumContentInfo albumContentInfo)
        {
            var albumID = 0;

            IDataParameter[] parms = null;

            var SQL_INSERT = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(albumContentInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms);

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        ExecuteNonQuery(trans, SQL_INSERT, parms);

                        albumID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, TABLE_NAME);

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            return(albumID);
        }
Ejemplo n.º 5
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                var albumContentIdList = new List <int>();
                if (_parentId > 0)
                {
                    albumContentIdList = DataProviderWx.AlbumContentDao.GetAlbumContentIdList(PublishmentSystemId, _albumId, _parentId);
                }
                var photoCount = TranslateUtils.ToInt(Request.Form["Photo_Count"]);
                if (photoCount > 0)
                {
                    for (var index = 1; index <= photoCount; index++)
                    {
                        var id       = TranslateUtils.ToInt(Request.Form["ID_" + index]);
                        var smallUrl = Request.Form["SmallUrl_" + index];
                        var largeUrl = Request.Form["LargeUrl_" + index];
                        var title    = Request.Form["imgTitle_" + index];

                        if (!string.IsNullOrEmpty(smallUrl) && !string.IsNullOrEmpty(largeUrl))
                        {
                            if (id > 0)
                            {
                                var albumContentInfo = DataProviderWx.AlbumContentDao.GetAlbumContentInfo(id);
                                if (albumContentInfo != null)
                                {
                                    albumContentInfo.ImageUrl      = smallUrl;
                                    albumContentInfo.LargeImageUrl = largeUrl;
                                    albumContentInfo.Title         = title;

                                    DataProviderWx.AlbumContentDao.Update(albumContentInfo);
                                }
                                albumContentIdList.Remove(id);
                            }
                            else
                            {
                                var albumContentInfo = new AlbumContentInfo();
                                albumContentInfo.PublishmentSystemId = PublishmentSystemId;
                                albumContentInfo.AlbumId             = _albumId;
                                albumContentInfo.ParentId            = _parentId;
                                albumContentInfo.ImageUrl            = smallUrl;
                                albumContentInfo.LargeImageUrl       = largeUrl;
                                albumContentInfo.Title = title;

                                DataProviderWx.AlbumContentDao.Insert(albumContentInfo);
                            }
                        }
                    }
                }

                if (albumContentIdList.Count > 0)
                {
                    DataProviderWx.AlbumContentDao.Delete(PublishmentSystemId, albumContentIdList);
                }

                PageUtils.CloseModalPage(Page);
            }
        }
Ejemplo n.º 6
0
        public AlbumContentInfo GetAlbumContentInfo(int albumContentId)
        {
            AlbumContentInfo albumContentInfo = null;

            string sqlWhere  = $"WHERE ID = {albumContentId}";
            var    sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null);

            using (var rdr = ExecuteReader(sqlSelect))
            {
                if (rdr.Read())
                {
                    albumContentInfo = new AlbumContentInfo(rdr);
                }
                rdr.Close();
            }

            return(albumContentInfo);
        }
Ejemplo n.º 7
0
        public AlbumContentInfo GetAlbumContentInfo(int albumContentID)
        {
            AlbumContentInfo albumContentInfo = null;

            string SQL_WHERE  = $"WHERE ID = {albumContentID}";
            var    SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null);

            using (var rdr = ExecuteReader(SQL_SELECT))
            {
                if (rdr.Read())
                {
                    albumContentInfo = new AlbumContentInfo(rdr);
                }
                rdr.Close();
            }

            return(albumContentInfo);
        }
Ejemplo n.º 8
0
        public List <AlbumContentInfo> GetAlbumContentInfoList(int publishmentSystemId)
        {
            var list = new List <AlbumContentInfo>();

            string sqlWhere  = $"WHERE {AlbumContentAttribute.PublishmentSystemId} = {publishmentSystemId}";
            var    sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null);

            using (var rdr = ExecuteReader(sqlSelect))
            {
                while (rdr.Read())
                {
                    var albumContentInfo = new AlbumContentInfo(rdr);
                    list.Add(albumContentInfo);
                }
                rdr.Close();
            }

            return(list);
        }
Ejemplo n.º 9
0
        public List <AlbumContentInfo> GetAlbumContentInfoList(int publishmentSystemID)
        {
            var list = new List <AlbumContentInfo>();

            string SQL_WHERE  = $"WHERE {AlbumContentAttribute.PublishmentSystemID} = {publishmentSystemID}";
            var    SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null);

            using (var rdr = ExecuteReader(SQL_SELECT))
            {
                while (rdr.Read())
                {
                    var albumContentInfo = new AlbumContentInfo(rdr);
                    list.Add(albumContentInfo);
                }
                rdr.Close();
            }

            return(list);
        }