Exemple #1
0
        //Generate Events
        public static string GetFiles(string folderName, string MainFolder, string Group)
        {
            string htmlString = "";

            List <PeraImage> images = CMSActivieies.GetPeraImage(MainFolder);

            //System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(HttpContext.Current.Server.MapPath(folderName));
            //to retrieve aspx files alone
            //System.IO.FileInfo[] fileEntries = di.GetFiles("*.jpg");
            //string[] fileEntries = Directory.GetFiles(Server.MapPath("images/PhotaGallery"));

            DBKOMPDataContext db  = new DBKOMPDataContext();
            PeraImage         obj = new PeraImage();

            obj.Directory = MainFolder;

            foreach (PeraImage fileName in images)
            {
                //htmlString = htmlString + "<div style='margin-left:5px;width:210px;height:210px;float:left'>";

                htmlString = htmlString + "<div style='margin-left:5px;width:180px;height:90px;margin-top:6px'>";
                htmlString = htmlString + "<div style='width:200px;height:90px;overflow:hidden;'  class='BoxPicBG'>";
                htmlString = htmlString + "<div style='margin:0 auto;width:180px;height:90px;overflow:hidden;vertical-align:middle;display:table-cell;' ><a rel='" + Group + "' style='outline: none;' class='fancy' title='" + fileName.Detail + "' href='images/" + MainFolder + "/" + fileName.FileName + "'>";
                htmlString = htmlString + " <img src='images/" + MainFolder + "/thumbs/thumbs_" + fileName.FileName + "' style='border:none;width:180px;height:auto;margin:0 auto' />";
                htmlString = htmlString + " </a></div> </div>";
                htmlString = htmlString + "<p style='margin-left:0px;display:none' >" + fileName.Detail + "</p> </div>";
            }
            return(htmlString);
        }
Exemple #2
0
        //Generate Events
        public static string GetFilesOnEventPage(string folderName, string MainFolder, string Group)
        {
            string htmlString = "";

            List <PeraImage> images = CMSActivieies.GetPeraImageOnEvent(MainFolder);

            //System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(HttpContext.Current.Server.MapPath(folderName));
            //to retrieve aspx files alone
            //System.IO.FileInfo[] fileEntries = di.GetFiles("*.jpg");
            //string[] fileEntries = Directory.GetFiles(Server.MapPath("images/PhotaGallery"));

            DBKOMPDataContext db  = new DBKOMPDataContext();
            PeraImage         obj = new PeraImage();

            obj.Directory = MainFolder;

            int    indx        = 1;
            string floatCss    = "float:left";
            string clearCss    = string.Empty;
            string EventName   = string.Empty;
            string CenterImage = string.Empty;

            foreach (PeraImage fileName in images)
            {
                if (indx == 1)
                {
                    EventName   = (from w in db.PhotoDirectories where w.FolderName == fileName.Directory select w).First().AlbumName;
                    CenterImage = "<img src='images/" + MainFolder + "/" + fileName.FileName + "' style='position:absolute;border:none;width:auto;height:380px;margin:0 auto' />";
                }

                //floatCss = indx%2==0?"float:left":"";
                clearCss = indx % 2 == 0?"<div style='clear:both'></div>":"";
                indx++;
                //htmlString = htmlString + "<div style='margin-left:5px;width:210px;height:210px;float:left'>";

                htmlString = htmlString + "<div style='margin-left:8px;width:90px;height:90px;margin-top:8px;" + floatCss + "'>";
                htmlString = htmlString + "<div style='width:90px;height:90px;overflow:hidden;'  class='BoxPicBG'>";
                //TODO : un commne blow an comment belwo next
                htmlString = htmlString + "<div style='margin:0 auto;width:90px;height:90px;overflow:hidden;vertical-align:middle;display:table-cell;' ><a rel='" + Group + "' style='outline: none;' class='fancy' title='" + fileName.Detail + "' href='images/" + MainFolder + "/" + fileName.FileName + "'>";
                //htmlString = htmlString + "<div style='margin:0 auto;width:90px;height:90px;overflow:hidden;vertical-align:middle;display:table-cell;' ><a rel='" + Group + "' style='outline: none;' class='fancy' title='" + fileName.Detail + "' href='Events.aspx?id=" + fileName.Id + "'>";
                htmlString = htmlString + " <img src='images/" + MainFolder + "/thumbs/thumbs_" + fileName.FileName + "' style='border:none;width:90px;height:90px;margin:0 auto' />";
                htmlString = htmlString + " </a></div> </div>";
                //htmlString = htmlString + "<p style='margin-left:0px;display:none' >" + fileName.Detail + "</p>
                htmlString = htmlString + "</div>";
                htmlString = htmlString + clearCss;
            }

            return(htmlString + "^" + EventName + "^" + CenterImage);
        }
