Example #1
0
 public FailedUserData(int lineNumber, string data, RejectionReason rejectionReason, UserData userdata)
 {
     LineNumber      = lineNumber;
     Data            = data;
     RejectionReason = rejectionReason;
     UserData        = userdata;
 }
Example #2
0
        /// <summary>
        /// Rejects a job in the 'Reviewable' state
        /// </summary>
        /// <param name="jobId">The job ID</param>
        /// <param name="reason">Reason for rejection (mandatory)</param>
        /// <param name="comment">Elaboration on reason (mandatory)</param>
        /// <param name="captcha">
        /// Value of captcha image. The URL for this can be obtained through
        /// the <see cref="Get"/> method.
        /// </param>
        /// <param name="requeueJob"></param>
        /// <returns></returns>
        public async Task Reject(int jobId, RejectionReason reason,
                                 string comment, string captcha, bool requeueJob)
        {
            if (String.IsNullOrWhiteSpace(comment))
            {
                throw new ArgumentException(
                          Resources.RejectionCommentMandatory,
                          "comment");
            }

            if (String.IsNullOrWhiteSpace(captcha))
            {
                throw new ArgumentException(
                          Resources.RejectionCaptchaNotSpecified,
                          "captcha");
            }

            var uri = UriPartJob + jobId;

            var data = new JObject();

            data["action"] = "reject";

            data["reason"]    = reason.ToReasonString();
            data["comment"]   = comment;
            data["captcha"]   = captcha;
            data["follow_up"] = requeueJob ? "requeue" : "cancel";

            await _client.PutJsonAsync <JObject>(uri, data);
        }
        public RepositoryActionResult <RejectionReason> Update(RejectionReason t)
        {
            try
            {
                var existingData = _ctx.RejectionReasons.FirstOrDefault(exp => exp.Id == t.Id);

                if (existingData == null)
                {
                    return(new RepositoryActionResult <RejectionReason>(t, RepositoryActionStatus.NotFound));
                }

                _ctx.Entry(existingData).State = EntityState.Detached;
                _ctx.RejectionReasons.Attach(t);
                _ctx.Entry(t).State = EntityState.Modified;


                var result = _ctx.SaveChanges();
                if (result > 0)
                {
                    return(new RepositoryActionResult <RejectionReason>(t, RepositoryActionStatus.Updated));
                }
                else
                {
                    return(new RepositoryActionResult <RejectionReason>(t, RepositoryActionStatus.NothingModified, null));
                }
            }
            catch (Exception ex)
            {
                return(new RepositoryActionResult <RejectionReason>(null, RepositoryActionStatus.Error, ex));
            }
        }
        public IHttpActionResult Post([FromBody] RejectionReason reason)
        {
            try
            {
                if (reason == null)
                {
                    return(BadRequest());
                }



                var result = _repository.Insert(reason);
                if (result.Status == RepositoryActionStatus.Created)
                {
                    // map to dto
                    return(Created <RejectionReason>(Request.RequestUri
                                                     + "/" + reason.Id.ToString(), reason));
                }

                return(BadRequest());
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }
        public async Task <ActionResult> Edit(int?id)
        {
            var    rolesAssigneed = canLoggedInUserView();
            string roleCanView    = "Customer Interface";

            if (rolesAssigneed != null)
            {
                var element = rolesAssigneed.Where(x => x.StartsWith(roleCanView)).FirstOrDefault();
                if (element != roleCanView)
                {
                    return(RedirectToAction("Unauthorized", "Access"));
                }
                else
                {
                    if (id == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    }
                    RejectionReason reason = await _applicationDbContext.RejectionReasons.FindAsync(id);

                    if (reason == null)
                    {
                        return(HttpNotFound());
                    }
                    return(View(reason));
                }
            }
            else
            {
                AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
            }
            return(RedirectToAction("Login", "Access"));
        }
 private CancelPurchaseApplicationCommand(
     Id purchaseApplicationId,
     RejectionReason rejectionReason)
 {
     PurchaseApplicationId = purchaseApplicationId;
     RejectionReason       = rejectionReason;
 }
        }                                                                       // default constructor for IStringifiable

        public RejectedFillEventArgs(InstrumentName name, FillEventArgs rejectedFill, RejectionReason reason, string rejectionMessage)
        {
            this.m_Name  = name;
            this.Reason  = reason;
            this.Message = rejectionMessage;
            this.OriginalFillEventArg = rejectedFill;
        }
 private Either <Error, PurchaseApplication> Reject(
     PurchaseApplication purchaseApplication,
     RejectionReason rejection)
 {
     return(purchaseApplication
            .Reject(timeService.UtcNow(), rejection)
            .MapLeft(_ => Error.PurchaseApplicationIsAlreadyRejected));
 }
