Example #1
0
        public ActionResult Detail(string id)
        {
            EntityCounter(id, "Vister");

            Epaper entity = m_FTISService.GetEpaperById(int.Parse(DecryptId(id)));

            Response.Redirect(entity.AUrl);

            return(new EmptyResult());
        }
Example #2
0
        private void EntityCounter(string id, string type)
        {
            Epaper entity = m_FTISService.GetEpaperById(int.Parse(DecryptId(id)));

            switch (type)
            {
            case "Vister":
                entity.Vister += 1;
                break;
            }
            m_FTISService.UpdateEpaper(entity);
        }
Example #3
0
 protected void LoadEntity(Epaper entity)
 {
     if (entity != null)
     {
         ENo      = entity.ENo;
         EntityId = entity.EpaperId;
         Name     = entity.Name;
         SortId   = entity.SortId;
         Status   = entity.Status;
         PostDate = entity.PostDate;
         AUrl     = entity.AUrl;
         Vister   = entity.Vister;
     }
 }
        public ActionResult SetSort(string entityId, string sortValue)
        {
            AjaxResult    result = new AjaxResult(AjaxResultStatus.Success, string.Empty);
            StringBuilder sbMsg  = new StringBuilder();

            try
            {
                Epaper entity = m_FTISService.GetEpaperById(Convert.ToInt32(entityId));
                entity.SortId = int.Parse(sortValue);
                m_FTISService.UpdateEpaper(entity);
            }
            catch (Exception ex)
            {
                result.ErrorCode = AjaxResultStatus.Fail;
                sbMsg.AppendFormat(ex.Message + "<br/>");
            }

            result.Message = sbMsg.ToString();
            return(this.Json(result));
        }
        public ActionResult Delete(int id)
        {
            AjaxResult result = new AjaxResult();

            try
            {
                Epaper entity = m_FTISService.GetEpaperById(id);

                m_FTISService.DeleteEpaper(entity);

                result.ErrorCode = AjaxResultStatus.Success;
                result.Message   = string.Format("{0}刪除成功", entity.Name);
            }
            catch (Exception ex)
            {
                result.ErrorCode = AjaxResultStatus.Exception;
                result.Message   = ex.Message;
            }

            return(this.Json(result));
        }
Example #6
0
        private void Save(Epaper entity)
        {
            entity.ENo      = ENo;
            entity.Name     = Name;
            entity.SortId   = SortId;
            entity.Status   = Status;
            entity.PostDate = PostDate;
            entity.AUrl     = AUrl;
            entity.Vister   = Vister;

            if (entity.EpaperId == 0)
            {
                m_FTISService.CreateEpaper(entity);
            }
            else
            {
                m_FTISService.UpdateEpaper(entity);
            }

            LoadEntity(entity.EpaperId);
        }
Example #7
0
        static void Main(string[] args)
        {
            Pi.Init <BootstrapWiringPi>();

            //initialize ePaper display
            var ePaper = new Epaper(176, 264);

            ePaper.Initialize();

            //create black and red screens
            var blackScreen = new Screen(176, 264, Rotate.ROTATE_270, Color.WHITE);
            var redScreen   = new Screen(176, 264, Rotate.ROTATE_270, Color.WHITE);

            //draw something on screen using a font
            var font  = new Font8();
            var font2 = new Font20();

            blackScreen.DrawString(10, 20, "Black text", font, Color.WHITE, Color.BLACK);
            redScreen.DrawString(10, 50, "Red text", font2, Color.WHITE, Color.RED);

            ePaper.DisplayScreens(blackScreen, redScreen);
        }
        public ActionResult MultiDelete(string allId)
        {
            AjaxResult    result = new AjaxResult(AjaxResultStatus.Success, string.Empty);
            StringBuilder sbMsg  = new StringBuilder();

            string[] ids = allId.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string id in ids)
            {
                try
                {
                    Epaper entity = m_FTISService.GetEpaperById(Convert.ToInt32(id));
                    m_FTISService.DeleteEpaper(entity);
                }
                catch (Exception ex)
                {
                    result.ErrorCode = AjaxResultStatus.Fail;
                    sbMsg.AppendFormat(ex.Message + "<br/>");
                }
            }

            result.Message = sbMsg.ToString();
            return(this.Json(result));
        }
Example #9
0
        public void Update()
        {
            Epaper entity = m_FTISService.GetEpaperById(EntityId);

            Save(entity);
        }
Example #10
0
        public void Insert()
        {
            Epaper entity = new Epaper();

            Save(entity);
        }
Example #11
0
        protected void LoadEntity(int id)
        {
            Epaper entity = m_FTISService.GetEpaperById(id);

            LoadEntity(entity);
        }