public async Task <IActionResult> AddEditJournalItem(int id)
        {
            var taskCode = await Task.FromResult(0);

            JournalItem    journalItem    = null;
            GeneralJournal generalJournal = null;

            if (id != 0)
            {
                // get journal item for edit
            }
            else
            {
                journalItem = new JournalItem();

                object tempDataJournal = null;
                if (TempData.TryGetValue("GeneralJournal", out tempDataJournal) == true)
                {
                    generalJournal = JsonConvert.DeserializeObject <GeneralJournal>((string)tempDataJournal);
                }

                journalItem.JournalId = generalJournal != null ? generalJournal.Id : 0;
            }

            var serializeObject = JsonConvert.SerializeObject(generalJournal);

            TempData["GeneralJournal"] = serializeObject;

            return(PartialView("~/Views/GeneralJournals/_FormJournalItem.cshtml", journalItem));
        }
        public void AddTopicToJournal(int PortalId, int ModuleId, int ForumId, int TopicId, int UserId, string URL, string Subject, string Summary, string Body, int SecurityOption, string ReadRoles, int SocialGroupId)
        {
            var ji = new JournalItem
            {
                PortalId  = PortalId,
                ProfileId = UserId,
                UserId    = UserId,
                Title     = Subject,
                ItemData  = new ItemData {
                    Url = URL
                }
            };

            if (string.IsNullOrEmpty(Summary))
            {
                Summary = Utilities.StripHTMLTag(Body);
                if (Summary.Length > 150)
                {
                    Summary = Summary.Substring(0, 150) + "...";
                }
            }
            ji.Summary       = Summary;
            ji.Body          = Utilities.StripHTMLTag(Body);
            ji.JournalTypeId = 5;
            ji.ObjectKey     = string.Format("{0}:{1}", ForumId.ToString(), TopicId.ToString());
            if (JournalController.Instance.GetJournalItemByKey(PortalId, ji.ObjectKey) != null)
            {
                JournalController.Instance.DeleteJournalItemByKey(PortalId, ji.ObjectKey);
            }
            string roles = string.Empty;

            if (!(string.IsNullOrEmpty(ReadRoles)))
            {
                if (ReadRoles.Contains("|"))
                {
                    roles = ReadRoles.Substring(0, ReadRoles.IndexOf("|", StringComparison.Ordinal) - 1);
                }
            }

            foreach (string s in roles.Split(';'))
            {
                if ((s == "-1") | (s == "-3"))
                {
                    /* cjh - securityset was null and throwing an error, thus journal items weren't added */
                    if ((ji.SecuritySet != null) && !(ji.SecuritySet.Contains("E,")))
                    {
                        ji.SecuritySet += "E,";
                    }
                }
                else
                {
                    ji.SecuritySet += "R" + s + ",";
                }
            }
            if (SocialGroupId > 0)
            {
                ji.SocialGroupId = SocialGroupId;
            }
            JournalController.Instance.SaveJournalItem(ji, -1);
        }
Example #3
0
        public void AddAnnouncementToJournal(AnnouncementInfo announcement, String journalType, ModuleInfo moduleInfo)
        {
            var objJournalType = JournalController.Instance.GetJournalType(journalType);

            var journalItem = new JournalItem
            {
                PortalId      = announcement.PortalID,
                ProfileId     = announcement.LastModifiedByUserID,
                UserId        = announcement.LastModifiedByUserID,
                ContentItemId = announcement.ContentItemID,
                Title         = announcement.Title
            };
            var data = new ItemData
            {
                Url = announcement.Permalink()
            };

            journalItem.ItemData      = data;
            journalItem.Summary       = HtmlUtils.Shorten(HtmlUtils.Clean(System.Web.HttpUtility.HtmlDecode(announcement.Description), false), 250, "...");
            journalItem.Body          = announcement.Description;
            journalItem.JournalTypeId = objJournalType.JournalTypeId;
            journalItem.SecuritySet   = "E,";

            JournalController.Instance.SaveJournalItem(journalItem, moduleInfo);
        }
