public ArticleInfo(IGetArticle modelObject, bool hideEmptyFields, bool showIcon) { HideEmptyFields = hideEmptyFields; ShowIcon = showIcon; CurrentItem = modelObject; var field = modelObject as ArticleField; if (field != null) { PropertyDisplay pd = new PropertyDisplay() { Title = field.FieldDisplayName }; var article = modelObject.GetItem(null); if (hideEmptyFields && article == null) { return; } if (article != null) { var valueTitleSource = article.Fields.Values.OfType <IGetFieldStringValue>().FirstOrDefault(); pd.Value = new ActionLink { CurrentItem = article, ShowIcon = showIcon, IconClass = "edit", Title = valueTitleSource != null ? valueTitleSource.Value : null }; } Content = pd; } }
public PropertyDisplay GetPropertyDetails(long propertyID, PropertiesDisplayType display = PropertiesDisplayType.AllBrokers) { PropertyDisplay lst = null; var query = db.Properties.Where(x => !x.IsDeleted && x.PropertyID == propertyID && x.IsActive); if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { query = query.Where(x => x.AllowVisitors); } else { query = query.Where(x => x.SharedID == "All"); } var row = query.FirstOrDefault(); if (row == null) { return(null); } lst = query.Select(x => new PropertyDisplay() { EntryDate = x.EntryDate, FloorTypeTitle = x.PropertyFloorType.FloorTypeTitle, Title = x.Title, LocationName = x.Location.LocationName, OwnerShipTitle = x.OwnerShipType.OwnerShipTitle, PropertyID = x.PropertyID, PropPurposeTitle = x.PropertyPurpose.PropPurposeTitle, PropTypeTitle = x.PropertyType.PropTypeTitle, AddressDetails = x.AddressDetails, ReadyDate = x.ReadyDate, Area = x.Area, Comments = x.Comments, Commission = x.Commission, CommissionType = x.CommissionType, FloorNum = x.FloorNum, NumberOfBathrooms = x.NumberOfBathrooms, NumberOfRooms = x.NumberOfRooms, ProjectID = x.ProjectID, FullName = x.User.FullName, CompanyID = x.Project != null ? x.Project.CompanyID : 0, CompanyName = (x.Project != null && x.Project.Company != null) ? x.Project.Company.CompanyName : null, ProjectName = x.Project != null ? x.Project.ProjectName : null, Contacts = (x.Project != null && x.Project.Company != null) ? x.Project.Company.Contacts : x.User.Mobile, ContactsForBrokers = (x.Project != null && x.Project.Company != null) ? x.Project.Company.ContactsForBrokers : null, Price = x.Price, UserID = x.ByUserID, AreaID = x.LocationID, AreaName = x.Location.LocationName, CityID = x.Location.ParentID, Images = db.Files.Where(z => z.IsActive == true && z.IsDeleted != true && z.ParentType == "Properties" && z.ParentID == x.PropertyID).Select(z => z.FileName).ToList(), HasElevator = x.HasElevator, HasGarage = x.HasGarage, CanInstallment = x.CanInstallment, DownPayment = x.DownPayment, NoOfYears = x.NoOfYears }).FirstOrDefault(); var city = db.Locations.Where(z => z.LocationID == lst.CityID).FirstOrDefault(); lst.CityName = city.LocationName; lst.GovernorateID = city.ParentID; lst.GovernorateName = db.Locations.Where(z => z.LocationID == lst.GovernorateID).Select(x => x.LocationName).FirstOrDefault(); lst.PostComments = db.Comments.Where(x => x.PostID == propertyID && x.PostType == 1).OrderByDescending(x => x.CreatedDate).Select(x => new PostComment() { CommentID = x.CommentID, CommentMsg = x.CommentMsg, CreatedDate = x.CreatedDate.Value, UserID = x.UserID.Value, UserImg = x.User.ProfileImgPath, UserName = x.User.FullName }).ToList(); if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { var matchedQuery = db.PropertyRequests.Where(z => z.IsActive && !z.IsDeleted && z.ByUserID == CurrentUser.UserID && (z.OwnerShipTypeID == row.OwnerShipTypeID || z.OwnerShipTypeID == null) && (z.PropertyFloorTypeID == row.PropertyFloorTypeID || z.PropertyFloorTypeID == null) && (z.LocationIDs == row.LocationID || z.LocationIDs == null) && (z.CityID == lst.CityID || z.CityID == null) && (z.GovID == lst.GovernorateID || z.GovID == null) && (z.PropertyPurposeID == row.PropertyPurposeID || z.PropertyPurposeID == null) && (z.MinPrice <= lst.Price && z.MaxPrice >= lst.Price) && (z.MinPrice == 0 && z.MaxPrice == 0) && (z.MinArea <= lst.Area && z.MaxArea <= lst.Area) && (z.MinArea == 0 && z.MinArea == 0)); lst.MatchedRequests = matchedQuery.Select(x => new PropertyShortDisplay() { EntryDate = x.EntryDate, FloorTypeTitle = x.PropertyFloorType.FloorTypeTitle, Title = x.Title, LocationName = x.Location.LocationName, OwnerShipTitle = x.OwnerShipType.OwnerShipTitle, PropertyID = x.RequestID, PropPurposeTitle = x.PropertyPurpose.PropPurposeTitle, PropTypeTitle = x.PropertyType.PropTypeTitle, AddressDetails = x.AddressDetails, UserID = x.ByUserID }).ToList(); } return(lst); }
public void OnPointerDown(PointerEventData eventData) { if (Input.GetMouseButtonDown(0)) { //Debug.Log (Parent.name + "\t" + click); List <Property> properties = Game.players [Game.currentPlayer].GetProperties(); bool didit = false; int index = 0; foreach (Property p in properties) { if (p.GetGroup().Equals(Parent.name)) { Debug.Log(Parent.name + "\t" + click); if (index == click) { pname = p.GetName(); if (PropertyDisplay.image2.gameObject.activeInHierarchy) { if (!PropertyDisplay.image2.sprite.name.Equals(pname)) { PropertyDisplay.doit(1); if (PropertyDisplay.imageOther2.gameObject.activeInHierarchy) { PropertyDisplay.imageOther2.gameObject.SetActive(false); } didit = true; } else { //PropertyDisplay.doit (3); PropertyDisplay.image2.gameObject.SetActive(false); } } else if (!PropertyDisplay.image2.gameObject.activeInHierarchy) { didit = true; PropertyDisplay.doit(1); PropertyDisplay.image2.gameObject.SetActive(true); } } index++; } } if (TradeManager.IsTrading && !PropertyDisplay.image2.gameObject.activeInHierarchy) { properties = Game.players [TradeManager.PlayerToTrade].GetProperties(); index = 0; foreach (Property p in properties) { if (p.GetGroup().Equals(Parent.name)) { Debug.Log(Parent.name + "\t" + click); if (index == click) { pname = p.GetName(); if (PropertyDisplay.imageOther2.gameObject.activeInHierarchy) { if (!PropertyDisplay.imageOther2.sprite.name.Equals(pname)) { PropertyDisplay.doit(2); } else { PropertyDisplay.imageOther2.gameObject.SetActive(false); } } else if (!PropertyDisplay.imageOther2.gameObject.activeInHierarchy) { //PropertyDisplay.doit (2); PropertyDisplay.imageOther2.gameObject.SetActive(true); } } index++; } } } } else if (Input.GetMouseButtonDown(1) && TradeManager.IsTrading) { Debug.Log("RIGHT CLICK"); int index = 0; foreach (Property p in Game.players[Game.currentPlayer].GetProperties()) { if (p.GetGroup().Equals(Parent.name)) { Debug.Log("Current:\t" + p.GetName()); if (index == click) { pname = p.GetName(); TradeManager.currentPlayer.Add(p); /*if (PropertyDiplaye.image2.gameObject.activeInHierarchy && PropertyDiplaye.image2.sprite.name.Equals (pname)) { * PropertyDiplaye.image2.gameObject.SetActive (false); * } else if (!PropertyDiplaye.image2.gameObject.activeInHierarchy) { * PropertyDiplaye.image2.gameObject.SetActive (true); * }*/ TradeManager.doit = true; } index++; } } index = 0; foreach (Property p in Game.players[TradeManager.PlayerToTrade].GetProperties()) { if (p.GetGroup().Equals(Parent.name)) { Debug.Log("Other:\t" + p.GetName()); if (index == click) { pname = p.GetName(); TradeManager.otherPlayer.Add(p); /*if (PropertyDiplaye.image2.gameObject.activeInHierarchy && PropertyDiplaye.image2.sprite.name.Equals (pname)) { * PropertyDiplaye.image2.gameObject.SetActive (false); * } else if (!PropertyDiplaye.image2.gameObject.activeInHierarchy) { * PropertyDiplaye.image2.gameObject.SetActive (true); * }*/ //BuildingManager.needsUpdate = true; TradeManager.doit = true; } index++; } } } }
public ArticleCollection(IModelObject parent, IGetArticles modelObject, bool hideEmptyMultipleFields, bool showIcon, bool isHorizontal, string separator = ", ") { HideEmptyMultipleFields = hideEmptyMultipleFields; ShowIcon = showIcon; IsHorizontal = isHorizontal; CurrentItem = parent; var field = modelObject as ArticleField; if (field != null) { PropertyDisplay pd = new PropertyDisplay() { Title = field.FieldDisplayName }; var articles = modelObject.GetArticles(null).ToArray(); UIItemsControl stackPanel = new StackPanel { IsHorizontal = isHorizontal };; UIItemsControl container; if (isHorizontal) { container = new StackPanel(); container.AddChild(stackPanel); } else { container = stackPanel; } if (hideEmptyMultipleFields && !articles.Any()) { return; } if (showIcon) { container.PrependChild(new ActionLink { Title = ProductCardStrings.Edit, CurrentItem = parent, ShowIcon = true, IconClass = "edit" }); } for (int i = 0; i < articles.Length; i++) { var article = articles[i]; if (article == null) { continue; } var valueTitleSource = article.Fields.Values.OfType <IGetFieldStringValue>().FirstOrDefault(); stackPanel.AddChild(new ActionLink { CurrentItem = article, Title = valueTitleSource != null ? valueTitleSource.Value : null }); if (isHorizontal && !string.IsNullOrEmpty(separator) && i < articles.Length - 1) { stackPanel.AddChild(new Label { Title = separator }); } } pd.Value = container; Content = pd; } }
public void Attach(Type type) { this.Controls.Clear(); Properties = new List <PropertyDisplay>(); foreach (var prop in type.GetProperties()) { var colName = prop.Name; var attrs = prop.GetCustomAttributes(typeof(BrowsableAttribute), true); if (attrs.Length > 0) { if (!(attrs[0] as BrowsableAttribute).Browsable) { continue; // not browsable } } attrs = prop.GetCustomAttributes(typeof(DisplayNameAttribute), true); if (attrs.Length > 0) { colName = (attrs[0] as DisplayNameAttribute).DisplayName; } var display = new PropertyDisplay(); Properties.Add(display); display.Description = new Label(); display.Description.Text = colName; this.Controls.Add(display.Description); display.DescWidth = TextRenderer.MeasureText(colName, display.Description.Font).Width; display.Description.Width = display.DescWidth; // TODO : add more controls here if (prop.PropertyType == typeof(DateTime)) { var dt = new DateTimePicker(); display.Editor = dt; display.EditorWidth = dt.Width; display.Editor.DataBindings.Add("Value", this.BindingSource, prop.Name); } else { var textLen = 10; //if (prop.PropertyType == typeof(int)) textLen = 10; if (prop.PropertyType == typeof(string)) { attrs = prop.GetCustomAttributes(typeof(StringLengthAttribute), true); if (attrs.Length > 0) { textLen = (attrs[0] as StringLengthAttribute).MaximumLength; } } var dt = new TextBox(); display.Editor = dt; display.EditorWidth = TextRenderer.MeasureText(new string('n', textLen), display.Editor.Font).Width; display.Editor.Width = display.EditorWidth; display.Editor.DataBindings.Add("Text", this.BindingSource, prop.Name); } this.Controls.Add(display.Editor); } RearrangeColumns(); }