コード例 #1
0
        public void SendNewTopicSubscriptionMail(string forumName, string forumTitle, string forumBody, string topicLink)
        {
            var account = new AccountInfo();
            var departmentMapping = DepartmentService.GetDepartmentForumMappings(forumName);
            var result = GetModeratorEmailIds(forumName);

            var employees = ContactsService.GetByDepartmentOrlocation(departmentMapping);

            var departmentMails = employees.Aggregate(string.Empty, (current, subscription) => current + "," + subscription.Email);
            var subscriptionModel = GetAllSubscribedUsers(forumName);

            var mailIds = subscriptionModel.Aggregate(string.Empty, (current, subscription) => current + "," + subscription.EmployeeEmail);
            mailIds = mailIds + "," + departmentMails;
            var distinctWords = new List<string>(mailIds.ToLowerInvariant().Split(',').Distinct());
            
            mailIds = result.Aggregate(
                distinctWords.Where(t => !string.IsNullOrEmpty(t)).Aggregate(string.Empty,
                (current, t) => current + "," + t), 
                (current, moderators) => current.Replace("," + moderators.ToLowerInvariant(), string.Empty));

            var emailHelper = new EmailHelper();
            var paramters = new Dictionary<string, string>
                {
                    {"ForumName", forumName.Trim()},
                    {"TopicName", forumTitle.Trim()},
                    {"TipicLink", topicLink.Trim()},
                    {"ForumBody", forumBody.Trim()},
                    {"CreatedBy", account.GetFullName()},
                    {"Signature", ApplicationConfiguration.EmailSignature}
                };
            if (!string.IsNullOrEmpty(mailIds))
                emailHelper.SendBccMail("", mailIds, "NewTopicSubscription", paramters);
        }
コード例 #2
0
 public ActionResult Index()
 {
     var account = new AccountInfo();
     try
     {
         var profile = ProfileService.GetUserProfile(account.GetUserName());
         string imageFile = AppDomain.CurrentDomain.BaseDirectory + "/content/img/DefaultUser.png";
         var buffer = string.IsNullOrEmpty(profile.ProfilePicture) ? imageFile : profile.ProfilePicture;
         var model = new UserProfileModel()
         {
             FirstName = profile.FirstName,
             LastName = profile.LastName,
             FullName = profile.FullName,
             EmailAddress = profile.EmailAddress,
             MobilePhone = profile.MobilePhone,
             ProfilePicture = buffer,
             Notes = profile.Notes,
             Department = profile.Department,
             JobTitle = profile.JobTitle,
             FullProfileLink = ApplicationConfiguration.ProfileUri
         };
         ViewBag.Title = "My Profile";
         return View(model);
     }
     catch (Exception ex) { throw ex; }
 }
コード例 #3
0
        public ActionResult Index(bool isFirstLoad = false)
        {
            var output = new List<MenuModel>();
            var account = new AccountInfo();
           
            try
            {
                var errorMessage = "";
                if (!SecurityService.ValidLdapUser(account.GetUserName(),out errorMessage))
                    return RedirectToAction("Logout");
                

                var documents = MenuService.GetTopMenu();
                foreach (var model in documents)
                {

                    var menu = new MenuModel() { LibraryName = model.LibraryName, Name = model.Name, FolderPath = model.FolderPath, ControllerName = model.ControllerName, ActionName = model.ActionName, Type = model.Type, ImageSource = model.ImageSource, ToolTip = model.ToolTip };

                    foreach (var child in model.Children)
                    {
                        menu.Children.Add(new MenuModel() { LibraryName = child.LibraryName, Name = child.Name, FolderPath = child.FolderPath, ControllerName = child.ControllerName, ActionName = child.ActionName, Type = child.Type, ToolTip = child.ToolTip });
                    }
                    output.Add(menu);
                }
            }
            catch (Exception) { return RedirectToAction("Logout"); }

            return View(output);
        }
コード例 #4
0
        public ClientContext GetClientContext(bool isLegacy = true,bool isExternalCall = false)
        {
            try
            {
                var account = new AccountInfo();
                if (isExternalCall)
                {
                    Context = new ClientContext(ApplicationConfiguration.ModernSpInsatance)
                    {
                        Credentials = new NetworkCredential(ApplicationConfiguration.SharePointServiceAccount, ApplicationConfiguration.SharePointServiceAccountCredential, ApplicationConfiguration.Domain)
                    };
                }
                else
                {
                    Context = new ClientContext(ApplicationConfiguration.ModernSpInsatance)
                    {
                        Credentials =
                            account.GetCredentials()
                    };
                }
               

                return Context;
            }
            catch (Exception ex) { throw ex; }
        }