Example #4
0
        public int AddFoodUsage(JournalItemModel foodUsageModel)
        {
            var portions = foodUsageModel.portions.Select(portionModel => new Portion
            {
                Size       = portionModel.size,
                UnitId     = portionModel.unit.id,
                BreadUnits = portionModel.breadUnits,
                ProductId  = portionModel.product.id
            }).ToList();

            using (var context = new EasyScheduleDatabaseEntities())
            {
                var newFoodUsage = new JournalItem
                {
                    JournalItemTypeId = (int)Enums.JournalItemTypes.FoodUsage,
                    FoodUsageTypeId   = foodUsageModel.foodUsageType.id,
                    Time     = foodUsageModel.time,
                    Value    = foodUsageModel.value,
                    Portions = portions
                };
                context.JournalItems.Add(newFoodUsage);
                context.SaveChanges();
                return(newFoodUsage.Id);
            }
        }
Example #5
0
        internal string GetJournalTemplate(string journalType, JournalItem ji)
        {
            string template = Services.Localization.Localization.GetString("journal_" + journalType, resxPath);

            if (String.IsNullOrEmpty(template))
            {
                template = Services.Localization.Localization.GetString("journal_generic", resxPath);
            }

            template = Regex.Replace(template, "\\[BaseUrl\\]", url, RegexOptions.IgnoreCase);
            template = template.Replace("[journalitem:action]", Services.Localization.Localization.GetString(journalType + ".Action", resxPath));
            string pattern     = "{CanComment}(.*?){/CanComment}";
            string replacement = string.Empty;

            if (CurrentUser.UserID > 0 && SocialGroupId <= 0)
            {
                replacement = "$1";
            }
            if (CurrentUser.UserID > 0 && ji.SocialGroupId > 0)
            {
                if (CurrentUser.IsInRole(ji.JournalOwner.Name))
                {
                    replacement = "$1";
                }
                else
                {
                    replacement = string.Empty;
                }
            }
            template = Regex.Replace(template, pattern, replacement, RegexOptions.IgnoreCase);

            return(template);
        }
Example #6
0
        /// <summary>
        /// Informs the core journal that the user has voted for a post (positive or negative).
        /// </summary>
        /// <param name="objPost"></param>
        /// <param name="title"></param>
        /// <param name="voteId"></param>
        /// <param name="summary"></param>
        /// <param name="portalId"></param>
        /// <param name="journalUserId"></param>
        /// <param name="url"></param>
        /// <remarks>Do not send flagged posts to this method (they are technically 'votes'), keep those out of the journal.</remarks>
        internal void AddVoteToJournal(PostInfo objPost, int voteId, string title, string summary, int portalId, int journalUserId, string url)
        {
            var objectKey = Constants.ContentTypeName + "_" + Constants.JournalVoteTypeName + "_" + string.Format("{0}:{1}", objPost.ModuleID, voteId);
            var ji        = JournalController.Instance.GetJournalItemByKey(portalId, objectKey);

            if ((ji != null))
            {
                JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey);
            }

            ji = new JournalItem
            {
                PortalId      = portalId,
                ProfileId     = journalUserId,
                UserId        = journalUserId,
                ContentItemId = objPost.ContentItemId,
                Title         = title,
                ItemData      = new ItemData {
                    Url = url
                },
                Summary       = summary,
                Body          = null,
                JournalTypeId = GetVoteJournalTypeID(portalId),
                ObjectKey     = objectKey,
                SecuritySet   = "E,"
            };

            JournalController.Instance.SaveJournalItem(ji, objPost.TabID);
        }
