Ver Fonte

Diverse Punkte der To-Do-Liste vom 28.09. umgesetzt + diverse Fehler behoben!

Arne Diekmann há 8 anos atrás
pai
commit
b833a02b4e
23 ficheiros alterados com 393 adições e 86 exclusões
  1. 14 0
      GreenTree.Nachtragsmanagement.Core/Domain/User/Role.cs
  2. 4 0
      GreenTree.Nachtragsmanagement.Data/Mapping/User/RoleMap.cs
  3. 4 0
      GreenTree.Nachtragsmanagement.Web/Content/devex.css
  4. 8 2
      GreenTree.Nachtragsmanagement.Web/Controllers/AdminController.cs
  5. 1 0
      GreenTree.Nachtragsmanagement.Web/Controllers/DeviationController.cs
  6. 1 0
      GreenTree.Nachtragsmanagement.Web/Controllers/SiteController.cs
  7. 139 40
      GreenTree.Nachtragsmanagement.Web/Extensions/GridViewSettingsHelper.cs
  8. 6 1
      GreenTree.Nachtragsmanagement.Web/Models/Admin/User/RoleDataModel.cs
  9. 8 0
      GreenTree.Nachtragsmanagement.Web/Models/Appendix/AppendixDataModel.cs
  10. 7 2
      GreenTree.Nachtragsmanagement.Web/Models/Misc/MailNotificationDataModel.cs
  11. 7 2
      GreenTree.Nachtragsmanagement.Web/Models/Site/SiteDataModel.cs
  12. 22 6
      GreenTree.Nachtragsmanagement.Web/Validation/Appendix/AppendixDataModelValidator.cs
  13. 50 14
      GreenTree.Nachtragsmanagement.Web/Validation/Deviation/DeviationDataModelValidator.cs
  14. 18 0
      GreenTree.Nachtragsmanagement.Web/Views/Admin/Roles/View.cshtml
  15. 35 4
      GreenTree.Nachtragsmanagement.Web/Views/Admin/Roles/_RoleGridPartial.cshtml
  16. 19 0
      GreenTree.Nachtragsmanagement.Web/Views/Admin/Users/View.cshtml
  17. 7 1
      GreenTree.Nachtragsmanagement.Web/Views/Admin/Users/_UserGridPartial.cshtml
  18. 15 4
      GreenTree.Nachtragsmanagement.Web/Views/Appendices/View.cshtml
  19. 1 1
      GreenTree.Nachtragsmanagement.Web/Views/Deviations/View.cshtml
  20. 8 1
      GreenTree.Nachtragsmanagement.Web/Views/Home/Index.cshtml
  21. 1 1
      GreenTree.Nachtragsmanagement.Web/Views/Misc/MailNotifications.cshtml
  22. 1 1
      GreenTree.Nachtragsmanagement.Web/Views/Sites/View.cshtml
  23. 17 6
      GreenTree.Nachtragsmanagement.Web/Views/Sites/_SiteEditTreePartial.cshtml

+ 14 - 0
GreenTree.Nachtragsmanagement.Core/Domain/User/Role.cs

@@ -10,6 +10,11 @@ namespace GreenTree.Nachtragsmanagement.Core.Domain.User
     {
         #region Fields
 
+        /// <summary>
+        /// Users related to the role
+        /// </summary>
+        private ICollection<User> _users;
+
         /// <summary>
         /// Functionlist
         /// </summary>
@@ -32,6 +37,15 @@ namespace GreenTree.Nachtragsmanagement.Core.Domain.User
         /// </summary>
         public bool SeeOnlyAssigned { get; set; }
 
+        /// <summary>
+        /// Users assigned to the role
+        /// </summary>
+        public virtual ICollection<User> Users
+        {
+            get { return _users ?? (_users = new List<User>()); }
+            protected set { _users = value; }
+        }
+
         /// <summary>
         /// Functions the role have
         /// </summary>

+ 4 - 0
GreenTree.Nachtragsmanagement.Data/Mapping/User/RoleMap.cs

@@ -22,6 +22,10 @@ namespace GreenTree.Nachtragsmanagement.Data.Mapping.User
             HasMany(r => r.Functions)
                 .WithMany()
                 .Map(m => m.ToTable("RoleFunctions"));
+
+            HasMany(m => m.Users)
+                .WithMany(u => u.Roles)
+                .Map(m => m.ToTable("UserRoles"));
         }
     }
 }

+ 4 - 0
GreenTree.Nachtragsmanagement.Web/Content/devex.css

@@ -9,6 +9,10 @@
 
 .devExCenter { margin: 0 auto; }
 
+.devExGridGroupRow { color: #009688 !important; }
+.devExGridFooterPanel { color: #009688 !important; }
+.devExGridFooterPanel > td.dxgv { color: #009688 !important; white-space: normal; }
+
 .devExNoBorder { border-style: none; }
 .devExBorderLeft { border-left-style: solid !important; }
 .devExBorderLeftGray { border-left-color: #D9D9D9 !important; }

+ 8 - 2
GreenTree.Nachtragsmanagement.Web/Controllers/AdminController.cs

@@ -75,13 +75,16 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
         /// <summary>
         /// Callback result for user grid
         /// </summary>
-        public ActionResult PartialUsers()
+        /// <param name="scrollHeight">The height of the grid scrollable component.</param>
+        public ActionResult PartialUsers(int scrollHeight = -1)
         {
             var users = _userService.GetAllUsers();
             var userModels = users
                 .Select(u => UserDataModel.FromUser(u, false))
                 .ToList();
 
+            ViewData["ScrollHeight"] = scrollHeight;
+
             return PartialView("~/Views/Admin/Users/_UserGridPartial.cshtml", userModels);
         }
 
@@ -210,13 +213,16 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
         /// <summary>
         /// Callback result for role grid
         /// </summary>
-        public ActionResult PartialRoles()
+        /// <param name="scrollHeight">The height of the grid scrollable component.</param>
+        public ActionResult PartialRoles(int scrollHeight = -1)
         {
             var roles = _userService.GetAllRoles();
             var roleModels = roles
                 .Select(r => RoleDataModel.FromRole(r, false))
                 .ToList();
 
+            ViewData["ScrollHeight"] = scrollHeight;
+
             return PartialView("~/Views/Admin/Roles/_RoleGridPartial.cshtml", roleModels);
         }
 

+ 1 - 0
GreenTree.Nachtragsmanagement.Web/Controllers/DeviationController.cs

@@ -266,6 +266,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
                 var deviation = _deviationService.GetDeviationById(deviationModel.Id);
 
                 deviation.CustomNumber = deviationModel.CustomNumber;
+                deviation.Description = deviationModel.Description;
                 deviation.ReceiptDate = deviationModel.ReceiptDate;
                 deviation.AppendixDate = deviationModel.AppendixDate;
                 deviation.Value = deviationModel.Value;

+ 1 - 0
GreenTree.Nachtragsmanagement.Web/Controllers/SiteController.cs

@@ -53,6 +53,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
                                 .Select(r => r.Description)))
                     })
                     .ToList();