Example #9
0
        public BindNakPDU(byte[] buffer, int offset) : base(buffer, offset)
        {
            int startOffset = offset;

            offset      += CommonFieldsLength;
            RejectReason = (RejectionReason)LittleEndianReader.ReadUInt16(buffer, ref offset);
            Versions     = new VersionsSupported(buffer, offset);
        }
        public async Task <ActionResult> DeleteConfirmed(RejectionReason id)
        {
            RejectionReason reason = await _applicationDbContext.RejectionReasons.FindAsync(id.RejectionReasonId);

            _applicationDbContext.RejectionReasons.Remove(reason);
            await _applicationDbContext.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #11
0
        public bool CanAcceptContent(Context context, ContentHash hash, out RejectionReason rejectionReason)
        {
            if (ContentStore is IPushFileHandler handler)
            {
                return(handler.CanAcceptContent(context, hash, out rejectionReason));
            }

            rejectionReason = RejectionReason.NotSupported;
            return(false);
        }
Example #12
0
        private PushResponse(bool shouldCopy, RejectionReason rejection)
        {
            ShouldCopy = shouldCopy;
            Rejection  = rejection;

            _metadata = new Lazy <Metadata>(() => new Metadata
            {
                { "should_copy", ShouldCopy.ToString() },
                { "rejection_reason", ((int)rejection).ToString() }
            });
        }
Example #13
0
        /// <inheritdoc />
        public bool CanAcceptContent(Context context, ContentHash hash, out RejectionReason rejectionReason)
        {
            if (Store.Contains(hash))
            {
                rejectionReason = RejectionReason.ContentAvailableLocally;
                return(false);
            }

            rejectionReason = RejectionReason.Accepted;
            return(true);
        }
        public async Task <ActionResult> Edit([Bind(Include = "RejectionReasonId,Reason")] RejectionReason report)
        {
            if (ModelState.IsValid)
            {
                _applicationDbContext.Entry(report).State = EntityState.Modified;
                await _applicationDbContext.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(report));
        }
        public async Task <ActionResult> Create([Bind(Include = "Reason")] RejectionReason report)
        {
            if (ModelState.IsValid)
            {
                _applicationDbContext.RejectionReasons.Add(report);
                await _applicationDbContext.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ModelState.AddModelError("", "Unable to add request");
            return(View());
        }
        /// <summary>
        /// Rejects a player who's trying to authenticate.
        /// </summary>
        /// <param name="rejectionReason">The rejection reason.</param>
        /// <param name="isForced">Indicates whether the player has to be rejected forcefully or not.</param>
        /// <param name="customReason">The custom rejection reason (Banned and Custom reasons only).</param>
        /// <param name="expiration">The ban expiration ticks (Banned reason only).</param>
        /// <param name="seconds">The delay in seconds (Delay reason only).</param>
        /// <param name="port">The redirection port (Redirect reason only).</param>
        public void Reject(RejectionReason rejectionReason, bool isForced, string customReason = null, long expiration = 0, byte seconds = 0, ushort port = 0)
        {
            if (customReason != null && customReason.Length > 400)
            {
                throw new ArgumentOutOfRangeException(nameof(rejectionReason), "Reason can't be longer than 400 characters.");
            }

            if (!IsAllowed)
            {
                return;
            }

            IsAllowed = false;

            NetDataWriter rejectData = new NetDataWriter();

            rejectData.Put((byte)rejectionReason);

            switch (rejectionReason)
            {
            case RejectionReason.Banned:
                rejectData.Put(expiration);
                rejectData.Put(customReason);
                break;

            case RejectionReason.Custom:
                rejectData.Put(customReason);
                break;

            case RejectionReason.Delay:
                rejectData.Put(seconds);
                break;

            case RejectionReason.Redirect:
                rejectData.Put(port);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(rejectionReason), rejectionReason, null);
            }

            if (isForced)
            {
                Request.RejectForce(rejectData);
            }
            else
            {
                Request.Reject(rejectData);
            }
        }
        public void CreatesCommand()
        {
            var commandDto = BuildCancelPurchaseApplicationCommandDto();

            var result = CancelPurchaseApplicationCommand.Create(commandDto);

            result.IsSuccess.Should().BeTrue();
            result.IfSuccess(command =>
            {
                var expectedPurchaseApplicationId = Id.Create(commandDto.PurchaseApplicationId).IfFail(() => null);
                command.PurchaseApplicationId.Should().Be(expectedPurchaseApplicationId);
                var expectedRejectionReason = RejectionReason.Create(commandDto.RejectionReason).IfFail(() => null);
                command.RejectionReason.Should().Be(expectedRejectionReason);
            });
        }
Example #18
0
        public Either <Error, PurchaseApplication> Reject(DateTime dateTime, RejectionReason rejectionReason)
        {
            if (Rejection.IsSome)
            {
                return(Error.PurchaseApplicationIsAlreadyRejected);
            }
            var rejection = new Rejection(dateTime: dateTime, reason: rejectionReason);

            return(new PurchaseApplication(
                       id: Id,
                       products: Products,
                       client: Client,
                       additionalInformation: AdditionalInformation,
                       creationDateTime: CreationDateTime,
                       rejection: rejection));
        }
        public string GetErrorMessage(FailedUserData failedUserData)
        {
            RejectionReason rejectionReason = failedUserData.RejectionReason;
            string          data            = failedUserData.Data;

            if (rejectionReason == RejectionReason.UnexpectedFormat)
            {
                return(string.Format(ErrorMessages.UserDataUnexpectedFormat, data));
            }

            if (rejectionReason == RejectionReason.FailedParsing)
            {
                return(string.Format(ErrorMessages.FailedParsingUserData, data));
            }

            string name = failedUserData.UserData?.Name?.Length > 175 ? failedUserData.UserData?.Name?.Substring(0, 175)
                              : failedUserData.UserData?.Name;

            if (rejectionReason == RejectionReason.FahNameExceedsMaxSize)
            {
                return(FormatExceedsMaxSizeRejection(ErrorMessages.FahNameExceedsMaxSize, name,
                                                     failedUserData.UserData?.Name?.Length ?? 0));
            }

            if (rejectionReason == RejectionReason.FriendlyNameExceedsMaxSize)
            {
                return(FormatExceedsMaxSizeRejection(ErrorMessages.FriendlyNameExceedsMaxSize, name,
                                                     failedUserData.UserData?.FriendlyName?.Length ?? 0));
            }

            if (rejectionReason == RejectionReason.BitcoinAddressExceedsMaxSize)
            {
                return(FormatExceedsMaxSizeRejection(ErrorMessages.BitcoinAddressExceedsMaxSize, name,
                                                     failedUserData.UserData?.BitcoinAddress?.Length ?? 0));
            }

            if (rejectionReason == RejectionReason.FailedAddToDatabase)
            {
                return(string.Format(ErrorMessages.FailedAddUserToDatabase, name));
            }

            return(string.Empty);
        }
 public RepositoryActionResult <RejectionReason> Insert(RejectionReason t)
 {
     try
     {
         _ctx.RejectionReasons.Add(t);
         var result = _ctx.SaveChanges();
         if (result > 0)
         {
             return(new RepositoryActionResult <RejectionReason>(t, RepositoryActionStatus.Created));
         }
         else
         {
             return(new RepositoryActionResult <RejectionReason>(t, RepositoryActionStatus.NothingModified, null));
         }
     }
     catch (Exception ex)
     {
         return(new RepositoryActionResult <RejectionReason>(null, RepositoryActionStatus.Error, ex));
     }
 }
        public void SetAttributes(Dictionary <string, string> attributes)
        {
            RejectionReason reason;
            InstrumentName  name;

            foreach (string aKey in attributes.Keys)
            {
                if (aKey.Equals("Reason") && Enum.TryParse <RejectionReason>(attributes[aKey], out reason))
                {
                    this.Reason = reason;
                }
                else if (aKey.Equals("Message"))
                {
                    this.Message = attributes[aKey];
                }
                else if (aKey.Equals("InstrumentName") && InstrumentName.TryDeserialize(attributes[aKey], out name))
                {
                    this.m_Name = name;
                }
            }
        }
Example #22
0
        private bool IsUserDataValid(AddUserDataParameters addUserParameters, UserData userData,
                                     out RejectionReason rejectionReason)
        {
            if (userData.Name?.Length > addUserParameters.FahUserName.Size)
            {
                rejectionReason = RejectionReason.FahNameExceedsMaxSize;
                return(false);
            }

            if (userData.FriendlyName?.Length > addUserParameters.FriendlyName.Size)
            {
                rejectionReason = RejectionReason.FriendlyNameExceedsMaxSize;
                return(false);
            }

            if (userData.BitcoinAddress?.Length > addUserParameters.BitcoinAddress.Size)
            {
                rejectionReason = RejectionReason.BitcoinAddressExceedsMaxSize;
                return(false);
            }

            rejectionReason = RejectionReason.None;
            return(true);
        }
Example #23
0
 public bool CanAcceptContent(Context context, ContentHash hash, out RejectionReason rejectionReason)
 => _local.CanAcceptContent(context, hash, out rejectionReason);
        /// <summary>
        /// Rejects a job in the 'Reviewable' state
        /// </summary>
        /// <param name="jobId">The job ID</param>
        /// <param name="reason">Reason for rejection (mandatory)</param>
        /// <param name="comment">Elaboration on reason (mandatory)</param>
        /// <param name="captcha">
        /// Value of captcha image. The URL for this can be obtained through
        /// the <see cref="Get"/> method.
        /// </param>
        /// <param name="requeueJob"></param>
        /// <returns></returns>
        public async Task Reject(int jobId, RejectionReason reason,
            string comment, string captcha, bool requeueJob)
        {
            if (String.IsNullOrWhiteSpace(comment))
                throw new ArgumentException(
                    Resources.RejectionCommentMandatory,
                    "comment");

            if (String.IsNullOrWhiteSpace(captcha))
                throw new ArgumentException(
                    Resources.RejectionCaptchaNotSpecified,
                    "captcha");

            var uri = UriPartJob + jobId;
            
            var data = new JObject();

            data["action"] = "reject";

            data["reason"] = reason.ToReasonString();
            data["comment"] = comment;
            data["captcha"] = captcha;
            data["follow_up"] = requeueJob ? "requeue" : "cancel";

            await _client.PutJsonAsync<JObject>(uri, data);
        }
Example #25
0
        public void CreatesReject()
        {
            var result = RejectionReason.Create("Razon del rechazo");

            result.IsSuccess.Should().BeTrue();
        }
Example #26
0
 public void RejectOrder(int runLogId, RejectionReason reason)
 {
     // log the rejection, DONT clear the order memberid and raise an exception to the human controller.
 }
Example #27
0
        protected override void Seed(NailsContext context)
        {
            var dt = DateTime.Now;

            var region = new Region()
            {
                Id = 1, Title = "Ленинградская область", Created = dt, Updated = dt
            };

            context.Regions.AddOrUpdate(region);

            var city = new City()
            {
                Id = 1, Title = "Пикалево", Region = region, Created = dt, Updated = dt
            };

            context.Cities.AddOrUpdate(city);

            var master = new Master()
            {
                Id              = 1,
                FirstName       = "Юлия",
                LastName        = "Афанасьева",
                Photo           = "/Content/Photos/Users/yulya.jpg",
                ExperienceYears = 1,
                Region          = region,
                City            = city,
                Created         = dt,
                Updated         = dt
            };

            var contactType1 = new ContactType()
            {
                Id = 1, Title = "Email", Logo = "/Content/Logos/Email.png", Created = dt, Updated = dt
            };
            var contactType2 = new ContactType()
            {
                Id = 2, Title = "Instagram", Logo = "/Content/Logos/Instagram.png", Created = dt, Updated = dt
            };
            var contactType3 = new ContactType()
            {
                Id = 3, Title = "Whatsapp", Logo = "/Content/Logos/Whatsapp.png", Created = dt, Updated = dt
            };
            var contactType4 = new ContactType()
            {
                Id = 4, Title = "ВКонтакте", Logo = "/Content/Logos/VK.png", Created = dt, Updated = dt
            };

            context.ContactTypes.AddOrUpdate(contactType1);
            context.ContactTypes.AddOrUpdate(contactType2);
            context.ContactTypes.AddOrUpdate(contactType3);
            context.ContactTypes.AddOrUpdate(contactType4);

            var contact2 = new Contact()
            {
                Id = 1, ContactType = contactType2, Address = "https://www.instagram.com/afanaseva_nail/", User = master, Created = dt, Updated = dt
            };
            var contact3 = new Contact()
            {
                Id = 2, ContactType = contactType3, Address = "https://wa.me/79633431516", User = master, Created = dt, Updated = dt
            };
            var contact4 = new Contact()
            {
                Id = 3, ContactType = contactType4, Address = "https://vk.com/yuliya_afanaseva", User = master, Created = dt, Updated = dt
            };

            context.Contacts.AddOrUpdate(contact2);
            context.Contacts.AddOrUpdate(contact3);
            context.Contacts.AddOrUpdate(contact4);

            context.Masters.AddOrUpdate(master);

            var certificationAuthority1 = new CertificationAhority()
            {
                Id = 1, Title = "Paris Nail", Url = "https://parisnail.ru/", Created = dt, Updated = dt
            };

            context.CertificationAhorities.AddOrUpdate(certificationAuthority1);

            var cert1 = new Certificate()
            {
                Id = 1, Authority = certificationAuthority1, Scan = "/Content/Certificates/cert1.jpg", Master = master, Created = dt, Updated = dt
            };
            var cert2 = new Certificate()
            {
                Id = 2, Authority = certificationAuthority1, Scan = "/Content/Certificates/cert2.jpg", Master = master, Created = dt, Updated = dt
            };
            var cert3 = new Certificate()
            {
                Id = 3, Authority = certificationAuthority1, Scan = "/Content/Certificates/cert3.jpg", Master = master, Created = dt, Updated = dt
            };
            var cert4 = new Certificate()
            {
                Id = 4, Authority = certificationAuthority1, Scan = "/Content/Certificates/cert4.jpg", Master = master, Created = dt, Updated = dt
            };

            context.Certificates.AddOrUpdate(cert1);
            context.Certificates.AddOrUpdate(cert2);
            context.Certificates.AddOrUpdate(cert3);
            context.Certificates.AddOrUpdate(cert4);

            var reject1 = new RejectionReason()
            {
                Id = 1, Title = "Отказ клиента", Created = dt, Updated = dt
            };
            var reject2 = new RejectionReason()
            {
                Id = 2, Title = "Отказ мастера", Created = dt, Updated = dt
            };
            var reject3 = new RejectionReason()
            {
                Id = 3, Title = "Другая причина", Created = dt, Updated = dt
            };

            context.RejectionReasons.AddOrUpdate(reject1);
            context.RejectionReasons.AddOrUpdate(reject2);
            context.RejectionReasons.AddOrUpdate(reject3);

            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 1, Path = "/Content/Photos/Manicure/manicure1.jpg"
            });
            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 2, Path = "/Content/Photos/Manicure/manicure2.jpg"
            });
            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 3, Path = "/Content/Photos/Manicure/manicure3.jpg"
            });
            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 4, Path = "/Content/Photos/Manicure/manicure4.jpg"
            });
            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 5, Path = "/Content/Photos/Manicure/manicure5.jpg"
            });
            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 6, Path = "/Content/Photos/Manicure/manicure6.jpg"
            });
            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 7, Path = "/Content/Photos/Manicure/manicure7.jpg"
            });
            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 8, Path = "/Content/Photos/Manicure/manicure8.jpg"
            });
            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 9, Path = "/Content/Photos/Manicure/manicure9.jpg"
            });
            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 10, Path = "/Content/Photos/Manicure/manicure10.jpg"
            });
            context.Photos.AddOrUpdate(new Photo()
            {
                Id = 11, Path = "/Content/Photos/Manicure/manicure11.jpg"
            });

            context.ContentBlocks.AddOrUpdate(new ContentBlock()
            {
                Id      = 1,
                Title   = "Маникюр в Пикалево",
                HtmlId  = "manicure",
                Content =
                    "Выполним маникюр в Пикалево. Консультация по носке и уходу за покрытием - бесплатно." +
                    "Маникюр придаст вашим рукам красоту, поможет вовремя заметить проблемы и начать их лечение. " +
                    "Стерильные инструменты, которыми выполняются работы - гарантия безопасности и отсутствия бактерий. ",
                Created = dt,
                Updated = dt
            });

            context.ContentBlocks.AddOrUpdate(new ContentBlock()
            {
                Id      = 2,
                Title   = "Педикюр в Пикалево",
                HtmlId  = "pedicure",
                Content =
                    "Выполним педикюр в Пикалево. Педикюр - это визуальное удовлетворение и уход за кожей стоп и ногтями. " +
                    "Трещины, мозоли и инфекции могут доставлять не только дискомфорт, но и мучительную боль! " +
                    "Педикюр обеспечит качественный уход за кожей и ногтями, лечение имеющихся проблем и уверенность в себе.",
                Created = dt,
                Updated = dt
            });
        }
Example #28
0
 /// <nodoc />
 public static PushResponse DoNotCopy(RejectionReason reason) => PushReasonseByRejection[reason];
Example #29
0
 public FailedUserData(int lineNumber, RejectionReason rejectionReason, UserData userdata)
     : this(lineNumber, null, rejectionReason, userdata)
 {
 }
Example #30
0
 public FailedUserData(int lineNumber, string data, RejectionReason rejectionReason)
     : this(lineNumber, data, rejectionReason, null)
 {
 }
Example #31
0
 internal static PushFileResult Rejected(RejectionReason rejectionReason)
 => CreateUnsuccessful(rejectionReason switch