Example #7
0
        public static void CreateJournalEntry(RoleInfo roleInfo, UserInfo createdBy)
        {
            var    journalController = JournalController.Instance;
            var    journalItem       = new JournalItem();
            string url = "";

            if (roleInfo.Settings.ContainsKey("URL"))
            {
                url = roleInfo.Settings["URL"];
            }
            journalItem.PortalId  = roleInfo.PortalID;
            journalItem.ProfileId = createdBy.UserID;
            journalItem.UserId    = createdBy.UserID;
            journalItem.Title     = roleInfo.RoleName;
            journalItem.ItemData  = new ItemData {
                Url = url
            };
            journalItem.SocialGroupId = roleInfo.RoleID;
            journalItem.Summary       = roleInfo.Description;
            journalItem.Body          = null;
            journalItem.JournalTypeId = journalController.GetJournalType("groupcreate").JournalTypeId;
            journalItem.ObjectKey     = string.Format("groupcreate:{0}:{1}", roleInfo.RoleID.ToString(CultureInfo.InvariantCulture), createdBy.UserID.ToString(CultureInfo.InvariantCulture));
            if ((journalController.GetJournalItemByKey(roleInfo.PortalID, journalItem.ObjectKey) != null))
            {
                journalController.DeleteJournalItemByKey(roleInfo.PortalID, journalItem.ObjectKey);
            }
            journalItem.SecuritySet = string.Empty;
            if (roleInfo.IsPublic)
            {
                journalItem.SecuritySet += "E,";
            }
            journalController.SaveJournalItem(journalItem, -1);
        }
Example #8
0
        /// <summary>
        /// Informs the core journal that the user has earned a new privilege.
        /// </summary>
        /// <param name="objPrivilege"></param>
        /// <param name="title"></param>
        /// <param name="summary"></param>
        /// <param name="portalId"></param>
        /// <param name="tabId"></param>
        /// <param name="journalUserId"></param>
        /// <param name="url"></param>
        internal void AddPrivilegeToJournal(QaSettingInfo objPrivilege, string title, string summary, int portalId, int tabId, int journalUserId, string url)
        {
            var objectKey = Constants.ContentTypeName + "_" + Constants.JournalPrivilegeTypeName + "_" + objPrivilege.Key;
            var ji        = JournalController.Instance.GetJournalItemByKey(portalId, objectKey);

            if ((ji != null))
            {
                JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey);
            }

            ji = new JournalItem
            {
                PortalId  = portalId,
                ProfileId = journalUserId,
                UserId    = journalUserId,
                Title     = title,
                ItemData  = new ItemData {
                    Url = url
                },
                Summary       = "", // summary,
                Body          = null,
                JournalTypeId = GetPrivilegeJournalTypeID(portalId),
                ObjectKey     = objectKey,
                SecuritySet   = "E,"
            };

            JournalController.Instance.SaveJournalItem(ji, tabId);
        }
Example #9
0
        /// <summary>
        /// Informs the core journal that the user has created an item
        /// </summary>
        /// <param name="objEntity"></param>
        /// <param name="tabId"></param>
        /// <param name="title"></param>
        /// <param name="portalId"></param>
        /// <param name="journalUserId"></param>
        /// <param name="url"></param>
        /// <remarks>This may need to be updated based on what you intent to send to the jorunal.</remarks>
        internal void AddItemToJournal(EntityInfo objEntity, int tabId, string title, int portalId, int journalUserId, string url)
        {
            var objectKey = Constants.ContentTypeName + "_" + Constants.JournalSocialModuleTypeName + "_" + string.Format("{0}:{1}", objEntity.Id, portalId);
            var ji        = JournalController.Instance.GetJournalItemByKey(portalId, objectKey);

            if ((ji != null))
            {
                JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey);
            }

            ji = new JournalItem
            {
                PortalId  = portalId,
                ProfileId = journalUserId,
                UserId    = journalUserId,
                //SocialGroupId = objEntity.GroupId,
                //ContentItemId = objEntity.ContentItemId,
                Title    = title,
                ItemData = new ItemData {
                    Url = url
                },
                //Summary = objEntity.Details,
                Body          = null,
                JournalTypeId = GetCreateEventJournalType(portalId),
                ObjectKey     = objectKey,
                SecuritySet   = "E,"
            };

            //if (objEntity.GroupId > Null.NullInteger) ji.SocialGroupId = objEntity.GroupId;

            JournalController.Instance.SaveJournalItem(ji, tabId);
        }
