public string HandlePersonProfilePicture(string picturename, long PersonId, long aid) { if (!string.IsNullOrEmpty(picturename)) { var model = _AttachmentBAL.TMS_Attachment_GetSingleByIdAndTypeBAL(aid); _AttachmentBAL.TMS_Attachment_CompletedProfileLogoBAL(new TMS_Attachments { CompletedDate = DateTime.Now, ID = aid, OpenID = PersonId, OpenType = 1 }); return(model.FilePath.Replace("~/", "") + model.FileName); } return("/images/i/people.png"); }
public string HandleOrganizationIndexLogo(string picturename, long OrganizationId, long aid)//handle in case of new is created { if (!string.IsNullOrEmpty(picturename)) { var _aatchedFromDB = _AttachmentBAL.TMS_Attachment_GetSingleByIdAndTypeBAL(aid); var newparentroot = DateTime.Now.Ticks.ToString(); var physicalPath = Path.Combine(Server.MapPath("~/UploadTempFolder")); string strSource = physicalPath + "/" + _aatchedFromDB.FileParentRootFolder + "/" + _aatchedFromDB.FileName; string targetString = "~/Attachment/TMS/Organization/" + OrganizationId + "/Profile/" + newparentroot + "/"; string targetSource = Utility.CreateDirectory(Path.Combine(Server.MapPath(targetString))) + _aatchedFromDB.FileName; Utility.MoveAttachment(strSource, targetSource, false); System.IO.DirectoryInfo di = new DirectoryInfo(physicalPath + "/" + _aatchedFromDB.FileParentRootFolder); di.Delete(); _AttachmentBAL.TMS_Attachment_CompletedOrganizationLogoBAL(new TMS_Attachments { CompletedDate = DateTime.Now, ID = aid, OpenID = OrganizationId, OpenType = 2, FileParentRootFolder = newparentroot, FilePath = targetString }); var model = _AttachmentBAL.TMS_Attachment_GetSingleByIdAndTypeBAL(aid); return(model.FilePath.Replace("~/", "") + model.FileName); } return("/images/i/people.png"); }
internal void RemoveTMSFileFromDiskLogoOnly(long aid) { var model = _AttachmentBAL.TMS_Attachment_GetSingleByIdAndTypeBAL(aid); string targetPath = model.FilePath; var fileName = model.FileName; var physicalPath = Path.Combine(Server.MapPath(targetPath)); if (System.IO.File.Exists(physicalPath + "/" + fileName)) { System.IO.File.Delete(physicalPath + "/" + fileName); TMS_Attachments _Attachments = new TMS_Attachments { UpdatedBy = CurrentUser.NameIdentifierInt64, UpdatedDate = DateTime.Now, ID = aid }; _AttachmentBAL.TMS_Attachment_DeleteBAL(_Attachments); System.IO.DirectoryInfo di = new DirectoryInfo(physicalPath); di.Delete(); } }