Parcourir la source

Merge branch 'master' of https://greentreestudios.de/Git/GreenTree.Nachtragsmanagement

Arne Diekmann il y a 8 ans
Parent
commit
f366342caa

+ 39 - 0
GreenTree.Nachtragsmanagement.Web/Controllers/GlobalController.cs

@@ -107,6 +107,45 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
             return View("~/Views/Global/NotAuthorized.cshtml");
         }
 
+        /// <summary>
+        /// Deletes the specified cookies and session variables from request
+        /// </summary>
+        /// <param name="cookies">Cookie names.</param>
+        /// <param name="sessionVariables">Session variable names.</param>
+        [HttpPost]
+        public ActionResult DeleteCookiesAndSessionVariables(string[] cookies, string[] sessionVariables)
+        {
+            if (cookies != null && cookies.Length > 0)
+            {
+                foreach (var cookieName in cookies)
+                {
+                    var cookie = Request.Cookies[cookieName];
+
+                    if (cookie != null)
+                    {
+                        cookie.Expires = DateTime.Now.AddDays(-1);
+
+                        Request.Cookies.Set(cookie);
+                        Response.Cookies.Set(cookie);
+                    }
+                }
+            }
+
+            if (sessionVariables != null && sessionVariables.Length > 0)
+            {
+                foreach (var sessionVariable in sessionVariables)
+                {
+                    if (Session[sessionVariable] != null)
+                        Session.Remove(sessionVariable);
+                }
+            }
+
+            return new JsonResult
+            {
+                Data = "success"
+            };
+        }
+
         #region Comments
 
         /// <summary>

+ 36 - 1
GreenTree.Nachtragsmanagement.Web/Extensions/GridViewSettingsHelper.cs

@@ -92,6 +92,13 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                     i.Image.IconID = IconID.PrintDefaultprinter16x16;
                     i.BeginGroup = true;
                 });
+                t.Items.Add(i =>
+                {
+                    i.Text = "Zurücksetzen";
+                    i.Name = "ResetSettings";
+                    i.Image.IconID = IconID.ActionsReset16x16;
+                    i.BeginGroup = true;
+                });
             });
 
             if (_userContext.CurrentUser.HasFunction("Site-Sites-Edit") || _userContext.CurrentUser.HasFunction("Site-Sites-Delete"))
@@ -121,7 +128,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                 column.FieldName = "CustomNumber";
                 column.SettingsHeaderFilter.Mode = GridHeaderFilterMode.CheckedList;
                 column.MinWidth = 100;
-                column.Width = new Unit(8, UnitType.Percentage);                
+                column.Width = new Unit(8, UnitType.Percentage);
             });
             s.Columns.Add(column =>
             {
@@ -369,6 +376,13 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                     i.Image.IconID = IconID.PrintDefaultprinter16x16;
                     i.BeginGroup = true;
                 });
+                t.Items.Add(i =>
+                {
+                    i.Text = "Zurücksetzen";
+                    i.Name = "ResetSettings";
+                    i.Image.IconID = IconID.ActionsReset16x16;
+                    i.BeginGroup = true;
+                });
             });
 
             s.Columns.Add(column =>
@@ -833,6 +847,13 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                     i.Image.IconID = IconID.PrintDefaultprinter16x16;
                     i.BeginGroup = true;
                 });
+                t.Items.Add(i =>
+                {
+                    i.Text = "Zurücksetzen";
+                    i.Name = "ResetSettings";
+                    i.Image.IconID = IconID.ActionsReset16x16;
+                    i.BeginGroup = true;
+                });
             });
 
             s.Columns.Add(column =>
@@ -1181,6 +1202,13 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                     i.Image.IconID = IconID.OtherViewgridlines16x16gray;
                     i.BeginGroup = true;
                 });
+                t.Items.Add(i =>
+                {
+                    i.Text = "Zurücksetzen";
+                    i.Name = "ResetSettings";
+                    i.Image.IconID = IconID.ActionsReset16x16;
+                    i.BeginGroup = true;
+                });
             });
 
             if (_userContext.CurrentUser.HasFunction("Misc-MailNotifications-Edit"))
@@ -1343,6 +1371,13 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                     i.Image.IconID = IconID.PrintDefaultprinter16x16;
                     i.BeginGroup = true;
                 });