Example #10
0
        internal string GetCommentAreaHTML(JournalItem journal, IList <CommentInfo> comments)
        {
            if (journal.CommentsHidden)
            {
                return(string.Empty);
            }
            var sb = new StringBuilder();

            sb.AppendFormat("<ul class=\"jcmt\" id=\"jcmt-{0}\">", journal.JournalId);
            foreach (CommentInfo ci in comments)
            {
                if (ci.JournalId == journal.JournalId)
                {
                    sb.Append(GetCommentRow(journal, ci));
                }
            }
            if (CurrentUser.UserID > 0 && !journal.CommentsDisabled)
            {
                sb.AppendFormat("<li id=\"jcmt-{0}-txtrow\" class=\"cmteditarea\">", journal.JournalId);
                sb.AppendFormat("<textarea id=\"jcmt-{0}-txt\" class=\"cmteditor\"></textarea>", journal.JournalId);
                sb.Append("<div class=\"editorPlaceholder\">{resx:leavecomment}</div></li>");
                sb.Append("<li class=\"cmtbtn\">");
                sb.Append("<a href=\"#\">{resx:comment}</a></li>");
            }

            sb.Append("</ul>");
            return(sb.ToString());
        }
Example #11
0
        /// <summary>
        /// Informs the core journal that the user has added a new task.
        /// </summary>
        /// <param name="objCard"></param>
        /// <param name="title"></param>
        /// <param name="summary"></param>
        /// <param name="portalId"></param>
        /// <param name="journalUserId"></param>
        /// <param name="url"></param>
        internal void AddTaskToJournal(int profileid, int userid, int contentitemid,
                                       string objectKey, string title, string summary, string url,
                                       int portalid, int tabid, JournalSecurity security)
        {
            var ji = JournalController.Instance.GetJournalItemByKey(portalid, objectKey);

            if ((ji != null))
            {
                JournalController.Instance.DeleteJournalItemByKey(portalid, objectKey);
            }

            ji = new JournalItem
            {
                PortalId      = portalid,
                ProfileId     = profileid,
                UserId        = userid,
                ContentItemId = contentitemid,
                Title         = title,
                ItemData      = new ItemData {
                    Url = url
                },
                Summary       = summary,
                Body          = null,
                JournalTypeId = getTaskAddJournalTypeId(portalid, "taskadd"),
                ObjectKey     = objectKey,
                SecuritySet   = security.ToString().ToUpper().Substring(0, 1)
            };

            JournalController.Instance.SaveJournalItem(ji, tabid);
        }
Example #12
0
        public bool Send(JournalItem message)
        {
            if (message == null)
            {
                throw new ArgumentNullException();
            }

            if (this.disposed)
            {
                return(false);
            }

            if (!message.ItemActions.HasFlag(JournalItemAction.Dispatch))
            {
                return(true);                // no op
            }
            if (message.SerializedBody == null || message.SerializedBody.Length == 0)
            {
                return(true);                // no op
            }
            if (string.IsNullOrWhiteSpace(message.SerializedType))
            {
                return(true);
            }

            var currentChannel = this.OpenChannel(false);

            if (currentChannel == null)
            {
                return(false);
            }

            return(this.Send(message, currentChannel));
        }
Example #13
0
        /// <summary>
        /// Informs the core journal that the user has updated a task (assigned it to someone, edited description or other associated data not available on creation, etc.)
        /// </summary>
        /// <param name="objCard"></param>
        /// <param name="actionKey"></param>
        /// <param name="title"></param>
        /// <param name="portalId"></param>
        /// <param name="journalUserId"></param>
        /// <param name="url"></param>
        /// <param name="summary"> </param>
        internal void AddTaskUpdateToJournal(string objectKey, int actionKey, string title, int portalId, int contentitemid, int journalUserId, string url, int tabid, string summary)
        {
            var ji = JournalController.Instance.GetJournalItemByKey(portalId, objectKey);

            if ((ji != null))
            {
                JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey);
            }

            ji = new JournalItem
            {
                PortalId      = portalId,
                ProfileId     = journalUserId,
                UserId        = journalUserId,
                ContentItemId = contentitemid,
                Title         = title,
                ItemData      = new ItemData {
                    Url = url
                },
                Summary       = summary,
                Body          = null,
                JournalTypeId = getTaskUpdateJournalTypeId(portalId),
                ObjectKey     = objectKey,
                SecuritySet   = "E,"
            };

            JournalController.Instance.SaveJournalItem(ji, tabid);
        }
