Exemplo n.º 1
0
        protected void loadByJsonData(SdNode config, String json)
        {
            ONode data = ONode.tryLoad(json);

            if (DdSource.isBook(config))
            {
                if (TextUtils.isEmpty(shop))
                {
                    logo  = data.get("logo").getString();
                    name  = data.get("name").getString();
                    shop  = data.get("shop").getString();
                    intro = data.get("intro").getString();

                    buyUrl = data.get("buyUrl").getString();
                }
            }

            ONode sl = data.get("pictures").asArray();

            foreach (ONode n in sl)
            {
                PicModel pic = new PicModel(bookUrl, n.getString());

                pictures.Add(pic);
            }
        }
 //显示图片方法
 private void Ph_ShowPicture(PicModel obj)
 {
     this.Dispatcher.Invoke(new Action(() =>
     {
         sh.AddPicModel(obj);
     }));
 }
Exemplo n.º 3
0
        public ActionResult CreateAlbum(int?s, int?aSN)
        {
            string ID      = string.Empty;
            int    status  = s ?? 0;
            int    albumSN = aSN ?? 0;

            if (Session["UserID"] != null)
            {
                ID = Session["UserID"].ToString();

                if (status == 0)//建立相簿時取得圖片
                {
                    ViewBag.getNotJoinPic = PicModel.getUserPicEnableByID(ID);
                }

                if (status == 1 && albumSN != 0)                                                  //編輯相簿時取得圖片
                {
                    List <Vw_AlbumJoinPic> joinPic = AlbumJoinPicModel.getUpdateJoinPic(albumSN); //已加入相簿的圖片

                    ViewBag.VwAlbum       = AlbumModel.getVwAlbum(albumSN);                       //相簿資料
                    ViewBag.getJoinPic    = joinPic;
                    ViewBag.joinPicCount  = joinPic.Count();
                    ViewBag.getNotJoinPic = AlbumJoinPicModel.getUpdateNotJoinPic(albumSN, ID).OrderByDescending(o => o.CreateDate);//未加入相簿的圖片
                }

                ViewBag.picAllCount = PicModel.getUserAllPicByID(ID).Count();
            }

            ViewBag.aSN = albumSN;
            return(View());
        }
Exemplo n.º 4
0
        public ActionResult DownloadZip(string type, string[] SN)
        {
            string        zipPath         = Server.MapPath("~/Upload//zip//" + type);
            string        downloadUrl     = string.Empty;
            List <string> zipFileNamePath = new List <string>();

            if (type == "img")
            {
                List <Rio_Pic> Pic = new PicModel().getZipPic(SN);
                foreach (var item in Pic)
                {
                    zipFileNamePath.Add(Server.MapPath(item.PicPath) + item.PicName);
                }
            }
            else if (type == "doc")
            {
                List <Rio_Doc> Doc = DocModel.getZipDoc(SN);
                foreach (var item in Doc)
                {
                    zipFileNamePath.Add(Server.MapPath(item.DocPath) + item.DocName);
                }
            }

            downloadUrl = App_Code.Zip.AddZip(zipFileNamePath, zipPath);

            return(Content("/Upload/zip/" + type + "/" + downloadUrl));
        }
Exemplo n.º 5
0
        public List <PicModel> loadGallery()
        {
            List <PicModel> Models = new List <PicModel>();

            base.Connect();
            DataTable dt = base.Select("SELECT [PicId] ,[PicAddress] ,[PicThumbnailAddress] ,[PicName] ,[PicLable] ,[PicDescription] FROM [tbl_PicUploader]");

            base.DC();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var model = new PicModel()
                {
                    PicId        = Convert.ToInt32(dt.Rows[i]["PicId"]),
                    Path         = dt.Rows[i]["PicAddress"].ToString(),
                    ThumpnailPic = dt.Rows[i]["PicThumbnailAddress"].ToString(),
                    Description  = dt.Rows[i]["PicDescription"].ToString(),
                    Lable        = dt.Rows[i]["PicLable"].ToString(),
                    Name         = dt.Rows[i]["PicName"].ToString(),
                };
                Models.Add(model);
            }

            return(Models);
        }
