예제 #1
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        /// <param name="type">The type.</param>
        void ProcessDeleteCommand(string[] items, string type)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int  id       = Int32.Parse(keys[0]);
                    Guid customer = new Guid(keys[1]);

                    OrderGroup order = null;
                    if (type == "ShoppingCart")
                    {
                        order = (OrderGroup)OrderContext.Current.GetCart(customer, id);
                    }
                    else if (type == "PaymentPlan")
                    {
                        order = (OrderGroup)OrderContext.Current.GetPaymentPlan(customer, id);
                    }
                    else
                    {
                        order = (OrderGroup)OrderContext.Current.GetPurchaseOrder(customer, id);
                    }

                    if (order != null)
                    {
                        order.Delete();
                        order.AcceptChanges();
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        /// <param name="Id">The id.</param>
        void ProcessDeleteCommand(string[] items, int Id)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int    id            = Int32.Parse(keys[0]);
                    string type          = keys[1];
                    string outlineNumber = keys[2];

                    if (type.Equals("Node"))
                    {
                        FolderElement.Delete(id);
                    }
                    else if (type.Equals("Folder"))
                    {
                        Mediachase.Ibn.Data.Services.TreeNode node = TreeManager.GetNodeByOulineNumber(Folder.GetAssignedMetaClass(), outlineNumber);
                        if (node != null)
                        {
                            DeleteEntryRecursive(node);
                            TreeManager.DeleteNode(node);
                        }
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    // delete selected items
                    DataTable dt = Language.GetAllLanguagesDT();
                    if (dt.Rows.Count > 1)
                    {
                        // TODO: delete language from sites, shipping & payment providers,... and other objects that use it

                        // delete language
                        Language.DeleteLanguage(id);
                    }
                    else if ((int)dt.Rows[0]["LangId"] == id)
                    {
                        // do not allow to delete the last language
                        throw new Exception("Cannot delete the last language");
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Processes the move command.
        /// </summary>
        /// <param name="args">The args.</param>
        void ProcessMoveCommand(Dictionary <string, object> args)
        {
            int folderId = 0;

            string folderString = args["folder"] as string;

            if (String.IsNullOrEmpty(folderString) || !Int32.TryParse(folderString, out folderId))
            {
                return;
            }

            string[] items = MyListView.CurrentListView.GetCheckedCollection();

            if (items != null)
            {
                for (int i = 0; i < items.Length; i++)
                {
                    string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                    if (keys != null)
                    {
                        int id = Int32.Parse(keys[0]);
                        FileTreeItem.MoveTo(id, folderId);
                    }
                }
            }
        }
예제 #5
0
        void ProcessDeleteCommand(string[] items)
        {
            // load all shipping options
            ShippingMethodDto dto = ShippingManager.GetShippingMethods(null, true);

            if (dto != null && dto.ShippingOption.Count > 0)
            {
                // delete selected
                for (int i = 0; i < items.Length; i++)
                {
                    string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                    if (keys != null)
                    {
                        Guid id = new Guid(keys[0]);

                        // delete selected shipping option

                        ShippingMethodDto.ShippingOptionRow[] soRows = (ShippingMethodDto.ShippingOptionRow[])dto.ShippingOption.Select(String.Format("ShippingOptionId='{0}'", id));
                        if (soRows != null && soRows.Length > 0)
                        {
                            soRows[0].Delete();
                        }
                    }
                }

                if (dto.HasChanges())
                {
                    ShippingManager.SaveShipping(dto);
                }
            }
        }
예제 #6
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    string     id             = keys[0];
                    List <int> expressionList = new List <int>();

                    SegmentDto dto = SegmentManager.GetSegmentDto(Int32.Parse(id));
                    if (dto.Segment.Count > 0)
                    {
                        SegmentDto.SegmentRow segmentRow = dto.Segment[0];
                        foreach (SegmentDto.SegmentConditionRow condition in segmentRow.GetSegmentConditionRows())
                        {
                            expressionList.Add(condition.ExpressionId);
                        }
                        dto.Segment[0].Delete();
                        SegmentManager.SaveSegment(dto);
                    }

                    // Delete corresponding expressions
                    foreach (int expressionId in expressionList)
                    {
                        ExpressionDto expressionDto = ExpressionManager.GetExpressionDto(expressionId);
                        if (expressionDto != null && expressionDto.Expression.Count > 0)
                        {
                            expressionDto.Expression[0].Delete();
                            ExpressionManager.SaveExpression(expressionDto);
                        }
                    }
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Processes the status command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessStatusCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    string id = keys[0];

                    using (TransactionScope scope = new TransactionScope())
                    {
                        PromotionDto dto            = PromotionManager.GetPromotionDto(Int32.Parse(id));
                        List <int>   expressionList = new List <int>();
                        if (dto.Promotion.Count > 0)
                        {
                            if (dto.Promotion[0].Status == PromotionStatus.Active)
                            {
                                dto.Promotion[0].Status = PromotionStatus.Inactive;
                            }
                            else
                            {
                                dto.Promotion[0].Status = PromotionStatus.Active;
                            }

                            PromotionManager.SavePromotion(dto);
                        }

                        scope.Complete();
                    }
                }
            }
        }