Example #14
0
 public void AddReplyToJournal(int PortalId, int ModuleId, int TabId, int ForumId, int TopicId, int ReplyId, int UserId, string URL, string Subject, string Body)
 {
     //make sure that this is a User before trying to create a journal item, you can't post a JI without
     if (UserId > 0)
     {
         ModuleInfo  module = ModuleController.Instance.GetModule(ModuleId, TabId, false);
         string      summary;
         JournalItem ji = new JournalItem
         {
             PortalId      = PortalId,
             ProfileId     = UserId,
             UserId        = UserId,
             Title         = Subject,
             JournalTypeId = GetReplyTopicTypeId(PortalId),
             ItemData      = new ItemData {
                 Url = URL
             }
         };
         summary = TextUtilityClass.StripHTML(HttpUtility.HtmlDecode(Body));
         if (summary.Length > 150)
         {
             summary = summary.Substring(0, 150) + "...";
         }
         ji.Summary   = summary;
         ji.Body      = TextUtilityClass.StripHTML(Body);
         ji.ObjectKey = GetJournalKey(ModuleId, ForumId, TopicId, ReplyId);
         if (JournalController.Instance.GetJournalItemByKey(PortalId, ji.ObjectKey) != null)
         {
             JournalController.Instance.DeleteJournalItemByKey(PortalId, ji.ObjectKey);
         }
         ji.SecuritySet = "E,";
         JournalController.Instance.SaveJournalItem(ji, module);
     }
 }
Example #15
0
        /// <summary>
        /// Informs the core journal that the user has provided an answer.
        /// </summary>
        /// <param name="objPost"></param>
        /// <param name="questionTitle"></param>
        /// <param name="portalId"></param>
        /// <param name="journalUserId"></param>
        /// <param name="url"></param>
        internal void AddAnswerToJournal(PostInfo objPost, string questionTitle, int portalId, int journalUserId, string url)
        {
            var objectKey = Constants.ContentTypeName + "_" + Constants.JournalAnswerTypeName + "_" + string.Format("{0}:{1}", objPost.ParentId, objPost.PostId);
            var ji        = JournalController.Instance.GetJournalItemByKey(portalId, objectKey);

            if ((ji != null))
            {
                JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey);
            }

            ji = new JournalItem
            {
                PortalId      = portalId,
                ProfileId     = journalUserId,
                UserId        = journalUserId,
                ContentItemId = objPost.ContentItemId,
                Title         = questionTitle,
                ItemData      = new ItemData {
                    Url = url
                },
                Summary       = "", //objPost.Body,
                Body          = null,
                JournalTypeId = GetAnswerJournalTypeID(portalId),
                ObjectKey     = objectKey,
                SecuritySet   = "E,"
            };

            JournalController.Instance.SaveJournalItem(ji, objPost.TabID);
        }