Exemplo n.º 6
0
        public ActionResult RioPicView(int?page)
        {
            string ID     = string.Empty;
            string title  = "PicView";
            string mode   = "V";
            bool   isUser = false;

            if (Request.QueryString.Get("m") != null)
            {
                if (Request.QueryString.Get("m").Equals("E"))
                {
                    title = "PicEdit";
                    mode  = "E";
                }
            }
            ViewBag.title = title;

            ClassNameModel cn = ClassNameModel.getClassName("pic");

            ViewBag.className = cn;

            #region getData
            List <Rio_Pic> data = new List <Rio_Pic>();
            if (Session["UserID"] != null)
            {
                ID   = Session["UserID"].ToString();
                data = PicModel.getUserAllPicByID(ID);
            }

            if (Request.QueryString.Get("vid") != null)
            {
                ID   = Request.QueryString.Get("vid");
                data = PicModel.getUserPicEnableByID(ID);
            }

            if (Session["UserID"] != null && Request.QueryString.Get("vid") != null)
            {
                if (Session["UserID"].ToString().Equals(Request.QueryString.Get("vid")))
                {
                    ID     = Session["UserID"].ToString();
                    isUser = true;
                    data   = PicModel.getUserAllPicByID(ID);
                }
            }

            if (Session["UserID"] == null && Request.QueryString.Get("vid") == null)
            {
                return(RedirectToAction("Login", "Rio_Account", null));
            }

            var pageNumeber = page ?? 1;
            var pageData    = data.ToPagedList(pageNumeber, pageSize);
            ViewBag.vid    = ID;
            ViewBag.mode   = mode;
            ViewBag.isUser = isUser;
            #endregion

            return(View(pageData));
        }
Exemplo n.º 7
0
        public ActionResult SelectCover()
        {
            string UserID = string.Empty;

            if (Session["UserID"] != null)
            {
                UserID = Session["UserID"].ToString();
            }
            ViewBag.Pic = PicModel.getUserPicEnableByID(UserID);

            return(View());
        }
Exemplo n.º 8
0
 public ActionResult ReScaling()//重製縮圖
 {
     if (Session["UserID"] != null)
     {
         string ID = Session["UserID"].ToString();
         if (PicModel.getUserAllPicByID(ID) != null)
         {
             string Message = App_Code.ImageTools.ReScaling(PicModel.getUserAllPicByID(ID));
             Response.Write(App_Code.JS.Alert(Message));
         }
     }
     return(RedirectToAction("RioPicView", "Rio_Pic", new { m = "E" }));
 }
Exemplo n.º 9
0
        protected void loadByJsonData(SdNode config, String json, StateTag state)
        {
            ONode list = null;
            ONode obj  = ONode.tryLoad(json);

            if (obj.isObject)
            {
                list = obj.get("list").asArray();
                String bg = obj.get("bg").getString();

                if (TextUtils.isEmpty(bg) == false)
                {
                    bgUrl = bg;
                }

                if (TextUtils.isEmpty(name))
                {
                    name = obj.get("name").getString();
                    logo = obj.get("logo").getString();
                }
            }
            else
            {
                list = obj;
            }

            foreach (ONode n in list)
            {
                PicModel pic = null;

                if (n.isObject)
                {
                    pic = new PicModel(section(), n.get("url").getString(), n.get("time").getInt(), state.value);
                }
                else
                {
                    pic = new PicModel(section(), n.getString(), 0, state.value);
                }

                pic.cacheID = items.Count;
                doAddItem(pic, state);

                state.value++;
            }
        }
Exemplo n.º 10
0
        public void AddPicModel(PicModel pic)
        {
            var ext          = System.IO.Path.GetExtension(pic.ImgUrl);
            var newPath      = cacheFolder + "\\" + name + "\\" + pic.Index + ext;
            var downloadPath = name + "\\" + System.IO.Path.GetFileName(pic.ImgUrl);

            if (File.Exists(downloadPath))
            {
                pic.localUrl = System.IO.Path.GetFullPath(downloadPath);
            }
            else if (File.Exists(newPath))
            {
                pic.localUrl = System.IO.Path.GetFullPath(newPath);
            }
            else
            {
                Task.Factory.StartNew <string>(() =>
                {
                    int tryNumber = 0;
                    do
                    {
                        try
                        {
                            WebClient client = new WebClient();
                            client.DownloadFile(pic.ImgUrl, newPath);
                            return(newPath);
                        }
                        catch { }
                    } while (tryNumber++ < 3);
                    return(pic.ImgUrl);
                }, TaskCreationOptions.PreferFairness).ContinueWith((x) =>
                {
                    if (x.Status == TaskStatus.RanToCompletion)
                    {
                        pic.localUrl = System.IO.Path.GetFullPath(x.Result);
                    }
                });
            }
            this.pms.Add(pic);
            if (pms.Count == 1)
            {
                ShowPic();
            }
        }
