Example #1
0
    //---------------------------------------------------------------

    #region ---------------SaveFiles---------------
    //-----------------------------------------------
    //SaveFiles
    //-----------------------------------------------
    protected void SaveFiles(UsersDataEntity UserDataObject)
    {
        #region Save uploaded photo
        //Photo-----------------------------
        if (fuPhoto.HasFile)
        {
            //if has an old photo
            if (!string.IsNullOrEmpty(oldPhotoExtension))
            {
                //Delete old original photo
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoOriginals(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID)) + UsersDataFactory.CreateUserPhotoName(UserDataObject.UserProfileID) + oldPhotoExtension);
                //Delete old Thumbnails
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoNormalThumbs(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID)) + UsersDataFactory.CreateUserPhotoName(UserDataObject.UserProfileID) + MoversFW.Thumbs.thumbnailExetnsion);
                File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoBigThumbs(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID)) + UsersDataFactory.CreateUserPhotoName(UserDataObject.UserProfileID) + MoversFW.Thumbs.thumbnailExetnsion);
            }
            //------------------------------------------------
            //Save new original photo
            fuPhoto.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoOriginals(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID)) + UserDataObject.Photo);
            //Create new thumbnails
            MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_UserDataPhotoNormalThumbs(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID), UsersDataFactory.CreateUserPhotoName(UserDataObject.UserProfileID), fuPhoto.PostedFile, SiteSettings.Photos_NormalThumnailWidth, SiteSettings.Photos_NormalThumnailHeight);
            MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_UserDataPhotoBigThumbs(UserDataObject.OwnerName, UserDataObject.ModuleTypeID, UserDataObject.CategoryID, UserDataObject.UserProfileID), UsersDataFactory.CreateUserPhotoName(UserDataObject.UserProfileID), fuPhoto.PostedFile, SiteSettings.Photos_BigThumnailWidth, SiteSettings.Photos_BigThumnailHeight);
        }
        //------------------------------------------------
        #endregion
    }
Example #2
0
 //-----------------------------------------------
 #endregion
 //-------------------------------------------------------
 #region ---------------SaveFiles---------------
 //-----------------------------------------------
 //SaveFiles
 //-----------------------------------------------
 protected void SaveFiles(UsersDataEntity userdata)
 {
     #region Save uploaded photo
     //Photo-----------------------------
     if (fuPhoto.HasFile)
     {
         //------------------------------------------------
         //Save new original photo
         fuPhoto.PostedFile.SaveAs(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoOriginals(userdata.OwnerName, userdata.ModuleTypeID, userdata.CategoryID, userdata.UserProfileID)) + userdata.Photo);
         //Create new thumbnails
         MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_UserDataPhotoNormalThumbs(userdata.OwnerName, userdata.ModuleTypeID, userdata.CategoryID, userdata.UserProfileID), UsersDataFactory.CreateUserPhotoName(userdata.UserProfileID), fuPhoto.PostedFile, SiteSettings.Photos_NormalThumnailWidth, SiteSettings.Photos_NormalThumnailHeight);
         MoversFW.Thumbs.CreateThumb(DCSiteUrls.GetPath_UserDataPhotoBigThumbs(userdata.OwnerName, userdata.ModuleTypeID, userdata.CategoryID, userdata.UserProfileID), UsersDataFactory.CreateUserPhotoName(userdata.UserProfileID), fuPhoto.PostedFile, SiteSettings.Photos_BigThumnailWidth, SiteSettings.Photos_BigThumnailHeight);
         //-------------------------------------------------------
     }
     #endregion
 }
Example #3
0
    protected void btnDeletePhoto_Click(object sender, EventArgs e)
    {
        if (MoversFW.Components.UrlManager.ChechIsValidParameter("id"))
        {
            Guid            userid          = new Guid(Request.QueryString["id"]);
            UsersDataEntity usersDataObject = UsersDataFactory.GetUsersDataObject(userid, OwnerID);
            if (usersDataObject != null)
            {
                //Photo-----------------------------
                if (!string.IsNullOrEmpty(usersDataObject.PhotoExtension))
                {
                    //Delete old original photo
                    File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoOriginals(usersDataObject.OwnerName, usersDataObject.ModuleTypeID, usersDataObject.CategoryID, usersDataObject.UserProfileID)) + usersDataObject.Photo);
                    //Delete old Thumbnails
                    File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoNormalThumbs(usersDataObject.OwnerName, usersDataObject.ModuleTypeID, usersDataObject.CategoryID, usersDataObject.UserProfileID)) + UsersDataFactory.CreateUserPhotoName(usersDataObject.UserProfileID) + MoversFW.Thumbs.thumbnailExetnsion);
                    File.Delete(DCServer.MapPath(DCSiteUrls.GetPath_UserDataPhotoBigThumbs(usersDataObject.OwnerName, usersDataObject.ModuleTypeID, usersDataObject.CategoryID, usersDataObject.UserProfileID)) + UsersDataFactory.CreateUserPhotoName(usersDataObject.UserProfileID) + MoversFW.Thumbs.thumbnailExetnsion);
                }
                //------------------------------------------------

                trPhotoPreview.Visible = false;
                //-----------------------------

                usersDataObject.PhotoExtension = "";
                bool status = UsersDataFactory.Update(usersDataObject);
                if (status)
                {
                    lblResult.CssClass = "lblResult_Done";
                    lblResult.Text     = Resources.AdminText.DeletingOprationDone;
                }

                else
                {
                    lblResult.CssClass = "lblResult_Faild";
                    lblResult.Text     = Resources.AdminText.DeletingOprationFaild;
                }
            }
        }
    }