Example #16
0
        public void AddThreadToJournal(int PortalId, int ModuleId, int TabId, int ForumId, int TopicId, int PostId, int UserId, string URL, string Subject, string Body)
        {
            ModuleInfo  module = ModuleController.Instance.GetModule(ModuleId, TabId, false);
            string      summary;
            JournalItem ji = new JournalItem
            {
                PortalId      = PortalId,
                ProfileId     = UserId,
                UserId        = UserId,
                Title         = Subject,
                JournalTypeId = GetAddTopicTypeId(PortalId),
                ItemData      = new ItemData {
                    Url = URL
                }
            };

            summary = TextUtilityClass.StripHTML(HttpUtility.HtmlDecode(Body));
            if (summary.Length > 150)
            {
                summary = summary.Substring(0, 150) + "...";
            }

            ji.Summary   = summary;
            ji.Body      = TextUtilityClass.StripHTML(Body);
            ji.ObjectKey = GetJournalKey(ModuleId, ForumId, TopicId, PostId);
            if (JournalController.Instance.GetJournalItemByKey(PortalId, ji.ObjectKey) != null)
            {
                JournalController.Instance.DeleteJournalItemByKey(PortalId, ji.ObjectKey);
            }
            ji.SecuritySet = "E,";
            JournalController.Instance.SaveJournalItem(ji, module);
        }
Example #17
0
            static JournalItem Create(string body, long sequence)
            {
                var item = new JournalItem();

                item.AsTransformationResultMessage(sequence, body, new Dictionary <string, string>());
                return(item);
            }
Example #18
0
        public ActionResult DeleteConfirmed(int id)
        {
            JournalItem journalItem = db.JournalItems.Find(id);

            db.JournalItems.Remove(journalItem);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public virtual void Include(JournalItem item)
        {
            this.AddSerializedData(item);
            var metadataId = this.AddMetadata(item);
            var insert     = this.DetermineInsertStatement(item);

            this.messagesStatement.AppendFormat(insert, item.MessageSequence, metadataId, this.index);
            this.index++;
        }
Example #20
0
 public void update(JournalItem j)
 {
     for (var i = 0; i < journalitems.Count; i++)
     {
         if (journalitems[i].id == j.id)
         {
             journalitems.SetItem(i, j);
         }
     }
 }
            protected override void DoPaintLine(BaseScreen screen, int index, ExtRect rect)
            {
                JournalItem item = (JournalItem)fLines.GetObject(index);

                if (item != null)
                {
                    TextColor = item.Color;
                }
                base.DoPaintLine(screen, index, rect);
            }
        private string DetermineInsertStatement(JournalItem item)
        {
            if (!item.ItemActions.HasFlag(JournalItemAction.Acknowledge))
            {
                return(this.index == 0 ? InsertFirstLocalMessage : InsertNextLocalMessage);
            }

            this.session.IncludeParameter("@f{0}".FormatWith(this.index), item.ForeignId.ToByteArray());
            return(this.index == 0 ? InsertFirstForeignMessage : InsertNextForeignMessage);
        }
Example #23
0
 public void delete(JournalItem j)
 {
     for (var i = 0; i < journalitems.Count; i++)
     {
         if (journalitems[i].id == j.id)
         {
             var item = journalitems[i];
             journalitems.Remove(item);
         }
     }
 }
Example #24
0
        protected JournalItem EnsureJournalItem(Product product, bool updateExisting = false)
        {
            var journalTypeId = EnsureJournalType(JORNALTYPE_PRODUCTADD);
            var dnnUser       = DnnUserController.Instance.GetCurrentUserInfo();
            var dnnUserId     = dnnUser != null ? dnnUser.UserID : CurrentPortalSettings.AdministratorId;

            var jItem =
                ServiceLocator <IJournalController, JournalController> .Instance.GetJournalItemByKey(
                    CurrentPortalSettings.PortalId, product.Bvin);

            if (jItem != null && !updateExisting)
            {
                return(jItem);
            }

            var isCreateRequired = false;

            if (jItem == null)
            {
                jItem = new JournalItem
                {
                    JournalTypeId = journalTypeId,
                    ObjectKey     = product.Bvin,
                    PortalId      = CurrentPortalSettings.PortalId
                };
                isCreateRequired = true;
            }

            var contentItemId = EnsureProductContentItem(product, jItem.ContentItemId);

            jItem.ContentItemId = contentItemId;
            jItem.Title         = product.ProductName;
            jItem.Summary       = product.MetaDescription;
            jItem.UserId        = dnnUserId;
            jItem.ItemData      = new ItemData
            {
                Title = product.ProductName,
                Url   = HccUrlBuilder.RouteHccUrl(HccRoute.Product, new { slug = product.UrlSlug })
            };

#pragma warning disable 618
            if (isCreateRequired)
            {
                ServiceLocator <IJournalController, JournalController> .Instance.SaveJournalItem(jItem, Null.NullInteger);
            }
            else
            {
                ServiceLocator <IJournalController, JournalController> .Instance.UpdateJournalItem(jItem, Null.NullInteger);
            }
#pragma warning restore 618

            return(jItem);
        }
Example #25
0
 public void DeleteInsulinUsage(int id)
 {
     using (var context = new EasyScheduleDatabaseEntities())
     {
         var deletedItem = new JournalItem {
             Id = id
         };
         context.JournalItems.Attach(deletedItem);
         context.JournalItems.Remove(deletedItem);
         context.SaveChanges();
     }
 }
Example #26
0
 public void UpdateSugar(int id, JournalItemModel model)
 {
     using (var context = new EasyScheduleDatabaseEntities())
     {
         var editedSugar = new JournalItem {
             Id = id
         };
         context.JournalItems.Attach(editedSugar);
         editedSugar.Value = model.value;
         editedSugar.Time  = model.time;
         context.SaveChanges();
     }
 }
 public JournalItemTokenReplace(JournalItem journalItem, JournalControl journalControl)
 {
     PropertySource["journalitem"]    = journalItem;
     PropertySource["journalcontrol"] = journalControl;
     if (journalItem.ItemData != null)
     {
         PropertySource["journaldata"] = journalItem.ItemData;
     }
     if (journalItem.JournalAuthor != null)
     {
         PropertySource["journalauthor"] = journalItem.JournalAuthor;
     }
 }
Example #28
0
        // GET: JournalItems/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JournalItem journalItem = db.JournalItems.Find(id);

            if (journalItem == null)
            {
                return(HttpNotFound());
            }
            return(View(journalItem));
        }
