Example #1
0
        private Control getEditButton(Order current_order)
        {
            Control retControl = null;

            if (Security.IsAuthorized(getUserID(), PwasObject.Order, PwasAction.Update, PwasScope.All) &&
                (current_order.Status.statusId == OrderConstants.ORDER_STATUS_CREATED ||
                 current_order.Status.statusId == OrderConstants.ORDER_STATUS_PAID))
            {
                ImageButton editButton = new ImageButton();
                editButton.ID = current_order.orderID + "e";
                editButton.CommandArgument = current_order.orderID.ToString();
                editButton.ImageUrl        = "/images/edit.gif";
                editButton.Command        += new CommandEventHandler(func_Edit);
                retControl = editButton;
            }
            else if (Security.IsAuthorized(getUserID(), PwasObject.Order, PwasAction.Update, PwasScope.Self) &&
                     current_order.Status.statusId == OrderConstants.ORDER_STATUS_CREATED &&
                     OrderUtilities.isMyOrder(current_order.orderID, getUserID()))
            {
                ImageButton editButton = new ImageButton();
                editButton.ID = current_order.orderID + "e";
                editButton.CommandArgument = current_order.orderID.ToString();
                editButton.ImageUrl        = "/images/edit.gif";
                editButton.Command        += new CommandEventHandler(func_Edit);
                retControl = editButton;
            }
            else
            {
                Image image = new Image();
                image.ImageUrl = "/images/edit_gray.gif";
                retControl     = image;
            }

            return(retControl);
        }
Example #2
0
        private Control getViewButton(Order current_order)
        {
            Control retControl = null;

            if (Security.IsAuthorized(getUserID(), PwasObject.Order, PwasAction.Update, PwasScope.All))
            {
                ImageButton viewButton = new ImageButton();

                viewButton.ID = current_order.orderID + "v";
                viewButton.CommandArgument = current_order.orderID.ToString();
                viewButton.ImageUrl        = "/images/left-list.gif";
                viewButton.Command        += new CommandEventHandler(func_View);

                retControl = viewButton;
            }
            else if (Security.IsAuthorized(getUserID(), PwasObject.Order, PwasAction.Update, PwasScope.Self) &&
                     OrderUtilities.isMyOrder(current_order.orderID, getUserID()))
            {
                ImageButton viewButton = new ImageButton();

                viewButton.ID = current_order.orderID + "v";
                viewButton.CommandArgument = current_order.orderID.ToString();
                viewButton.ImageUrl        = "/images/left-list.gif";
                viewButton.Command        += new CommandEventHandler(func_View);

                retControl = viewButton;
            }
            else
            {
                Image image = new Image();
                image.ImageUrl = "/images/left-list_gray.gif";
                retControl     = image;
            }

            return(retControl);
        }