/// <summary> /// Creates Messages object by calling Messages data provider create method. /// <example>[Example]bool status=MessagesFactory.Create(msg);.</example> /// </summary> /// <param name="msg">The Messages object.</param> /// <returns>Status of create operation.</returns> public static bool Create(MessagesEntity msg, bool createMsgFolder) { //Insert user name------------------------------------------ string username = ""; if (HttpContext.Current.User.Identity.IsAuthenticated) { username = HttpContext.Current.User.Identity.Name; msg.InsertUserName = username; } //---------------------------------------------------------- bool status = MessagesSqlDataPrvider.Instance.Create(msg); //------------------------------------- if (status && createMsgFolder) { // Create msg folder string folder = DCSiteUrls.GetPath_MessagesDirectory(msg.OwnerName, msg.ModuleTypeID, msg.CategoryID, msg.MessageID); string folderPhysicalPath = DCServer.MapPath(folder); if (!Directory.Exists(folderPhysicalPath)) { string defaultFolder = DCSiteUrls.GetPath_DefaultMessageFolder(); string defaultFolderPhysicalPath = DCServer.MapPath(defaultFolder); DirectoryInfo diSource = new DirectoryInfo(defaultFolderPhysicalPath); DirectoryInfo diTarget = new DirectoryInfo(folderPhysicalPath); DcDirectoryManager.CopyAll(diSource, diTarget); } } //------------------------------------- return(status); }