protected void SaveNewRoomDetails(object sender, EventArgs e) { try { if (Request[WebConstants.Request.Room_ID] == null || Request[WebConstants.Request.Room_ID] == "") { propRoom = new PropertyRoom(); propRoom.CreatedBy = loggedInUserId; propRoom.DateCreated = DateTime.Now; propRoom.CompanySequence = loggedInUserCoId; propRoom.DateLastAmended = DateTime.Now; propRoom.LastAmendedBy = loggedInUserId; propRoom.PropertySequence = property.Sequence; int totalRoomsInProperty = property.PropertyRooms.Count; propRoom.RoomNo = totalRoomsInProperty + 1; property.PropertyRooms.Add(propRoom); estateAgentDB.SaveChanges(); } else { int roomID = int.Parse(Request[WebConstants.Request.Room_ID]); propRoom = property.PropertyRooms.SingleOrDefault(room => room.Sequence == roomID); } if (HeadingTextBox.Text != null && HeadingTextBox.Text.CompareTo("") != 0) propRoom.RoomHeading = HeadingTextBox.Text; if (AspectTextBox.Text != null && AspectTextBox.Text.CompareTo("") != 0) propRoom.RoomAspect = AspectTextBox.Text; if (ParagraphTextBox.Text != null && ParagraphTextBox.Text.CompareTo("") != 0) propRoom.RoomText = ParagraphTextBox.Text; if (RoomLengthInMeters.Value != null && RoomLengthInMeters.Value.CompareTo("") != 0) propRoom.RoomLengthM = double.Parse(RoomLengthInMeters.Value); if (RoomLengthInFeet.Value != null && RoomLengthInFeet.Value.CompareTo("") != 0) propRoom.RoomLengthFt = double.Parse(RoomLengthInFeet.Value); if (RoomLengthInInches.Value != null && RoomLengthInInches.Value.CompareTo("") != 0) propRoom.RoomLengthIn = double.Parse(RoomLengthInInches.Value); if (RoomLengthText.Value != null && RoomLengthText.Value.CompareTo("") != 0) propRoom.RoomLengthText = RoomLengthText.Value; if (RoomWidthInMeters.Value != null && RoomWidthInMeters.Value.CompareTo("") != 0) propRoom.RoomWidthM = double.Parse(RoomWidthInMeters.Value); if (RoomWidthInFeet.Value != null && RoomWidthInFeet.Value.CompareTo("") != 0) propRoom.RoomWidthFt = double.Parse(RoomWidthInFeet.Value); if (RoomWidthInInches.Value != null && RoomWidthInInches.Value.CompareTo("") != 0) propRoom.RoomWidthIn = double.Parse(RoomWidthInInches.Value); if (RoomWidthText.Value != null && RoomWidthText.Value.CompareTo("") != 0) propRoom.RoomWidthText = RoomWidthText.Value; estateAgentDB.SaveChanges(); propRoom = null; Response.Redirect("~/Orders/AddOrderPeople.aspx?" + WebConstants.Request.PROPERTY_ORDER_ID + "=" + property.Sequence, false); } catch (Exception exc) { Response.Redirect("~/Orders/AddOrderPeople.aspx?" + WebConstants.Request.PROPERTY_ORDER_ID + "=" + property.Sequence + "&" + WebConstants.Request.ERROR + "=invalid property id: " + Request[WebConstants.Request.PROPERTY_ORDER_ID]); } }
/// <summary> /// Deprecated Method for adding a new object to the PropertyRooms EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPropertyRooms(PropertyRoom propertyRoom) { base.AddObject("PropertyRooms", propertyRoom); }
/// <summary> /// Create a new PropertyRoom object. /// </summary> /// <param name="sequence">Initial value of the Sequence property.</param> public static PropertyRoom CreatePropertyRoom(global::System.Int32 sequence) { PropertyRoom propertyRoom = new PropertyRoom(); propertyRoom.Sequence = sequence; return propertyRoom; }