public async Task PersistAdd(AppealUpload entity)
        {
            var transaction = _unitOfWork.GetTransaction();

            await transaction.Connection.ExecuteAsync(
                @"INSERT INTO [AppealUpload]
                    ([Id],
                    [ApplicationId],
                    [AppealId],
                    [FileStorageReference],
                    [Filename],
                    [ContentType],
                    [Size],
                    [UserId],
                    [UserName],
                    [CreatedOn])
                    VALUES (
                    @Id,
                    @ApplicationId,
                    @AppealId,
                    @FileStorageReference,
                    @Filename,
                    @ContentType,
                    @Size,
                    @UserId,
                    @UserName,
                    @CreatedOn)",
                entity, transaction);
        }
예제 #2
0
        public void Setup()
        {
            _command = new RemoveAppealFileCommand
            {
                ApplicationId = _applicationId,
                FileId        = _appealUploadId,
                UserId        = "userId",
                UserName      = "******"
            };

            var upload = new AppealUpload {
                Id = _appealUploadId, FileStorageReference = _fileStorageFileId, ApplicationId = _applicationId
            };

            _appealUploadRepository = new Mock <IAppealUploadRepository>();
            _appealUploadRepository.Setup(x => x.GetById(_appealUploadId)).ReturnsAsync(upload);
            _appealUploadRepository.Setup(x => x.Remove(It.IsAny <Guid>()));

            _appealFileStorage = new Mock <IAppealsFileStorage>();
            _appealFileStorage.Setup(x => x.Remove(_applicationId, It.IsAny <Guid>(), It.IsAny <CancellationToken>()))
            .Returns(Task.CompletedTask);

            _auditService = new Mock <IAuditService>();
            _auditService.Setup(x => x.StartTracking(UserAction.RemoveAppealFile, _command.UserId, _command.UserName));
            _auditService.Setup(x => x.AuditDelete(It.IsAny <AppealUpload>()));

            _handler = new RemoveAppealFileCommandHandler(_appealUploadRepository.Object, _appealFileStorage.Object, _auditService.Object);
        }
        public async Task PersistUpdate(AppealUpload entity)
        {
            var transaction = _unitOfWork.GetTransaction();

            await transaction.Connection.ExecuteAsync(
                @"UPDATE [AppealUpload] SET
                    [ApplicationId] = @ApplicationId,
                    [AppealId] = @AppealId,
                    [FileStorageReference] = @FileStorageReference,
                    [Filename] = @Filename,
                    [ContentType] = @ContentType,
                    [Size] = @Size,
                    [UserId] = @UserId,
                    [UserName] = @UserName,
                    [CreatedOn] = @CreatedOn
                    WHERE [Id] = @Id",
                entity, transaction);
        }
예제 #4
0
        public void Setup()
        {
            _fileName    = _autoFixture.Create <string>();
            _contentType = _autoFixture.Create <string>();
            _content     = _autoFixture.Create <byte[]>();

            _request = new GetAppealUploadQuery
            {
                ApplicationId  = _applicationId,
                AppealId       = _appealId,
                AppealUploadId = _appealUploadId
            };

            _appealUploadRepository = new Mock <IAppealUploadRepository>();
            _appealFileStorage      = new Mock <IAppealsFileStorage>();

            _appealUpload = new AppealUpload
            {
                Filename             = _fileName,
                ContentType          = _contentType,
                FileStorageReference = _fileStorageReference,
                AppealId             = _appealId,
                ApplicationId        = _applicationId,
                Id        = _appealUploadId,
                CreatedOn = _autoFixture.Create <DateTime>(),
                Size      = _autoFixture.Create <int>(),
                UserId    = _autoFixture.Create <string>(),
                UserName  = _autoFixture.Create <string>()
            };

            _appealUploadRepository.Setup(x => x.GetById(_appealUploadId)).ReturnsAsync(_appealUpload);

            _appealFileStorage.Setup(x => x.Get(_applicationId, _fileStorageReference, It.IsAny <CancellationToken>()))
            .ReturnsAsync(_content);

            _handler = new GetAppealUploadQueryHandler(_appealUploadRepository.Object, _appealFileStorage.Object);
        }