예제 #8
0
파일: List.ascx.cs 프로젝트: hdgardner/ECF
        /// <summary>
        /// Processes the move copy command.
        /// </summary>
        /// <param name="args">The args.</param>
        void ProcessMoveCopyCommand(Dictionary <string, object> args)
        {
            if (args["cmd"] != null)
            {
                string command = args["cmd"].ToString();
                if (String.Compare(command, "move", true) == 0 || String.Compare(command, "copy", true) == 0)
                {
                    string folder = args["folder"] as string;
                    if (String.IsNullOrEmpty(folder))
                    {
                        return;
                    }

                    int targetFolderId = Int32.Parse(folder);

                    string[] items = MyListView.CurrentListView.GetCheckedCollection();

                    if (items != null)
                    {
                        for (int i = 0; i < items.Length; i++)
                        {
                            string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                            if (keys != null)
                            {
                                int    id   = Int32.Parse(keys[0]);
                                string type = keys[1];

                                if (String.Compare(command, "move", true) == 0)
                                {
                                    if (type == "Node")
                                    {
                                        FolderElement.Move(id, targetFolderId);
                                    }
                                    else
                                    {
                                        Folder.Move(id, targetFolderId);
                                    }
                                }
                                else if (String.Compare(command, "copy", true) == 0)
                                {
                                    if (type == "Node")
                                    {
                                        FolderElement.Copy(id, targetFolderId);
                                    }
                                    else
                                    {
                                        Folder.CopyRecursive(id, targetFolderId);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #9
0
 /// <summary>
 /// Processes the language command.
 /// </summary>
 /// <param name="items">The items.</param>
 void ProcessLanguageCommand(string[] items)
 {
     for (int i = 0; i < items.Length; i++)
     {
         string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
         if (keys != null)
         {
             int folderId = Int32.Parse(keys[0]);
             PopulateLanguagesRecursive(folderId);
         }
     }
 }
예제 #10
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    DeleteEntryRecursive(id, 0);
                }
            }
        }
예제 #11
0
        void ProcessApproveCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int versionId = Int32.Parse(keys[0]);

                    using (IDataReader reader = PageVersion.GetVersionById(versionId))
                    {
                        if (reader.Read())
                        {
                            int templateId = (int)reader["TemplateId"];
                            int statusId   = (int)reader["StatusId"];
                            int stateId    = (int)reader["StateId"];
                            int langId     = (int)reader["LangId"];

                            int newStatus = WorkflowAccess.GetNextStatusId(statusId);

                            if (newStatus > 0)
                            {
                                PageVersion.UpdatePageVersion(versionId, templateId, langId, statusId, newStatus, ProfileContext.Current.UserId, 1, "");
                            }
                            //PageVersion.UpdatePageVersion(CMSContext.Current.VersionId, templateId, langId, statusId, WorkflowAccess.GetMaxStatus(Roles.GetRolesForUser(), WorkflowStatus.GetLast(statusId)), (Guid)Membership.GetUser(Page.User.Identity.Name).ProviderUserKey, 1, string.Empty);

                            // if we publish version
                            if (newStatus == WorkflowStatus.GetLast(statusId))
                            {
                                //find old publishd and put to archive
                                using (IDataReader reader2 = PageVersion.GetVersionByStatusId((int)reader["PageId"], newStatus))
                                {
                                    while (reader2.Read())
                                    {
                                        if ((int)reader2["LangId"] == langId)
                                        {
                                            if (versionId != (int)reader2["VersionId"])
                                            {
                                                PageVersion.UpdatePageVersion((int)reader2["VersionId"], (int)reader2["TemplateId"], (int)reader2["LangId"], (int)reader2["StatusId"], WorkflowStatus.GetArcStatus((int)reader2["StatusId"]), ProfileContext.Current.UserId, 2, "sent to archieve");
                                            }
                                        }
                                    }
                                    reader2.Close();
                                }
                            }
                        }
                        reader.Close();
                    }
                }
            }
        }
예제 #12
0
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int versionId = Int32.Parse(keys[0]);

                    // delete selected version
                    PageVersion.DeletePageVersion(versionId);
                }
            }
        }