+            ViewData["DefaultAppendixState"] = _appendixService.GetDefaultState();
         }
 
         #region Sites

+ 139 - 40
GreenTree.Nachtragsmanagement.Web/Extensions/GridViewSettingsHelper.cs

@@ -4,6 +4,7 @@ using DevExpress.Web;
 using DevExpress.Web.ASPxThemes;
 using DevExpress.Web.Mvc;
 using GreenTree.Nachtragsmanagement.Core.Authentication;
+using GreenTree.Nachtragsmanagement.Web.Models.Appendix;
 using System;
 using System.Collections.Generic;
 using System.Web.UI;
@@ -30,8 +31,9 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             s.KeyFieldName = "Id";
             s.CallbackRouteValues = new { Controller = "Site", Action = "PartialSites" };
             s.Width = Unit.Percentage(99);
+            s.Settings.ShowHeaderFilterButton = true;
             s.Settings.ShowFilterRow = true;
-            s.Settings.ShowFilterRowMenu = true;
+            s.Settings.ShowFilterRowMenu = false;
             s.Settings.ShowFooter = true;
             s.Settings.ShowGroupPanel = true;
             s.Settings.AutoFilterCondition = AutoFilterCondition.Contains;
@@ -45,6 +47,11 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             s.SettingsPopup.CustomizationWindow.Width = new Unit(250, UnitType.Pixel);
             s.SettingsPopup.CustomizationWindow.Height = new Unit(350, UnitType.Pixel);
             s.SettingsBehavior.EnableCustomizationWindow = true;
+            s.SettingsBehavior.AllowHeaderFilter = true;
+            s.SettingsPager.AlwaysShowPager = true;
+            s.SettingsResizing.ColumnResizeMode = ColumnResizeMode.NextColumn;
+            s.SettingsCookies.Enabled = true;
+            s.SettingsCookies.CookiesID = "siteGridStateCookie";
 
             s.Toolbars.Add(t =>
             {
@@ -112,7 +119,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                     });
                     column.Settings.AllowDragDrop = DefaultBoolean.False;
                     column.Settings.AllowSort = DefaultBoolean.False;
-                    column.Width = new Unit(150, UnitType.Pixel);
+                    column.Width = new Unit(100, UnitType.Pixel);
                 });
             }
             s.Columns.Add(column =>
@@ -120,19 +127,20 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                 column.Caption = "Kostenstelle";
                 column.FieldName = "CustomNumber";
                 column.MinWidth = 100;
-                column.Width = new Unit(10, UnitType.Percentage);
+                column.Width = new Unit(8, UnitType.Percentage);
             });
             s.Columns.Add(column =>
             {
                 column.Caption = "Bauvorhaben";
                 column.FieldName = "Description";
-                column.Width = new Unit(13, UnitType.Percentage);
+                column.Width = new Unit(20, UnitType.Percentage);
             });
             s.Columns.Add(column =>
             {
                 column.Caption = "Start";
                 column.FieldName = "Start";
                 column.PropertiesEdit.DisplayFormatString = "dd.MM.yyyy";
+                column.SettingsHeaderFilter.Mode = GridHeaderFilterMode.DateRangePicker;
                 column.MinWidth = 110;
                 column.Width = new Unit(8, UnitType.Percentage);
             });
@@ -141,6 +149,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                 column.Caption = "Ende";
                 column.FieldName = "End";
                 column.PropertiesEdit.DisplayFormatString = "dd.MM.yyyy";
+                column.SettingsHeaderFilter.Mode = GridHeaderFilterMode.DateRangePicker;
                 column.MinWidth = 110;
                 column.Width = new Unit(8, UnitType.Percentage);
             });
@@ -148,6 +157,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             {
                 column.Caption = "VA";
                 column.FieldName = "DeviationDescription";
+                column.Visible = false;
                 column.MinWidth = 150;
                 column.Width = new Unit(12, UnitType.Percentage);
             });
@@ -156,6 +166,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                 column.Caption = "VA-Summe";
                 column.FieldName = "DeviationValue";
                 column.PropertiesEdit.DisplayFormatString = "c2";
+                column.Visible = false;
                 column.MinWidth = 120;
                 column.Width = new Unit(10, UnitType.Percentage);
             });
