コード例 #1
0
ファイル: PinnedItems.ascx.cs プロジェクト: Hennz/StageBitz
        /// <summary>
        /// Handles the OnItemCommand event of the lvPinnedItem control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="ListViewCommandEventArgs"/> instance containing the event data.</param>
        protected void lvPinnedItem_OnItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (!PageBase.StopProcessing)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;
                SelectedItemId = (int)lvPinnedItems.DataKeys[dataItem.DisplayIndex]["ItemId"];
                int itemBookingId = (int)lvPinnedItems.DataKeys[dataItem.DisplayIndex]["ItemBookingId"];

                switch (e.CommandName)
                {
                case "Remove":

                    if (InformItemBriefDetailToGetCompleteItemDirtyStatus != null)
                    {
                        InformItemBriefDetailToGetCompleteItemDirtyStatus();
                    }

                    if (IsCompleteItemTabDirty)
                    {
                        popupConfirmDirtySave.ShowPopup();
                    }
                    else
                    {
                        ShowRemoveConfirmationMessage();
                    }
                    break;

                case "Keep":
                    InventoryBL inventoryBL   = new InventoryBL(DataContext);
                    Code        bookingStatus = inventoryBL.GetItemBookingStatus(itemBookingId);

                    if (bookingStatus != null && bookingStatus.CodeId == Utils.GetCodeIdByCodeValue("ItemBookingStatusCode", "PINNEDDELAYED"))
                    {
                        if (InformParentToShowDelayedPopup != null)
                        {
                            InformParentToShowDelayedPopup(SelectedItemId);
                        }
                    }
                    else if (inventoryBL.CanKeepItem(ItemBriefId, SelectedItemId))
                    {
                        popupBoxKeepItem.ShowPopup();
                    }
                    else if (!GetBL <InventoryBL>().IsItemDeleted(SelectedItemId))
                    {
                        //Needs to be provided by Mat
                        popUpPinError.ShowPopup();
                    }

                    break;
                }

                LoadData();
            }
        }