예제 #13
0
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    // delete selected sites
                    Mediachase.Cms.Workflow.DeleteWorkflow(id);
                }
            }
        }
예제 #14
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int    id   = Int32.Parse(keys[0]);
                    string name = keys[1];

                    CatalogContext.Current.DeleteCatalog(id);
                }
            }
        }
예제 #15
0
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    // delete selected sites
                    NavigationManager.DeleteCommand(id);
                }
            }
        }
예제 #16
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    string id = keys[0];

                    // delete selected sites
                    ProfileContext.Current.DeleteAccount(id);
                }
            }
        }
예제 #17
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    string id = keys[0];

                    // delete selected sites
                    Guid siteId = new Guid(id);

                    using (TransactionScope scope = new TransactionScope())
                    {
                        SiteDto dto = CMSContext.Current.GetSiteDto(siteId, true);
                        if (dto.Site.Rows.Count > 0)
                        {
                            // delete menus
                            MenuDto menuDto = MenuManager.GetMenuDto(siteId);
                            if (menuDto.Menu.Rows.Count > 0)
                            {
                                foreach (MenuDto.MenuRow menuRow in menuDto.Menu.Rows)
                                {
                                    menuRow.Delete();
                                }
                            }

                            if (menuDto.HasChanges())
                            {
                                MenuManager.SaveMenuDto(menuDto);
                            }

                            // delete folders and pages
                            int rootId = FileTreeItem.GetRoot(siteId);
                            FileTreeItem.DeleteFileItem(rootId);

                            //delete site
                            dto.Site[0].Delete();
                            CMSContext.Current.SaveSite(dto);
                        }

                        scope.Complete();
                    }
                }
            }
        }
예제 #18
0
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    string id = keys[0];

                    // delete selected sites
                    if (Roles.RoleExists(id))
                    {
                        Roles.DeleteRole(id, false);
                    }
                }
            }
        }
예제 #19
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    CatalogTaxDto dto = CatalogTaxManager.GetTaxCategoryByTaxCategoryId(id);
                    if (dto != null && dto.TaxCategory.Count > 0)
                    {
                        dto.TaxCategory[0].Delete();
                        CatalogTaxManager.SaveTaxCategory(dto);
                    }
                }
            }
        }
