Example #1
0
        /*
         * public string GetFileName()
         * {
         *  return Files.GetFileName(_FileExtension, File, FileIdentifre, _FileID);
         * }
         */

        public string GetFilePath()
        {
            if (_FileExtension.Length > 0)
            {
                string FileName = File;
                string path     = DCSiteUrls.GetPath_ItemsFiles(OwnerName, ModuleTypeID, CategoryID, ItemID) + FileName;
                string realPath = string.Format(path, ItemID.ToString());
                return(realPath);
            }
            else
            {
                return("");
            }
        }
Example #2
0
 public string GetPhotoPath(PhotoTypes photo)
 {
     if (_FileExtension.Length > 0)
     {
         string photoName = GetPhotoName(photo);
         string path      = DCSiteUrls.GetPath_ItemsFiles(OwnerName, ModuleTypeID, CategoryID, ItemID) + photoName;
         string realPath  = string.Format(path, ItemID.ToString());
         return(realPath);
     }
     else
     {
         return(SiteDesign.NoPhotoPath);
     }
 }
Example #3
0
    //-----------------------------------------------
    #endregion

    #region ---------------SaveFiles---------------
    //-----------------------------------------------
    //SaveFiles
    //-----------------------------------------------
    protected void SaveFiles(ItemsEntity itemsObject)
    {
        #region Save uploaded photo
        //Photo-----------------------------
        if (fuPhoto.HasFile)
        {
            //------------------------------------------------
            //Save new original photo
            fuPhoto.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_ItemsPhotoOriginals(itemsObject.OwnerName, itemsObject.ModuleTypeID, itemsObject.CategoryID, itemsObject.ItemID)) + itemsObject.Photo);
            //Create new thumbnails
            MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_ItemsPhotoNormalThumbs(itemsObject.OwnerName, itemsObject.ModuleTypeID, itemsObject.CategoryID, itemsObject.ItemID), ItemsFactory.CreateItemsPhotoName(itemsObject.ItemID), fuPhoto.PostedFile, SiteSettings.Photos_NormalThumnailWidth, SiteSettings.Photos_NormalThumnailHeight);
            MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_ItemsPhotoBigThumbs(itemsObject.OwnerName, itemsObject.ModuleTypeID, itemsObject.CategoryID, itemsObject.ItemID), ItemsFactory.CreateItemsPhotoName(itemsObject.ItemID), fuPhoto.PostedFile, SiteSettings.Photos_BigThumnailWidth, SiteSettings.Photos_BigThumnailHeight);
            //-------------------------------------------------------
        }
        #endregion

        #region Save uploaded file
        //File-----------------------------
        if (fuFile.HasFile)
        {
            //Save new original file
            fuFile.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_ItemsFiles(itemsObject.OwnerName, itemsObject.ModuleTypeID, itemsObject.CategoryID, itemsObject.ItemID)) + itemsObject.File);
        }
        #endregion

        #region Save uploaded video
        //Video-----------------------------
        if (fuVideo.HasFile)
        {
            fuVideo.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_ItemsFiles(itemsObject.OwnerName, itemsObject.ModuleTypeID, itemsObject.CategoryID, itemsObject.ItemID)) + itemsObject.Video);
        }
        #endregion

        #region Save uploaded audio
        //Audio-----------------------------
        if (fuAudio.HasFile)
        {
            fuAudio.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_ItemsFiles(itemsObject.OwnerName, itemsObject.ModuleTypeID, itemsObject.CategoryID, itemsObject.ItemID)) + itemsObject.Audio);
        }
        #endregion

        #region Save uploaded photo2
        //-------------------------------------------------------------------------------------
        //Photo2-----------------------------
        if (fuPhoto2.HasFile)
        {
            fuPhoto2.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_ItemsFiles(itemsObject.OwnerName, itemsObject.ModuleTypeID, itemsObject.CategoryID, itemsObject.ItemID)) + itemsObject.Photo2);
        }
        #endregion
    }