+                t.Items.Add(i =>
+                {
+                    i.Text = "Zurücksetzen";
+                    i.Name = "ResetSettings";
+                    i.Image.IconID = IconID.ActionsReset16x16;
+                    i.BeginGroup = true;
+                });
             });
 
             s.Columns.Add(column =>

+ 7 - 7
GreenTree.Nachtragsmanagement.Web/Models/Appendix/AppendixDataModel.cs

@@ -69,7 +69,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Appendix
                 return new AppendixDataModel
                 {
                     Id = -1,
-                    Percentage = 50
+                    Percentage = 100
                 };
 
             if (appendixEntity == null && !newWhenIsNull)
@@ -80,8 +80,8 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Appendix
                 Id = appendixEntity.Id,
                 CustomNumber = appendixEntity.CustomNumber,
                 Description = appendixEntity.Description,
-                Percentage = appendixEntity.Percentage.HasValue 
-                    ? appendixEntity.Percentage.Value 
+                Percentage = appendixEntity.Percentage.HasValue
+                    ? appendixEntity.Percentage.Value
                     : (decimal)0.5,
                 PercentageValue = appendixEntity.Value.HasValue && appendixEntity.Percentage.HasValue
                     ? appendixEntity.Value.Value * appendixEntity.Percentage.Value
@@ -92,9 +92,9 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Appendix
                 RelationOfferingToDeviations =
                     appendixEntity.Value.HasValue && appendixEntity.Deviations.Any()
                         ? (decimal?)Convert.ToDecimal(
-                            appendixEntity.Value / 
+                            appendixEntity.Value /
                                 (appendixEntity.Deviations
-                                    .Sum(r => r.Value.HasValue && r.Percentage.HasValue ? r.Value.Value * r.Percentage.Value : 0) != 0 
+                                    .Sum(r => r.Value.HasValue && r.Percentage.HasValue ? r.Value.Value * r.Percentage.Value : 0) != 0
                                         ? appendixEntity.Deviations
                                             .Sum(r => r.Value.HasValue && r.Percentage.HasValue ? r.Value.Value * r.Percentage.Value : 0)
                                         : 1))
@@ -110,7 +110,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Appendix
                 OrderDate = appendixEntity.OrderDate,
                 Comment = appendixEntity.Comment,
                 OrderInvoiceCreated = appendixEntity.OrderInvoiceCreated,
-                OrderInvoiceCreatedDescription = 
+                OrderInvoiceCreatedDescription =
                     appendixEntity.OrderInvoiceCreated
                         ? "Ja"
                         : "Nein",
@@ -167,7 +167,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Appendix
                     appendixEntity.Deviations
                         .Select(r => r.CustomNumber)
                         .ToList(),
-                DeviationDescription = 
+                DeviationDescription =
                     String.Join(", ",
                         appendixEntity.Deviations
                             .Select(d => d.CustomNumber)),

+ 11 - 0
GreenTree.Nachtragsmanagement.Web/Views/Appendices/View.cshtml

@@ -55,6 +55,17 @@
 				devGridViewAppendix.HideCustomizationWindow();
 			else
 				devGridViewAppendix.ShowCustomizationWindow();
+		} else if (e.item.name == "ResetSettings") {
+			$.ajax({
+				type: "POST",
+				url: '@Url.Action("DeleteCookiesAndSessionVariables", "Global")',
+				data: { cookies: [ "appendixGridStateCookie" ], sessionVariables: [ "AppendixGridState", "AppendixGridViewState" ] },
+				success: function (response) {
+					if (response == "success") {
+						window.location = window.location;
+					}
+				}
+			});
 		}
 	}
 

+ 11 - 0
GreenTree.Nachtragsmanagement.Web/Views/Deviations/View.cshtml

@@ -68,6 +68,17 @@
 				devGridViewDeviation.HideCustomizationWindow();
 			else
 				devGridViewDeviation.ShowCustomizationWindow();
+		} else if (e.item.name == "ResetSettings") {
+			$.ajax({
+				type: "POST",
+				url: '@Url.Action("DeleteCookiesAndSessionVariables", "Global")',
+				data: { cookies: [ "deviationGridStateCookie" ], sessionVariables: [ "DeviationGridState", "DeviationGridViewState" ] },
+				success: function (response) {
+					if (response == "success") {
+						window.location = window.location;
+					}
+				}
+			});
 		}
 	}
 

+ 11 - 0
GreenTree.Nachtragsmanagement.Web/Views/Misc/Logs.cshtml

@@ -53,6 +53,17 @@
 				devGridViewLog.HideCustomizationWindow();
 			else
 				devGridViewLog.ShowCustomizationWindow();
+		} else if (e.item.name == "ResetSettings") {
+			$.ajax({
+				type: "POST",
+				url: '@Url.Action("DeleteCookiesAndSessionVariables", "Global")',
+				data: { cookies: [ "logGridStateCookie" ], sessionVariables: [ "LogGridState", "LogGridViewState" ] },
+				success: function (response) {
+					if (response == "success") {
+						window.location = window.location;
+					}
+				}
+			});
 		}
 	}
 

+ 11 - 0
GreenTree.Nachtragsmanagement.Web/Views/Misc/MailNotifications.cshtml

@@ -44,6 +44,17 @@
 				devGridViewMailNotifications.HideCustomizationWindow();
 			else
 				devGridViewMailNotifications.ShowCustomizationWindow();
+		} else if (e.item.name == "ResetSettings") {
+			$.ajax({
+				type: "POST",
+				url: '@Url.Action("DeleteCookiesAndSessionVariables", "Global")',
+				data: { cookies: ["mailNotificationGridStateCookie"], sessionVariables: [ "MailNotificationsGridState", "MailNotificationsGridViewState" ] },
+				success: function (response) {
+					if (response == "success") {
+						window.location = window.location;
+					}
+				}
+			});
 		}
 	}
 

+ 11 - 0
GreenTree.Nachtragsmanagement.Web/Views/Sites/View.cshtml

@@ -56,6 +56,17 @@
 				devGridViewSite.HideCustomizationWindow();
 			else
 				devGridViewSite.ShowCustomizationWindow();
+		} else if (e.item.name == "ResetSettings") {
+			$.ajax({
+				type: "POST",
+				url: '@Url.Action("DeleteCookiesAndSessionVariables", "Global")',
+				data: { cookies: [ "siteGridStateCookie" ], sessionVariables: [ "SiteGridState", "SiteGridViewState" ] },
+				success: function (response) {
+					if (response == "success") {
+						window.location = window.location;
+					}
+				}
+			});
 		}
 	}