private void OnRoomImageLinkListRemove(RoomImageLink entity) { SendPropertyChanging(null); entity.Room = null; SendPropertyChanged(null); }
/// <summary> /// Handles the Click event of the _btnCreateRoom control. /// </summary> /// <param name = "sender">The source of the event.</param> /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param> protected void _btnCreateRoom_Click(object sender, EventArgs e) { if (!Page.IsValid) return; var db = new UrbanDataContext(); //Verify All sections from user are valid var validationCheck = VerifyRequiredFieldsSelected(); switch (validationCheck) { case -1: { WriteFeedBackMaster(FeedbackType.Warning, "Please fill in required fields"); return; } case -2: { WriteFeedBackMaster(FeedbackType.Warning, "Building already exists with this address information"); return; } case -3: { WriteFeedBackMaster(FeedbackType.Warning, "Room already exists for this building and room number"); return; } case 1: { break; } } try { db.Connection.Open(); _transac = db.Connection.BeginTransaction(); db.Transaction = _transac; //Building Creation var buildingCreateParams = GetBuildingCreateParams(); var buidlingResult = BuildingUtilities.ProcessBuildingCreation(ref db, Cu.Id, buildingCreateParams); if (buidlingResult != -1) { //Room Creation var roomCreateParams = GetRoomCreateParams(); var roomResult = RoomUtilities.ProcessRoomCreation(ref db, buidlingResult, Cu.Id, AvailabilityList, roomCreateParams); if (roomResult == -1) { WriteFeedBackMaster(FeedbackType.Warning, "Room already exists with this number for this building please select another."); _transac.Rollback(); } else { //_transac.Rollback(); _transac.Commit(); //Move every temp image to full image foreach (var file in ImageList) { var filesTemp = Server.MapPath("~/FilesTemp"); var imageToCopy = Path.Combine(filesTemp, file.ImageUrl); var files = Server.MapPath("~/Files"); var imagePathToCopy = Path.Combine(files, file.ImageUrl); File.Copy(imageToCopy, imagePathToCopy); var f = new Files { Extension = file.Extension, FilesName = file.FileName, FileSubType = "Image", ServerFileName = file.ImageUrl }; db.Files.InsertOnSubmit(f); db.SubmitChanges(); var link = new RoomImageLink { ImageDescription = file.Description, Title = file.Title, RoomID = roomResult, FileID = f.Id }; db.RoomImageLink.InsertOnSubmit(link); db.SubmitChanges(); } RadAjaxManager.GetCurrent(Page).Redirect(String.Format("~/App/Pages/MyAccount.aspx?message={0}", ("Room " + _txtRoomNumber.Text + " created"))); } } else { WriteFeedBackMaster(FeedbackType.Warning, "This address information already eixsts for a different user. Please modify and resubmit"); _transac.Rollback(); } } catch (Exception) { if (_transac != null) _transac.Rollback(); throw; } finally { if (db.Connection.State == ConnectionState.Open) db.Connection.Close(); } }
private void OnRoomImageLinkListAdd(RoomImageLink entity) { SendPropertyChanging(null); entity.Room = this; SendPropertyChanged(null); }
private void OnRoomImageLinkListRemove(RoomImageLink entity) { SendPropertyChanging(null); entity.RoomImageType1 = null; SendPropertyChanged(null); }
private void OnRoomImageLinkListAdd(RoomImageLink entity) { SendPropertyChanging(null); entity.RoomImageType1 = this; SendPropertyChanged(null); }
/// <summary> /// Handles the Click event of the _btnUploadImage control. /// </summary> /// <param name = "sender">The source of the event.</param> /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param> protected void _btnUploadImage_Click(object sender, EventArgs e) { if (RadUpload1.UploadedFiles.Count <= 0) return; var db = new UrbanDataContext(); foreach (UploadedFile validFile in RadUpload1.UploadedFiles) { var guid = Guid.NewGuid(); var targetFolder = Server.MapPath("~/Files"); validFile.SaveAs(Path.Combine(targetFolder, guid.ToString()), true); var f = new Files { Extension = validFile.GetExtension(), FilesName = validFile.GetNameWithoutExtension(), FileSubType = "Image", ServerFileName = guid.ToString() }; db.Files.InsertOnSubmit(f); db.SubmitChanges(); var link = new RoomImageLink { ImageDescription = _txtDescription.Text, Title = _txtName.Text, RoomID = RoomId, FileID = f.Id }; db.RoomImageLink.InsertOnSubmit(link); db.SubmitChanges(); _txtName.Text = ""; _txtDescription.Text = ""; } _rgImages.Rebind(); }
private void OnFileRoomImageLinkListRemove(RoomImageLink entity) { SendPropertyChanging(null); entity.FileFiles = null; SendPropertyChanged(null); }
private void OnFileRoomImageLinkListAdd(RoomImageLink entity) { SendPropertyChanging(null); entity.FileFiles = this; SendPropertyChanged(null); }