Exemple #3
0
        public static int SaveTitle(string imageFile, string title, string folderName)
        {
            DBKOMPDataContext db = new DBKOMPDataContext();

            lock (db)
            {
                System.Diagnostics.Process.GetCurrentProcess();

                PeraImage obj = new PeraImage();

                PeraImage objUpdated = db.PeraImages.Where(p => (p.Directory == folderName && p.FileName == imageFile)).First();
                objUpdated.Detail = title;

                db.SubmitChanges();
                db.Dispose();
            }
            return(1);
        }
        public static int SaveEventNPics(PeraImage peraImage)
        {
            try
            {
                DBKOMPDataContext db = new DBKOMPDataContext();

                db.PeraImages.InsertOnSubmit(peraImage);


                db.SubmitChanges();
                return(1);
                // Page.ClientScript.RegisterStartupScript(typeof(Page), "sub", "GetFiles();", true);

                // SetFolders();
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Exemple #5
0
        //protected void Images()
        //{
        //    System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(HttpContext.Current.Server.MapPath("images/"+Folders.SelectedItem));
        //    //to retrieve aspx files alone
        //    System.IO.FileInfo[] fileEntries = di.GetFiles("*.jpg");

        //    //string[] fileEntries = Directory.GetFiles(Server.MapPath("images/PhotaGallery"));
        //    foreach (FileInfo fileName in fileEntries)
        //    {
        //        ltrlImage.Text = ltrlImage.Text + "<div id='" + fileName.Name + "' ><a rel='group' class='aaa' title='" + fileName.Name + "' href='../Samples/" + fileName.Name + "'>" +
        //                 "<img src='images/" + Folders.Text + "/" + fileName.Name + "' width='40' height='30' /></a><input id='chk" + fileName.Name + "' type='checkbox' /></div>";

        //    }
        //}

        //protected void Folders_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    Images();
        //}

        protected void btnUpload_Click(object sender, EventArgs e)
        {
            try
            {
                DBKOMPDataContext db = new DBKOMPDataContext();

                // Get the HttpFileCollection
                HttpFileCollection hfc = Request.Files;
                for (int i = 0; i < hfc.Count; i++)
                {
                    PeraImage obj = new PeraImage();
                    obj.Directory = Folders.SelectedItem.ToString();

                    HttpPostedFile hpf = hfc[i];
                    if (hpf.ContentLength > 0)
                    {
                        hpf.SaveAs(Server.MapPath("images/" + Folders.SelectedItem) + "\\" +
                                   System.IO.Path.GetFileName(hpf.FileName));
                        Response.Write("<b>File: </b>" + hpf.FileName + "  <b>Size:</b> " +
                                       hpf.ContentLength + "  <b>Type:</b> " + hpf.ContentType + " Uploaded Successfully <br/>");
                    }

                    obj.FileName = hpf.FileName;
                    obj.Detail   = hpf.FileName.Replace(".jpg", "").Replace(".JPG", "");

                    db.PeraImages.InsertOnSubmit(obj);
                    db.SubmitChanges();
                }

                Page.ClientScript.RegisterStartupScript(typeof(Page), "sub", "GetFiles();", true);

                // SetFolders();
            }
            catch (Exception ex)
            {
            }
        }