@@ -169,24 +180,53 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             {
                 column.Caption = "Mitarbeiter";
                 column.MinWidth = 150;
-                column.Width = new Unit(20, UnitType.Percentage);
+                column.Width = new Unit(15, UnitType.Percentage);
                 column.SetDataItemTemplateContent(c =>
                 {
                     var userDescriptions = DataBinder.Eval(c.DataItem, "UserDescriptions") as List<string>;
 
                     if (userDescriptions != null)
                     {
-                        html.ViewContext.Writer.Write(
-                            String.Join("<br />", userDescriptions));
+                        foreach (var description in userDescriptions)
+                        {
+                            var split = description.Split('|');
+
+                            if (split.Length > 1)
+                                html.ViewContext.Writer.Write(
+                                    "<span style=\"float: left\">" + split[0] + "</span>" +
+                                    "<span style=\"float: right\">" + split[1] + "</span><br />");
+                            else
+                                html.ViewContext.Writer.Write(
+                                    "<span>" + split[0] + "</span><br />");
+                        }
+
                     }
                 });
             });
             s.Columns.Add(column =>
             {
                 column.Caption = "Kommentar";
-                column.FieldName = "Comment";
-                column.MinWidth = 100;
-                column.Width = new Unit(10, UnitType.Percentage);
+                column.CellStyle.Wrap = DefaultBoolean.True;
+                column.SetDataItemTemplateContent(c =>
+                {
+                    var id = Convert.ToInt32(DataBinder.Eval(c.DataItem, "Id"));
+
+                    var comment = DataBinder.Eval(c.DataItem, "Comment");
+                    var text = comment == null
+                        ? String.Empty
+                        : comment.ToString();
+
+                    if (text.ToString().Length > 40)
+                    {
+                        html.ViewContext.Writer.Write(text.Substring(0, 40) + " ...");
+                        html.ViewContext.Writer.Write("<a href=\"#\" onclick='showComment(\"site\"," + id + ",this)'><br />Anzeigen</a>");
+                    }
+                    else
+                        html.ViewContext.Writer.Write(text);
+                });
+                column.MinWidth = 120;
+                column.Width = new Unit(15, UnitType.Percentage);
+                column.Visible = false;
             });
 
             s.TotalSummary.Add(DevExpress.Data.SummaryItemType.Sum, "DeviationValue");
@@ -210,6 +250,9 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
 
             s.Styles.AlternatingRow.BackColor = System.Drawing.Color.FromArgb(247, 247, 247);
 
+            s.Styles.Footer.CssClass += "devExGridFooterPanel";
+            s.Styles.GroupRow.CssClass += "devExGridGroupRow";
+
             return s;
         }
 
@@ -225,6 +268,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             s.KeyFieldName = "Id";
             s.CallbackRouteValues = new { Controller = "Deviation", Action = "PartialDeviations" };
             s.Width = Unit.Percentage(99);
+            s.Settings.ShowHeaderFilterButton = true;
             s.Settings.ShowFilterRow = true;
             s.Settings.ShowFilterRowMenu = true;
             s.Settings.ShowFooter = true;
@@ -237,9 +281,14 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                 : (int)html.ViewData["ScrollHeight"];
             s.SettingsExport.Landscape = true;
             s.SettingsExport.FileName = "Vertragsabweichungsliste";
-            s.SettingsBehavior.EnableCustomizationWindow = true;
             s.SettingsPopup.CustomizationWindow.Width = new Unit(250, UnitType.Pixel);
             s.SettingsPopup.CustomizationWindow.Height = new Unit(350, UnitType.Pixel);
+            s.SettingsBehavior.EnableCustomizationWindow = true;
+            s.SettingsBehavior.AllowHeaderFilter = true;
+            s.SettingsPager.AlwaysShowPager = true;
+            s.SettingsResizing.ColumnResizeMode = ColumnResizeMode.NextColumn;
+            s.SettingsCookies.Enabled = true;
+            s.SettingsCookies.CookiesID = "deviationGridStateCookie";
 
             s.Toolbars.Add(t =>
             {
@@ -317,6 +366,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                 column.Caption = "Einreichung";
                 column.FieldName = "ReceiptDate";
                 column.PropertiesEdit.DisplayFormatString = "dd.MM.yyyy";
+                column.SettingsHeaderFilter.Mode = GridHeaderFilterMode.DateRangePicker;
                 column.MinWidth = 110;
                 column.Width = new Unit(8, UnitType.Percentage);
             });