コード例 #5
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {

            if (Disable) return;
            var isInvalid = false;

            var account = new AccountInfo();
            var dao = new SecurityDao();

            if (String.IsNullOrEmpty(account.GetUserName()))
                isInvalid = true;
         
            if (!isInvalid)
            {
                var errorMessage = "";
                if (!dao.ValidLdapUser(account.GetUserName(), out errorMessage))
                    isInvalid = true;
            }

            if (isInvalid)
            {
                filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Account", action = "Login", ReturnUrl = filterContext.HttpContext.Request.Url.PathAndQuery }));
                return;
            }

            base.OnActionExecuting(filterContext);
        }
コード例 #6
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var account = new AccountInfo();
            var modules = UserModuleService.GetAllUserModuleByLdapUser(new UserModule() { LdapName = account.GetUserName() });
            var moduleList = ModuleService.GetAllModules();

            var moduleMenuList = new List<UserModuleDetails>();

            foreach (var module in moduleList)
            {
                moduleMenuList.AddRange(from userModule in modules
                    where userModule.ModuleId == module.Id
                    where userModule.IsAdd || userModule.IsEdit || userModule.IsApprover
                    select new UserModuleDetails()
                    {
                        LdapName = userModule.LdapName,
                        ModuleId = userModule.ModuleId, 
                        ModuleName = module.Name,
                        DisplayName = module.DisplayName, 
                        Icon = module.Icon, 
                        IsAdd = userModule.IsAdd, 
                        IsEdit = userModule.IsEdit,
                        IsApprover = userModule.IsApprover
                    });
            }
            filterContext.Controller.ViewBag.ModulesMenu = moduleMenuList;

        }
コード例 #7
0
        public ActionResult Validate(UserLogonModel userModel)
        {

            try
            {
                var account = new AccountInfo();
                var userobj = new User()
                {
                    UserName = userModel.UserName,
                    Password = userModel.Password
                };
                var errorMessage = "";
                if (SecurityService.ValidateCredentials(userobj, out errorMessage))
                {
                    account.SetUserName(userModel.UserName);
                    account.SetUserCredentials(userModel.Password);

                    if (TempData != null && TempData.Count > 0 && TempData.ContainsKey("ReturnURL"))
                    {
                        var returnUrl = TempData["ReturnURL"].ToString();
                        TempData.Clear();
                        var decodedUrl = "";
                        if (!string.IsNullOrEmpty(returnUrl))
                            decodedUrl = Server.UrlDecode(returnUrl);


                        if (Url.IsLocalUrl(decodedUrl))
                        {
                            decodedUrl = decodedUrl.Replace("\\\"", ""); ;
                            decodedUrl = Request.Url.Scheme + "://" + Request.Url.Authority + decodedUrl;
                            return Redirect(decodedUrl);
                        }
                    }

                    return RedirectToAction("Index", "Home");
                }
                if (errorMessage.ToUpper().Equals("LDAPERROR"))
                {
                    ModelState.AddModelError("UserName", _InvalidUser);
                    return View("Login");
                }
                return View("Login");
            }
            catch (System.Runtime.InteropServices.COMException ce)
            {
                ModelState.AddModelError("UserName", ce.Message);
                return View("Login");
            }
            catch (InvalidOperationException ix)
            {
                ModelState.AddModelError("UserName", _InvalidUser);
                ModelState.AddModelError("Password", String.Empty);
                return View("Login");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #8
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var account = new AccountInfo();
            var controller = (((filterContext)).Controller).ToString().Split('.')[
                (((filterContext)).Controller).ToString().Split('.').Length - 1].Replace("Controller","");
            //var currentUser = account.GetUserName();
            var modules = UserModuleService.GetAllUserModuleByLdapUser(new UserModule() { LdapName = account.GetUserName() });
            var moduleList = ModuleService.GetAllModules();

            var moduleMenuList = new List<UserModuleDetails>();

            foreach (var module in moduleList)
            {
                moduleMenuList.AddRange(from userModule in modules
                                        where userModule.ModuleId == module.Id
                                        where userModule.IsAdd || userModule.IsEdit || userModule.IsApprover
                                        select new UserModuleDetails()
                                        {
                                            LdapName = userModule.LdapName,
                                            ModuleId = userModule.ModuleId,
                                            ModuleName = module.Name,
                                            DisplayName = module.DisplayName,
                                            Icon = module.Icon,
                                            IsAdd = userModule.IsAdd,
                                            IsEdit = userModule.IsEdit,
                                            IsApprover = userModule.IsApprover
                                        });
            }
            moduleMenuList.Add(new UserModuleDetails { ModuleName = "LandingPage" });

            var notificationList = NotificationService.GetAllNotificationDetailsList(account.GetFullName());

            filterContext.Controller.ViewBag.NotificationModel = notificationList;

            filterContext.Controller.ViewBag.CountNotifications = notificationList.Count;

            if (moduleMenuList.Any(a => a.ModuleName.ToUpper().Equals(controller.ToUpper())) || controller.ToUpper() == "NOTIFICATION") return;
            filterContext.HttpContext.Response.StatusCode = 401;
            filterContext.Controller.TempData["ErrorMessage"] = "You do not have permission to access this section, Please contact administrator <a href='mailto:[email protected]'>Service Desk</a>";

            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "Error", area = "" }));

            filterContext.HttpContext.Response.Clear();
        }