Exemplo n.º 11
0
        public ActionResult Index()
        {
            int    SN     = 0;
            string userID = string.Empty;

            if (Request.QueryString.Get("vid") != null)
            {
                userID = Request.QueryString.Get("vid").ToString();
            }
            Vw_Account rioAccount = AccountModel.getVwAccountByID(userID);

            if (rioAccount != null)
            {
                int.TryParse(rioAccount.SN.ToString(), out SN);

                //使用者設定
                ViewBag.userSetting       = UserIndexSettingMode.getVwUserIndexSettingBySN(SN);
                ViewBag.indexAccountCover = rioAccount.PicPath + rioAccount.PicName;

                //系統相簿、圖片、文件總數
                ViewBag.albumCount = AlbumModel.getUsertVwAlbumEnableListByID(userID).Where(o => o.IsEnable == true).Count();
                ViewBag.picCount   = PicModel.getUserPicEnableByID(userID).Count();
                ViewBag.docCount   = DocModel.getUserDocEnableListByID(userID).Count();

                //系統預覽
                ViewBag.preViewAlbum = AlbumModel.getPreViewAlbumListByID(userID);
                ViewBag.preViewPic   = PicModel.getPreViewPicListByID(userID);
                ViewBag.preViewDoc   = DocModel.getPreviewDocListByID(userID);

                if (Session["UserSN"] != null)
                {
                    int userSN = 0;
                    int.TryParse(Session["UserSN"].ToString(), out userSN);

                    //是否Track
                    ViewBag.userTrack = UserTrackModel.getUserTrackBySN(userSN, SN);

                    //未閱讀通知數量
                    Session["notReadNoticeCount"] = NoticeModel.getNotReadNoticeCountByTrackSN(userSN);
                }
            }
            return(View());
        }
Exemplo n.º 12
0
        private void changeEnablePic(string[] SNArray)
        {
            foreach (var data in SNArray)
            {
                int SN = 0;
                int.TryParse(data.ToString(), out SN);


                Rio_Pic Pic = db.Rio_Pic.Find(SN);
                if (Pic.IsEnable == true)
                {
                    Pic.IsEnable = false;
                }
                else
                {
                    Pic.IsEnable = true;
                }
                PicModel.Update(Pic);
            }
        }
Exemplo n.º 13
0
        private void setDBimg(string ID, string fileName, string upLoadType)
        {
            Rio_Pic Pic = new Rio_Pic();

            Pic.PicName    = fileName;
            Pic.PicPath    = "/Upload/" + ID + "/" + upLoadType + "/";
            Pic.PicContent = string.Empty;
            Pic.HitCount   = 0;
            Pic.CreateID   = ID;
            Pic.CreateName = ID;
            Pic.ModifyID   = ID;
            Pic.ModifyName = ID;

            DateTime dt = DateTime.Now;

            Pic.CreateDate = dt;
            Pic.ModifyDate = dt;

            Pic.IsEnable = true;
            Pic.IsDelete = false;
            PicModel.Insert(Pic);
        }
Exemplo n.º 14
0
        public List <PicModel> GetClients()
        {
            List <PicModel> Models = new List <PicModel>();

            base.Connect();
            DataTable dt = base.Select("SELECT A.[PicId],[PicAddress],[PicThumbnailAddress] FROM [tbl_PicUploader] as A inner join [tbl_PicUse] as B on A.PicId=B.PicId where B.PicUseAs LIKE N'OurClients'");

            base.DC();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var model = new PicModel()
                {
                    PicId        = Convert.ToInt32(dt.Rows[i]["PicId"]),
                    Path         = dt.Rows[i]["PicAddress"].ToString(),
                    ThumpnailPic = dt.Rows[i]["PicThumbnailAddress"].ToString()
                };
                Models.Add(model);
            }

            return(Models);
        }
Exemplo n.º 15
0
 public void GetPicModelAsync(string pageUrl)
 {
     Task.Factory.StartNew(() =>
     {
         var url             = pageUrl;
         var client          = new WebClient();
         var pageSize        = this.GetPageCount(GetPageString(pageUrl));
         List <PicModel> pms = new List <PicModel>();
         Regex reg           = new Regex(@"<div class=""gdtm"".*?<a href=""(.*?)"".*?</div>");
         var ChildReg        = new Regex(@"<div id=""i3"">.*?<img id=""img"" src=""(.*?)"".*?</div>");
         int index           = 0;
         //先读取所有的链接之后再进行下载,可以得到进度
         List <string> links = new List <string>();
         for (var i = 0; i < pageSize; i++)
         {
             var masterPageHtml = client.DownloadString(string.Format(url, i));
             if (reg.IsMatch(masterPageHtml))
             {
                 foreach (Match m in reg.Matches(masterPageHtml))
                 {
                     //解析LINK链接 从新的html中找到Image的地址并且下载图片
                     var downloadClient = new WebClient();
                     var ChildPageHtml  = downloadClient.DownloadString(m.Groups[1].Value);
                     if (ChildReg.IsMatch(ChildPageHtml))
                     {
                         Match mm    = ChildReg.Match(ChildPageHtml);
                         var imgLink = mm.Groups[1].Value;
                         var pm      = new PicModel()
                         {
                             ImgUrl = imgLink, Index = index++
                         };
                         AddPicture?.Invoke(pm);
                     }
                 }
             }
         }
     });
 }