@@ -418,8 +468,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             {
                 FieldName = "DaysReceiptToAppendixOffering",
                 SummaryType = DevExpress.Data.SummaryItemType.Custom,
-                DisplayFormat = "Schnitt = {0:n0}",
-                
+                DisplayFormat = "Schnitt = {0:n0}"
             });
             s.GroupSummary.Add(new ASPxSummaryItem
             {
@@ -441,6 +490,9 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             s.ClientSideEvents.BeginCallback = "function (s, e) { e.customArgs['scrollHeight'] = [ gridScrollHeight ]; }";
             s.ClientSideEvents.ToolbarItemClick = "function (s, e) { onToolbarItemClick(s, e); }";
 
+            s.Styles.Footer.CssClass += "devExGridFooterPanel";
+            s.Styles.GroupRow.CssClass += "devExGridGroupRow";
+
             s.Styles.AlternatingRow.BackColor = System.Drawing.Color.FromArgb(247, 247, 247);
 
             return s;
@@ -458,11 +510,13 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             s.KeyFieldName = "Id";
             s.CallbackRouteValues = new { Controller = "Appendix", Action = "PartialAppendices" };
             s.Width = Unit.Percentage(99);
+            s.Settings.ShowHeaderFilterButton = true;
             s.Settings.ShowFilterRow = true;
             s.Settings.ShowFilterRowMenu = true;
             s.Settings.ShowFooter = true;
             s.Settings.ShowGroupPanel = true;
             s.Settings.AutoFilterCondition = AutoFilterCondition.Contains;
+            s.Settings.HorizontalScrollBarMode = ScrollBarMode.Auto;
             s.Settings.VerticalScrollBarMode = ScrollBarMode.Auto;
             s.Settings.VerticalScrollableHeight =
                 (html.ViewData["ScrollHeight"] == null || (int)html.ViewData["ScrollHeight"] == -1)
@@ -470,9 +524,14 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                 : (int)html.ViewData["ScrollHeight"];
             s.SettingsExport.Landscape = true;
             s.SettingsExport.FileName = "Nachtragsliste";
-            s.SettingsBehavior.EnableCustomizationWindow = true;
             s.SettingsPopup.CustomizationWindow.Width = new Unit(250, UnitType.Pixel);
             s.SettingsPopup.CustomizationWindow.Height = new Unit(350, UnitType.Pixel);
+            s.SettingsBehavior.EnableCustomizationWindow = true;
+            s.SettingsBehavior.AllowHeaderFilter = true;
+            s.SettingsPager.AlwaysShowPager = true;
+            s.SettingsResizing.ColumnResizeMode = ColumnResizeMode.Control;
+            s.SettingsCookies.Enabled = true;
+            s.SettingsCookies.CookiesID = "appendixGridStateCookie";
 
             s.Toolbars.Add(t =>
             {
@@ -519,10 +578,10 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
 
             s.Columns.Add(column =>
             {
-                column.Caption = "Nummer";
+                column.Caption = "#";
                 column.FieldName = "CustomNumber";
                 column.MinWidth = 80;
-                column.Width = new Unit(8, UnitType.Percentage);
+                column.Width = new Unit(80, UnitType.Pixel);
             });
             s.Columns.Add(column =>
             {
@@ -535,62 +594,73 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             {
                 column.Caption = "Baustelle";
                 column.FieldName = "SiteDescription";
-                column.MinWidth = 120;
+                column.MinWidth = 150;
                 column.Width = new Unit(10, UnitType.Percentage);
             });
             s.Columns.Add(column =>
+            {
+                column.Caption = "Kst.-Stelle";
+                column.FieldName = "SiteCustomNumber";
+                column.MinWidth = 120;
+                column.Width = new Unit(120, UnitType.Pixel);
+            });
+            s.Columns.Add(column =>
             {
                 column.Caption = "Einreichung";
                 column.FieldName = "OfferingDate";
                 column.PropertiesEdit.DisplayFormatString = "dd.MM.yyyy";
                 column.MinWidth = 110;
-                column.Width = new Unit(8, UnitType.Percentage);
+                column.Width = new Unit(110, UnitType.Pixel);
             });
             s.Columns.Add(column =>
             {
-                column.Caption = "Angeb.-Sum.";
+                column.Caption = "Angeb. -Summe";
                 column.FieldName = "OfferingValue";
                 column.PropertiesEdit.DisplayFormatString = "c2";
-                column.MinWidth = 140;
-                column.Width = new Unit(8, UnitType.Percentage);
+                column.MinWidth = 110;
+                column.Width = new Unit(110, UnitType.Pixel);
+                column.HeaderStyle.Wrap = DefaultBoolean.True;
             });
             s.Columns.Add(column =>
             {
-                column.Caption = "Verhand.-Sum.";
+                column.Caption = "Verhand. -Summe";
                 column.FieldName = "NegotiationValue";
                 column.PropertiesEdit.DisplayFormatString = "c2";
-                column.MinWidth = 140;
-                column.Width = new Unit(8, UnitType.Percentage);
+                column.MinWidth = 110;
+                column.Width = new Unit(110, UnitType.Pixel);
+                column.HeaderStyle.Wrap = DefaultBoolean.True;
             });
             s.Columns.Add(column =>
             {
-                column.Caption = "Verh. Angeb./Verha.";
+                column.Caption = "Anteil Verh. zu Angeb.";
                 column.FieldName = "RelationOfferingToNegotiation";
                 column.PropertiesEdit.DisplayFormatString = "p2";
-                column.MinWidth = 140;
-                column.Width = new Unit(10, UnitType.Percentage);
+                column.MinWidth = 115;
+                column.Width = new Unit(115, UnitType.Pixel);
+                column.HeaderStyle.Wrap = DefaultBoolean.True;
             });
             s.Columns.Add(column =>
             {
                 column.Caption = "VA";
                 column.FieldName = "DeviationDescription";
-                column.MinWidth = 100;
+                column.MinWidth = 70;
                 column.Width = new Unit(6, UnitType.Percentage);
             });
             s.Columns.Add(column =>
             {
-                column.Caption = "Verh. Angeb./VA.";
+                column.Caption = "Faktor Angeb. zu VA";
                 column.FieldName = "RelationOfferingToDeviations";
                 column.PropertiesEdit.DisplayFormatString = "n2";
-                column.MinWidth = 140;
-                column.Width = new Unit(10, UnitType.Percentage);
+                column.MinWidth = 100;
+                column.Width = new Unit(100, UnitType.Pixel);
+                column.HeaderStyle.Wrap = DefaultBoolean.True;
             });
             s.Columns.Add(column =>
             {
                 column.Caption = "Status";
                 column.FieldName = "StateDescription";
                 column.MinWidth = 100;
-                column.Width = new Unit(6, UnitType.Percentage);
+                column.Width = new Unit(100, UnitType.Pixel);
             });
             s.Columns.Add(column =>
             {
@@ -631,28 +701,36 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             {
                 SummaryType = DevExpress.Data.SummaryItemType.Sum,
                 FieldName = "OfferingValue",
-                DisplayFormat = "{0:c2}"
+                DisplayFormat = "Angeb.-Sum.: {0:c2}"
             });
             s.GroupSummary.Add(new ASPxSummaryItem
             {
                 SummaryType = DevExpress.Data.SummaryItemType.Sum,
                 FieldName = "OfferingValue",
-                DisplayFormat = "{0:c2}"
+                DisplayFormat = "Angeb.-Sum.: {0:c2}"
             });
 
             s.TotalSummary.Add(new ASPxSummaryItem
             {
                 SummaryType = DevExpress.Data.SummaryItemType.Sum,
                 FieldName = "NegotiationValue",
-                DisplayFormat = "{0:c2}"
+                DisplayFormat = "Verhand.-Sum.: {0:c2}"
             });
             s.GroupSummary.Add(new ASPxSummaryItem
             {
                 SummaryType = DevExpress.Data.SummaryItemType.Sum,
                 FieldName = "NegotiationValue",
-                DisplayFormat = "{0:c2}"
+                DisplayFormat = "Verhand.-Sum.: {0:c2}"
             });
 
+            s.HtmlRowPrepared = (sender, e) =>
+            {
+                var state = e.GetValue("State") as StateDataModel;
+
+                if (e.RowType == GridViewRowType.Data && state != null && !state.IsDefault)
+                    e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(state.HexColor);
+            };
+
             s.ClientLayout = (sender, e) =>
             {
                 if (e.LayoutMode == ClientLayoutMode.Loading)
@@ -665,8 +743,12 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             };
             s.ClientSideEvents.BeginCallback = "function (s, e) { e.customArgs['scrollHeight'] = [ gridScrollHeight ]; }";
             s.ClientSideEvents.ToolbarItemClick = "function (s, e) { onToolbarItemClick(s, e); }";
+            s.ClientSideEvents.ColumnResized = "function (s, e) { setGridScrollHeight(); }";
 
-            s.Styles.AlternatingRow.BackColor = System.Drawing.Color.FromArgb(247, 247, 247);
+            //s.Styles.AlternatingRow.BackColor = System.Drawing.Color.FromArgb(247, 247, 247);
+
+            s.Styles.Footer.CssClass += "devExGridFooterPanel";
+            s.Styles.GroupRow.CssClass += "devExGridGroupRow";
 
             return s;
         }
@@ -683,6 +765,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             s.KeyFieldName = "Id";
             s.CallbackRouteValues = new { Controller = "Misc", Action = "PartialMailNotifications" };
             s.Width = Unit.Percentage(99);
+            s.Settings.ShowHeaderFilterButton = true;
             s.Settings.ShowFilterRow = true;
             s.Settings.ShowFilterRowMenu = true;
             s.Settings.ShowFooter = true;
@@ -698,6 +781,11 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             s.SettingsPopup.CustomizationWindow.Width = new Unit(250, UnitType.Pixel);
             s.SettingsPopup.CustomizationWindow.Height = new Unit(350, UnitType.Pixel);
             s.SettingsBehavior.EnableCustomizationWindow = true;
+            s.SettingsBehavior.AllowHeaderFilter = true;
+            s.SettingsPager.AlwaysShowPager = true;
+            s.SettingsResizing.ColumnResizeMode = ColumnResizeMode.NextColumn;
+            s.SettingsCookies.Enabled = true;
+            s.SettingsCookies.CookiesID = "mailNotificationGridStateCookie";
 
             s.Toolbars.Add(t =>
             {
@@ -787,15 +875,26 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             {
                 column.Caption = "Mitarbeiter";
                 column.MinWidth = 150;
-                column.Width = new Unit(20, UnitType.Percentage);
+                column.Width = new Unit(15, UnitType.Percentage);
                 column.SetDataItemTemplateContent(c =>
                 {
                     var userDescriptions = DataBinder.Eval(c.DataItem, "UserDescriptions") as List<string>;
 
                     if (userDescriptions != null)
                     {
-                        html.ViewContext.Writer.Write(
-                            String.Join("<br />", userDescriptions));
+                        foreach (var description in userDescriptions)
+                        {
+                            var split = description.Split('|');
+
+                            if (split.Length > 1)
+                                html.ViewContext.Writer.Write(
+                                    "<span style=\"float: left\">" + split[0] + "</span>" +
+                                    "<span style=\"float: right\">" + split[1] + "</span><br />");
+                            else
+                                html.ViewContext.Writer.Write(
+                                    "<span>" + split[0] + "</span><br />");
+                        }
+
                     }
                 });
             });

+ 6 - 1
GreenTree.Nachtragsmanagement.Web/Models/Admin/User/RoleDataModel.cs

@@ -23,6 +23,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Admin.User
                     return String.Join(", ", FunctionDescriptions);
             }
         }
+        public string UserDescription { get; set; }
 
         public RoleDataModel()
         {
@@ -54,7 +55,11 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Admin.User
                 FunctionDescriptions =
                     roleEntity.Functions
                         .Select(r => r.Description)
-                        .ToList()
+                        .ToList(),
+                UserDescription =
+                    String.Join(", ", 
+                        roleEntity.Users
+                            .Select(u => u.Lastname))
             };
         }
 

+ 8 - 0
GreenTree.Nachtragsmanagement.Web/Models/Appendix/AppendixDataModel.cs

@@ -27,9 +27,11 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Appendix
         public bool OrderInvoiceCreated { get; set; }
         public string Comment { get; set; }
         public int? StateId { get; set; }
+        public StateDataModel State { get; set; }
         public string StateDescription { get; set; }
         public int? SiteId { get; set; }
         public string SiteDescription { get; set; }
+        public string SiteCustomNumber { get; set; }
         public ICollection<int> DeviationValues { get; set; }
         public ICollection<string> DeviationDescriptions { get; set; }
         public string DeviationDescription { get; set; }
@@ -106,6 +108,9 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Appendix
                 Comment = appendixEntity.Comment,
                 OrderInvoiceCreated = appendixEntity.OrderInvoiceCreated,
                 StateId = appendixEntity.StateId,
+                State = appendixEntity.State == null
+                    ? null
+                    : StateDataModel.FromState(appendixEntity.State, false),
                 StateDescription = appendixEntity.State == null
                     ? null
                     : appendixEntity.State.Description,
@@ -113,6 +118,9 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Appendix
                 SiteDescription = appendixEntity.Site == null
                     ? null
                     : appendixEntity.Site.Description,
+                SiteCustomNumber = appendixEntity.Site == null
+                    ? null
+                    : appendixEntity.Site.CustomNumber,
                 CategoryValueEntities =
                     appendixEntity.CategoryValues
                         .Select(r =>

+ 7 - 2
GreenTree.Nachtragsmanagement.Web/Models/Misc/MailNotificationDataModel.cs

@@ -75,8 +75,13 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Misc
                         .ToList(),
                 UserDescriptions =
                     mailNotificationEntity.Users
-                        .Select(r => String.Format("{0} - ({1})", r.Lastname,
-                            String.Join(", ", r.Roles.Select(u => u.Description))))
+                        .Select(r => new
+                        {
+                            LastName = r.Lastname,
+                            Roles = String.Join(", ", r.Roles.Select(u => u.Description))
+                        })
+                        .OrderBy(r => r.Roles)
+                        .Select(r => String.Format("{0}|({1})", r.LastName, r.Roles))
                         .ToList(),
                 Users =
                     mailNotificationEntity.Users

+ 7 - 2
GreenTree.Nachtragsmanagement.Web/Models/Site/SiteDataModel.cs

@@ -130,8 +130,13 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Site
                         .ToList(),
                 UserDescriptions =
                     siteEntity.Users
-                        .Select(r => String.Format("{0} - ({1})", r.Lastname, 
-                            String.Join(", ", r.Roles.Select(u => u.Description))))
+                        .Select(r => new
+                        {
+                            LastName = r.Lastname,
+                            Roles = String.Join(", ", r.Roles.Select(u => u.Description))
+                        })
+                        .OrderBy(r => r.Roles)
+                        .Select(r => String.Format("{0}|({1})", r.LastName, r.Roles))
                         .ToList(),
                 Users = 
                     siteEntity.Users

+ 22 - 6
GreenTree.Nachtragsmanagement.Web/Validation/Appendix/AppendixDataModelValidator.cs

@@ -16,8 +16,6 @@ namespace GreenTree.Nachtragsmanagement.Web.Validation.Appendix
     {
         public AppendixDataModelValidator()
         {
-            var siteService = Singleton<IContainer>.Instance.Resolve<ISiteService>();
-
             RuleFor(m => m.CustomNumber)
                 .NotEmpty()
                     .WithMessage("Nummer wird benötigt")
@@ -25,10 +23,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Validation.Appendix
                     .WithMessage("Muss unter 10 Zeichen sein");
 
             RuleFor(m => m)
-                .Must(a1 => a1.SiteId.HasValue &&
-                    !siteService.GetSiteById(a1.SiteId.Value).Appendices
-                        .Select(a2 => a2.CustomNumber)
-                            .Contains(a1.CustomNumber))
+                .Must(m => CustomNumberDoesNotExistInSite(m))
                     .WithMessage("Nachtragsnummer in Baustelle bereits vorhanden.");
 
             RuleFor(m => m.Description)
@@ -43,5 +38,26 @@ namespace GreenTree.Nachtragsmanagement.Web.Validation.Appendix
                 .NotEmpty()
                     .WithMessage("Eine Angebotssumme wird benötigt");
         }
+
+        private bool CustomNumberDoesNotExistInSite(AppendixDataModel model)
+        {
+            var siteService = Singleton<IContainer>.Instance.Resolve<ISiteService>();
+
+            if (model == null) return false;
+
+            if (!model.SiteId.HasValue) return false;
+
+            var existingAppendix =
+                siteService.GetSiteById(model.SiteId.Value).Appendices
+                    .FirstOrDefault(a => a.CustomNumber == model.CustomNumber);
+
+            if (existingAppendix != null && existingAppendix.Id == model.Id) return true;
+
+            if (existingAppendix != null && existingAppendix.Id != model.Id) return false;
+
+            if (existingAppendix == null) return true;
+
+            return false;
+        }
     }
 }

+ 50 - 14
GreenTree.Nachtragsmanagement.Web/Validation/Deviation/DeviationDataModelValidator.cs

@@ -16,9 +16,6 @@ namespace GreenTree.Nachtragsmanagement.Web.Validation.Deviation
     {
         public DeviationDataModelValidator()
         {
-            var siteService = Singleton<IContainer>.Instance.Resolve<ISiteService>();
-            var appendixService = Singleton<IContainer>.Instance.Resolve<IAppendixService>();
-
             RuleFor(m => m.CustomNumber)
                 .NotEmpty()
                     .WithMessage("Nummer wird benötigt")
@@ -26,17 +23,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Validation.Deviation
                     .WithMessage("Muss unter 10 Zeichen sein");
 
             RuleFor(m => m)
-                .Must(d1 =>
-                   (d1.SiteId.HasValue &&
-                        !siteService.GetSiteById(d1.SiteId.Value).Appendices
-                            .SelectMany(d2 => d2.Deviations)
-                                .Select(d3 => d3.CustomNumber)
-                                    .Contains(d1.CustomNumber)) ||
-                   (d1.AppendixId.HasValue &&
-                        !appendixService.GetAppendixById(d1.AppendixId.Value).Site.Appendices
-                            .SelectMany(d2 => d2.Deviations)
-                                .Select(d3 => d3.CustomNumber)
-                                    .Contains(d1.CustomNumber)))
+                .Must(m => CustomNumberDoesNotExistInSite(m))
                     .WithMessage("VA-Nummer in Baustelle bereits vorhanden.");
 
             RuleFor(m => m.Description)
@@ -55,5 +42,54 @@ namespace GreenTree.Nachtragsmanagement.Web.Validation.Deviation
                 .NotEmpty()
                     .WithMessage("Eine Art muss gewählt werden");
         }
+
+        private bool CustomNumberDoesNotExistInSite(DeviationDataModel model)
+        {
+            var siteService = Singleton<IContainer>.Instance.Resolve<ISiteService>();
+            var appendixService = Singleton<IContainer>.Instance.Resolve<IAppendixService>();
+
+            if (model == null) return false;
+
+            var allDeviations = new List<Core.Domain.Deviation.Deviation>();
+
+            if (model.SiteId.HasValue)
+            {
+                var site = siteService.GetSiteById(model.SiteId.Value);
+
+                if (site != null)
+                    allDeviations.AddRange(
+                        site.Appendices
+                            .SelectMany(a => a.Deviations));
+
+                if (site != null)
+                    allDeviations.AddRange(
+                        site.Deviations);
+            }
+            else if (model.AppendixId.HasValue)
+            {
+                var appendix = appendixService.GetAppendixById(model.AppendixId.Value);
+
+                if (appendix != null && appendix.Site != null)
+                    allDeviations.AddRange(
+                        appendix.Site.Appendices
+                            .SelectMany(a => a.Deviations));
+
+                if (appendix != null && appendix.Site != null)
+                    allDeviations.AddRange(
+                        appendix.Site.Deviations);
+            }
+
+            var existingDeviation =
+                allDeviations
+                    .FirstOrDefault(d => d.CustomNumber == model.CustomNumber);
+
+            if (existingDeviation != null && existingDeviation.Id == model.Id) return true;
+
+            if (existingDeviation != null && existingDeviation.Id != model.Id) return false;
+
+            if (existingDeviation == null) return true;
+
+            return false;
+        }
     }
 }

+ 18 - 0
GreenTree.Nachtragsmanagement.Web/Views/Admin/Roles/View.cshtml

@@ -9,6 +9,24 @@
 <script>
 	var deleteId;
 	var deleteReplaceId = -1;
+	var gridScrollHeight;
+	var gridScrollOffset = 120;
+	var resizeFinished;
+
+	$(document).ready(function () {
+		gridScrollHeight = $(window).height() - gridScrollOffset;
+		setTimeout(function () {
+			devGridViewRole.PerformCallback();
+		}, 500);
+	});
+
+	$(window).resize(function () {
+		clearTimeout(window.resizedFinished);
+		window.resizedFinished = setTimeout(function () {
+			gridScrollHeight = $(window).height() - gridScrollOffset;
+			devGridViewRole.PerformCallback();
+		}, 250);
+	});
 
 	function editRole(id) {
 		if (!id) return;

+ 35 - 4
GreenTree.Nachtragsmanagement.Web/Views/Admin/Roles/_RoleGridPartial.cshtml

@@ -12,6 +12,11 @@
 	s.Width = Unit.Percentage(100);
 	s.Settings.ShowFilterRow = true;
 	s.Settings.ShowFilterRowMenu = true;
+	s.Settings.VerticalScrollBarMode = ScrollBarMode.Auto;
+	s.Settings.VerticalScrollableHeight =
+		(ViewData["ScrollHeight"] == null || (int)ViewData["ScrollHeight"] == -1)
+			? 400
+			: (int)ViewData["ScrollHeight"];
 
 	if (userContext.CurrentUser.HasFunction("Administration-Roles-Edit"))
 	{
@@ -32,12 +37,37 @@
 			});
 			column.Settings.AllowDragDrop = DefaultBoolean.False;
 			column.Settings.AllowSort = DefaultBoolean.False;
-			column.Width = 70;
+			column.Width = new Unit(150, UnitType.Pixel);
 		});
 	}
