Example #1
0
		public void delete (bool inConference, BookingDocumentDto document)
		{
			if (this.parentController != null && this.Delegate != null) {
				this.parentController.InvokeOnMainThread (delegate {
					this.Delegate.beginDeleteFileRequest (this); 
				});
			}

			Action<string> successful = (response => {
				#if DEBUG
				Console.Out.WriteLine (response);
				#endif

				if (parentController != null && this.Delegate != null) {
					this.parentController.InvokeOnMainThread (delegate {
						this.Delegate.finishDeleteFileRequest (this);

						bool result = CoreSystem.ParseDataHelper.parseResponseCommon (response);

						if (result) {
							this.Delegate.deleteFileSuccess (this, document);
							TCNotificationCenter.defaultCenter.postNotification(MConstants.kPostRefreshAlertFileDeleted, document);
						} else {
							this.Delegate.deleteFileFail (this, document);
						}
					});
				}
			});

			Action<string> failure = (response => {
				if (this.parentController != null && this.Delegate != null) {
					this.parentController.InvokeOnMainThread (delegate {
						this.Delegate.finishDeleteFileRequest (this);
						this.Delegate.deleteFileFail (this, document);
					});
				}
			});

			DataHelperRequest.getInstance ().deleteDocument (inConference, document.BookingId, document.Id, successful, failure);
		}
		public void actionFileFail (TCFileManagerHelper helper, ACTION_FILE_TYPE type, BookingDocumentDto document)
		{
			MUtils.showAlert (this, TCLocalizabled.getText ("TitleAlertDeleteFile"), String.Format (TCLocalizabled.getText ("MessageAlertDeleteFile"), document.OriginalFileName));
		}
		public void actionFileSuccess (TCFileManagerHelper helper, ACTION_FILE_TYPE type, BookingDocumentDto document)
		{
			if (this.bookingInfo.BookingDocuments != null && this.bookingInfo.BookingDocuments.Count > 0) {
				List<BookingDocumentDto> bookingDocuments = this.bookingInfo.BookingDocuments;

				var documentDto = bookingDocuments.Find (x => x.Id == document.Id) as BookingDocumentDto;
				if (documentDto != null) {
					this.bookingInfo.BookingDocuments.Remove (documentDto);

					object[] result = addFileHelper.displayFiles (this.bookingInfo.Id, this.bookingInfo.BookingDocuments, null, this.viewFiles);
					tweakFrameModifyDocument (result);
				}
			}
		}
		private void deleteFile (BookingDocumentDto document)
		{
			if (document.BookingId == this.bookingInfo.Id) {

				List<BookingDocumentDto> bookingDocuments = this.bookingInfo.BookingDocuments;

				BookingDocumentDto documentDto = null;
				if (bookingDocuments != null) {
					documentDto = bookingDocuments.Find (x => x.Id == document.Id) as BookingDocumentDto;
				}

				if (documentDto != null) {
					this.bookingInfo.BookingDocuments.Remove (documentDto);
				}

				object[] result = addFileHelper.displayFiles (this.bookingInfo.Id, this.bookingInfo.BookingDocuments, null, this.viewFiles);
				tweakFrameModifyDocument (result);
			}
		}
		public void actionFileSuccess (TCFileManagerHelper helper, ACTION_FILE_TYPE type, BookingDocumentDto document)
		{
			deleteFile (document);
		}
		private void onActionDeleteFile(BookingDocumentDto document){
			if (document.BookingId == bookingId) {
				TCNotificationCenter.defaultCenter.postNotification(constants.kUpdateAlertWhenDeleteFileLocal, document);
				var documentDto = bookingDocs.Find (x => x.Id == document.Id) as BookingDocumentDto;
				if (documentDto != null) {
					bookingDocs.Remove ((BookingDocumentDto)documentDto);
					utilsAndroid.addFileView (this, bookingDocs, true, addFiles, deleteFile, llFileAttach);
				}
			}
		}
		public void onDeleteSuccess (bool status, BookingDocumentDto document)
		{
			this.RunOnUiThread (() => {
				llProgress.Visibility = ViewStates.Gone;
				if(status) {
					onActionDeleteFile(document);
				} else {
					popupNotice.showNoticeDialog (GetString (Resource.String.delete_title), String.Format(GetString (Resource.String.delete_fail), document.OriginalFileName));
				}
			});
		}