コード例 #9
0
        public static bool ActiveDirectoryValidation(string userName, DirectoryEntry entry,out string errorMessage)
        {
            errorMessage = "";
            if (String.IsNullOrEmpty(userName)) return false;
            
            var result = false;

            var account = new AccountInfo();
            var search = new DirectorySearcher(entry);
            var extensionAttributesName = ApplicationConfiguration.ActiveDirectoryAttributeName.Split('|');
            var extensionAttributesValue = ApplicationConfiguration.ActiveDirectoryAttributeValue.Split('|');
            search.Filter = "(SAMAccountName=" + userName + ")";
            search.PropertiesToLoad.Add("cn");
            search.PropertiesToLoad.Add("mail");
            search.PropertiesToLoad.Add("department");
            search.PropertiesToLoad.Add("physicalDeliveryOfficeName");
            foreach (string extension in extensionAttributesName)
                search.PropertiesToLoad.Add(extension);

            var searchResult = search.FindOne();

            for (int i = 0; i < extensionAttributesName.Length; i++)
            {
                if (searchResult.Properties[extensionAttributesName[i]].Count == 0)
                {
                    errorMessage = "LDAPError";
                    return false;
                }
                if (searchResult.Properties[extensionAttributesName[i]][0].ToString().ToUpper() == extensionAttributesValue[i].ToString().ToUpper())
                {
                    if (searchResult.Properties["cn"].Count > 0)
                    {
                        account.SetFullName((String)searchResult.Properties["cn"][0]);
                        account.SetEmailAddress((String)searchResult.Properties["mail"][0]);
                        account.SetDepartment((string)searchResult.Properties["department"][0]);
                        account.SetLocation((string)searchResult.Properties["physicalDeliveryOfficeName"][0]);
                        result = true;
                    }
                }
            }

            return result;
        }
コード例 #10
0
        private bool CheckInStatus(string lockUser)
        {
            if (String.Equals(lockUser, String.Empty, StringComparison.CurrentCultureIgnoreCase)) return false;

            var account = new AccountInfo();
            var loginUser = account.GetFullName();
            return (String.Equals(loginUser, lockUser, StringComparison.CurrentCultureIgnoreCase));
        }
コード例 #11
0
ファイル: Helper.cs プロジェクト: Aranjedeath/SpecimenCode
 public static byte[] ReturnProfileImageBytes(string profileImageUrl)
 {
     var account = new AccountInfo();
     var webClient = new WebClient { Credentials = account.GetCredentials() };
     return webClient.DownloadData(Convert.ToString(profileImageUrl));
 }