예제 #20
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    ExpressionDto dto = ExpressionManager.GetExpressionDto(id);
                    if (dto.Expression.Count > 0)
                    {
                        dto.Expression[0].Delete();
                        ExpressionManager.SaveExpression(dto);
                    }
                }
            }
        }
예제 #21
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    string id = keys[0];

                    CampaignDto dto = CampaignManager.GetCampaignDto(Int32.Parse(id));
                    if (dto.Campaign.Count > 0)
                    {
                        dto.Campaign[0].Delete();
                        CampaignManager.SaveCampaign(dto);
                    }
                }
            }
        }
예제 #22
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    PolicyDto dto = PolicyManager.GetPolicyDto(id);
                    if (dto.Policy.Count > 0)
                    {
                        dto.Policy[0].Delete();
                        PolicyManager.SavePolicy(dto);
                    }
                }
            }
        }
예제 #23
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    WarehouseDto dto = WarehouseManager.GetWarehouseByWarehouseId(id);
                    if (dto != null && dto.Warehouse.Count > 0)
                    {
                        dto.Warehouse[0].Delete();
                        WarehouseManager.SaveWarehouse(dto);
                    }
                }
            }
        }
예제 #24
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    LogDto dto = (LogDto)LogManager.GetAppLog(id);

                    if (dto != null && dto.ApplicationLog.Count > 0)
                    {
                        dto.ApplicationLog[0].Delete();
                        LogManager.SaveAppLog(dto);
                    }
                }
            }
        }
예제 #25
0
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    // delete selected items
                    TemplateDto templateDto = DictionaryManager.GetTemplateDto(id);
                    if (templateDto.main_Templates.Count > 0)
                    {
                        templateDto.main_Templates.Rows[0].Delete();
                        DictionaryManager.SaveTemplateDto(templateDto);
                    }
                }
            }
        }
예제 #26
0
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    // delete selected country
                    CountryDto dto = CountryManager.GetCountry(id, true);
                    if (dto != null && dto.Country.Count > 0)
                    {
                        dto.Country[0].Delete();
                        CountryManager.SaveCountry(dto);
                    }
                }
            }
        }
예제 #27
0
        /// <summary>
        /// Processes the delete command.
        /// </summary>
        /// <param name="items">The items.</param>
        void ProcessDeleteCommand(string[] items)
        {
            if (!ProfileContext.Current.CheckPermission("content:site:nav:mng:delete"))
            {
                throw new UnauthorizedAccessException("Current user does not have enough rights to access the requested operation.");
            }

            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int folderId = Int32.Parse(keys[0]);

                    // delete selected sites
                    FileTreeItem.DeleteFileItem(folderId);
                }
            }
        }
예제 #28
0
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    // delete selected jurisdiction
                    JurisdictionDto dto = JurisdictionManager.GetJurisdiction(id);
                    if (dto != null && dto.Jurisdiction.Count > 0)
                    {
                        dto.Jurisdiction[0].Delete();
                        JurisdictionManager.SaveJurisdiction(dto);
                    }
                }
            }
        }
예제 #29
0
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    int id = Int32.Parse(keys[0]);

                    // delete selected tax
                    TaxDto dto = TaxManager.GetTax(id);
                    if (dto != null && dto.Tax.Count > 0)
                    {
                        dto.Tax[0].Delete();
                        TaxManager.SaveTax(dto);
                    }
                }
            }
        }
예제 #30
0
        void ProcessDeleteCommand(string[] items)
        {
            for (int i = 0; i < items.Length; i++)
            {
                string[] keys = EcfListView.GetPrimaryKeyIdStringItems(items[i]);
                if (keys != null)
                {
                    Guid id = new Guid(keys[0]);

                    // delete selected payment method
                    PaymentMethodDto dto = PaymentManager.GetPaymentMethod(id, true);
                    if (dto != null && dto.PaymentMethod.Count > 0)
                    {
                        dto.PaymentMethod[0].Delete();
                        PaymentManager.SavePayment(dto);
                    }
                }
            }
        }