Exemplo n.º 16
0
        private void deletePic(string[] SNArray)
        {
            foreach (var data in SNArray)
            {
                int SN = 0;
                int.TryParse(data.ToString(), out SN);

                //刪除實體檔案
                Rio_Pic Pic = db.Rio_Pic.Find(SN);
                if (System.IO.File.Exists(Server.MapPath(Pic.PicPath + "\\" + Pic.PicName)))
                {
                    System.IO.File.Delete(Server.MapPath(Pic.PicPath + "\\" + Pic.PicName));
                }

                //刪除實體檔案縮圖
                if (System.IO.File.Exists(Server.MapPath(Pic.PicPath + "\\Scaling\\" + Pic.PicName)))
                {
                    System.IO.File.Delete(Server.MapPath(Pic.PicPath + "\\Scaling\\" + Pic.PicName));
                }

                //資料庫更新刪除標記
                PicModel.Delete(Pic);
            }
        }
Exemplo n.º 17
0
 protected abstract void doAddItem(PicModel pic, StateTag state);
Exemplo n.º 18
0
 protected abstract void doAddItem(PicModel pic, StateTag state);
Exemplo n.º 19
0
        protected void loadByJsonData(SdNode config, String json, StateTag state)
        {
            ONode list = null;
            ONode obj = ONode.tryLoad(json);

            if (obj.isObject) {
                list = obj.get("list").asArray();
                String bg = obj.get("bg").getString();

                if (TextUtils.isEmpty(bg) == false) {
                    bgUrl = bg;
                }

                if (TextUtils.isEmpty(name)) {
                    name = obj.get("name").getString();
                    logo = obj.get("logo").getString();
                }

            }
            else {
                list = obj;
            }

            foreach (ONode n in list) {
                PicModel pic = null;

                if (n.isObject) {
                    pic = new PicModel(section(), n.get("url").getString(), n.get("time").getInt(), state.value);
                }
                else {
                    pic = new PicModel(section(), n.getString(), 0, state.value);
                }

                pic.cacheID = items.Count;
                doAddItem(pic, state);

                state.value++;
            }
        }