-	s.Columns.Add("Description", "Beschreibung");
-	s.Columns.Add("Level", "Stufe");
-	s.Columns.Add("FunctionDescription", "Funktionen");
+	s.Columns.Add(column =>
+	{
+		column.FieldName = "Description";
+		column.Caption = "Beschreibung";
+		column.MinWidth = 200;
+		column.Width = new Unit(15, UnitType.Percentage);
+	});
+	s.Columns.Add(column =>
+	{
+		column.FieldName = "Level";
+		column.Caption = "Stufe";
+		column.MinWidth = 120;
+		column.Width = new Unit(8, UnitType.Percentage);
+	});
+	s.Columns.Add(column =>
+	{
+		column.FieldName = "FunctionDescription";
+		column.Caption = "Funktionen";
+		column.MinWidth = 350;
+		column.Width = new Unit(57, UnitType.Percentage);
+	});
+	s.Columns.Add(column =>
+	{
+		column.FieldName = "UserDescription";
+		column.Caption = "Mitglieder";
+		column.MinWidth = 250;
+		column.Width = new Unit(20, UnitType.Percentage);
+	});
 
 	s.ClientLayout = (sender, e) =>
 	{
@@ -49,6 +79,7 @@
 		else
 			Session["RoleGridState"] = e.LayoutData;
 	};