コード例 #12
0
        private List<DocumentLibraryModel> GetDocumentModel(string folderPath, string libraryName, string sortField, string sortDir, string Type)
        {
            try
            {
                var account = new AccountInfo();
                var docModel = new DocumentLibraryModel() { FolderPath = folderPath, LibraryName = libraryName, SortField = sortField, SortDir = sortDir };
                var docLib = new DocumentLibrary() { FolderPath = docModel.FolderPath, LibraryName = docModel.LibraryName, SortField = docModel.SortField, SortDir = docModel.SortDir };
                var logInUser = account.GetFullName();

                var documents = DocumentLibraryService.GetAllDocuments(docLib);
                var output = new List<DocumentLibraryModel>();

                foreach (var model in documents)
                {
                    output.Add(new DocumentLibraryModel()
                    {
                        Name = model.Name,
                        Description = model.Description,
                        ContentType = model.ContentType,
                        FolderPath = model.FolderPath,
                        LibraryName = model.LibraryName,
                        RelativePath = model.RelativePath,
                        CreatedBy = model.CreatedBy,
                        CreatedDate = model.CreatedDate,
                        LastUpdated = model.LastUpdated,
                        ModifieddBy = model.ModifieddBy,
                        Permission = new SPPermissionModel() { CanAdd = model.Permission.CanAdd, CanDelete = model.Permission.CanDelete },
                        IsOldVersion = model.IsOldVersion,
                        ImgSrc = model.ImgSrc,
                        CheckedOutUserName = model.CheckedOutUserName,
                        IsCheckedoutToLocal = model.IsCheckedoutToLocal,
                        IsCheckedIn = CheckInStatus(model.CheckedOutUserName),
                        IsCheckedOut = CheckOutStatus(model.CheckedOutUserName),
                        LogInUserName = logInUser
                    });
                }

                var permission = DocumentLibraryService.GetPermission(docLib);
                ViewBag.canAdd = permission.Permission.CanAdd;

                return output;
            }
            catch (Exception ex) { throw ex; }
        }
コード例 #13
0
 private ForumsDetailsModel GetForumsDetailsModel(ForumsDetails forums)
 {
     var account = new AccountInfo();
     SetFullNameAndEmail();
     string imageFile = AppDomain.CurrentDomain.BaseDirectory + "/content/img/DefaultUser.png";
     var buffer = string.IsNullOrEmpty(forums.ProfileImgUrl) ? imageFile : forums.ProfileImgUrl;
     return new ForumsDetailsModel()
     {
         Name = forums.Name,
         DisplayName = forums.Name,
         LibraryName = forums.LibraryName,
         FolderPath = forums.FolderPath,
         Body = forums.Body,
         Id = forums.Id,
         CreatedBy = forums.CreatedBy,
         EditedBy = forums.EditedBy,
         CreatedDate = forums.CreatedDate,
         ParentFolderPath = forums.ParentFolderPath,
         TrimmedBody = forums.TrimmedBody,
         Replies = forums.Replies,
         LastUpdated = forums.LastUpdated,
         ModifiedDate = forums.ModifiedDate,
         ParentId = forums.ParentId,
         Permission = new SPPermissionModel() { CanAdd = forums.Permission.CanAdd },
         RootReply = forums.RootReply,
         Type = forums.Type,
         ProfileImgUrl = buffer,
         ForumFullPath = forums.ForumFullPath,
         EmployeeName = account.GetUserName(),  //User.Identity.Name,
         EmployeeEmail = account.GetEmailAddress(),
         IsSubscribed = false
     };
 }
コード例 #14
0
 public ActionResult MyProfile()
 {
     var account = new AccountInfo();
     var userName = account.GetUserName();
     try
     {
         var profile = ProfileService.GetUserProfile(userName);
         userName = userName.ToUpper().Contains(ApplicationConfiguration.Domain.ToUpper())
             ? userName
             : ApplicationConfiguration.Domain + userName.StartWithBackwardSlash();
         string imageFile = AppDomain.CurrentDomain.BaseDirectory + "/content/img/DefaultUser.png";
         var buffer = string.IsNullOrEmpty(profile.ProfilePicture) ? imageFile : profile.ProfilePicture;
         var model = new UserProfileModel()
         {
             FirstName = profile.FirstName,
             LastName = profile.LastName,
             FullName = profile.FullName,
             EmailAddress = profile.EmailAddress,
             MobilePhone = profile.MobilePhone,
             ProfilePicture = buffer,
             Notes = profile.Notes,
             Department = profile.Department,
             JobTitle = profile.JobTitle,
             FullProfileLink = ApplicationConfiguration.ModernProfileUri + "?accountname=" + userName
         };
         ViewBag.Title = "Profile";
         ViewBag.AdvanceSearch = "True";
         return View("Index", model);
     }
     catch (Exception ex) { throw ex; }
 }