Exemplo n.º 20
0
        public IndexModel GetData()
        {
            DataTable dt;

            base.Connect();
            ////Sliders
            List <PicModel> Sliders = new List <PicModel>();

            dt = base.Select("SELECT A.[PicId],[PicAddress],[PicThumbnailAddress] FROM [tbl_PicUploader] as A inner join [tbl_PicUse] as B on A.PicId=B.PicId where B.PicUseAs LIKE N'Slider'");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var Slider = new PicModel()
                {
                    PicId        = Convert.ToInt32(dt.Rows[i]["PicId"]),
                    Path         = dt.Rows[i]["PicAddress"].ToString(),
                    ThumpnailPic = dt.Rows[i]["PicThumbnailAddress"].ToString()
                };
                Sliders.Add(Slider);
            }
            ////////Portfolios
            List <PortfolioModel> Portfolios = new List <PortfolioModel>();

            dt = base.Select("SELECT top 4 [P_Id],[Subject],[BackGroundPicId],(SELECT [PicThumbnailAddress] FROM [tbl_PicUploader] where PicId=[BackGroundPicId]) as BackGroundPic,[LogoPicId],(SELECT [PicThumbnailAddress] FROM [tbl_PicUploader] where PicId=[LogoPicId]) as LogoPic ,[Discription],[SEO_KeyWord],[SEO_Discription],[Show_MainPage] FROM [tbl_Portfolio] where [Show_MainPage]=1 AND [Deleted]=0");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var Portfolio = new PortfolioModel()
                {
                    Background_Id   = Convert.ToInt32(dt.Rows[i]["BackGroundPicId"]),
                    Background_Path = dt.Rows[i]["BackGroundPic"].ToString(),
                    Discription     = dt.Rows[i]["Discription"].ToString(),
                    Logo_Path       = dt.Rows[i]["LogoPic"].ToString(),
                    Log_Id          = Convert.ToInt32(dt.Rows[i]["LogoPicId"]),
                    PortfolioId     = Convert.ToInt32(dt.Rows[i]["P_Id"]),
                    SEO_discription = dt.Rows[i]["SEO_Discription"].ToString(),
                    SEO_Keyword     = dt.Rows[i]["SEO_KeyWord"].ToString(),
                    Subject         = dt.Rows[i]["Subject"].ToString(),
                    Show            = Convert.ToInt32(dt.Rows[i]["Show_MainPage"])
                };
                Portfolios.Add(Portfolio);
            }

            ////////Clients
            List <PicModel> Clients = new List <PicModel>();

            dt = base.Select("SELECT top 7 A.[PicId],[PicAddress],[PicThumbnailAddress] FROM [tbl_PicUploader] as A inner join [tbl_PicUse] as B on A.PicId=B.PicId where B.PicUseAs LIKE N'OurClients'");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var C = new PicModel()
                {
                    PicId        = Convert.ToInt32(dt.Rows[i]["PicId"]),
                    Path         = dt.Rows[i]["PicAddress"].ToString(),
                    ThumpnailPic = dt.Rows[i]["PicThumbnailAddress"].ToString()
                };
                Clients.Add(C);
            }

            ////////MainVideo
            MainVideoModel mainVideo = new MainVideoModel();

            ////////MainVideoLink
            dt = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoLink'");
            if (dt.Rows.Count != 0)
            {
                mainVideo.VideoLink = dt.Rows[0]["ItemValue"].ToString();
            }
            else
            {
                mainVideo.VideoLink = "";
            }
            ////////MainVideoSub1
            dt = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoSub1'");
            if (dt.Rows.Count != 0)
            {
                mainVideo.VideoSub1 = dt.Rows[0]["ItemValue"].ToString();
            }
            else
            {
                mainVideo.VideoSub1 = "";
            }
            /////////MainVideoSub2
            dt = base.Select("SELECT [ItemValue] FROM [tbl_SiteProperties] WHERE ItemKey Like N'MainVideoSub2'");
            if (dt.Rows.Count != 0)
            {
                mainVideo.VideoSub2 = dt.Rows[0]["ItemValue"].ToString();
            }
            else
            {
                mainVideo.VideoSub2 = "";
            }
            /////////MainVideoBackground
            dt = base.Select("SELECT A.[PicId] , B.[PicAddress] From [tbl_PicUse] AS A INNER JOIN [tbl_PicUploader]AS B ON A.PicId=B.PicId WHERE A.PicUseAs LIKE N'MainVideoBackground'");
            if (dt.Rows.Count != 0)
            {
                mainVideo.MainVideoBackground_PicId = Convert.ToInt32(dt.Rows[0]["PicId"]);
                mainVideo.MainVideoBackground_Pic   = dt.Rows[0]["PicAddress"].ToString();
            }
            else
            {
                mainVideo.MainVideoBackground_PicId = 0;
                mainVideo.MainVideoBackground_Pic   = "";
            }
            /////////
            ////////VideoLogo
            dt = base.Select("SELECT A.[PicId],[PicAddress],[PicThumbnailAddress] FROM [tbl_PicUploader] as A inner join [tbl_PicUse] as B on A.PicId=B.PicId where B.PicUseAs LIke N'VideoLogo'");
            if (dt.Rows.Count != 0)
            {
                mainVideo.MainVideoLogo_Pic         = dt.Rows[0]["PicAddress"].ToString();
                mainVideo.MainVideoBackground_PicId = Convert.ToInt32(dt.Rows[0]["PicId"]);
            }
            else
            {
                mainVideo.MainVideoLogo_Pic         = "";
                mainVideo.MainVideoBackground_PicId = 0;
            }

            base.DC();

            var model = new IndexModel()
            {
                mainVideo  = mainVideo,
                Clients    = Clients,
                portfolios = Portfolios,
                Sliders    = Sliders
            };

            return(model);
        }
Exemplo n.º 21
0
        protected void loadByJsonData(SdNode config, String json)
        {
            ONode data = ONode.tryLoad(json);

            if (DdSource.isBook(config)) {
                if (TextUtils.isEmpty(shop)) {
                    logo = data.get("logo").getString();
                    name = data.get("name").getString();
                    shop = data.get("shop").getString();
                    intro = data.get("intro").getString();

                    buyUrl = data.get("buyUrl").getString();
                }
            }

            ONode sl = data.get("pictures").asArray();

            foreach (ONode n in sl) {
                PicModel pic = new PicModel(bookUrl, n.getString());

                pictures.Add(pic);
            }
        }