Exemplo n.º 1
0
        public static ConfirmPayoutResult ConfirmPayout(string protoIdentity)
        {
            protoIdentity = HttpUtility.UrlDecode(protoIdentity);

            AuthenticationData authData = GetAuthenticationDataAndCulture();

            if (
                !authData.Authority.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.Financials, AccessType.Write)))
            {
                throw new SecurityException("Insufficient privileges for operation");
            }

            ConfirmPayoutResult result = new ConfirmPayoutResult();

            Payout payout = Payout.CreateFromProtoIdentity(authData.CurrentUser, protoIdentity);

            PWEvents.CreateEvent(EventSource.PirateWeb, EventType.PayoutCreated,
                                 authData.CurrentUser.Identity, 1, 1, 0, payout.Identity,
                                 protoIdentity);

            // Create result and return it

            result.AssignedId     = payout.Identity;
            result.DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutCreated, payout.Identity,
                                                  payout.Recipient);

            return(result);
        }
Exemplo n.º 2
0
        public static ConfirmPayoutResult ConfirmPayout(string protoIdentity)
        {
            AuthenticationData authData = GetAuthenticationDataAndCulture();

            if (
                !authData.Authority.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.Financials, AccessType.Write)))
            {
                throw new UnauthorizedAccessException("Insufficient privileges for operation");
            }

            Payout payout = Payout.CreateFromProtoIdentity(authData.CurrentUser, protoIdentity);  // TODO: Catch ConcurrencyException

            // Create result and return it

            return(new ConfirmPayoutResult
            {
                AssignedId = payout.Identity,
                DisplayMessage = String.Format(Resources.Pages.Financial.PayOutMoney_PayoutCreated, payout.Identity,
                                               payout.Recipient),
                Success = true
            });
        }
Exemplo n.º 3
0
    protected void ButtonPay_Click(object sender, EventArgs e)
    {
        List <string> identityStrings = new List <string>();

        if (_authority.HasPermission(Permission.CanPayOutMoney, Organization.PPSEid, -1, Authorization.Flag.ExactOrganization))
        {
            foreach (string indexString in this.GridPayouts.SelectedIndexes)
            {
                // Creating the payout closes the invoices and expense claims.

                int    index         = Int32.Parse(indexString);
                string protoIdentity = (string)this.GridPayouts.MasterTableView.DataKeyValues[index]["ProtoIdentity"];
                Payout payout        = Payout.CreateFromProtoIdentity(_currentUser, protoIdentity);

                Activizr.Logic.Support.PWEvents.CreateEvent(EventSource.PirateWeb, EventType.PayoutCreated,
                                                            _currentUser.Identity, 1, 1, 0, payout.Identity,
                                                            protoIdentity);
            }

            PopulateGrid();
            this.GridPayouts.Rebind();
        }
    }