Example #8
0
		public object[] displayFiles (Guid bookingId, List<BookingDocumentDto> oldFiles, BookingDocumentDto newFiles, UIView inView)
		{
			removeAllFile (inView);

			object[] info = new object[2];
			List<BookingDocumentDto> finalFiles = new List<BookingDocumentDto>();

			float X = 0;
			float Y = 0;
			float HeightFile = 0;
			float HeightControl = 21.0f;

			if ((oldFiles == null || oldFiles.Count == 0) && (newFiles == null || newFiles.OriginalFileName == null || newFiles.OriginalFileName.Equals(""))) {
				if (!this.hideNA) {
					UILabel lbNA = new UILabel ();
					lbNA.BackgroundColor = UIColor.Clear;
					lbNA.Frame = new CGRect (X, Y, 60.0f, HeightControl);
					lbNA.Text = "N/A";
					lbNA.Font = MUtils.getFontWithSize (false, 13.0f);
					lbNA.TextColor = UIColor.Black;
					HeightFile += HeightControl + 4.0f;
					inView.AddSubview (lbNA);
				}
			} else {

				if (oldFiles != null && oldFiles.Count > 0) {
					finalFiles = oldFiles;
				}

				if (newFiles != null && newFiles.OriginalFileName != null && !newFiles.OriginalFileName.Equals ("")) {
					finalFiles.Add (newFiles);
				}
					
				foreach (BookingDocumentDto file in finalFiles) {
					if (!file.OriginalFileName.Equals ("")) {

						string fileName = file.OriginalFileName;

						UIImageView imageAttachment = new UIImageView ();
						imageAttachment.Frame = new CGRect (X, Y + 4.0f,  13.0f, 13.0f);
						imageAttachment.Image = UIImage.FromBundle ("attachment_icon");

						UIButton btnNameFile = UIButton.FromType (UIButtonType.System);
						btnNameFile.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
						btnNameFile.TitleLabel.TextColor = UIColor.Black;
						btnNameFile.SetTitle (fileName, UIControlState.Normal);
						btnNameFile.TitleLabel.Font = MUtils.getFontWithSize(false, 13.0f);
						btnNameFile.Frame = new CGRect (imageAttachment.Frame.Width + 5.0f, Y, inView.Frame.Width - imageAttachment.Frame.Width - 35.0f, HeightControl);
						btnNameFile.AddTarget ((sender, args) => {
							showImage(file.S3FileName);
						}, UIControlEvent.TouchUpInside);

						btnNameFile.SetAttributedTitle (new NSAttributedString (
							btnNameFile.TitleLabel.Text, 
							underlineStyle: NSUnderlineStyle.Single), UIControlState.Normal);
							
						UIButton btnDelete = UIButton.FromType (UIButtonType.Custom);
						btnDelete.Frame = new CGRect (inView.Frame.Width - 25.0f, btnNameFile.Frame.Y, HeightControl, HeightControl);
						btnDelete.SetImage (UIImage.FromBundle("delete_icon"), UIControlState.Normal);
						btnDelete.AddTarget ((sender, args) => {
							deleteDocument(this.inConference, file);
						}, UIControlEvent.TouchUpInside);
							
						inView.AddSubview (imageAttachment);
						inView.AddSubview (btnNameFile);
						inView.AddSubview (btnDelete);

						Y += HeightControl;
						HeightFile += HeightControl ;
					}
				}
			}

			info [0] = finalFiles;
			info [1] = HeightFile;

			return info;
		}
Example #9
0
		public void deleteFileFail (TCDeleteFileHelper helper, BookingDocumentDto document)
		{
			if (this.Delegate != null) {
				this.Delegate.actionFileFail (this, ACTION_FILE_TYPE.DELETE, document);
			}
		}
Example #10
0
		private void deleteDocument (bool inConference, BookingDocumentDto documentDelete)
		{
			#if DEBUG
			Console.Out.WriteLine("Deleting File : " + documentDelete.OriginalFileName);
			#endif

			TCDeleteFileHelper deleteFileHelper = new TCDeleteFileHelper (this.parentVC);
			deleteFileHelper.Delegate = this;
			deleteFileHelper.delete (inConference, documentDelete);
		}