Example #4
0
        //------------------------------------------
        #endregion

        #region --------------GetItemsPhotoThumbnail--------------
        public static string GetPhotoThumbnail(object photoID, object photoExtension, int width, int height, object ownerName, object ModuleTypeID, object CategoryID, object ItemID)
        {
            if (photoExtension.ToString().Length > 0)
            {
                string photoName = Photos.GetPhotoName((string)photoExtension, PhotoTypes.Big, ItemsFilesEntity.FileIdentifre, (int)photoID);
                string path      = DCSiteUrls.GetPath_ItemsFiles((string)ownerName, (int)ModuleTypeID, (int)CategoryID, (int)ItemID) + photoName;

                //return DCSiteUrls.GetPath_ItemsPhotoNormalThumbs ((string)ownerName) + CreateItemsPhotoName((int)itemID) + MoversFW.Thumbs.thumbnailExetnsion;
                return("/Thumbnails/Maker1.aspx?file=" + path + "&W=" + width + "&H=" + height);
            }
            else
            {
                return(SiteDesign.NoPhotoPath);
            }
        }
Example #5
0
        public static string GetPhotoPath(PhotoTypes photo, object _PhotoID, object _photoExtension, object ownerName, object ModuleTypeID, object CategoryID, object ItemID)
        {
            if (((string)_photoExtension).Length > 0)
            {
                string photoName = Photos.GetPhotoName((string)_photoExtension, photo, FileIdentifre, (int)_PhotoID);

                string path     = DCSiteUrls.GetPath_ItemsFiles((string)ownerName, (int)ModuleTypeID, (int)CategoryID, (int)ItemID) + photoName;
                string realPath = string.Format(path, _PhotoID.ToString());
                return(realPath);
            }
            else
            {
                return(SiteDesign.NoPhotoPath);
            }
        }
Example #6
0
        public static string GetFilePath(object _FileID, object _FileExtension, object ownerName, object ModuleTypeID, object CategoryID, object ItemID)
        {
            if (((string)_FileExtension).Length > 0)
            {
                string FileName = FileIdentifre + _FileID.ToString() + _FileExtension.ToString();

                string path     = DCSiteUrls.GetPath_ItemsFiles((string)ownerName, (int)ModuleTypeID, (int)CategoryID, (int)ItemID) + FileName;
                string realPath = string.Format(path, _FileID.ToString());
                return(realPath);
            }
            else
            {
                //return Files.GetNoFilePath(File);
                return("");
            }
        }
Example #7
0
    //-----------------------------------------------
    //btnSave_Click
    //-----------------------------------------------
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
        {
            if (!Page.IsValid)
            {
                return;
            }
            int              itemID     = Convert.ToInt32(Request.QueryString["ID"]);
            ItemsEntity      item       = ItemsFactory.GetObject(itemID, Languages.Unknowen, UsersTypes.Admin, OwnerID);
            ItemsFilesEntity ItemsFiles = new ItemsFilesEntity();
            ItemsFiles.ItemID = itemID;
            //-------------
            ItemsFiles.FileExtension = Path.GetExtension(fuPhoto.FileName);
            //-----------------------------------------------------------------
            ItemsFiles.FileType = FileType;
            //-----------------------------------------------------------------
            ItemsFiles.CategoryID   = item.CategoryID;
            ItemsFiles.ModuleTypeID = item.ModuleTypeID;
            ItemsFiles.OwnerName    = item.OwnerName;
            ItemsFiles.OwnerID      = OwnerID;
            //-----------------------------------------------------------------
            bool status = ItemsFilesFactory.Create(ItemsFiles);
            if (status)
            {
                //Photo-----------------------------
                if (fuPhoto.HasFile)
                {
                    string filesPath = DCSiteUrls.GetPath_ItemsFiles(ItemsFiles.OwnerName, ItemsFiles.ModuleTypeID, ItemsFiles.CategoryID, ItemsFiles.ItemID);

                    fuPhoto.SaveAs(DCServer.MapPath(filesPath + ItemsFiles.Photo));
                }
                lblResult.CssClass = "lblResult_Done";
                lblResult.Text     = Resources.AdminText.SavingDataSuccessfuly;
                LoadList();
                //ClearControls();
            }
            else
            {
                lblResult.CssClass = "lblResult_Faild";
                lblResult.Text     = Resources.AdminText.SavingDataFaild;
            }
        }
    }
