Exemple #1
0
        /// <summary>
        /// Determines whether [is action valid].
        /// </summary>
        /// <returns></returns>
        private bool IsActionValid()
        {
            Data.Item item = null;
            if (this.GetBL <InventoryBL>().IsItemDeleted(this.ItemId))
            {
                popupItemDeletedWarning.ShowItemDeleteMessagePopup(this.ItemId, CompanyId);
                return(false);
            }
            else
            {
                item = GetBL <InventoryBL>().GetItem(this.ItemId);
            }

            if (!(Utils.IsCompanyInventoryAdmin(this.CompanyId, UserID) || Utils.IsCompanyInventoryStaffMember(CompanyId, this.UserID, item.LocationId, DataContext)))
            {
                bool canAccessInventory = Support.CanAccessInventory(this.CompanyId);
                projectWarningPopup.ShowErrorPopup(ErrorCodes.NoEditPermissionForInventory, !canAccessInventory);
                return(false);
            }
            else if (this.GetBL <InventoryBL>().CheckPermissionsForItemDetailsPage(UserID, ItemId, CompanyId, false) == null)
            {
                projectWarningPopup.ShowErrorPopup(ErrorCodes.ItemNotVisible);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #2
0
 /// <summary>
 /// Handles the Click event of the btnDoneItemIsPinnedPopup control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void btnDoneItemIsPinnedPopup_Click(object sender, EventArgs e)
 {
     if (Support.CanAccessInventory(this.CompanyId))
     {
         Response.Redirect(string.Format("~/Inventory/ItemDetails.aspx?ItemId={0}&CompanyId={1}&Sort={2}&Booking={3}&Inventory={4}",
                                         this.ItemId, this.CompanyId, Server.UrlEncode(this.SortParam), Server.UrlEncode(GetBookingParam()), Server.UrlEncode(this.InventoryParam)));
     }
 }
        /// <summary>
        /// Checks for project status.
        /// </summary>
        private void CheckForProjectStatus()
        {
            int zIndex = 1002;

            if (IsPostBack)
            {
                if (Mode == ProjectWarningMode.Project && ProjectId > 0)
                {
                    var project = GetBL <ProjectBL>().GetProject(ProjectId);
                    if (project != null)
                    {
                        if (!IsProjectClosed && GetBL <ProjectBL>().IsProjectClosed(ProjectId))
                        {
                            if (Support.IsCompanyAdministrator(CompanyId))
                            {
                                Page.Response.Redirect(Page.Request.Url.ToString(), true);
                            }
                            else
                            {
                                InitializePopup();
                                popupProjectCloseWarning.ShowPopup(zIndex);
                                PageBase.StopProcessing = true;
                                PageBase.IsPageDirty    = false;
                            }
                        }
                        else if (!IsProjectSuspended && project.ProjectStatusCodeId == ProjectSuspendCodeId)
                        {
                            InitializePopup();
                            popupProjectSuspendedWarning.ShowPopup(zIndex);
                            PageBase.StopProcessing = true;
                            PageBase.IsPageDirty    = false;
                        }
                    }
                }
                else if (Mode == ProjectWarningMode.Inventory && CompanyId > 0)
                {
                    if (!Support.CanAccessInventory(CompanyId))
                    {
                        InitializePopup();
                        ShowErrorPopup(ErrorCodes.NoEditPermissionForInventory, true);
                        PageBase.StopProcessing = true;
                        PageBase.IsPageDirty    = false;
                    }
                    else if (!IsCompanySuspended && (GetBL <CompanyBL>().HasCompanySuspendedbySBAdmin(CompanyId) || GetBL <CompanyBL>().IsCompanySuspended(CompanyId)))
                    {
                        InitializePopup();
                        popupProjectSuspendedWarning.Title = "This Company is currently Suspended";
                        popupProjectSuspendedWarning.ShowPopup(zIndex);
                        PageBase.StopProcessing = true;
                        PageBase.IsPageDirty    = false;
                        IsProjectSuspended      = true;
                    }
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Loads the data.
        /// </summary>
        /// <returns>Is data loaded.</returns>
        private bool LoadData()
        {
            Data.Item item = this.GetBL <InventoryBL>().CheckPermissionsForItemDetailsPage(UserID, ItemId, CompanyId);

            #region Validation

            if (item == null)
            {
                DisplayTitle = "Item not found.";
                plcItemNotAvailable.Visible = true;
                grpItem.Visible             = false;
                plcHeaderLinks.Visible      = false;
                upnlBottom.Visible          = false;
                plhScripts.Visible          = false;
                return(false);
            }
            else
            {
                DisplayTitle = string.Concat("Item Details - ", item.Name);
                Page.Title   = string.Concat("'", item.Name, "'");
                LoadBreadCrumbs(item);
                SetItemDetailsWatchListViewSettings();
            }

            if (!Support.CanAccessInventory(this.CompanyId))
            {
                btnDone.Visible = false;
            }

            #endregion Validation

            this.IsFromSharedCompany = GetBL <InventoryBL>().IsCompanyInSharedInventory(this.CompanyId) && (this.CompanyId != item.CompanyId.Value);

            ItemStatusInformationForUser itemStatusInformationForUser = this.GetBL <InventoryBL>().GetItemStatusInformationForUser(item, CompanyId, UserID);

            bool isCompanyAdmin     = itemStatusInformationForUser.IsCompanyAdmin;
            bool isInventoryManager = itemStatusInformationForUser.IsInventoryManager;
            bool isItemInUse        = itemStatusInformationForUser.IsItemInUse;

            bool hasPaymentSetuped = itemStatusInformationForUser.HasPaymentSetuped;
            bool hasSuspended      = itemStatusInformationForUser.HasSuspended;
            IsReadOnly = itemStatusInformationForUser.IsReadOnly;

            #region DeleteItemButton

            if ((isCompanyAdmin || isInventoryManager) && item.CompanyId == CompanyId && !this.GetBL <CompanyBL>().HasCompanySuspendedbySBAdmin(CompanyId) && hasPaymentSetuped && !hasSuspended)
            {
                btnDeleteItem.Visible = btnDone.Enabled = true;
                if (!isItemInUse)
                {
                    btnDeleteItem.Enabled = true;
                }
                else
                {
                    btnDeleteItem.Enabled = false;
                    btnDeleteItem.ToolTip = "This Item is being used on a Project so cannot be deleted";
                }
            }
            else
            {
                btnDeleteItem.Visible = btnDone.Enabled = false;
            }

            #endregion DeleteItemButton

            return(true);
        }