コード例 #15
0
        private ForumsDetailsModel ConvertToForumDetailsModel(ForumsDetails forums)
        {
            var account = new AccountInfo();
            var accounType = typeof(AccountInfo);
            account.Department = account.GetDepartment();
            account.physicalDeliveryOfficeName = account.GetLocation();

            var forumDetails = GetForumsDetailsModel(forums);
            var subscription = ForumSubscriptionService.GetAllSubscriptions();
            var departmentForum = ForumActiveDirectoryMappingService.GetForumDepartmentMappings(accounType.GetProperty("Department").Name, account.GetDepartment());
            var locationForum = ForumActiveDirectoryMappingService.GetForumDepartmentMappings(accounType.GetProperty("physicalDeliveryOfficeName").Name, account.GetLocation());

            var nodeIsSubscribed = false;
            foreach (var subscriptionItem in subscription)
            {
                if (subscriptionItem.EmployeeName == account.GetUserName() && subscriptionItem.ForumName == forums.ForumFullPath)
                    nodeIsSubscribed = subscriptionItem.IsSubscribed;
            }
            forumDetails.IsSubscribed = nodeIsSubscribed;
            foreach (var names in departmentForum)
            {
                if (names == forums.ForumFullPath)
                    forumDetails.Department = names;
            }
            foreach (var location in locationForum)
            {
                if (location == forums.ForumFullPath)
                    forumDetails.Department = location;
            }
            forumDetails.CommentCount = forums.CommentCount;
            return forumDetails;
        }
コード例 #16
0
 public string MyName()
 {
     var account = new AccountInfo();
     var profile = ProfileService.GetUserProfile(account.GetUserName());
     return profile.FirstName;
 }
コード例 #17
0
        public void SendReplySubscriptionMail(string forumName, string forumTitle, string forumBody, string topicLink)
        {
            var account = new AccountInfo();
            forumBody = forumBody.Substring(0, 8) + " <b> Reply : </b>" + forumBody.Substring(8, forumBody.Length - 8);
            var departmentMapping = DepartmentService.GetDepartmentForumMappings(forumName);

            var employees = ContactsService.GetByDepartmentOrlocation(departmentMapping);

            var departmentMails = employees.Aggregate(string.Empty, (current, subscription) => current + "," + subscription.Email);
            var subscriptionModel = GetAllSubscribedUsers(forumName);

            var mailIds = subscriptionModel.Aggregate(string.Empty, (current, subscription) => current + "," + subscription.EmployeeEmail);
            mailIds = mailIds + "," + departmentMails;
            var distinctWords = new List<string>(mailIds.ToLowerInvariant().Split(',').Distinct());
            mailIds = distinctWords.Where(t => !string.IsNullOrEmpty(t)).Aggregate(string.Empty, (current, t) => current + "," + t);

            var emailHelper = new EmailHelper();
            var paramters = new Dictionary<string, string>
                {
                    {"ForumTitle", forumName + " : " +forumTitle.Trim()},
                    {"ForumBody", forumBody.Trim()},
                    {"PostedBy", account.GetFullName()},
                    {"TipicLink", topicLink.Trim()},
                    {"Signature", ApplicationConfiguration.EmailSignature}
                };
            if (!string.IsNullOrEmpty(mailIds))
                emailHelper.SendBccMail("", mailIds, "CommentsSubscription", paramters);
        }
コード例 #18
0
 private void SetUserFullName()
 {
     var account = new AccountInfo();
     if (String.IsNullOrEmpty(account.GetFullName()))
         account.SetFullName(SecurityService.GetLoggedInUserName(account.GetUserName()));
 }
コード例 #19
0
 private void SetFullNameAndEmail()
 {
     SetUserFullName();
     var account = new AccountInfo();
     if (String.IsNullOrEmpty(account.GetEmailAddress()))
         account.SetEmailAddress(SecurityService.GetLoggedInUserEmailAddress(account.GetUserName()));
 }