Example #8
0
        //------------------------------------------
        #endregion

        public static void DeleteFiles(ItemsFilesEntity itemFile)
        {
            HttpContext context = HttpContext.Current;

            //ItemsEntity item = ItemsFactory.GetObject(itemFile.ItemID,
            //-----------------------------
            if (!string.IsNullOrEmpty(itemFile.FileExtension))
            {
                if (itemFile.FileType == ItemFileTypes.Photo)
                {
                    //Delete old Thumbnails
                    File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_ItemsFiles(itemFile.OwnerName, itemFile.ModuleTypeID, itemFile.CategoryID, itemFile.ItemID)) + itemFile.GetPhotoName(PhotoTypes.Thumb));
                }
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_ItemsFiles(itemFile.OwnerName, itemFile.ModuleTypeID, itemFile.CategoryID, itemFile.ItemID)) + itemFile.GetPhotoName(PhotoTypes.Big));
                //------------------------------------------------
            }
            //Delete old original photo
            File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_ItemsFiles(itemFile.OwnerName, itemFile.ModuleTypeID, itemFile.CategoryID, itemFile.ItemID)) + itemFile.File);
        }
Example #9
0
    //-----------------------------------------------
    //btnSave_Click
    //-----------------------------------------------
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }
        int itemID = Convert.ToInt32(ddlItems.SelectedValue);

        ItemsEntity      item     = ItemsFactory.GetObject(itemID, Languages.Unknowen, UsersTypes.Admin, OwnerID);
        ItemsFilesEntity itemFile = new ItemsFilesEntity();

        itemFile.ItemID       = itemID;
        itemFile.Title        = txtTitle.Text;
        itemFile.ModuleTypeID = ModuleTypeID;
        //-----------------------------------------------------------------
        itemFile.CategoryID   = item.CategoryID;
        itemFile.ModuleTypeID = item.ModuleTypeID;
        itemFile.OwnerName    = item.OwnerName;
        itemFile.OwnerID      = OwnerID;
        //-----------------------------------------------------------------
        if (fuPhoto.HasFile)
        {
            if (FileType == ItemFileTypes.Photo)
            {
                if (!MoversFW.Photos.CheckIsImage(fuPhoto.PostedFile))
                {
                    lblResult.CssClass = "lblResult_Faild";
                    lblResult.Text     = Resources.AdminText.InvalidPhotoFile;
                    return;
                }
            }
        }
        itemFile.FileExtension = Path.GetExtension(fuPhoto.FileName);
        //-----------------------------------------------------------------
        itemFile.FileType = FileType;
        bool status = ItemsFilesFactory.Create(itemFile);

        if (status)
        {
            //Photo-----------------------------
            if (fuPhoto.HasFile)
            {
                string photosPath = DCSiteUrls.GetPath_ItemsFiles(itemFile.OwnerName, itemFile.ModuleTypeID, itemFile.CategoryID, itemFile.ItemID);
                if (FileType == ItemFileTypes.Photo)
                {
                    //-----------------------------------
                    //Photos.SavePhotos(fuPhoto, ItemsFiles, photosPath);
                    //------------------------------------------------
                    //Save new original photo
                    fuPhoto.PostedFile.SaveAs(DCServer.MapPath(photosPath) + itemFile.GetPhotoName(PhotoTypes.Original));
                    //Create new thumbnails
                    MoversFW.Thumbs.CreateThumb(photosPath, itemFile.GetPhotoName(PhotoTypes.Thumb), fuPhoto.PostedFile, SiteSettings.Photos_NormalThumnailWidth, SiteSettings.Photos_NormalThumnailHeight);
                    MoversFW.Thumbs.CreateThumb(photosPath, itemFile.GetPhotoName(PhotoTypes.Big), fuPhoto.PostedFile, SiteSettings.Photos_BigThumnailWidth, SiteSettings.Photos_BigThumnailHeight);
                    //------------------------------------------------
                }
                else
                {
                    fuPhoto.SaveAs(DCServer.MapPath(photosPath + itemFile.Photo));
                }
            }
            lblResult.CssClass = "lblResult_Done";
            lblResult.Text     = Resources.AdminText.SavingDataSuccessfuly;
            LoadList();
            //ClearControls();
        }
    }