+	s.ClientSideEvents.BeginCallback = "function (s, e) { e.customArgs['scrollHeight'] = [ gridScrollHeight ]; }";
 
 	s.Styles.AlternatingRow.BackColor = System.Drawing.Color.FromArgb(247, 247, 247);
 }).Bind(Model).GetHtml()

+ 19 - 0
GreenTree.Nachtragsmanagement.Web/Views/Admin/Users/View.cshtml

@@ -6,6 +6,25 @@
 
 <script>
 	var deleteId;
+	var resizeFinished;
+	var gridScrollHeight;
+	var gridScrollOffset = 120;
+	var resizeFinished;
+
+	$(document).ready(function () {
+		gridScrollHeight = $(window).height() - gridScrollOffset;
+		setTimeout(function () {
+			devGridViewUser.PerformCallback();
+		}, 500);
+	});
+
+	$(window).resize(function () {
+		clearTimeout(window.resizedFinished);
+		window.resizedFinished = setTimeout(function () {
+			gridScrollHeight = $(window).height() - gridScrollOffset;
+			devGridViewUser.PerformCallback();
+		}, 250);
+	});
 
 	function editUser(id) {
 		if (!id) return;

+ 7 - 1
GreenTree.Nachtragsmanagement.Web/Views/Admin/Users/_UserGridPartial.cshtml

@@ -12,6 +12,11 @@
 	s.Width = Unit.Percentage(100);
 	s.Settings.ShowFilterRow = true;
 	s.Settings.ShowFilterRowMenu = true;
+	s.Settings.VerticalScrollBarMode = ScrollBarMode.Auto;
+	s.Settings.VerticalScrollableHeight =
+		(ViewData["ScrollHeight"] == null || (int)ViewData["ScrollHeight"] == -1)
+			? 400
+			: (int)ViewData["ScrollHeight"];
 
 	if (userContext.CurrentUser.HasFunction("Administration-Users-Edit"))
 	{
@@ -32,7 +37,7 @@
 			});
 			column.Settings.AllowDragDrop = DefaultBoolean.False;
 			column.Settings.AllowSort = DefaultBoolean.False;