Example #29
0
        private string GetStringReplacement(JournalItem journalItem)
        {
            string replacement = string.Empty;

            if (CurrentUser.UserID > 0 && SocialGroupId <= 0 && !isUnverifiedUser)
            {
                replacement = "$1";
            }
            if (CurrentUser.UserID > 0 && journalItem.SocialGroupId > 0 && !isUnverifiedUser)
            {
                replacement = CurrentUser.IsInRole(journalItem.JournalOwner.Name) ? "$1" : string.Empty;
            }
            return(replacement);
        }
Example #30
0
 public JournalItemTokenReplace(JournalItem journalItem, JournalControl journalControl)
 {
     PropertySource["journalitem"]    = journalItem;
     PropertySource["journalcontrol"] = journalControl;
     if (journalItem.ItemData != null)
     {
         PropertySource["journaldata"] = journalItem.ItemData;
     }
     if (journalItem.JournalAuthor != null)
     {
         PropertySource["journalauthor"]  = journalItem.JournalAuthor;
         PropertySource["journalprofile"] = new ProfilePicPropertyAccess(journalItem.JournalAuthor.Id);
     }
 }
Example #31
0
        public JournalItemViewModel(JournalItem journalItem)
        {
            ShowObjectCommand = new RelayCommand(OnShowObject, CanShowObject);
            JournalItem = journalItem;
            switch(JournalItem.JournalItemType)
            {
                case JournalItemType.Device:
                    DeviceState = XManager.DeviceStates.DeviceStates.FirstOrDefault(x => x.UID == JournalItem.ObjectUID);
                    PresentationName = DeviceState.Device.Driver.ShortName + " " + DeviceState.Device.DottedAddress;
                    break;

                case JournalItemType.Zone:
                    ZoneState = XManager.DeviceStates.ZoneStates.FirstOrDefault(x => x.UID == JournalItem.ObjectUID);
                    PresentationName = ZoneState.Zone.PresentationName;
                    break;

                case JournalItemType.Direction:
                    DirectionState = XManager.DeviceStates.DirectionStates.FirstOrDefault(x => x.UID == JournalItem.ObjectUID);
                    PresentationName = DirectionState.Direction.PresentationName;
                    break;

                case JournalItemType.GK:
                    DeviceState = XManager.DeviceStates.DeviceStates.FirstOrDefault(x => x.UID == JournalItem.ObjectUID);
                    PresentationName = DeviceState.Device.Driver.ShortName + " " + DeviceState.Device.DottedAddress;
                    break;

                case JournalItemType.System:
                    break;
            }

            var states = XStatesHelper.StatesFromInt(journalItem.ObjectState);
            var stringBuilder = new StringBuilder();
            foreach (var state in states)
            {
                stringBuilder.Append(state.ToDescription() + " ");
            }
            StringStates = stringBuilder.ToString();
        }
