Selaa lähdekoodia

Diverse Änderungen übernommen!

Arne Diekmann 8 vuotta sitten
vanhempi
commit
cf7b5552f1

+ 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>

+ 35 - 3
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"))
@@ -152,7 +159,6 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
             {
                 column.Caption = "Offene VA";
                 column.FieldName = "DeviationDescription";
-                column.Visible = false;
                 column.MinWidth = 150;
                 column.Width = new Unit(12, UnitType.Percentage);
                 column.SetDataItemTemplateContent(c =>
@@ -180,7 +186,6 @@ 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);
             });
@@ -249,7 +254,6 @@ namespace GreenTree.Nachtragsmanagement.Web.Extensions
                 });
                 column.MinWidth = 120;
                 column.Width = new Unit(15, UnitType.Percentage);
-                column.Visible = false;
             });
 
             s.TotalSummary.Add(new ASPxSummaryItem
@@ -369,6 +373,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 =>
@@ -777,6 +788,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 =>
@@ -1097,6 +1115,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"))
@@ -1259,6 +1284,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 =>

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

@@ -67,7 +67,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Appendix
                 return new AppendixDataModel
                 {
                     Id = -1,
-                    Percentage = 50
+                    Percentage = 100
                 };
 
             if (appendixEntity == null && !newWhenIsNull)

+ 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;
+					}
+				}
+			});
 		}
 	}