-			column.Width = 70;
+			column.Width = 150;
 		});
 	}
 	s.Columns.Add("CustomNumber", "Personal-Nr.");
@@ -51,6 +56,7 @@
 		else
 			Session["UserGridState"] = e.LayoutData;
 	};
+	s.ClientSideEvents.BeginCallback = "function (s, e) { e.customArgs['scrollHeight'] = [ gridScrollHeight ]; }";
 
 	s.Styles.AlternatingRow.BackColor = System.Drawing.Color.FromArgb(247, 247, 247);
 }).Bind(Model).GetHtml()

+ 15 - 4
GreenTree.Nachtragsmanagement.Web/Views/Appendices/View.cshtml

@@ -7,11 +7,11 @@
 <script>
 	var deleteId;
 	var gridScrollHeight;
-	var gridScrollOffset = 280;
+	var gridScrollOffset = 240;
 	var resizeFinished;
 
 	$(document).ready(function () {
-		gridScrollHeight = $(window).height() - gridScrollOffset;
+		gridScrollHeight = calculateGridScrollHeight();
 		setTimeout(function () {
 			devGridViewAppendix.PerformCallback();
 		}, 500);
@@ -20,11 +20,22 @@
 	$(window).resize(function () {
 		clearTimeout(window.resizedFinished);
 		window.resizedFinished = setTimeout(function () {
-			gridScrollHeight = $(window).height() - gridScrollOffset;
-			devGridViewAppendix.PerformCallback();
+			setGridScrollHeight();
 		}, 250);
 	});
 
+	function calculateGridScrollHeight() {
+		var windowHeight = $(window).height();
+		var gridHeaderHeight = $("#devGridViewAppendix_DXHeadersRow0").height();
+		var gridFooterHeight = $("#devGridViewAppendix_DXFooterRow").height();
+		return windowHeight - gridHeaderHeight - gridFooterHeight - gridScrollOffset;
+	}
+
+	function setGridScrollHeight() {
+		gridScrollHeight = calculateGridScrollHeight();
+		devGridViewAppendix.PerformCallback();
+	}
+
 	function onToolbarItemClick(s, e) {
 		if (!s || !e) return;
 		if (IsExportToolbarCommand(e.item.name)) {

+ 1 - 1
GreenTree.Nachtragsmanagement.Web/Views/Deviations/View.cshtml

@@ -7,7 +7,7 @@
 <script>
 	var deleteId;
 	var gridScrollHeight;
-	var gridScrollOffset = 280;
+	var gridScrollOffset = 350;
 	var resizeFinished;
 
 	$(document).ready(function () {

+ 8 - 1
GreenTree.Nachtragsmanagement.Web/Views/Home/Index.cshtml

@@ -108,7 +108,10 @@
 		var popupName = e.item.name + "-Popup";
 		var popupElement = controls.GetByName(popupName);
 		var popupControl = MVCxClientPopupControl.Cast(popupElement);
-		if (popupControl.IsVisible()) return;
+		if (popupControl.IsVisible()) {
+			popupControl.BringToFront();
+			return;
+		}
 		if (popupMinimized[e.item.name] == true) {
 			popupControl.Show();
 			$("#" + e.item.name + "-PanelItem").fadeTo(500, 1);
@@ -156,6 +159,7 @@
 			popupStatus[e.item.name] = "maximized";
 		} else {
 			popupStatus[e.item.name] = "normalized";
+			popupControl.BringToFront();
 		}
 	}
 
@@ -225,6 +229,9 @@
 			popupMinimized[popupName] = true;
 			$("#" + popupName + "-PanelItem").fadeTo(500, 0.6);
 		} else {
+			if (popupMinimized[popupName] == true) {
+				popupMinimized[popupName] = false;
+			}
 			popupStatus[popupName] = "closed";
 			popupContentElem.addClass("dxpc-shadow");
 			popupContentElem.addClass("devExAllowDrag");

+ 1 - 1
GreenTree.Nachtragsmanagement.Web/Views/Misc/MailNotifications.cshtml

@@ -8,7 +8,7 @@
 	var deleteId;
 	var processId;
 	var gridScrollHeight;
-	var gridScrollOffset = 280;
+	var gridScrollOffset = 350;
 	var resizeFinished;
 
 	$(document).ready(function () {

+ 1 - 1
GreenTree.Nachtragsmanagement.Web/Views/Sites/View.cshtml

@@ -7,7 +7,7 @@
 <script>
 	var deleteId;
 	var gridScrollHeight;
-	var gridScrollOffset = 280;
+	var gridScrollOffset = 350;
 	var resizeFinished;
 
 	$(document).ready(function () {

+ 17 - 6
GreenTree.Nachtragsmanagement.Web/Views/Sites/_SiteEditTreePartial.cshtml

@@ -11,7 +11,7 @@
 	t.ParentFieldName = "TreeParentKey";
 	t.CallbackRouteValues = new { Controller = "Site", Action = "PartialDeviationAppendices", siteId = Model.Id };
 	t.Width = Unit.Percentage(100);
-	t.Settings.GridLines = GridLines.Vertical;
+	t.Settings.GridLines = GridLines.Both;
 	t.SettingsBehavior.AllowDragDrop = true;
 	t.SettingsEditing.NodeDragDropRouteValues = new { Controller = "Site", Action = "PartialDeviationAppendices", siteId = Model.Id };
 	t.ClientSideEvents.StartDragNode = "function (s, e) { startSiteTreeNodeDrag(s, e); }";
@@ -62,11 +62,14 @@
 
 			if (treeKey.StartsWith("a"))
 			{
-				ViewContext.Writer.Write("<b>" + DataBinder.Eval(c.DataItem, "CustomNumber") + "</b>");
+				if (treeKey == "a_0")
+					ViewContext.Writer.Write("<b>" + DataBinder.Eval(c.DataItem, "CustomNumber") + "</b>");
+				else
+					ViewContext.Writer.Write("<b>NT - " + DataBinder.Eval(c.DataItem, "CustomNumber") + "</b>");
 			}
 			else if (treeKey.StartsWith("d"))
 			{
-				ViewContext.Writer.Write(DataBinder.Eval(c.DataItem, "CustomNumber"));
+				ViewContext.Writer.Write("VA - " + DataBinder.Eval(c.DataItem, "CustomNumber"));
 			}
 		});
 	});
@@ -126,10 +129,18 @@
 	t.HtmlRowPrepared = (sender, e) =>
 	{
 		var hexColor = e.GetValue("StatusColor");
+		var defaultState = ViewData["DefaultAppendixState"] as GreenTree.Nachtragsmanagement.Core.Domain.Appendix.State;
+		var statusDescription = e.GetValue("StatusDescription");
 
-		if (hexColor == null) return;
-
-		e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(hexColor.ToString());
+		if (hexColor == null ||
+			(defaultState != null && statusDescription != null && statusDescription.ToString() == defaultState.Description))
+		{
+			var treeKey = e.GetValue("TreeKey");
+			if (treeKey.ToString().StartsWith("a"))
+				e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml("#fff2f2");
+		}
+		else
+			e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(hexColor.ToString());
 	};
 
 	t.ControlStyle.CssClass += "siteTreeList";