コード例 #20
0
        private void WriteUpdateSubscription(string forumName, string email, string isSubscribed, bool subscribeParentOnly)
        {
            var account = new AccountInfo();
            SetFullNameAndEmail();

            #region Subscription database writing
            if (isSubscribed == "True")
            {
                var output = ConvertToForumDetailsListModel(ForumService.GetListofForums(forumName));
                var forum = new ForumsDetailsModel();
                forum.SubForums.AddRange(output);
                forum = null;
                var names = forumName.ForumSplit();
                foreach (var item in names)
                {
                    forum = (forum == null) ? output.FirstOrDefault(x => x.DisplayName == item) : forum.SubForums.FirstOrDefault(x => x.DisplayName == item);
                }

                var subscriptionModel = new Subscription()
                                        {
                                            CreatedBy = account.GetFullName(),
                                            EmployeeEmail = account.GetEmailAddress(),//email,
                                            EmployeeName = account.GetUserName(), //User.Identity.Name.Replace("\\", "/"),
                                            ForumName = forumName,
                                            IsActive = true,
                                            IsDeleted = false,
                                            IsSubscribed = true,
                                            CreatedDate = DateTime.Now
                                        };
                ForumSubscriptionService.InsertSubscription(subscriptionModel);
                if (!subscribeParentOnly)
                {
                    foreach (var forumItem in forum.SubForums)
                    {
                        subscriptionModel = new Subscription()
                        {
                            CreatedBy = account.GetFullName(),
                            EmployeeEmail = account.GetEmailAddress(),
                            EmployeeName = account.GetUserName(), //User.Identity.Name.Replace("\\", "/"),
                            ForumName = forumItem.ForumFullPath,
                            IsActive = true,
                            IsDeleted = false,
                            IsSubscribed = true,
                            CreatedDate = DateTime.Now
                        };
                        ForumSubscriptionService.InsertSubscription(subscriptionModel);

                        WriteChildForums(forumItem, email);
                    }
                }
                ForumSubscriptionService.SubscriptionRequestMail(forumName.ForumSplit().ForumJoin(), account.GetEmailAddress(), true);
            }
            #endregion

            #region un-Subscription database writing
            else if (isSubscribed == "False" && !subscribeParentOnly)
            {
                var output = ConvertToForumDetailsListModel(ForumService.GetListofForums(forumName));
                var forum = new ForumsDetailsModel();
                forum.SubForums.AddRange(output);
                forum = null;
                var names = forumName.ForumSplit();
                foreach (var item in names)
                {
                    forum = (forum == null) ? output.FirstOrDefault(x => x.DisplayName == item) : forum.SubForums.FirstOrDefault(x => x.DisplayName == item);
                }

                var subscriptionModel = new Subscription()
                {
                    CreatedBy = account.GetFullName(),
                    EmployeeEmail = account.GetEmailAddress(),
                    EmployeeName = account.GetUserName(), //User.Identity.Name.Replace("\\", "/"),
                    ForumName = forumName,
                    IsActive = true,
                    IsDeleted = false,
                    IsSubscribed = true,
                };
                subscriptionModel = ForumSubscriptionService.GetSubscriptions(subscriptionModel);
                if (subscriptionModel != null)
                {
                    subscriptionModel.IsActive = false;
                    subscriptionModel.IsDeleted = true;

                    ForumSubscriptionService.UpdateSubscription(subscriptionModel);
                }
                foreach (var forumItem in forum.SubForums)
                {
                    subscriptionModel = new Subscription()
                    {
                        CreatedBy = account.GetFullName(),
                        EmployeeEmail = account.GetEmailAddress(),
                        EmployeeName = account.GetUserName(), //User.Identity.Name.Replace("\\", "/"),
                        ForumName = forumItem.ForumFullPath,
                        IsActive = true,
                        IsDeleted = false,
                        IsSubscribed = true,
                    };
                    subscriptionModel = ForumSubscriptionService.GetSubscriptions(subscriptionModel);
                    if (subscriptionModel != null)
                    {
                        subscriptionModel.IsActive = false;
                        subscriptionModel.IsDeleted = true;

                        ForumSubscriptionService.UnsubscribeAllSubscriptions(subscriptionModel);
                    }
                    RemoveChildForums(forumItem);
                }
                ForumSubscriptionService.SubscriptionRequestMail(forumName.ForumSplit().ForumJoin(), account.GetEmailAddress(), false);
            }
            #endregion
        }