Example #32
0
 public JournalNode(Node parent, JournalItem journalItem) : base(parent, null) { _journalItem = journalItem; }
Example #33
0
 bool FilterRecord(JournalItem journalItem)
 {
     //JournalFilter.StateTypes
     return true;
 }
Example #34
0
        public PostInfo(JournalItem journalItem, string lastPath)
        {
            IsJournal = true;
            LastPath = lastPath;
            CreationDate = journalItem.When;
            var backspIndex = journalItem.Who.IndexOf('\\');
            if (backspIndex != -1)
            {
                var domain = journalItem.Who.Substring(0, backspIndex);
                var name = journalItem.Who.Substring(backspIndex + 1);
                CreatedBy = User.Load(domain, name);
            }

            //var contentName = string.Empty;
            //if (journalItem.Wherewith.StartsWith(contextPath))
            //{
            //    contentName = journalItem.Wherewith.Substring(contextPath.Length).TrimStart('/');
            //    // if workspace relative path is empty, the context path is the workspace itself
            //    if (string.IsNullOrEmpty(contentName))
            //        contentName = RepositoryPath.GetFileName(contextPath);
            //}
            //else
            //{
            //    contentName = RepositoryPath.GetFileName(journalItem.Wherewith);
            //}

            var what = journalItem.What.ToLower();
            if (what == "deletedphysically")
                what = "deleted";

            // type
            if (what == "created")
                Type = PostType.JournalCreated;
            if (what == "modified")
                Type = PostType.JournalModified;
            if (what == "deleted")
                Type = PostType.JournalDeletedPhysically;
            if (what == "moved")
                Type = PostType.JournalMoved;
            if (what == "copied")
                Type = PostType.JournalCopied;

            Text = Type == PostType.JournalCopied || Type == PostType.JournalMoved ?
                string.Format("{0} <a href='{1}'>{2}</a> to <a href='{3}'>{4}</a>", what, "{{path}}", journalItem.DisplayName, journalItem.TargetPath, journalItem.TargetDisplayName) :
                string.Format("{0} <a href='{1}'>{2}</a>", what, "{{path}}", journalItem.DisplayName);

            JournalId = journalItem.Id; // journal's id to leave out item from wall if post already exists
            Id = journalItem.Id;
            ClientId = "J" + Id.ToString();
            Path = lastPath;

            // details
            switch (Type)
            {
                case PostType.JournalModified:
                    Details = journalItem.Details;
                    break;
                case PostType.JournalMoved:
                    Details = string.Format("Source: <a href='{0}'>{0}</a><br/>Target: <a href='{1}'>{1}</a>", RepositoryPath.GetParentPath(journalItem.SourcePath), journalItem.TargetPath);
                    break;
                case PostType.JournalCopied:
                    Details = string.Format("Source: <a href='{0}'>{0}</a><br/>Target: <a href='{1}'>{1}</a>", RepositoryPath.GetParentPath(journalItem.Wherewith), journalItem.TargetPath);
                    break;
                default:
                    break;
            }

            //SharedContent = Node.LoadNode(journalItem.Wherewith);
        }