Merge branch 'develop' of keyhammer:StockMan into develop

Conflicts:
	SiteSelector/bin/SiteSelector.dll
	StockManMVC/bin/StockManMVC.dll
	VersGen/bin/Release/VersGen.dll
	VersGen/obj/Release/TempPE/VersGen.cs.dll
	VersGen/obj/Release/VersGen.dll
This commit is contained in:
Samuele E. Locatelli
2016-10-10 12:00:12 +02:00
34 changed files with 50 additions and 2073 deletions
+2 -2
View File
@@ -162,7 +162,7 @@
</site>
<site name="StockManMVC" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\StockMan\StockManMVC" />
<virtualDirectory path="/" physicalPath="C:\Users\samuele\Documents\Visual Studio 2015\Projects\StockMan\StockManMVC" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:4539:localhost" />
@@ -170,7 +170,7 @@
</site>
<site name="SiteSelector" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\StockMan\SiteSelector" />
<virtualDirectory path="/" physicalPath="C:\Users\samuele\Documents\Visual Studio 2015\Projects\StockMan\SiteSelector" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:3526:localhost" />
Binary file not shown.
-39
View File
@@ -1,39 +0,0 @@
/***
* Grid.Mvc stylesheet http://gridmvc.codeplex.com/
* This file contains default styles for Grid.Mvc.
*/
/* Grid */
table.grid-table { margin: 0; }
table.grid-table .grid-wrap { padding: 0; position: relative; }
table.grid-table .grid-empty-text { color: #666; }
/* Grid headers */
table.grid-table .grid-header { position: relative; }
table.grid-table .grid-header .sorted-asc .grid-sort-arrow:after { content: " \2193"; }
table.grid-table .grid-header .sorted-desc .grid-sort-arrow:after { content: " \2191"; }
table.grid-table .grid-header > .grid-header-title { width: 100%; margin-right: 15px; white-space: nowrap; }
/* Grid body */
table.grid-table tr.grid-row-selected td { background: #4888C2 !important; color: white; }
table.grid-table tr.grid-row-selected a { color: white; }
/* Grid filtering */
input.grid-filter-input { padding: 4px; font-size: 13px; }
table.grid-table .grid-filter { position: relative; margin-top: 2px; float: right; width: 10px; height: 12px; }
table.grid-table .grid-filter-btn { cursor: pointer; display: block; width: 10px; height: 12px; background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAJFJREFUKFNjkJSU/E8MZvj//78DMRhkoj+6bizYH2SiiIeHx2FjY+P/2DBIDqSGAQSOHTtmYWZm9hldEUgMJAdWBAJAHSzt7e056ApBYiA5qDIIAAoIhIaGroYpArFBYlBpVLB3715DmEIQGyqMCUDWwBRiWIkOYAqhXNwApMjX13c7lIsbgBQBrdWAcqGAgQEAdOGTrvsYKXIAAAAASUVORK5CYII=') no-repeat; }
table.grid-table .grid-filter-btn.filtered { background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAJNJREFUKFNjYGj//58o/P//fwdiMIOkpKQ/VhOQMFgNULWIh4fHYWNj4//YMEgOpIYBBI4dO2ZhZmb2GV0RSAwkB1YEAkAdLO3t7TnoCkFiIDmoMggACgiEhoauhikCsUFiUGlUsHfvXkOYQhAbKowJQNbAFGJYiQ5gCqFc3ACkyNfXdzuUixuAFAGt1YByoYCBAQAUDanUpFB4UQAAAABJRU5ErkJggg==') no-repeat; }
table.grid-table .grid-filter-buttons { padding: 0; }
table.grid-table .grid-filter-datepicker { font-size: 12px; }
table.grid-table .grid-filter-datepicker table td { padding: 1px!important; }
table.grid-table .grid-filter-datepicker .ui-datepicker { width: auto; }
table.grid-table .grid-dropdown-inner ul.menu-list li a.grid-filter-clear { white-space: nowrap; padding-left: 23px; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAARpJREFUKFNjYGj//58o/P//fwdiMIOkpKQ/VhOQMFgNULWIh4fHYWNj4//YMEgOpIYBBI4dO2axOC/396GinP/O+vpwRVbGxl92+vluXm1kuASsEKiD5VB99aG3eTH/HxjL/A/RUPsfrqb6f7e21uutlhbRYEUwAFQskOLmun2+lND/0xxM/7dycXzd6OxoCpVGBduWLjXv4+f/v5WF+f9RbtYvfeysqlApBKhhY2Hcxsy0+xAL038nbe3/m8W4ss/Jcx2GSiPAal6uvGtczP9TFOXBHgGJ7RHlmLGOjy0UrAAGzgT7rn7urP/P3NDgv6+v73aQWAMzM+dqTtbJYAUwsNzeyuhImE8GSBHQYxpQYYYJQCcxMDAwAAB7/bt5uWh9FAAAAABJRU5ErkJggg=='); background-position: 3px center; background-repeat: no-repeat; }
table.grid-table .grid-filter-choose.choose-selected { background-color: white!important; cursor: default; color: #999; }
table.grid-table .grid-popup-additional { padding: 3px 0 0 0; }
/* POP-UP */
.grid-dropdown { font-weight: normal; left: -102px; top: 16px!important; min-width: 180px; }
.grid-dropdown-arrow { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAICAYAAADJEc7MAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAAl0lEQVQoU42PMQuFMAyE6xN5gpOjjsIb/P9/o3O3zh27dY25kIPq8DBwmLT35WoQkUEVOmGec84CaW2q7+N+AdCD6M9SisQYTei1jsfyCeCu+vjFVGs1AN++94DRfUOfuNLoKUiyRC5y2F5I8NdaM4P/l0EswvBorQTnfxBhLMRih+2pklIy+eEtjQPu6MNZwIBNbwteMBd5X4ZGHcwL3QAAAABJRU5ErkJggg==") no-repeat; height: 8px; left: 99px; position: absolute; top: -8px; width: 14px; }
.grid-dropdown-inner { padding: 5px 7px; }
.grid-dropdown ul.menu-list { list-style-type: none; margin: 3px 0 0 0; padding: 0; }
.grid-dropdown ul.menu-list li a { text-decoration: none; background-position: 6px center; background-repeat: no-repeat; display: block; padding: 4px 5px; }
.grid-dropdown ul.menu-list li a:hover { background-color: #EEE; text-decoration: none; }
-60
View File
@@ -1,60 +0,0 @@
http://gridmvc.codeplex.com/
Note: Grid.Mvc installer has already made the following changes to your project:
- Views/Shared/_Grid.cshtml, Views/Shared/_GridPager.cshtml - views for grid
- Content/Gridmvc.css - default stylesheet for the grid
- Scripts/gridmvc.js, Scripts/gridmvc.min.js - Grid.Mvc scripts
- Reference GridMvc.dll
Follow these steps to start use Grid.mvc:
1. Define a model for display in the grid, like:
public class Foo
{
public string Title { get; set; }
public string Description { get;set; }
}
2. Prepare your model in your controller, like:
public ActionResult Index()
{
var items = fooRepository.GetAll();
return View(items);
}
3. Render GridMvc in the View: You can use Html helper extenstion:
Reference Grid.Mvc.Html in your view:
@using GridMvc.Html
Render Grid.Mvc:
@Html.Grid(Model).Columns(columns =>
{
columns.Add(foo => foo.Title).Titled("Custom column title").SetWidth(110);
columns.Add(foo => foo.Description).Sortable(true);
}).WithPaging(20)
4. Register a grid stylesheet and scripts in your _Layouts.cshtml file:
<link href="@Url.Content("~/Content/Gridmvc.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/gridmvc.min.js")" type="text/javascript"> </script>
Notes:
Default layout of Grid.Mvc uses Twitter Bootstrap (css framework). You also need to include stylesheets on your page. You can download it from - http://twitter.github.com/bootstrap/
like:
<link href="@Url.Content("~/Content/Css/bootstrap.min.css")" rel="stylesheet" type="text/css" />
Also you need to ensure that jQuery has registred on the page before gridmvc.min.js script.
For more documetation, please see: http://gridmvc.codeplex.com/
Binary file not shown.
-724
View File
@@ -1,724 +0,0 @@
/***
* Grid.Mvc
* Examples and documentation at: http://gridmvc.codeplex.com
* Version: 3.0.0
* Requires: window.jQuery v1.3+
* LGPL license: http://gridmvc.codeplex.com/license
*/
window.pageGrids = window.pageGrids || {};
$.fn.extend({
gridmvc: function () {
var aObj = [];
$(this).each(function () {
if (!$(this).data("gridmvc")) {
var options = { lang: $(this).attr("data-lang"), selectable: $(this).attr("data-selectable") == "true", multiplefilters: $(this).attr("data-multiplefilters") == "true" };
var grid = new GridMvc(this, options);
var name = $(this).attr("data-gridname");
if (name.length > 0)
window.pageGrids[$(this).attr("data-gridname")] = grid;
aObj.push(grid);
$(this).data("gridmvc", grid);
} else {
aObj.push($(this).data("gridmvc"));
}
});
if (aObj.length == 1)
return aObj[0];
return aObj;
}
});
GridMvc = (function ($) {
function gridMvc(container, options) {
this.jqContainer = $(container);
options = options || {};
this.options = $.extend({}, this.defaults(), options);
this.init();
}
gridMvc.prototype.init = function () {
//load current lang options:
this.lang = GridMvc.lang[this.options.lang];
if (typeof (this.lang) == 'undefined')
this.lang = GridMvc.lang.en;
this.events = [];
if (this.options.selectable)
this.initGridRowsEvents();
//Register default filter widgets:
this.filterWidgets = [];
this.addFilterWidget(new TextFilterWidget());
this.addFilterWidget(new NumberFilterWidget());
this.addFilterWidget(new DateTimeFilterWidget());
this.addFilterWidget(new BooleanFilterWidget());
this.openedMenuBtn = null;
this.initFilters();
};
/***
* Handle Grid row events
*/
gridMvc.prototype.initGridRowsEvents = function () {
var $this = this;
this.jqContainer.on("click", ".grid-row", function () {
$this.rowClicked.call(this, $this);
});
};
/***
* Trigger on Grid row click
*/
gridMvc.prototype.rowClicked = function ($context) {
if (!$context.options.selectable)
return;
var row = $(this).closest(".grid-row");
if (row.length <= 0)
return;
var gridRow = {};
row.find(".grid-cell").each(function () {
var columnName = $(this).attr("data-name");
if (columnName.length > 0)
gridRow[columnName] = $(this).text();
});
var evt = $.Event("RowClicked");
$context.notifyOnRowSelect(gridRow, evt);
if (!evt.isDefaultPrevented())
$context.markRowSelected(row);
};
/***
* Mark Grid row as selected
*/
gridMvc.prototype.markRowSelected = function (row) {
this.jqContainer.find(".grid-row.grid-row-selected").removeClass("grid-row-selected");
row.addClass("grid-row-selected");
};
/***
* Default Grid.Mvc options
*/
gridMvc.prototype.defaults = function () {
return {
selectable: true,
multiplefilters: false,
lang: 'en'
};
};
/***
* ============= EVENTS =============
* Methods that provides functionality for grid events
*/
gridMvc.prototype.onRowSelect = function (func) {
this.events.push({ name: "onRowSelect", callback: func });
};
gridMvc.prototype.notifyOnRowSelect = function (row, e) {
e.row = row;
this.notifyEvent("onRowSelect", e);
};
gridMvc.prototype.notifyEvent = function (eventName, e) {
for (var i = 0; i < this.events.length; i++) {
if (this.events[i].name == eventName)
if (!this.events[i].callback(e)) break;
}
};
/***
* ============= FILTERS =============
* Methods that provides functionality for filtering
*/
/***
* Method search all filter buttons and register 'onclick' event handlers:
*/
gridMvc.prototype.initFilters = function () {
var filterHtml = this.filterMenuHtml();
var self = this;
this.jqContainer.find(".grid-filter").each(function () {
$(this).click(function () {
return self.openFilterPopup.call(this, self, filterHtml);
});
});
};
/***
* Shows filter popup window and render filter widget
*/
gridMvc.prototype.openFilterPopup = function (self, html) {
//retrive all column filter parameters from html attrs:
var columnType = $(this).attr("data-type") || "";
//determine widget
var widget = self.getFilterWidgetForType(columnType);
//if widget for specified column type not found - do nothing
if (widget == null)
return false;
//if widget allready rendered - just open popup menu:
if (this.hasAttribute("data-rendered")) {
var or = self.openMenuOnClick.call(this, self);
self.setupPopupInitialPosition($(this));
if (!or && typeof (widget.onShow) != 'undefined')
widget.onShow();
return or;
}
var columnName = $(this).attr("data-name") || "";
var filterData = $(this).attr("data-filterdata") || "";
var widgetData = $(this).attr("data-widgetdata") || "{}";
var filterDataObj = self.parseFilterValues(filterData) || {};
var filterUrl = $(this).attr("data-url") || "";
//mark filter as rendered
$(this).attr("data-rendered", "1");
//append base popup layout:
$(this).append(html);
//determine widget container:
var widgetContainer = $(this).find(".grid-popup-widget");
//onRender target widget
if (typeof (widget.onRender) != 'undefined')
widget.onRender(widgetContainer, self.lang, columnType, filterDataObj, function (values) {
self.closeOpenedPopups();
self.applyFilterValues(filterUrl, columnName, values, false);
}, $.parseJSON(widgetData));
//adding 'clear filter' button if needed:
if ($(this).find(".grid-filter-btn").hasClass("filtered") && widget.showClearFilterButton()) {
var inner = $(this).find(".grid-popup-additional");
inner.append(self.getClearFilterButton(filterUrl));
inner.find(".grid-filter-clear").click(function () {
self.applyFilterValues(filterUrl, columnName, "", true);
});
}
var openResult = self.openMenuOnClick.call(this, self);
if (typeof (widget.onShow) != 'undefined')
widget.onShow();
self.setupPopupInitialPosition($(this));
return openResult;
};
gridMvc.prototype.setupPopupInitialPosition = function (popup) {
var drop = popup.find(".grid-dropdown");
function getInfo() {
var arrow = popup.find(".grid-dropdown-arrow");
return { arrow: arrow, currentDropLeft: parseInt(drop.css("left")), currentArrowLeft: parseInt(arrow.css("left")) };
}
var dropLeft = drop.offset().left;
if (dropLeft < 0) {
var info = getInfo();
info.arrow.css({ left: (info.currentArrowLeft + dropLeft - 10) + "px" });
drop.css({ left: (info.currentDropLeft - dropLeft + 10) + "px" });
return;
}
var dropWidth = drop.width();
var offsetRight = $(window).width() - (dropLeft + dropWidth);
if (offsetRight < 0) {
var info = getInfo();
info.arrow.css({ left: (info.currentArrowLeft - offsetRight + 10) + "px" });
drop.css({ left: (info.currentDropLeft + offsetRight - 10) + "px" });
}
};
/***
* Returns layout of filter popup menu
*/
gridMvc.prototype.filterMenuHtml = function () {
return '<div class="dropdown dropdown-menu grid-dropdown" style="display: none;">\
<div class="grid-dropdown-arrow"></div>\
<div class="grid-dropdown-inner">\
<div class="grid-popup-widget"></div>\
<div class="grid-popup-additional"></div>\
</div>\
</div>';
};
/***
* Returns layout of 'clear filter' button
*/
gridMvc.prototype.getClearFilterButton = function () {
return '<ul class="menu-list">\
<li><a class="grid-filter-clear" href="javascript:void(0);">' + this.lang.clearFilterLabel + '</a></li>\
</ul>';
};
/***
* Register filter widget in widget collection
*/
gridMvc.prototype.addFilterWidget = function (widget) {
this.filterWidgets.push(widget);
};
/***
* Parse filter settings from data attribute
*/
gridMvc.prototype.parseFilterValues = function (filterData) {
var opt = $.parseJSON(filterData);
var filters = [];
for (var i = 0; i < opt.length; i++) {
filters.push({ filterValue: this.urldecode(opt[i].FilterValue), filterType: opt[i].FilterType, columnName: opt[i].ColumnName });
}
return filters;
};
gridMvc.prototype.urldecode = function (str) {
return decodeURIComponent((str + '').replace(/\+/g, '%20'));
};
/***
* Return registred widget for specific column type name
*/
gridMvc.prototype.getFilterWidgetForType = function (typeName) {
for (var i = 0; i < this.filterWidgets.length; i++) {
if ($.inArray(typeName, this.filterWidgets[i].getAssociatedTypes()) >= 0)
return this.filterWidgets[i];
}
return null;
};
/***
* Replace existed filter widget
*/
gridMvc.prototype.replaceFilterWidget = function (typeNameToReplace, widget) {
for (var i = 0; i < this.filterWidgets.length; i++) {
if ($.inArray(typeNameToReplace, this.filterWidgets[i].getAssociatedTypes()) >= 0) {
this.filterWidgets.splice(i, 1);
this.addFilterWidget(widget);
return true;
}
}
return false;
};
/***
* Applies selected filter value by redirecting to another url:
*/
gridMvc.prototype.applyFilterValues = function (initialUrl, columnName, values, skip) {
var filters = this.jqContainer.find(".grid-filter");
if (initialUrl.length > 0)
initialUrl += "&";
var url = "";
if (!skip) {
url += this.getFilterQueryData(columnName, values);
}
if (this.options.multiplefilters) { //multiple filters enabled
for (var i = 0; i < filters.length; i++) {
if ($(filters[i]).attr("data-name") != columnName) {
var filterData = this.parseFilterValues($(filters[i]).attr("data-filterdata"));
if (filterData.length == 0) continue;
if (url.length > 0) url += "&";
url += this.getFilterQueryData($(filters[i]).attr("data-name"), filterData);
} else {
continue;
}
}
}
window.location.search = initialUrl + url;
};
gridMvc.prototype.getFilterQueryData = function (columnName, values) {
var url = "";
for (var i = 0; i < values.length; i++) {
url += "grid-filter=" + encodeURIComponent(columnName) + "__" + values[i].filterType + "__" + encodeURIComponent(values[i].filterValue);
if (i != values.length - 1)
url += "&";
}
return url;
};
/***
* ============= POPUP MENU =============
* Methods that provides base functionality for popup menus
*/
gridMvc.prototype.openMenuOnClick = function (self) {
if ($(this).hasClass("clicked")) return true;
self.closeOpenedPopups();
$(this).addClass("clicked");
var popup = $(this).find(".dropdown-menu");
if (popup.length == 0) return true;
popup.show();
popup.addClass("opened");
self.openedMenuBtn = $(this);
$(document).bind("click.gridmvc", function (e) {
self.documentCallback(e, self);
});
return false;
};
gridMvc.prototype.documentCallback = function (e, $context) {
e = e || event;
var target = e.target || e.srcElement;
var box = $(".dropdown-menu.opened").get(0);
var html = $("html").get(0);
if (typeof box != "undefined") {
do {
if (box == target) {
// Click occured inside the box, do nothing.
return;
}
if (html == target) {
box.style.display = "none";
$(box).removeClass("opened");
}
target = target.parentNode;
} while (target); // Click was outside the box, hide it.
}
if ($context.openedMenuBtn != null)
$context.openedMenuBtn.removeClass("clicked");
$(document).unbind("click.gridmvc");
};
gridMvc.prototype.closeOpenedPopups = function () {
var openedPopup = $(".dropdown-menu.opened");
openedPopup.hide();
openedPopup.removeClass("opened");
if (this.openedMenuBtn != null)
this.openedMenuBtn.removeClass("clicked");
};
/* Grid.Mvc clients functions */
gridMvc.prototype.selectable = function (enable) {
this.options.selectable = enable;
};
return gridMvc;
})(window.jQuery);
/***
* ============= LOCALIZATION =============
* You can localize Grid.Mvc by creating localization files and include it on the page after this script file
* This script file provides localization only for english language.
* For more documentation see: http://gridmvc.codeplex.com/documentation
*/
if (typeof (GridMvc.lang) == 'undefined')
GridMvc.lang = {};
GridMvc.lang.en = {
filterTypeLabel: "Type: ",
filterValueLabel: "Value:",
applyFilterButtonText: "Apply",
filterSelectTypes: {
Equals: "Equals",
StartsWith: "StartsWith",
Contains: "Contains",
EndsWith: "EndsWith",
GreaterThan: "Greater than",
LessThan: "Less than"
},
code: 'en',
boolTrueLabel: "Yes",
boolFalseLabel: "No",
clearFilterLabel: "Clear filter"
};
/***
* ============= FILTER WIDGETS =============
* Filter widget allows onRender custom filter user interface for different columns.
* For example if your added column is of type "DateTime" - widget can onRender calendar for picking filter value.
* This script provider base widget for default .Net types: System.String, System.Int32, System.Decimal etc.
* If you want to provide custom filter functionality - you can assign your own widget type for column and write widget for this types.
* For more documentation see: http://gridmvc.codeplex.com/documentation
*/
/***
* TextFilterWidget - Provides filter interface for text columns (of type "System.String")
* This widget onRenders filter interface with conditions, which specific for text types: contains, starts with etc.
*/
TextFilterWidget = (function ($) {
function textFilterWidget() { }
/***
* This method must return type of columns that must be associated with current widget
* If you not specify your own type name for column (see 'SetFilterWidgetType' method), GridMvc setup column type name from .Net type ("System.DateTime etc.)
*/
textFilterWidget.prototype.getAssociatedTypes = function () { return ["System.String"]; };
/***
* This method invokes when filter widget was shown on the page
*/
textFilterWidget.prototype.onShow = function () {
var textBox = this.container.find(".grid-filter-input");
if (textBox.length <= 0) return;
textBox.focus();
};
/***
* This method specify whether onRender 'Clear filter' button for this widget.
*/
textFilterWidget.prototype.showClearFilterButton = function () { return true; };
/***
* This method will invoke when user first clicked on filter button.
* container - html element, which must contain widget layout;
* lang - current language settings;
* typeName - current column type (if widget assign to multipile types, see: getAssociatedTypes);
* filterType - current filter type (like equals, starts with etc);
* filterValue - current filter value;
* cb - callback function that must invoked when user want to filter this column. Widget must pass filter type and filter value.
*/
textFilterWidget.prototype.onRender = function (container, lang, typeName, values, cb) {
this.cb = cb;
this.container = container;
this.lang = lang;
this.value = values.length > 0 ? values[0] : { filterType: 1, filterValue: "" };//support only one filter value
this.renderWidget();
this.registerEvents();
};
/***
* Internal method that build widget layout and append it to the widget container
*/
textFilterWidget.prototype.renderWidget = function () {
var html = '<div class="form-group">\
<label>' + this.lang.filterTypeLabel + '</label>\
<select class="grid-filter-type form-control">\
<option value="1" ' + (this.value.filterType == "1" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.Equals + '</option>\
<option value="2" ' + (this.value.filterType == "2" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.Contains + '</option>\
<option value="3" ' + (this.value.filterType == "3" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.StartsWith + '</option>\
<option value="4" ' + (this.value.filterType == "4" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.EndsWith + '</option>\
</select>\
</div>\
<div class="form-group">\
<label>' + this.lang.filterValueLabel + '</label>\
<input type="text" class="grid-filter-input form-control" value="' + this.value.filterValue + '" />\
</div>\
<div class="grid-filter-buttons">\
<button type="button" class="btn btn-primary grid-apply" >' + this.lang.applyFilterButtonText + '</button>\
</div>';
this.container.append(html);
};
/***
* Internal method that register event handlers for 'apply' button.
*/
textFilterWidget.prototype.registerEvents = function () {
//get apply button from:
var applyBtn = this.container.find(".grid-apply");
//save current context:
var $context = this;
//register onclick event handler
applyBtn.click(function () {
//get selected filter type:
var type = $context.container.find(".grid-filter-type").val();
//get filter value:
var value = $context.container.find(".grid-filter-input").val();
//invoke callback with selected filter values:
var filterValues = [{ filterType: type, filterValue: value }];
$context.cb(filterValues);
});
//register onEnter event for filter text box:
this.container.find(".grid-filter-input").keyup(function (event) {
if (event.keyCode == 13) { applyBtn.click(); }
if (event.keyCode == 27) { GridMvc.closeOpenedPopups(); }
});
};
return textFilterWidget;
})(window.jQuery);
/***
* NumberFilterWidget - Provides filter interface for number columns
* This widget onRenders filter interface with conditions, which specific for number types: great than, less that etc.
* Also validates user's input for digits
*/
NumberFilterWidget = (function ($) {
function numberFilterWidget() { }
numberFilterWidget.prototype.showClearFilterButton = function () { return true; };
numberFilterWidget.prototype.getAssociatedTypes = function () {
return ["System.Int32", "System.Double", "System.Decimal", "System.Byte", "System.Single", "System.Float", "System.Int64"];
};
numberFilterWidget.prototype.onShow = function () {
var textBox = this.container.find(".grid-filter-input");
if (textBox.length <= 0) return;
textBox.focus();
};
numberFilterWidget.prototype.onRender = function (container, lang, typeName, values, cb) {
this.cb = cb;
this.container = container;
this.lang = lang;
this.typeName = typeName;
this.value = values.length > 0 ? values[0] : { filterType: 1, filterValue: "" };//support only one filter value
this.renderWidget();
this.registerEvents();
};
numberFilterWidget.prototype.renderWidget = function () {
var html = '<div class="form-group">\
<label>' + this.lang.filterTypeLabel + '</label>\
<select class="grid-filter-type form-control">\
<option value="1" ' + (this.value.filterType == "1" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.Equals + '</option>\
<option value="5" ' + (this.value.filterType == "5" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.GreaterThan + '</option>\
<option value="6" ' + (this.value.filterType == "6" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.LessThan + '</option>\
</select>\
</div>\
<div class="form-group">\
<label>' + this.lang.filterValueLabel + '</label>\
<input type="text" class="grid-filter-input form-control" value="' + this.value.filterValue + '" />\
</div>\
<div class="grid-filter-buttons">\
<button type="button" class="btn btn-primary grid-apply">' + this.lang.applyFilterButtonText + '</button>\
</div>';
this.container.append(html);
};
numberFilterWidget.prototype.registerEvents = function () {
var $context = this;
var applyBtn = this.container.find(".grid-apply");
applyBtn.click(function () {
var type = $context.container.find(".grid-filter-type").val();
var value = $context.container.find(".grid-filter-input").val();
var filters = [{ filterType: type, filterValue: value }];
$context.cb(filters);
});
var txt = this.container.find(".grid-filter-input");
txt.keyup(function (event) {
if (event.keyCode == 13) { applyBtn.click(); }
if (event.keyCode == 27) { GridMvc.closeOpenedPopups(); }
})
.keypress(function (event) { return $context.validateInput.call($context, event); });
if (this.typeName == "System.Byte")
txt.attr("maxlength", "3");
};
numberFilterWidget.prototype.validateInput = function (evt) {
var $event = evt || window.event;
var key = $event.keyCode || $event.which;
key = String.fromCharCode(key);
var regex;
switch (this.typeName) {
case "System.Byte":
case "System.Int32":
case "System.Int64":
regex = /[0-9]/;
break;
default:
regex = /[0-9]|\.|\,/;
}
if (!regex.test(key)) {
$event.returnValue = false;
if ($event.preventDefault) $event.preventDefault();
}
};
return numberFilterWidget;
})(window.jQuery);
/***
* DateTimeFilterWidget - Provides filter interface for date columns (of type "System.DateTime").
* If datepicker script included, this widget will render calendar for pick filter values
* In other case he onRender textbox field for specifing date value (more info at http://window.jQueryui.com/)
*/
DateTimeFilterWidget = (function ($) {
function dateTimeFilterWidget() { }
dateTimeFilterWidget.prototype.getAssociatedTypes = function () { return ["System.DateTime"]; };
dateTimeFilterWidget.prototype.showClearFilterButton = function () { return true; };
dateTimeFilterWidget.prototype.onRender = function (container, lang, typeName, values, applycb, data) {
this.datePickerIncluded = typeof ($.fn.datepicker) != 'undefined';
this.cb = applycb;
this.data = data;
this.container = container;
this.lang = lang;
this.value = values.length > 0 ? values[0] : { filterType: 1, filterValue: "" };//support only one filter value
this.renderWidget();
this.registerEvents();
};
dateTimeFilterWidget.prototype.renderWidget = function () {
var html = '<div class="form-group">\
<label>' + this.lang.filterTypeLabel + '</label>\
<select class="grid-filter-type form-control">\
<option value="1" ' + (this.value.filterType == "1" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.Equals + '</option>\
<option value="5" ' + (this.value.filterType == "5" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.GreaterThan + '</option>\
<option value="6" ' + (this.value.filterType == "6" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.LessThan + '</option>\
</select>\
</div>' +
(this.datePickerIncluded ?
'<div class="grid-filter-datepicker"></div>'
:
'<div class="form-group">\
<label>' + this.lang.filterValueLabel + '</label>\
<input type="text" class="grid-filter-input form-control" value="' + this.value.filterValue + '" />\
</div>\
<div class="grid-filter-buttons">\
<input type="button" class="btn btn-primary grid-apply" value="' + this.lang.applyFilterButtonText + '" />\
</div>');
this.container.append(html);
//if window.jQueryUi included:
if (this.datePickerIncluded) {
var datePickerOptions = this.data || {};
datePickerOptions.format = datePickerOptions.format || "yyyy-mm-dd";
datePickerOptions.language = datePickerOptions.language || this.lang.code;
var $context = this;
var dateContainer = this.container.find(".grid-filter-datepicker");
dateContainer.datepicker(datePickerOptions).on('changeDate', function (ev) {
var type = $context.container.find(".grid-filter-type").val();
var filterValues = [{ filterType: type, filterValue: ev.format() }];
$context.cb(filterValues);
});
if (this.value.filterValue)
dateContainer.datepicker('update', this.value.filterValue);
}
};
dateTimeFilterWidget.prototype.registerEvents = function () {
var $context = this;
var applyBtn = this.container.find(".grid-apply");
applyBtn.click(function () {
var type = $context.container.find(".grid-filter-type").val();
var value = $context.container.find(".grid-filter-input").val();
var filterValues = [{ filterType: type, filterValue: value }];
$context.cb(filterValues);
});
this.container.find(".grid-filter-input").keyup(function (event) {
if (event.keyCode == 13) {
applyBtn.click();
}
});
};
return dateTimeFilterWidget;
})(window.jQuery);
/***
* BooleanFilterWidget - Provides filter interface for boolean columns (of type "System.Boolean").
* Renders two button for filter - true and false
*/
BooleanFilterWidget = (function ($) {
function booleanFilterWidget() { }
booleanFilterWidget.prototype.getAssociatedTypes = function () { return ["System.Boolean"]; };
booleanFilterWidget.prototype.showClearFilterButton = function () { return true; };
booleanFilterWidget.prototype.onRender = function (container, lang, typeName, values, cb) {
this.cb = cb;
this.container = container;
this.lang = lang;
this.value = values.length > 0 ? values[0] : { filterType: 1, filterValue: "" };//support only one filter value
this.renderWidget();
this.registerEvents();
};
booleanFilterWidget.prototype.renderWidget = function () {
var html = '<label>' + this.lang.filterValueLabel + '</label>\
<ul class="menu-list">\
<li><a class="grid-filter-choose ' + (this.value.filterValue == "true" ? "choose-selected" : "") + '" data-value="true" href="javascript:void(0);">' + this.lang.boolTrueLabel + '</a></li>\
<li><a class="grid-filter-choose ' + (this.value.filterValue == "false" ? "choose-selected" : "") + '" data-value="false" href="javascript:void(0);">' + this.lang.boolFalseLabel + '</a></li>\
</ul>';
this.container.append(html);
};
booleanFilterWidget.prototype.registerEvents = function () {
var $context = this;
var applyBtn = this.container.find(".grid-filter-choose");
applyBtn.click(function () {
var filterValues = [{ filterType: "1", filterValue: $(this).attr("data-value") }];
$context.cb(filterValues);
});
};
return booleanFilterWidget;
})(window.jQuery);
//startup init:
(function ($) {
if (!$) return;//jquery not referenced
$(function () {
$(".grid-mvc").each(function () {
$(".grid-mvc").gridmvc();
});
});
})(window.jQuery);
-22
View File
@@ -1,22 +0,0 @@
/***
* Grid.Mvc russian language (ru-RU) http://gridmvc.codeplex.com/
*/
window.GridMvc = window.GridMvc || {};
window.GridMvc.lang = window.GridMvc.lang || {};
GridMvc.lang.ru = {
filterTypeLabel: "Тип фильтра: ",
filterValueLabel: "Значение:",
applyFilterButtonText: "Применить",
filterSelectTypes: {
Equals: "Равно",
StartsWith: "Начинается с",
Contains: "Содержит",
EndsWith: "Оканчивается",
GreaterThan: "Больше",
LessThan: "Меньше"
},
code: 'ru',
boolTrueLabel: "Да",
boolFalseLabel: "Нет",
clearFilterLabel: "Очистить фильтр"
};
File diff suppressed because one or more lines are too long
-12
View File
@@ -76,10 +76,6 @@
<HintPath>..\packages\Glimpse.Mvc5.1.5.3\lib\net45\Glimpse.Mvc5.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="GridMvc, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Grid.Mvc.3.0.0\lib\net40\GridMvc.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.2\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
<Private>True</Private>
@@ -243,7 +239,6 @@
<Content Include="Content\bootstrap.min.css" />
<Content Include="Content\font-awesome.css" />
<Content Include="Content\font-awesome.min.css" />
<Content Include="Content\Gridmvc.css" />
<Content Include="Content\Site.css">
<DependentUpon>Site.less</DependentUpon>
</Content>
@@ -322,7 +317,6 @@
<Content Include="Models\SMModel.edmx.diagram">
<DependentUpon>SMModel.edmx</DependentUpon>
</Content>
<Content Include="Grid.mvc.readme" />
<Content Include="fonts\FontAwesome.otf" />
<Content Include="fonts\fontawesome-webfont.woff2" />
<Content Include="fonts\fontawesome-webfont.woff" />
@@ -350,9 +344,6 @@
<Content Include="Scripts\globalize\plural.js" />
<Content Include="Scripts\globalize\relative-time.js" />
<Content Include="Scripts\globalize\unit.js" />
<Content Include="Scripts\gridmvc.js" />
<Content Include="Scripts\gridmvc.lang.ru.js" />
<Content Include="Scripts\gridmvc.min.js" />
<None Include="Properties\PublishProfiles\IIS02_TK.pubxml" />
<None Include="Properties\PublishProfiles\TK_prod.pubxml" />
<None Include="Properties\PublishProfiles\TK_test.pubxml" />
@@ -428,9 +419,6 @@
<Content Include="Views\ItemFluxes\Edit.cshtml" />
<Content Include="Views\ItemFluxes\Index.cshtml" />
<Content Include="Views\Shared\_searchBox.cshtml" />
<Content Include="Views\Shared\_GridPager.cshtml" />
<Content Include="Views\Shared\_Grid.cshtml" />
<Content Include="Views\Items\Grid.cshtml" />
<Content Include="Views\Shared\_MVCGridToolbar.cshtml" />
<Content Include="Views\ItemFluxes\_CreatePrecompiled.cshtml" />
<Content Include="Views\vItemFlux2Save\Create.cshtml" />
-115
View File
@@ -1,115 +0,0 @@
@model IEnumerable<StockManMVC.Models.Item>
@using GridMvc.Html
@{
ViewBag.Title = "Grid";
}
@*@{
Layout = null;
}*@
<h2>Grid</h2>
<link href="@Url.Content("~/Content/Gridmvc.css")" rel="stylesheet" />
<link href="@Url.Content("~/Content/bootstrap.min.css")" rel="stylesheet" />
<script src="@Url.Content("~/Scripts/jquery-3.1.0.min.js")"></script>
<script src="@Url.Content("~/Scripts/gridmvc.min.js")"></script>
<div class="code-cut">
@Html.Grid(Model).Columns(columns =>
{
columns.Add()
.Encoded(false)
.Sanitized(false)
.SetWidth(30)
.RenderValueAs(o => Html.ActionLink("Select", "Details", new { id = o.ID }));
columns.Add(c => c.Descr).Titled("Descr").Filterable(true);
columns.Add(c => c.CodInt).Titled("CodInt").Filterable(true);
columns.Add(c => c.CodExt).Titled("CodExt").Filterable(true);
columns.Add(c => c.DescrExt).Titled("DescrExt").Filterable(true);
columns.Add(c => c.QtaMin).Titled("QtaMin").Filterable(true);
columns.Add(c => c.QtaBatch).Titled("QtaBatch").Filterable(true);
columns.Add(c => c.CurrValue).Titled("CurrValue").Filterable(true);
columns.Add(c => c.ItemFamily.Descr).Titled("Family").Filterable(true);
columns.Add()
.Encoded(false)
.Sanitized(false)
.SetWidth(30)
.RenderValueAs(o => Html.ActionLink("Edit", "Edit", new { id = o.ID }));
columns.Add()
.Encoded(false)
.Sanitized(false)
.SetWidth(30)
.RenderValueAs(o => Html.ActionLink("Delete", "Delete", new { id = o.ID }));
}).WithPaging(5).Sortable(true)
</div>
@*<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Descr)
</th>
<th>
@Html.DisplayNameFor(model => model.CodInt)
</th>
<th>
@Html.DisplayNameFor(model => model.CodExt)
</th>
<th>
@Html.DisplayNameFor(model => model.DescrExt)
</th>
<th>
@Html.DisplayNameFor(model => model.QtaMin)
</th>
<th>
@Html.DisplayNameFor(model => model.QtaBatch)
</th>
<th>
@Html.DisplayNameFor(model => model.CurrValue)
</th>
<th>
@Html.DisplayNameFor(model => model.ItemFamily.Descr)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Descr)
</td>
<td>
@Html.DisplayFor(modelItem => item.CodInt)
</td>
<td>
@Html.DisplayFor(modelItem => item.CodExt)
</td>
<td>
@Html.DisplayFor(modelItem => item.DescrExt)
</td>
<td>
@Html.DisplayFor(modelItem => item.QtaMin)
</td>
<td>
@Html.DisplayFor(modelItem => item.QtaBatch)
</td>
<td>
@Html.DisplayFor(modelItem => item.CurrValue)
</td>
<td>
@Html.DisplayFor(modelItem => item.ItemFamily.Descr)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>
</tr>
}
</table>*@
-65
View File
@@ -1,65 +0,0 @@
@using GridMvc.Columns
@model GridMvc.IGrid
@if (Model == null) { return; }
@if (Model.RenderOptions.RenderRowsOnly)
{
@RenderGridBody();
}
else
{
<div class="grid-mvc" data-lang="@Model.Language" data-gridname="@Model.RenderOptions.GridName" data-selectable="@Model.RenderOptions.Selectable.ToString().ToLower()" data-multiplefilters ="@Model.RenderOptions.AllowMultipleFilters.ToString().ToLower()">
<div class="grid-wrap">
<table class="table table-striped grid-table">
@* Draw grid header *@
<thead>
@RenderGridHeader()
</thead>
<tbody>
@RenderGridBody()
</tbody>
</table>
@RenderGridPager()
</div>
</div>
}
@helper RenderGridBody()
{
if (!Model.ItemsToDisplay.Any())
{
<tr class="grid-empty-text">
<td colspan="@Model.Columns.Count()">
@Model.EmptyGridText
</td>
</tr>
}
else
{
foreach (object item in Model.ItemsToDisplay)
{
<tr class="grid-row @Model.GetRowCssClasses(item)">
@foreach (IGridColumn column in Model.Columns)
{
@column.CellRenderer.Render(column, column.GetCell(item))
}
</tr>
}
}
}
@helper RenderGridHeader()
{
<tr>
@foreach (IGridColumn column in Model.Columns)
{
@column.HeaderRenderer.Render(column)
}
</tr>
}
@helper RenderGridPager()
{
if (Model.EnablePaging && Model.Pager != null)
{
<div class="grid-footer">
@Html.Partial(Model.Pager.TemplateName, Model.Pager)
</div>
}
}
@@ -1,49 +0,0 @@
@model GridMvc.Pagination.GridPager
@if (Model == null || Model.PageCount <= 1)
{
return;
}
<div class="grid-pager">
<ul class="pagination">
@if (Model.CurrentPage > 1)
{
<li>
<a href="@Model.GetLinkForPage(Model.CurrentPage - 1)">«</a>
</li>
}
@if (Model.StartDisplayedPage > 1)
{
<li>
<a href="@Model.GetLinkForPage(1)">1</a>
</li>
if (Model.StartDisplayedPage > 2)
{
<li><a href="@Model.GetLinkForPage(Model.StartDisplayedPage - 1)">...</a></li>
}
}
@for (int i = Model.StartDisplayedPage; i <= Model.EndDisplayedPage; i++)
{
if (i == Model.CurrentPage)
{
<li class="active"><span>@i</span></li>
}
else
{
<li><a href="@Model.GetLinkForPage(i)">@i</a></li>
}
}
@if (Model.EndDisplayedPage < Model.PageCount)
{
if (Model.EndDisplayedPage < Model.PageCount - 1)
{
<li><a href="@Model.GetLinkForPage(Model.EndDisplayedPage + 1)">...</a></li>
}
<li><a href="@Model.GetLinkForPage(Model.PageCount)">@Model.PageCount</a></li>
}
@if (Model.CurrentPage < Model.PageCount)
{
<li><a href="@Model.GetLinkForPage(Model.CurrentPage + 1)">»</a></li>
}
</ul>
</div>
+14 -3
View File
@@ -14,7 +14,7 @@
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
@@ -24,14 +24,24 @@
@Html.ActionLink("Stock Man", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
@Html.Partial("_menuTop")
@Html.Partial("_menuTop")
</div>
</div>
</div>
<div class="container-fluid body-content">
@RenderBody()
<footer class="navbar-fixed-bottom navbar navbar-inverse">
@{
// recupero variabile ambiente...
ViewBag.envir = System.Web.Configuration.WebConfigurationManager.AppSettings["Environment"];
string cssFixFooter = "";
}
@if (ViewBag.envir != "Dev")
{
cssFixFooter = "navbar-fixed-bottom";
}
<footer class="navbar navbar-inverse @cssFixFooter">
@Html.Partial("_footer")
</footer>
</div>
@@ -64,4 +74,5 @@
@RenderSection("scripts", required: false)
</body>
</html>
+5 -2
View File
@@ -1,8 +1,11 @@
<div class="row">
<div class="col-sm-6">
<div class="col-sm-4">
<p style="padding-left:1em;">@DateTime.Now.ToLongDateString(), @DateTime.Now.ToLongTimeString() | StockMan <sub>v: @typeof(StockManMVC.MvcApplication).Assembly.GetName().Version</sub></p>
</div>
<div class="col-sm-6">
<div class="col-sm-4 text-center">
<strong>@ViewBag.envir</strong>
</div>
<div class="col-sm-4">
<p style="padding-right:1em;" class="text-right">Steamware s.r.l. - &copy; 2007-@DateTime.Now.Year</p>
</div>
</div>
+2
View File
@@ -1,3 +1,5 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
// faccio le chiamate x recuperare l'utente ed i suoi diritti...
}
+3
View File
@@ -14,6 +14,9 @@
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<appSettings>
<add key="Environment" value="TK - Test" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
</appSettings>
<connectionStrings>
<add name="StockManEntities"
connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SQL-STEAM\SQL2012;initial catalog=TK_StockManTest;persist security info=True;user id=sa;password=keyhammer;MultipleActiveResultSets=True;App=EntityFramework&quot;"
+3
View File
@@ -14,6 +14,9 @@
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<appSettings>
<add key="Environment" value="TK - Test" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
</appSettings>
<connectionStrings>
<add name="StockManEntities"
connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SQL-STEAM\SQL2012;initial catalog=TK_StockManTest;persist security info=True;user id=sa;password=keyhammer;MultipleActiveResultSets=True;App=EntityFramework&quot;"
+3
View File
@@ -14,6 +14,9 @@
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<appSettings>
<add key="Environment" value="SteamWare - Prod" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
</appSettings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
+3
View File
@@ -14,6 +14,9 @@
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<appSettings>
<add key="Environment" value="TK - Prod" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
</appSettings>
<connectionStrings>
<add name="StockManEntities"
connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SRV-PRODTK01;initial catalog=TK_StockMan;persist security info=True;user id=connGMW;password=steamware;MultipleActiveResultSets=True;App=EntityFramework&quot;"
+3
View File
@@ -14,6 +14,9 @@
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<appSettings>
<add key="Environment" value="TK - Test" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
</appSettings>
<connectionStrings>
<add name="StockManEntities"
connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SRV-PRODTK01;initial catalog=TK_StockManTest;persist security info=True;user id=connGMW;password=steamware;MultipleActiveResultSets=True;App=EntityFramework&quot;"
+4 -7
View File
@@ -14,6 +14,7 @@
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="Environment" value="Dev" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.2" />
@@ -32,11 +33,7 @@
<httpHandlers>
<add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" />
</httpHandlers>
<pages>
<namespaces>
<add namespace="GridMvc" />
</namespaces>
</pages>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@@ -87,9 +84,9 @@
</system.webServer>
<connectionStrings>
<!--Ufficio Seriate-->
<add name="StockManEntities" connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SQL-STEAM\SQL2012;initial catalog=StockMan;persist security info=True;user id=sa;password=keyhammer;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<!--<add name="StockManEntities" connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SQL-STEAM\SQL2012;initial catalog=StockMan;persist security info=True;user id=sa;password=keyhammer;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />-->
<!--Portatile-->
<!--<add name="StockManEntities" connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=W10-DEV-WEB;initial catalog=StockMan;persist security info=True;user id=sa;password=keyhammer;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />-->
<add name="StockManEntities" connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=W10-DEV-WEB;initial catalog=StockMan;persist security info=True;user id=sa;password=keyhammer;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
+3 -2
View File
@@ -14,6 +14,7 @@
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="Environment" value="Dev" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.2" />
@@ -87,9 +88,9 @@
</system.webServer>
<connectionStrings>
<!--Ufficio Seriate-->
<add name="StockManEntities" connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SQL-STEAM\SQL2012;initial catalog=StockMan;persist security info=True;user id=sa;password=keyhammer;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<!--<add name="StockManEntities" connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SQL-STEAM\SQL2012;initial catalog=StockMan;persist security info=True;user id=sa;password=keyhammer;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />-->
<!--Portatile-->
<!--<add name="StockManEntities" connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=W10-DEV-WEB;initial catalog=StockMan;persist security info=True;user id=sa;password=keyhammer;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />-->
<add name="StockManEntities" connectionString="metadata=res://*/Models.SMModel.csdl|res://*/Models.SMModel.ssdl|res://*/Models.SMModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=W10-DEV-WEB;initial catalog=StockMan;persist security info=True;user id=sa;password=keyhammer;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
-1
View File
@@ -10,7 +10,6 @@
<package id="Glimpse.AspNet" version="1.9.2" targetFramework="net462" />
<package id="Glimpse.EF6" version="1.6.5" targetFramework="net462" />
<package id="Glimpse.Mvc5" version="1.5.3" targetFramework="net462" />
<package id="Grid.Mvc" version="3.0.0" targetFramework="net462" />
<package id="jQuery" version="3.1.1" targetFramework="net462" />
<package id="jQuery.UI.Combined" version="1.12.1" targetFramework="net462" />
<package id="jQuery.Validation" version="1.15.1" targetFramework="net462" />
@@ -3,3 +3,8 @@ C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\StockMan\VersGen\bi
C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\StockMan\VersGen\obj\Release\VersGen.csprojResolveAssemblyReference.cache
C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\StockMan\VersGen\obj\Release\VersGen.dll
C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\StockMan\VersGen\obj\Release\VersGen.pdb
C:\Users\samuele\Documents\Visual Studio 2015\Projects\StockMan\VersGen\bin\Release\VersGen.dll
C:\Users\samuele\Documents\Visual Studio 2015\Projects\StockMan\VersGen\bin\Release\VersGen.pdb
C:\Users\samuele\Documents\Visual Studio 2015\Projects\StockMan\VersGen\obj\Release\VersGen.csprojResolveAssemblyReference.cache
C:\Users\samuele\Documents\Visual Studio 2015\Projects\StockMan\VersGen\obj\Release\VersGen.dll
C:\Users\samuele\Documents\Visual Studio 2015\Projects\StockMan\VersGen\obj\Release\VersGen.pdb
-39
View File
@@ -1,39 +0,0 @@
/***
* Grid.Mvc stylesheet http://gridmvc.codeplex.com/
* This file contains default styles for Grid.Mvc.
*/
/* Grid */
table.grid-table { margin: 0; }
table.grid-table .grid-wrap { padding: 0; position: relative; }
table.grid-table .grid-empty-text { color: #666; }
/* Grid headers */
table.grid-table .grid-header { position: relative; }
table.grid-table .grid-header .sorted-asc .grid-sort-arrow:after { content: " \2193"; }
table.grid-table .grid-header .sorted-desc .grid-sort-arrow:after { content: " \2191"; }
table.grid-table .grid-header > .grid-header-title { width: 100%; margin-right: 15px; white-space: nowrap; }
/* Grid body */
table.grid-table tr.grid-row-selected td { background: #4888C2 !important; color: white; }
table.grid-table tr.grid-row-selected a { color: white; }
/* Grid filtering */
input.grid-filter-input { padding: 4px; font-size: 13px; }
table.grid-table .grid-filter { position: relative; margin-top: 2px; float: right; width: 10px; height: 12px; }
table.grid-table .grid-filter-btn { cursor: pointer; display: block; width: 10px; height: 12px; background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAJFJREFUKFNjkJSU/E8MZvj//78DMRhkoj+6bizYH2SiiIeHx2FjY+P/2DBIDqSGAQSOHTtmYWZm9hldEUgMJAdWBAJAHSzt7e056ApBYiA5qDIIAAoIhIaGroYpArFBYlBpVLB3715DmEIQGyqMCUDWwBRiWIkOYAqhXNwApMjX13c7lIsbgBQBrdWAcqGAgQEAdOGTrvsYKXIAAAAASUVORK5CYII=') no-repeat; }
table.grid-table .grid-filter-btn.filtered { background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAJNJREFUKFNjYGj//58o/P//fwdiMIOkpKQ/VhOQMFgNULWIh4fHYWNj4//YMEgOpIYBBI4dO2ZhZmb2GV0RSAwkB1YEAkAdLO3t7TnoCkFiIDmoMggACgiEhoauhikCsUFiUGlUsHfvXkOYQhAbKowJQNbAFGJYiQ5gCqFc3ACkyNfXdzuUixuAFAGt1YByoYCBAQAUDanUpFB4UQAAAABJRU5ErkJggg==') no-repeat; }
table.grid-table .grid-filter-buttons { padding: 0; }
table.grid-table .grid-filter-datepicker { font-size: 12px; }
table.grid-table .grid-filter-datepicker table td { padding: 1px!important; }
table.grid-table .grid-filter-datepicker .ui-datepicker { width: auto; }
table.grid-table .grid-dropdown-inner ul.menu-list li a.grid-filter-clear { white-space: nowrap; padding-left: 23px; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAMCAYAAABbayygAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAARpJREFUKFNjYGj//58o/P//fwdiMIOkpKQ/VhOQMFgNULWIh4fHYWNj4//YMEgOpIYBBI4dO2axOC/396GinP/O+vpwRVbGxl92+vluXm1kuASsEKiD5VB99aG3eTH/HxjL/A/RUPsfrqb6f7e21uutlhbRYEUwAFQskOLmun2+lND/0xxM/7dycXzd6OxoCpVGBduWLjXv4+f/v5WF+f9RbtYvfeysqlApBKhhY2Hcxsy0+xAL038nbe3/m8W4ss/Jcx2GSiPAal6uvGtczP9TFOXBHgGJ7RHlmLGOjy0UrAAGzgT7rn7urP/P3NDgv6+v73aQWAMzM+dqTtbJYAUwsNzeyuhImE8GSBHQYxpQYYYJQCcxMDAwAAB7/bt5uWh9FAAAAABJRU5ErkJggg=='); background-position: 3px center; background-repeat: no-repeat; }
table.grid-table .grid-filter-choose.choose-selected { background-color: white!important; cursor: default; color: #999; }
table.grid-table .grid-popup-additional { padding: 3px 0 0 0; }
/* POP-UP */
.grid-dropdown { font-weight: normal; left: -102px; top: 16px!important; min-width: 180px; }
.grid-dropdown-arrow { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAICAYAAADJEc7MAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAAl0lEQVQoU42PMQuFMAyE6xN5gpOjjsIb/P9/o3O3zh27dY25kIPq8DBwmLT35WoQkUEVOmGec84CaW2q7+N+AdCD6M9SisQYTei1jsfyCeCu+vjFVGs1AN++94DRfUOfuNLoKUiyRC5y2F5I8NdaM4P/l0EswvBorQTnfxBhLMRih+2pklIy+eEtjQPu6MNZwIBNbwteMBd5X4ZGHcwL3QAAAABJRU5ErkJggg==") no-repeat; height: 8px; left: 99px; position: absolute; top: -8px; width: 14px; }
.grid-dropdown-inner { padding: 5px 7px; }
.grid-dropdown ul.menu-list { list-style-type: none; margin: 3px 0 0 0; padding: 0; }
.grid-dropdown ul.menu-list li a { text-decoration: none; background-position: 6px center; background-repeat: no-repeat; display: block; padding: 4px 5px; }
.grid-dropdown ul.menu-list li a:hover { background-color: #EEE; text-decoration: none; }
-60
View File
@@ -1,60 +0,0 @@
http://gridmvc.codeplex.com/
Note: Grid.Mvc installer has already made the following changes to your project:
- Views/Shared/_Grid.cshtml, Views/Shared/_GridPager.cshtml - views for grid
- Content/Gridmvc.css - default stylesheet for the grid
- Scripts/gridmvc.js, Scripts/gridmvc.min.js - Grid.Mvc scripts
- Reference GridMvc.dll
Follow these steps to start use Grid.mvc:
1. Define a model for display in the grid, like:
public class Foo
{
public string Title { get; set; }
public string Description { get;set; }
}
2. Prepare your model in your controller, like:
public ActionResult Index()
{
var items = fooRepository.GetAll();
return View(items);
}
3. Render GridMvc in the View: You can use Html helper extenstion:
Reference Grid.Mvc.Html in your view:
@using GridMvc.Html
Render Grid.Mvc:
@Html.Grid(Model).Columns(columns =>
{
columns.Add(foo => foo.Title).Titled("Custom column title").SetWidth(110);
columns.Add(foo => foo.Description).Sortable(true);
}).WithPaging(20)
4. Register a grid stylesheet and scripts in your _Layouts.cshtml file:
<link href="@Url.Content("~/Content/Gridmvc.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/gridmvc.min.js")" type="text/javascript"> </script>
Notes:
Default layout of Grid.Mvc uses Twitter Bootstrap (css framework). You also need to include stylesheets on your page. You can download it from - http://twitter.github.com/bootstrap/
like:
<link href="@Url.Content("~/Content/Css/bootstrap.min.css")" rel="stylesheet" type="text/css" />
Also you need to ensure that jQuery has registred on the page before gridmvc.min.js script.
For more documetation, please see: http://gridmvc.codeplex.com/
-724
View File
@@ -1,724 +0,0 @@
/***
* Grid.Mvc
* Examples and documentation at: http://gridmvc.codeplex.com
* Version: 3.0.0
* Requires: window.jQuery v1.3+
* LGPL license: http://gridmvc.codeplex.com/license
*/
window.pageGrids = window.pageGrids || {};
$.fn.extend({
gridmvc: function () {
var aObj = [];
$(this).each(function () {
if (!$(this).data("gridmvc")) {
var options = { lang: $(this).attr("data-lang"), selectable: $(this).attr("data-selectable") == "true", multiplefilters: $(this).attr("data-multiplefilters") == "true" };
var grid = new GridMvc(this, options);
var name = $(this).attr("data-gridname");
if (name.length > 0)
window.pageGrids[$(this).attr("data-gridname")] = grid;
aObj.push(grid);
$(this).data("gridmvc", grid);
} else {
aObj.push($(this).data("gridmvc"));
}
});
if (aObj.length == 1)
return aObj[0];
return aObj;
}
});
GridMvc = (function ($) {
function gridMvc(container, options) {
this.jqContainer = $(container);
options = options || {};
this.options = $.extend({}, this.defaults(), options);
this.init();
}
gridMvc.prototype.init = function () {
//load current lang options:
this.lang = GridMvc.lang[this.options.lang];
if (typeof (this.lang) == 'undefined')
this.lang = GridMvc.lang.en;
this.events = [];
if (this.options.selectable)
this.initGridRowsEvents();
//Register default filter widgets:
this.filterWidgets = [];
this.addFilterWidget(new TextFilterWidget());
this.addFilterWidget(new NumberFilterWidget());
this.addFilterWidget(new DateTimeFilterWidget());
this.addFilterWidget(new BooleanFilterWidget());
this.openedMenuBtn = null;
this.initFilters();
};
/***
* Handle Grid row events
*/
gridMvc.prototype.initGridRowsEvents = function () {
var $this = this;
this.jqContainer.on("click", ".grid-row", function () {
$this.rowClicked.call(this, $this);
});
};
/***
* Trigger on Grid row click
*/
gridMvc.prototype.rowClicked = function ($context) {
if (!$context.options.selectable)
return;
var row = $(this).closest(".grid-row");
if (row.length <= 0)
return;
var gridRow = {};
row.find(".grid-cell").each(function () {
var columnName = $(this).attr("data-name");
if (columnName.length > 0)
gridRow[columnName] = $(this).text();
});
var evt = $.Event("RowClicked");
$context.notifyOnRowSelect(gridRow, evt);
if (!evt.isDefaultPrevented())
$context.markRowSelected(row);
};
/***
* Mark Grid row as selected
*/
gridMvc.prototype.markRowSelected = function (row) {
this.jqContainer.find(".grid-row.grid-row-selected").removeClass("grid-row-selected");
row.addClass("grid-row-selected");
};
/***
* Default Grid.Mvc options
*/
gridMvc.prototype.defaults = function () {
return {
selectable: true,
multiplefilters: false,
lang: 'en'
};
};
/***
* ============= EVENTS =============
* Methods that provides functionality for grid events
*/
gridMvc.prototype.onRowSelect = function (func) {
this.events.push({ name: "onRowSelect", callback: func });
};
gridMvc.prototype.notifyOnRowSelect = function (row, e) {
e.row = row;
this.notifyEvent("onRowSelect", e);
};
gridMvc.prototype.notifyEvent = function (eventName, e) {
for (var i = 0; i < this.events.length; i++) {
if (this.events[i].name == eventName)
if (!this.events[i].callback(e)) break;
}
};
/***
* ============= FILTERS =============
* Methods that provides functionality for filtering
*/
/***
* Method search all filter buttons and register 'onclick' event handlers:
*/
gridMvc.prototype.initFilters = function () {
var filterHtml = this.filterMenuHtml();
var self = this;
this.jqContainer.find(".grid-filter").each(function () {
$(this).click(function () {
return self.openFilterPopup.call(this, self, filterHtml);
});
});
};
/***
* Shows filter popup window and render filter widget
*/
gridMvc.prototype.openFilterPopup = function (self, html) {
//retrive all column filter parameters from html attrs:
var columnType = $(this).attr("data-type") || "";
//determine widget
var widget = self.getFilterWidgetForType(columnType);
//if widget for specified column type not found - do nothing
if (widget == null)
return false;
//if widget allready rendered - just open popup menu:
if (this.hasAttribute("data-rendered")) {
var or = self.openMenuOnClick.call(this, self);
self.setupPopupInitialPosition($(this));
if (!or && typeof (widget.onShow) != 'undefined')
widget.onShow();
return or;
}
var columnName = $(this).attr("data-name") || "";
var filterData = $(this).attr("data-filterdata") || "";
var widgetData = $(this).attr("data-widgetdata") || "{}";
var filterDataObj = self.parseFilterValues(filterData) || {};
var filterUrl = $(this).attr("data-url") || "";
//mark filter as rendered
$(this).attr("data-rendered", "1");
//append base popup layout:
$(this).append(html);
//determine widget container:
var widgetContainer = $(this).find(".grid-popup-widget");
//onRender target widget
if (typeof (widget.onRender) != 'undefined')
widget.onRender(widgetContainer, self.lang, columnType, filterDataObj, function (values) {
self.closeOpenedPopups();
self.applyFilterValues(filterUrl, columnName, values, false);
}, $.parseJSON(widgetData));
//adding 'clear filter' button if needed:
if ($(this).find(".grid-filter-btn").hasClass("filtered") && widget.showClearFilterButton()) {
var inner = $(this).find(".grid-popup-additional");
inner.append(self.getClearFilterButton(filterUrl));
inner.find(".grid-filter-clear").click(function () {
self.applyFilterValues(filterUrl, columnName, "", true);
});
}
var openResult = self.openMenuOnClick.call(this, self);
if (typeof (widget.onShow) != 'undefined')
widget.onShow();
self.setupPopupInitialPosition($(this));
return openResult;
};
gridMvc.prototype.setupPopupInitialPosition = function (popup) {
var drop = popup.find(".grid-dropdown");
function getInfo() {
var arrow = popup.find(".grid-dropdown-arrow");
return { arrow: arrow, currentDropLeft: parseInt(drop.css("left")), currentArrowLeft: parseInt(arrow.css("left")) };
}
var dropLeft = drop.offset().left;
if (dropLeft < 0) {
var info = getInfo();
info.arrow.css({ left: (info.currentArrowLeft + dropLeft - 10) + "px" });
drop.css({ left: (info.currentDropLeft - dropLeft + 10) + "px" });
return;
}
var dropWidth = drop.width();
var offsetRight = $(window).width() - (dropLeft + dropWidth);
if (offsetRight < 0) {
var info = getInfo();
info.arrow.css({ left: (info.currentArrowLeft - offsetRight + 10) + "px" });
drop.css({ left: (info.currentDropLeft + offsetRight - 10) + "px" });
}
};
/***
* Returns layout of filter popup menu
*/
gridMvc.prototype.filterMenuHtml = function () {
return '<div class="dropdown dropdown-menu grid-dropdown" style="display: none;">\
<div class="grid-dropdown-arrow"></div>\
<div class="grid-dropdown-inner">\
<div class="grid-popup-widget"></div>\
<div class="grid-popup-additional"></div>\
</div>\
</div>';
};
/***
* Returns layout of 'clear filter' button
*/
gridMvc.prototype.getClearFilterButton = function () {
return '<ul class="menu-list">\
<li><a class="grid-filter-clear" href="javascript:void(0);">' + this.lang.clearFilterLabel + '</a></li>\
</ul>';
};
/***
* Register filter widget in widget collection
*/
gridMvc.prototype.addFilterWidget = function (widget) {
this.filterWidgets.push(widget);
};
/***
* Parse filter settings from data attribute
*/
gridMvc.prototype.parseFilterValues = function (filterData) {
var opt = $.parseJSON(filterData);
var filters = [];
for (var i = 0; i < opt.length; i++) {
filters.push({ filterValue: this.urldecode(opt[i].FilterValue), filterType: opt[i].FilterType, columnName: opt[i].ColumnName });
}
return filters;
};
gridMvc.prototype.urldecode = function (str) {
return decodeURIComponent((str + '').replace(/\+/g, '%20'));
};
/***
* Return registred widget for specific column type name
*/
gridMvc.prototype.getFilterWidgetForType = function (typeName) {
for (var i = 0; i < this.filterWidgets.length; i++) {
if ($.inArray(typeName, this.filterWidgets[i].getAssociatedTypes()) >= 0)
return this.filterWidgets[i];
}
return null;
};
/***
* Replace existed filter widget
*/
gridMvc.prototype.replaceFilterWidget = function (typeNameToReplace, widget) {
for (var i = 0; i < this.filterWidgets.length; i++) {
if ($.inArray(typeNameToReplace, this.filterWidgets[i].getAssociatedTypes()) >= 0) {
this.filterWidgets.splice(i, 1);
this.addFilterWidget(widget);
return true;
}
}
return false;
};
/***
* Applies selected filter value by redirecting to another url:
*/
gridMvc.prototype.applyFilterValues = function (initialUrl, columnName, values, skip) {
var filters = this.jqContainer.find(".grid-filter");
if (initialUrl.length > 0)
initialUrl += "&";
var url = "";
if (!skip) {
url += this.getFilterQueryData(columnName, values);
}
if (this.options.multiplefilters) { //multiple filters enabled
for (var i = 0; i < filters.length; i++) {
if ($(filters[i]).attr("data-name") != columnName) {
var filterData = this.parseFilterValues($(filters[i]).attr("data-filterdata"));
if (filterData.length == 0) continue;
if (url.length > 0) url += "&";
url += this.getFilterQueryData($(filters[i]).attr("data-name"), filterData);
} else {
continue;
}
}
}
window.location.search = initialUrl + url;
};
gridMvc.prototype.getFilterQueryData = function (columnName, values) {
var url = "";
for (var i = 0; i < values.length; i++) {
url += "grid-filter=" + encodeURIComponent(columnName) + "__" + values[i].filterType + "__" + encodeURIComponent(values[i].filterValue);
if (i != values.length - 1)
url += "&";
}
return url;
};
/***
* ============= POPUP MENU =============
* Methods that provides base functionality for popup menus
*/
gridMvc.prototype.openMenuOnClick = function (self) {
if ($(this).hasClass("clicked")) return true;
self.closeOpenedPopups();
$(this).addClass("clicked");
var popup = $(this).find(".dropdown-menu");
if (popup.length == 0) return true;
popup.show();
popup.addClass("opened");
self.openedMenuBtn = $(this);
$(document).bind("click.gridmvc", function (e) {
self.documentCallback(e, self);
});
return false;
};
gridMvc.prototype.documentCallback = function (e, $context) {
e = e || event;
var target = e.target || e.srcElement;
var box = $(".dropdown-menu.opened").get(0);
var html = $("html").get(0);
if (typeof box != "undefined") {
do {
if (box == target) {
// Click occured inside the box, do nothing.
return;
}
if (html == target) {
box.style.display = "none";
$(box).removeClass("opened");
}
target = target.parentNode;
} while (target); // Click was outside the box, hide it.
}
if ($context.openedMenuBtn != null)
$context.openedMenuBtn.removeClass("clicked");
$(document).unbind("click.gridmvc");
};
gridMvc.prototype.closeOpenedPopups = function () {
var openedPopup = $(".dropdown-menu.opened");
openedPopup.hide();
openedPopup.removeClass("opened");
if (this.openedMenuBtn != null)
this.openedMenuBtn.removeClass("clicked");
};
/* Grid.Mvc clients functions */
gridMvc.prototype.selectable = function (enable) {
this.options.selectable = enable;
};
return gridMvc;
})(window.jQuery);
/***
* ============= LOCALIZATION =============
* You can localize Grid.Mvc by creating localization files and include it on the page after this script file
* This script file provides localization only for english language.
* For more documentation see: http://gridmvc.codeplex.com/documentation
*/
if (typeof (GridMvc.lang) == 'undefined')
GridMvc.lang = {};
GridMvc.lang.en = {
filterTypeLabel: "Type: ",
filterValueLabel: "Value:",
applyFilterButtonText: "Apply",
filterSelectTypes: {
Equals: "Equals",
StartsWith: "StartsWith",
Contains: "Contains",
EndsWith: "EndsWith",
GreaterThan: "Greater than",
LessThan: "Less than"
},
code: 'en',
boolTrueLabel: "Yes",
boolFalseLabel: "No",
clearFilterLabel: "Clear filter"
};
/***
* ============= FILTER WIDGETS =============
* Filter widget allows onRender custom filter user interface for different columns.
* For example if your added column is of type "DateTime" - widget can onRender calendar for picking filter value.
* This script provider base widget for default .Net types: System.String, System.Int32, System.Decimal etc.
* If you want to provide custom filter functionality - you can assign your own widget type for column and write widget for this types.
* For more documentation see: http://gridmvc.codeplex.com/documentation
*/
/***
* TextFilterWidget - Provides filter interface for text columns (of type "System.String")
* This widget onRenders filter interface with conditions, which specific for text types: contains, starts with etc.
*/
TextFilterWidget = (function ($) {
function textFilterWidget() { }
/***
* This method must return type of columns that must be associated with current widget
* If you not specify your own type name for column (see 'SetFilterWidgetType' method), GridMvc setup column type name from .Net type ("System.DateTime etc.)
*/
textFilterWidget.prototype.getAssociatedTypes = function () { return ["System.String"]; };
/***
* This method invokes when filter widget was shown on the page
*/
textFilterWidget.prototype.onShow = function () {
var textBox = this.container.find(".grid-filter-input");
if (textBox.length <= 0) return;
textBox.focus();
};
/***
* This method specify whether onRender 'Clear filter' button for this widget.
*/
textFilterWidget.prototype.showClearFilterButton = function () { return true; };
/***
* This method will invoke when user first clicked on filter button.
* container - html element, which must contain widget layout;
* lang - current language settings;
* typeName - current column type (if widget assign to multipile types, see: getAssociatedTypes);
* filterType - current filter type (like equals, starts with etc);
* filterValue - current filter value;
* cb - callback function that must invoked when user want to filter this column. Widget must pass filter type and filter value.
*/
textFilterWidget.prototype.onRender = function (container, lang, typeName, values, cb) {
this.cb = cb;
this.container = container;
this.lang = lang;
this.value = values.length > 0 ? values[0] : { filterType: 1, filterValue: "" };//support only one filter value
this.renderWidget();
this.registerEvents();
};
/***
* Internal method that build widget layout and append it to the widget container
*/
textFilterWidget.prototype.renderWidget = function () {
var html = '<div class="form-group">\
<label>' + this.lang.filterTypeLabel + '</label>\
<select class="grid-filter-type form-control">\
<option value="1" ' + (this.value.filterType == "1" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.Equals + '</option>\
<option value="2" ' + (this.value.filterType == "2" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.Contains + '</option>\
<option value="3" ' + (this.value.filterType == "3" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.StartsWith + '</option>\
<option value="4" ' + (this.value.filterType == "4" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.EndsWith + '</option>\
</select>\
</div>\
<div class="form-group">\
<label>' + this.lang.filterValueLabel + '</label>\
<input type="text" class="grid-filter-input form-control" value="' + this.value.filterValue + '" />\
</div>\
<div class="grid-filter-buttons">\
<button type="button" class="btn btn-primary grid-apply" >' + this.lang.applyFilterButtonText + '</button>\
</div>';
this.container.append(html);
};
/***
* Internal method that register event handlers for 'apply' button.
*/
textFilterWidget.prototype.registerEvents = function () {
//get apply button from:
var applyBtn = this.container.find(".grid-apply");
//save current context:
var $context = this;
//register onclick event handler
applyBtn.click(function () {
//get selected filter type:
var type = $context.container.find(".grid-filter-type").val();
//get filter value:
var value = $context.container.find(".grid-filter-input").val();
//invoke callback with selected filter values:
var filterValues = [{ filterType: type, filterValue: value }];
$context.cb(filterValues);
});
//register onEnter event for filter text box:
this.container.find(".grid-filter-input").keyup(function (event) {
if (event.keyCode == 13) { applyBtn.click(); }
if (event.keyCode == 27) { GridMvc.closeOpenedPopups(); }
});
};
return textFilterWidget;
})(window.jQuery);
/***
* NumberFilterWidget - Provides filter interface for number columns
* This widget onRenders filter interface with conditions, which specific for number types: great than, less that etc.
* Also validates user's input for digits
*/
NumberFilterWidget = (function ($) {
function numberFilterWidget() { }
numberFilterWidget.prototype.showClearFilterButton = function () { return true; };
numberFilterWidget.prototype.getAssociatedTypes = function () {
return ["System.Int32", "System.Double", "System.Decimal", "System.Byte", "System.Single", "System.Float", "System.Int64"];
};
numberFilterWidget.prototype.onShow = function () {
var textBox = this.container.find(".grid-filter-input");
if (textBox.length <= 0) return;
textBox.focus();
};
numberFilterWidget.prototype.onRender = function (container, lang, typeName, values, cb) {
this.cb = cb;
this.container = container;
this.lang = lang;
this.typeName = typeName;
this.value = values.length > 0 ? values[0] : { filterType: 1, filterValue: "" };//support only one filter value
this.renderWidget();
this.registerEvents();
};
numberFilterWidget.prototype.renderWidget = function () {
var html = '<div class="form-group">\
<label>' + this.lang.filterTypeLabel + '</label>\
<select class="grid-filter-type form-control">\
<option value="1" ' + (this.value.filterType == "1" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.Equals + '</option>\
<option value="5" ' + (this.value.filterType == "5" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.GreaterThan + '</option>\
<option value="6" ' + (this.value.filterType == "6" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.LessThan + '</option>\
</select>\
</div>\
<div class="form-group">\
<label>' + this.lang.filterValueLabel + '</label>\
<input type="text" class="grid-filter-input form-control" value="' + this.value.filterValue + '" />\
</div>\
<div class="grid-filter-buttons">\
<button type="button" class="btn btn-primary grid-apply">' + this.lang.applyFilterButtonText + '</button>\
</div>';
this.container.append(html);
};
numberFilterWidget.prototype.registerEvents = function () {
var $context = this;
var applyBtn = this.container.find(".grid-apply");
applyBtn.click(function () {
var type = $context.container.find(".grid-filter-type").val();
var value = $context.container.find(".grid-filter-input").val();
var filters = [{ filterType: type, filterValue: value }];
$context.cb(filters);
});
var txt = this.container.find(".grid-filter-input");
txt.keyup(function (event) {
if (event.keyCode == 13) { applyBtn.click(); }
if (event.keyCode == 27) { GridMvc.closeOpenedPopups(); }
})
.keypress(function (event) { return $context.validateInput.call($context, event); });
if (this.typeName == "System.Byte")
txt.attr("maxlength", "3");
};
numberFilterWidget.prototype.validateInput = function (evt) {
var $event = evt || window.event;
var key = $event.keyCode || $event.which;
key = String.fromCharCode(key);
var regex;
switch (this.typeName) {
case "System.Byte":
case "System.Int32":
case "System.Int64":
regex = /[0-9]/;
break;
default:
regex = /[0-9]|\.|\,/;
}
if (!regex.test(key)) {
$event.returnValue = false;
if ($event.preventDefault) $event.preventDefault();
}
};
return numberFilterWidget;
})(window.jQuery);
/***
* DateTimeFilterWidget - Provides filter interface for date columns (of type "System.DateTime").
* If datepicker script included, this widget will render calendar for pick filter values
* In other case he onRender textbox field for specifing date value (more info at http://window.jQueryui.com/)
*/
DateTimeFilterWidget = (function ($) {
function dateTimeFilterWidget() { }
dateTimeFilterWidget.prototype.getAssociatedTypes = function () { return ["System.DateTime"]; };
dateTimeFilterWidget.prototype.showClearFilterButton = function () { return true; };
dateTimeFilterWidget.prototype.onRender = function (container, lang, typeName, values, applycb, data) {
this.datePickerIncluded = typeof ($.fn.datepicker) != 'undefined';
this.cb = applycb;
this.data = data;
this.container = container;
this.lang = lang;
this.value = values.length > 0 ? values[0] : { filterType: 1, filterValue: "" };//support only one filter value
this.renderWidget();
this.registerEvents();
};
dateTimeFilterWidget.prototype.renderWidget = function () {
var html = '<div class="form-group">\
<label>' + this.lang.filterTypeLabel + '</label>\
<select class="grid-filter-type form-control">\
<option value="1" ' + (this.value.filterType == "1" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.Equals + '</option>\
<option value="5" ' + (this.value.filterType == "5" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.GreaterThan + '</option>\
<option value="6" ' + (this.value.filterType == "6" ? "selected=\"selected\"" : "") + '>' + this.lang.filterSelectTypes.LessThan + '</option>\
</select>\
</div>' +
(this.datePickerIncluded ?
'<div class="grid-filter-datepicker"></div>'
:
'<div class="form-group">\
<label>' + this.lang.filterValueLabel + '</label>\
<input type="text" class="grid-filter-input form-control" value="' + this.value.filterValue + '" />\
</div>\
<div class="grid-filter-buttons">\
<input type="button" class="btn btn-primary grid-apply" value="' + this.lang.applyFilterButtonText + '" />\
</div>');
this.container.append(html);
//if window.jQueryUi included:
if (this.datePickerIncluded) {
var datePickerOptions = this.data || {};
datePickerOptions.format = datePickerOptions.format || "yyyy-mm-dd";
datePickerOptions.language = datePickerOptions.language || this.lang.code;
var $context = this;
var dateContainer = this.container.find(".grid-filter-datepicker");
dateContainer.datepicker(datePickerOptions).on('changeDate', function (ev) {
var type = $context.container.find(".grid-filter-type").val();
var filterValues = [{ filterType: type, filterValue: ev.format() }];
$context.cb(filterValues);
});
if (this.value.filterValue)
dateContainer.datepicker('update', this.value.filterValue);
}
};
dateTimeFilterWidget.prototype.registerEvents = function () {
var $context = this;
var applyBtn = this.container.find(".grid-apply");
applyBtn.click(function () {
var type = $context.container.find(".grid-filter-type").val();
var value = $context.container.find(".grid-filter-input").val();
var filterValues = [{ filterType: type, filterValue: value }];
$context.cb(filterValues);
});
this.container.find(".grid-filter-input").keyup(function (event) {
if (event.keyCode == 13) {
applyBtn.click();
}
});
};
return dateTimeFilterWidget;
})(window.jQuery);
/***
* BooleanFilterWidget - Provides filter interface for boolean columns (of type "System.Boolean").
* Renders two button for filter - true and false
*/
BooleanFilterWidget = (function ($) {
function booleanFilterWidget() { }
booleanFilterWidget.prototype.getAssociatedTypes = function () { return ["System.Boolean"]; };
booleanFilterWidget.prototype.showClearFilterButton = function () { return true; };
booleanFilterWidget.prototype.onRender = function (container, lang, typeName, values, cb) {
this.cb = cb;
this.container = container;
this.lang = lang;
this.value = values.length > 0 ? values[0] : { filterType: 1, filterValue: "" };//support only one filter value
this.renderWidget();
this.registerEvents();
};
booleanFilterWidget.prototype.renderWidget = function () {
var html = '<label>' + this.lang.filterValueLabel + '</label>\
<ul class="menu-list">\
<li><a class="grid-filter-choose ' + (this.value.filterValue == "true" ? "choose-selected" : "") + '" data-value="true" href="javascript:void(0);">' + this.lang.boolTrueLabel + '</a></li>\
<li><a class="grid-filter-choose ' + (this.value.filterValue == "false" ? "choose-selected" : "") + '" data-value="false" href="javascript:void(0);">' + this.lang.boolFalseLabel + '</a></li>\
</ul>';
this.container.append(html);
};
booleanFilterWidget.prototype.registerEvents = function () {
var $context = this;
var applyBtn = this.container.find(".grid-filter-choose");
applyBtn.click(function () {
var filterValues = [{ filterType: "1", filterValue: $(this).attr("data-value") }];
$context.cb(filterValues);
});
};
return booleanFilterWidget;
})(window.jQuery);
//startup init:
(function ($) {
if (!$) return;//jquery not referenced
$(function () {
$(".grid-mvc").each(function () {
$(".grid-mvc").gridmvc();
});
});
})(window.jQuery);
@@ -1,22 +0,0 @@
/***
* Grid.Mvc russian language (ru-RU) http://gridmvc.codeplex.com/
*/
window.GridMvc = window.GridMvc || {};
window.GridMvc.lang = window.GridMvc.lang || {};
GridMvc.lang.ru = {
filterTypeLabel: "Тип фильтра: ",
filterValueLabel: "Значение:",
applyFilterButtonText: "Применить",
filterSelectTypes: {
Equals: "Равно",
StartsWith: "Начинается с",
Contains: "Содержит",
EndsWith: "Оканчивается",
GreaterThan: "Больше",
LessThan: "Меньше"
},
code: 'ru',
boolTrueLabel: "Да",
boolFalseLabel: "Нет",
clearFilterLabel: "Очистить фильтр"
};
File diff suppressed because one or more lines are too long
@@ -1,65 +0,0 @@
@using GridMvc.Columns
@model GridMvc.IGrid
@if (Model == null) { return; }
@if (Model.RenderOptions.RenderRowsOnly)
{
@RenderGridBody();
}
else
{
<div class="grid-mvc" data-lang="@Model.Language" data-gridname="@Model.RenderOptions.GridName" data-selectable="@Model.RenderOptions.Selectable.ToString().ToLower()" data-multiplefilters ="@Model.RenderOptions.AllowMultipleFilters.ToString().ToLower()">
<div class="grid-wrap">
<table class="table table-striped grid-table">
@* Draw grid header *@
<thead>
@RenderGridHeader()
</thead>
<tbody>
@RenderGridBody()
</tbody>
</table>
@RenderGridPager()
</div>
</div>
}
@helper RenderGridBody()
{
if (!Model.ItemsToDisplay.Any())
{
<tr class="grid-empty-text">
<td colspan="@Model.Columns.Count()">
@Model.EmptyGridText
</td>
</tr>
}
else
{
foreach (object item in Model.ItemsToDisplay)
{
<tr class="grid-row @Model.GetRowCssClasses(item)">
@foreach (IGridColumn column in Model.Columns)
{
@column.CellRenderer.Render(column, column.GetCell(item))
}
</tr>
}
}
}
@helper RenderGridHeader()
{
<tr>
@foreach (IGridColumn column in Model.Columns)
{
@column.HeaderRenderer.Render(column)
}
</tr>
}
@helper RenderGridPager()
{
if (Model.EnablePaging && Model.Pager != null)
{
<div class="grid-footer">
@Html.Partial(Model.Pager.TemplateName, Model.Pager)
</div>
}
}
@@ -1,49 +0,0 @@
@model GridMvc.Pagination.GridPager
@if (Model == null || Model.PageCount <= 1)
{
return;
}
<div class="grid-pager">
<ul class="pagination">
@if (Model.CurrentPage > 1)
{
<li>
<a href="@Model.GetLinkForPage(Model.CurrentPage - 1)">«</a>
</li>
}
@if (Model.StartDisplayedPage > 1)
{
<li>
<a href="@Model.GetLinkForPage(1)">1</a>
</li>
if (Model.StartDisplayedPage > 2)
{
<li><a href="@Model.GetLinkForPage(Model.StartDisplayedPage - 1)">...</a></li>
}
}
@for (int i = Model.StartDisplayedPage; i <= Model.EndDisplayedPage; i++)
{
if (i == Model.CurrentPage)
{
<li class="active"><span>@i</span></li>
}
else
{
<li><a href="@Model.GetLinkForPage(i)">@i</a></li>
}
}
@if (Model.EndDisplayedPage < Model.PageCount)
{
if (Model.EndDisplayedPage < Model.PageCount - 1)
{
<li><a href="@Model.GetLinkForPage(Model.EndDisplayedPage + 1)">...</a></li>
}
<li><a href="@Model.GetLinkForPage(Model.PageCount)">@Model.PageCount</a></li>
}
@if (Model.CurrentPage < Model.PageCount)
{
<li><a href="@Model.GetLinkForPage(Model.CurrentPage + 1)">»</a></li>
}
</ul>
</div>
-9
View File
@@ -1,9 +0,0 @@
<configuration>
<system.web>
<pages>
<namespaces>
<add namespace ="GridMvc" />
</namespaces>
</pages>
</system.web>
</configuration>
Binary file not shown.
Binary file not shown.