예제 #1
0
        public static void Set(BaseDomainPublishableObject baseObj, string Type, ChangeStatusEnum ChangeStatus, bool alsoUpdateObject)
        {
            //even uitgezet
            return;

            if (!(Type == "Folder" || Type == "Page" || Type == "Module" || Type == "Template" || Type == "Script" || Type == "DataCollection" || Type == "DataGroup" || Type == "DataItem"))
            {
                throw new Exception("Geen geldige type voor UnpublishedItem");
            }


            UnpublishedItem item = new UnpublishedItem();

            //try to find
            string where = String.Format("FK_Object = '{0}'", baseObj.ID);
            BaseCollection <UnpublishedItem> items = BaseCollection <UnpublishedItem> .Get(where);

            if (items.Count > 0)
            {
                item = items[0];
            }
            else
            {
                //nieuwe
            }
            if (baseObj.LastPublishedDate == null && ChangeStatus == ChangeStatusEnum.Deleted)
            {
                item.Delete();
            }
            else
            {
                item.LastPublishedDate = baseObj.LastPublishedDate;
                item.ChangeStatus      = ChangeStatus;
                item.Site         = baseObj.Site;
                item.Name         = baseObj.Name;
                item.FK_Object    = baseObj.ID;
                item.Type         = Type;
                item.ModifiedDate = DateTime.Now;
                if (Utils.WebSessionHelper.CurrentBitplateUser != null)
                {
                    item.UserName = Utils.WebSessionHelper.CurrentBitplateUser.Email;
                    item.FK_User  = Utils.WebSessionHelper.CurrentBitplateUser.ID;
                }
                if (ChangeStatus == ChangeStatusEnum.Deleted)
                {
                    item.Actions += String.Format("Verwijderd door {0} op {1:dd-MM-yyyy HH:mm}; ", item.UserName, DateTime.Now);
                }
                else
                {
                    item.Actions += String.Format("Bewaard door {0} op {1:dd-MM-yyyy HH:mm}; ", item.UserName, DateTime.Now);
                }
                item.Save();
            }
            if (alsoUpdateObject && ChangeStatus == ChangeStatusEnum.Modified)
            {
                //in de objecten wordt change-status ook bewaard (redundant (omwilen van minder db-calls)
                //hier wordt die gezet
                //dit wordt aangeroepen bij wijziging van een module op een pagina.
                string sql = String.Format("UPDATE {0} SET ChangeStatus={1}, ModifiedDate=NOW() WHERE ID='{2}'", Type, (int)ChangeStatusEnum.Modified, baseObj.ID);
                DataBase.Get().Execute(sql);
            }
        }
예제 #2
0
 public static void Set(BaseDomainPublishableObject baseObj, string Type, ChangeStatusEnum ChangeStatus)
 {
     Set(baseObj, Type, ChangeStatus, false);
 }