예제 #1
0
        public TemplateVO GetCurrentTemplate()
        {
            TemplateVO templateVO = m_TemplateService.GetCurrentTemplate(AppSettings.TemplateBeforeDays);
            if (templateVO == null)
            {
                templateVO = new TemplateVO();
            }

            return templateVO;
        }
예제 #2
0
        /// <summary>
        /// 取得樣板清單
        /// </summary>
        /// <param name="type">樣板類別</param>
        /// <returns>樣板清單</returns>
        public IList<TemplateVO> GetTemplateList(TemplateVO.Type type)
        {
            DetachedCriteria dCriteria = DetachedCriteria.For<TemplateVO>();
            dCriteria.Add(Expression.Eq("TemplateType", (int)type));

            int count = NHibernateDao.CountByDetachedCriteria(dCriteria);

            if (count == 0)
            {
                return null;
            }

            return NHibernateDao.SearchByDetachedCriteria<TemplateVO>(dCriteria);
        }
예제 #3
0
        /// <summary>
        /// 更新樣板
        /// </summary>
        /// <param name="templateVO">被更新的樣板</param>
        /// <returns>更新後的樣板</returns>
        public TemplateVO UpdateTemplate(TemplateVO templateVO)
        {
            NHibernateDao.Update(templateVO);

            return templateVO;
        }
예제 #4
0
        /// <summary>
        /// 新增樣板
        /// </summary>
        /// <param name="templateVO">被新增的樣板</param>
        /// <returns>新增後的樣板</returns>
        public TemplateVO CreateTemplate(TemplateVO templateVO)
        {
            NHibernateDao.Insert(templateVO);

            return templateVO;
        }
예제 #5
0
        private void InitTemplate()
        {
            TemplateVO templateVO1 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Season,
                Name = "春",
                //CSS = "<link href='season/season01.css' rel='stylesheet' type='text/css' />",
                //FileName = "season01.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "0301",
                EndDate = "0531"
            };
            m_TemplateService.CreateTemplate(templateVO1);

            TemplateVO templateVO2 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Season,
                Name = "夏",
                //CSS = "<link href='season/season02.css' rel='stylesheet' type='text/css' />",
                //FileName = "season02.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "0601",
                EndDate = "0831"
            };
            m_TemplateService.CreateTemplate(templateVO2);

            TemplateVO templateVO3 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Season,
                Name = "秋",
                //CSS = "<link href='season/season03.css' rel='stylesheet' type='text/css' />",
                //FileName = "season03.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "0901",
                EndDate = "1131"
            };
            m_TemplateService.CreateTemplate(templateVO3);

            TemplateVO templateVO4 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Season,
                Name = "冬",
                //CSS = "",
                //FileName = "season04.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "1201",
                EndDate = "0229"
            };
            m_TemplateService.CreateTemplate(templateVO4);

            TemplateVO templateVO5 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Festival,
                Name = "中秋節",
                //CSS = "<link href='festival01.css' rel='stylesheet' type='text/css' />",
                //FileName = "festival01.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "0815",
                EndDate = "0815"
            };
            m_TemplateService.CreateTemplate(templateVO5);

            TemplateVO templateVO6 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Festival,
                Name = "元宵節",
                //CSS = "",
                //FileName = "festival02.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "0115",
                EndDate = "0115"
            };
            m_TemplateService.CreateTemplate(templateVO6);

            TemplateVO templateVO7 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Festival,
                Name = "端午節",
                //CSS = "",
                //FileName = "festival03.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "0505",
                EndDate = "0505"
            };
            m_TemplateService.CreateTemplate(templateVO7);

            TemplateVO templateVO8 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Festival,
                Name = "中國情人節",
                //CSS = "",
                //FileName = "festival04.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "0707",
                EndDate = "0707"
            };
            m_TemplateService.CreateTemplate(templateVO8);

            TemplateVO templateVO9 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Festival,
                Name = "聖誕節",
                //CSS = "",
                //FileName = "festival05.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "1225",
                EndDate = "1225"
            };
            m_TemplateService.CreateTemplate(templateVO9);

            TemplateVO templateVO10 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Festival,
                Name = "春節",
                //CSS = "",
                //FileName = "festival06.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "0101",
                EndDate = "0101"
            };
            m_TemplateService.CreateTemplate(templateVO10);

            TemplateVO templateVO11 = new TemplateVO()
            {
                TemplateType = TemplateVO.Type.Festival,
                Name = "西洋情人節",
                //CSS = "",
                //FileName = "festival04.txt",
                FileName2 = "/Scripts/ckfinder/userfiles/flash/flash.swf",
                StartDate = "0214",
                EndDate = "0214"
            };
            m_TemplateService.CreateTemplate(templateVO11);
        }        
예제 #6
0
 public void LoadTemplate(TemplateVO template)
 {
     if (template != null)
     {
         EntityId = template.TemplateId;
         Name = template.Name;
         CSS = template.CSS;
         FileName = template.FileName;
         FileName2 = template.FileName2;
         StartDate = template.StartDate;
         EndDate = template.EndDate;
         Status = template.Flag.ToString();
         TemplateType = template.TemplateType.ToString();
     }
 }
예제 #7
0
        private void Save(TemplateVO template)
        {
            template.Name = Name;            
            template.CSS = CSS;
            template.FileName = FileName;
            template.FileName2 = FileName2;
            template.StartDate = StartDate;
            template.EndDate = string.IsNullOrWhiteSpace(EndDate) ? StartDate : EndDate;
            template.Flag = int.Parse(Status);

            if (template.TemplateId == 0)
            {                
                template.TemplateType = (TemplateVO.Type)Enum.Parse(typeof(TemplateVO.Type), TemplateType);
                m_TemplateService.CreateTemplate(template);
            }
            else
            {
                m_TemplateService.UpdateTemplate(template);
            }

            LoadTemplate(template.TemplateId);
        }
예제 #8
0
 public void Insert()
 {
     TemplateVO template = new TemplateVO();
     Save(template);
 }
예제 #9
0
 /// <summary>
 /// 取得樣板清單
 /// </summary>
 /// <param name="type">樣板類別</param>
 /// <returns>樣板清單</returns>
 public IList<TemplateVO> GetTemplateList(TemplateVO.Type type)
 {
     return TemplateDao.GetTemplateList(type);
 }
예제 #10
0
 /// <summary>
 /// 更新樣板
 /// </summary>
 /// <param name="templateVO">被更新的樣板</param>
 /// <returns>更新後的樣板</returns>
 public TemplateVO UpdateTemplate(TemplateVO templateVO)
 {
     return TemplateDao.UpdateTemplate(templateVO);
 }
예제 #11
0
 /// <summary>
 /// 新增樣板
 /// </summary>
 /// <param name="templateVO">被新增的樣板</param>
 /// <returns>新增後的樣板</returns>
 public TemplateVO CreateTemplate(TemplateVO templateVO)
 {
     return TemplateDao.CreateTemplate(templateVO);
 }