예제 #5
0
        public async Task <Unit> Handle(UploadAppealFileCommand request, CancellationToken cancellationToken)
        {
            _auditService.StartTracking(UserAction.UploadAppealFile, request.UserId, request.UserName);

            var fileStorageReference = await _appealsFileStorage.Add(request.ApplicationId, request.File, cancellationToken);

            var appealUpload = new AppealUpload
            {
                ApplicationId        = request.ApplicationId,
                FileStorageReference = fileStorageReference,
                ContentType          = request.File.ContentType,
                Filename             = request.File.Filename,
                Size     = request.File.Data.Length,
                UserId   = request.UserId,
                UserName = request.UserName
            };

            _appealUploadRepository.Add(appealUpload);

            _auditService.AuditInsert(appealUpload);
            _auditService.Save();

            return(Unit.Value);
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Verify.Visible = false;
            if (this.rbValid.SelectedValue == "Accepted")
            {
                this.admin_status = "5";
                Verify.Visible    = true;
            }
            else if (this.rbValid.SelectedValue == "Refused")
            {
                this.admin_status = "4";
                Verify.Visible    = true;
            }

            else if (this.rbValid.SelectedValue == "Kiv")
            {
                this.admin_status = "14";
                Verify.Visible    = true;
            }
            if (Session["pwalletID"] != null)
            {
                if (Session["pwalletID"].ToString() != "")
                {
                    this.admin = Session["pwalletID"].ToString();
                }
                else
                {
                    base.Response.Redirect("./xcontrol.aspx");
                }
            }
            else
            {
                //  base.Response.Redirect("./xcontrol.aspx");
            }
            if (base.Request.QueryString["x"] != null)
            {
                this.pID = base.Request.QueryString["x"].ToString();
                string tt2 = base.Request.QueryString["x2"].ToString();
                this.c_mark  = this.z.getMarkInfoByUserID(this.pID);
                appealupload = this.t.getAppealRefusal(tt2);



                if (appealupload.Status != "Pending")
                {
                    showvisible     = false;
                    rbValid.Visible = false;
                    comment.Visible = false;
                }

                txtAddress.Text = appealupload.Comment;
                this.c_p        = this.z.getPwalletDetailsByID(this.c_mark.log_staff);
                this.c_app      = this.t.getApplicantByUserID(this.c_p.ID);
                this.c_aos      = this.t.getAddressServiceByID(this.c_p.ID);
                this.c_rep      = this.t.getRepByUserID(this.c_p.ID);

                if ((c_app.addressID != null) && (c_app.addressID != "") && (c_app.addressID != "0"))
                {
                    this.c_app_addy = this.t.getAddressClassByID(this.c_app.addressID);
                }
                if ((c_rep.addressID != null) && (c_rep.addressID != "") && (c_rep.addressID != "0"))
                {
                    this.c_rep_addy = this.t.getAddressClassByID(this.c_rep.addressID);
                }
                this.lt_tm_office = this.z.getTmOfficeDetailsByID(this.c_p.ID);
                xname.Value       = c_p.applicantID;
                xname2.Value      = c_mark.product_title;

                xname3.Value = c_mark.reg_number;

                xname4.Value = c_p.validationID;
                xname5.Value = c_mark.log_staff;

                xname6.Value = c_p.applicantID;

                this.lt_tm_office = this.z.getTmOfficeDetailsByID(this.c_p.ID);
                for (int i = 0; i < this.lt_tm_office.Count; i++)
                {
                    this.xcomments          = this.xcomments + "<tr>";
                    this.xcomments          = this.xcomments + "<td align=\"center\" colspan=\"2\">";
                    this.xcomments          = this.xcomments + "<strong>" + this.lt_tm_office[i].xcomment.ToUpper() + "</strong><br />";
                    this.lt_x_admin_details = this.z.getTmAdminDetailsByID(this.lt_tm_office[i].xofficer);
                    string xcomments = this.xcomments;
                    this.xcomments = xcomments + "COMMENT BY: <strong>" + this.lt_x_admin_details.xname.ToUpper() + "( " + this.z.getRoleNameByID(this.lt_x_admin_details.xroleID).ToUpper() + " UNIT)</strong><br />   Date: <strong>" + this.lt_tm_office[i].reg_date.ToUpper() + "</strong>";
                    this.xcomments = this.xcomments + "</td>";
                    this.xcomments = this.xcomments + "</tr>";
                    if (lt_tm_office[i].xdoc1 != "")
                    {
                        this.xcomments = this.xcomments + "<tr>";
                        this.xcomments = this.xcomments + "<td colspan=\"2\" align=\"center\">";
                        this.xcomments = this.xcomments + "View Document 1: <a href=" + lt_tm_office[i].xdoc1 + " target='_blank'>View</a>";
                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "</tr>";
                    }

                    if (lt_tm_office[i].xdoc2 != "")
                    {
                        this.xcomments = this.xcomments + "<tr>";
                        this.xcomments = this.xcomments + "<td colspan=\"2\" align=\"center\">";
                        this.xcomments = this.xcomments + "View Document 2: <a href=" + lt_tm_office[i].xdoc2 + " target='_blank'>View</a>";
                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "</tr>";
                    }

                    if (lt_tm_office[i].xdoc3 != "")
                    {
                        this.xcomments = this.xcomments + "<tr>";
                        this.xcomments = this.xcomments + "<td colspan=\"2\" align=\"center\">";
                        this.xcomments = this.xcomments + "View Document 3: <a href=" + lt_tm_office[i].xdoc3 + " target='_blank'>View</a>";
                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "</tr>";
                    }
                    this.xcomments = this.xcomments + "<tr>";
                    this.xcomments = this.xcomments + "<td class=\"coltbbg\" colspan=\"2\" align=\"center\">";
                    this.xcomments = this.xcomments + "&nbsp;";
                    this.xcomments = this.xcomments + "</td>";
                    this.xcomments = this.xcomments + "</tr>";
                    if (this.lt_tm_office[i].admin_status == "3")
                    {
                        this.xcomments = this.xcomments + "<tr>";
                        this.xcomments = this.xcomments + "<td class=\"coltbbg\" colspan=\"2\" align=\"center\">";
                        this.xcomments = this.xcomments + "--- SUPPORTING SEARCH DOCUMENTS ---";
                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "</tr>";
                        this.xcomments = this.xcomments + "<tr>";
                        this.xcomments = this.xcomments + "<td align=\"right\">";
                        this.xcomments = this.xcomments + "Attached Document:";
                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "<td>";

                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "</tr>";
                        this.xcomments = this.xcomments + "<tr>";
                        this.xcomments = this.xcomments + "<td class=\"coltbbg\" colspan=\"2\" align=\"center\">";
                        this.xcomments = this.xcomments + "&nbsp;";
                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "</tr>";
                    }

                    //////////
                    if (this.lt_tm_office[i].admin_status == "33")
                    {
                        this.xcomments = this.xcomments + "<tr>";
                        this.xcomments = this.xcomments + "<td class=\"coltbbg\" colspan=\"2\" align=\"center\">";
                        this.xcomments = this.xcomments + "--- SUPPORTING SEARCH 2 DOCUMENTS ---";
                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "</tr>";
                        this.xcomments = this.xcomments + "<tr>";
                        this.xcomments = this.xcomments + "<td align=\"right\">";
                        this.xcomments = this.xcomments + "Attached Document:";
                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "<td>";

                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "</tr>";

                        this.xcomments = this.xcomments + "<tr>";
                        this.xcomments = this.xcomments + "<td class=\"coltbbg\" colspan=\"2\" align=\"center\">";
                        this.xcomments = this.xcomments + "&nbsp;";
                        this.xcomments = this.xcomments + "</td>";
                        this.xcomments = this.xcomments + "</tr>";
                    } //////////
                }
            }
            else
            {
                base.Response.Redirect("./verify_data.aspx");
            }
        }
 public void Update(AppealUpload entity)
 {
     _unitOfWork.Register(() => PersistUpdate(entity));
 }
 public void Add(AppealUpload entity)
 {
     _unitOfWork.Register(() => PersistAdd(entity));
 }