コード例 #21
0
        public ActionResult Download(string documentName, string libraryName, string folderPath)
        {
            var accountInfo = new AccountInfo();
            var extArr = documentName.Split('.');
            var docWithoutExt = documentName.ReplaceWithEmpty("." + extArr[extArr.Length - 1]);
            var dirPath = ApplicationConfiguration.RemoveDirectoryNFileFromServer.StartWithSlash() + "/";
            var key = Guid.NewGuid();
            var guidFileName = key + "." + extArr[extArr.Length - 1];
            var document = new DocumentLibrary()
            {
                Name = documentName,
                FolderPath = folderPath,
                LibraryName = libraryName,
                LocalDirectoryPath = dirPath,
                GuidDocumentName = guidFileName
            };

            DocumentLibraryService.GetDocuments(document);
            var appKey = new ApplicationKey()
            {
                AppId = Guid.NewGuid(),
                Key = key,
                DocumentName = guidFileName,
                OriginalDocumentName = documentName,
                DocumentPath = dirPath,
                UserName = accountInfo.GetUserName(),
                CreatedDate = DateTime.Now,
                CreatedBy = accountInfo.GetUserName(),
                IsDeleted = false,
                LastUpdatedDate = DateTime.Now,
                LastUpdatedBy = accountInfo.GetUserName(),
                CurrentPage = 1,
                StatusId = (int)ProcessorStatus.UnProcessed
            };
            ApplicationKeyService.InsertApplicationKey(appKey);
            appKey = ApplicationKeyService.GetApplicationKey(appKey);
            appKey.DocumentName = docWithoutExt;

            ViewBag.Folder = appKey.Key.ToString();
            ViewBag.TotalPages = appKey.PageCount;
            ViewBag.DocumentName = appKey.DocumentName;
            return View("Viewer");
        }
コード例 #22
0
        private void RemoveChildForums(ForumsDetailsModel forums)
        {
            var account = new AccountInfo();
            SetFullNameAndEmail();

            foreach (var forumItem in forums.SubForums)
            {
                var subscriptionModel = new Subscription()
                {
                    CreatedBy = account.GetFullName(),
                    EmployeeName = account.GetUserName(), //User.Identity.Name.Replace("\\", "/"),
                    ForumName = forumItem.ForumFullPath,
                    IsActive = true,
                    IsDeleted = false,
                    IsSubscribed = true,
                };
                subscriptionModel = ForumSubscriptionService.GetSubscriptions(subscriptionModel);
                if (subscriptionModel != null)
                {
                    subscriptionModel.IsActive = false;
                    subscriptionModel.IsDeleted = true;
                    ForumSubscriptionService.UpdateSubscription(subscriptionModel);
                }
                if (forumItem.SubForums.Count > 0)
                    RemoveChildForums(forumItem);
            }
        }
コード例 #23
0
        private void WriteChildForums(ForumsDetailsModel forums, string email)
        {
            var account = new AccountInfo();
            SetFullNameAndEmail();
            foreach (var forumItem in forums.SubForums)
            {
                var subscriptionModel = new Subscription()
                 {
                     CreatedBy = account.GetFullName(),
                     EmployeeEmail = account.GetEmailAddress(),
                     EmployeeName = account.GetUserName(), //User.Identity.Name.Replace("\\", "/"),
                     ForumName = forumItem.ForumFullPath,
                     IsActive = true,
                     IsDeleted = false,
                     IsSubscribed = true,
                     CreatedDate = DateTime.Now
                 };
                ForumSubscriptionService.InsertSubscription(subscriptionModel);

                if (forumItem.SubForums.Count > 0)
                    WriteChildForums(forumItem, email);
            }
        }
コード例 #24
0
 public string GetUserName()
 {
     var account = new AccountInfo();
     return SecurityService.GetLoggedInUserName(account.GetUserName());
 }
コード例 #25
0
        public void SendNewTopicMailToModerator(string topicForumPath, string topicTitle, string topicBody, string topicForum, string topicLink)
        {
            var account = new AccountInfo();
            var result = GetModeratorEmailIds(topicForumPath);
            var moderatorEmails = string.Join(",", result);
            var sendMail = new EmailHelper();

            var paramters = new Dictionary<string, string>
                                {
                                    {"TopicTitle", topicTitle.Trim()},
                                    {"TopicBody", topicBody.Trim()},
                                    {"TipicLink", topicLink.Trim()},
                                    {"TopicForum", topicForum },
                                    {"Requestor", account.GetFullName()},
                                    {"Signature", ApplicationConfiguration.EmailSignature}
                                };
            if (!string.IsNullOrEmpty(moderatorEmails))
                sendMail.SendBccMail("", moderatorEmails, "ForumNewTopicRequest", paramters);
        }