GIT: perform LF normalization
This commit is contained in:
@@ -1,32 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class DeviceBatchExtensions
|
||||
{
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<DeviceBatch> deviceBatches, int? SelectedId = null, bool IncludeNoBatchItem = true)
|
||||
{
|
||||
var items = deviceBatches.Select(db => new SelectListItem() { Value = db.Id.ToString(), Text = db.Name }).ToList();
|
||||
|
||||
if (SelectedId.HasValue)
|
||||
{
|
||||
string selectedIdString = SelectedId.Value.ToString();
|
||||
var selectedItem = items.Where(i => i.Value == selectedIdString).FirstOrDefault();
|
||||
if (selectedItem != null)
|
||||
selectedItem.Selected = true;
|
||||
}
|
||||
|
||||
if (IncludeNoBatchItem)
|
||||
items.Insert(0, new SelectListItem() { Value = string.Empty, Text = "Unknown", Selected = !SelectedId.HasValue });
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class DeviceBatchExtensions
|
||||
{
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<DeviceBatch> deviceBatches, int? SelectedId = null, bool IncludeNoBatchItem = true)
|
||||
{
|
||||
var items = deviceBatches.Select(db => new SelectListItem() { Value = db.Id.ToString(), Text = db.Name }).ToList();
|
||||
|
||||
if (SelectedId.HasValue)
|
||||
{
|
||||
string selectedIdString = SelectedId.Value.ToString();
|
||||
var selectedItem = items.Where(i => i.Value == selectedIdString).FirstOrDefault();
|
||||
if (selectedItem != null)
|
||||
selectedItem.Selected = true;
|
||||
}
|
||||
|
||||
if (IncludeNoBatchItem)
|
||||
items.Insert(0, new SelectListItem() { Value = string.Empty, Text = "Unknown", Selected = !SelectedId.HasValue });
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class DeviceModelExtensions
|
||||
{
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<DeviceModel> deviceModels, int? SelectedId = null, bool IncludeNoModelItem = false)
|
||||
{
|
||||
var items = deviceModels.Select(db => new SelectListItem() { Value = db.Id.ToString(), Text = db.Description }).ToList();
|
||||
|
||||
if (SelectedId.HasValue)
|
||||
{
|
||||
string selectedIdString = SelectedId.Value.ToString();
|
||||
var selectedItem = items.Where(i => i.Value == selectedIdString).FirstOrDefault();
|
||||
if (selectedItem != null)
|
||||
selectedItem.Selected = true;
|
||||
}
|
||||
|
||||
if (IncludeNoModelItem)
|
||||
items.Insert(0, new SelectListItem() { Value = string.Empty, Text = "Unknown", Selected = !SelectedId.HasValue });
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class DeviceModelExtensions
|
||||
{
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<DeviceModel> deviceModels, int? SelectedId = null, bool IncludeNoModelItem = false)
|
||||
{
|
||||
var items = deviceModels.Select(db => new SelectListItem() { Value = db.Id.ToString(), Text = db.Description }).ToList();
|
||||
|
||||
if (SelectedId.HasValue)
|
||||
{
|
||||
string selectedIdString = SelectedId.Value.ToString();
|
||||
var selectedItem = items.Where(i => i.Value == selectedIdString).FirstOrDefault();
|
||||
if (selectedItem != null)
|
||||
selectedItem.Selected = true;
|
||||
}
|
||||
|
||||
if (IncludeNoModelItem)
|
||||
items.Insert(0, new SelectListItem() { Value = string.Empty, Text = "Unknown", Selected = !SelectedId.HasValue });
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class DeviceProfileExtensions
|
||||
{
|
||||
public static IEnumerable<SelectListItem> ToSelectListItems(this IEnumerable<DeviceProfile> deviceProfiles, DeviceProfile SelectedDeviceProfile = null)
|
||||
{
|
||||
var selectedId = 1;
|
||||
|
||||
if (SelectedDeviceProfile != null)
|
||||
selectedId = SelectedDeviceProfile.Id;
|
||||
|
||||
return deviceProfiles.ToSelectListItems(selectedId);
|
||||
}
|
||||
public static IEnumerable<SelectListItem> ToSelectListItems(this IEnumerable<DeviceProfile> deviceProfiles, int SelectedDeviceProfileId = 1)
|
||||
{
|
||||
return deviceProfiles.Select(dp => new SelectListItem()
|
||||
{
|
||||
Value = dp.Id.ToString(),
|
||||
Text = dp.ToString(),
|
||||
Selected = (dp.Id == SelectedDeviceProfileId)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class DeviceProfileExtensions
|
||||
{
|
||||
public static IEnumerable<SelectListItem> ToSelectListItems(this IEnumerable<DeviceProfile> deviceProfiles, DeviceProfile SelectedDeviceProfile = null)
|
||||
{
|
||||
var selectedId = 1;
|
||||
|
||||
if (SelectedDeviceProfile != null)
|
||||
selectedId = SelectedDeviceProfile.Id;
|
||||
|
||||
return deviceProfiles.ToSelectListItems(selectedId);
|
||||
}
|
||||
public static IEnumerable<SelectListItem> ToSelectListItems(this IEnumerable<DeviceProfile> deviceProfiles, int SelectedDeviceProfileId = 1)
|
||||
{
|
||||
return deviceProfiles.Select(dp => new SelectListItem()
|
||||
{
|
||||
Value = dp.Id.ToString(),
|
||||
Text = dp.ToString(),
|
||||
Selected = (dp.Id == SelectedDeviceProfileId)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class DocumentTemplateExtensions
|
||||
{
|
||||
public static IEnumerable<SelectListItem> ToSelectListItems(this IEnumerable<DocumentTemplate> documentTemplates, string SelectedId = null)
|
||||
{
|
||||
if (SelectedId == null)
|
||||
return documentTemplates.Select(dt => new SelectListItem { Value = dt.Id, Text = dt.Description }).ToList();
|
||||
else
|
||||
return documentTemplates.Select(dt => new SelectListItem { Value = dt.Id, Text = dt.Description, Selected = (SelectedId == dt.Id) }).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class DocumentTemplateExtensions
|
||||
{
|
||||
public static IEnumerable<SelectListItem> ToSelectListItems(this IEnumerable<DocumentTemplate> documentTemplates, string SelectedId = null)
|
||||
{
|
||||
if (SelectedId == null)
|
||||
return documentTemplates.Select(dt => new SelectListItem { Value = dt.Id, Text = dt.Description }).ToList();
|
||||
else
|
||||
return documentTemplates.Select(dt => new SelectListItem { Value = dt.Id, Text = dt.Description, Selected = (SelectedId == dt.Id) }).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class JobSubTypeExtensions
|
||||
{
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobSubType> jobSubTypes, List<JobSubType> SelectedItems)
|
||||
{
|
||||
List<string> selectedIds = default(List<string>);
|
||||
|
||||
if (SelectedItems != null)
|
||||
selectedIds = SelectedItems.Select(i => string.Format("{0}_{1}", i.JobTypeId, i.Id)).ToList();
|
||||
|
||||
return jobSubTypes.ToSelectListItems(selectedIds);
|
||||
}
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobSubType> jobSubTypes, List<string> SelectedIds = null)
|
||||
{
|
||||
if (SelectedIds == null)
|
||||
return jobSubTypes.Select(jst => new SelectListItem { Value = string.Format("{0}_{1}", jst.JobTypeId, jst.Id), Text = jst.Description }).ToList();
|
||||
else
|
||||
return jobSubTypes.Select(jst => new SelectListItem { Value = string.Format("{0}_{1}", jst.JobTypeId, jst.Id), Text = jst.Description, Selected = (SelectedIds.Contains(string.Format("{0}_{1}", jst.JobTypeId, jst.Id))) }).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Models.Repository;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class JobSubTypeExtensions
|
||||
{
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobSubType> jobSubTypes, List<JobSubType> SelectedItems)
|
||||
{
|
||||
List<string> selectedIds = default(List<string>);
|
||||
|
||||
if (SelectedItems != null)
|
||||
selectedIds = SelectedItems.Select(i => string.Format("{0}_{1}", i.JobTypeId, i.Id)).ToList();
|
||||
|
||||
return jobSubTypes.ToSelectListItems(selectedIds);
|
||||
}
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobSubType> jobSubTypes, List<string> SelectedIds = null)
|
||||
{
|
||||
if (SelectedIds == null)
|
||||
return jobSubTypes.Select(jst => new SelectListItem { Value = string.Format("{0}_{1}", jst.JobTypeId, jst.Id), Text = jst.Description }).ToList();
|
||||
else
|
||||
return jobSubTypes.Select(jst => new SelectListItem { Value = string.Format("{0}_{1}", jst.JobTypeId, jst.Id), Text = jst.Description, Selected = (SelectedIds.Contains(string.Format("{0}_{1}", jst.JobTypeId, jst.Id))) }).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Models.Repository;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class JobTypeExtensions
|
||||
{
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobType> jobTypes, JobType SelectedItem)
|
||||
{
|
||||
string selectedId = default(string);
|
||||
|
||||
if (SelectedItem != null)
|
||||
selectedId = SelectedItem.Id;
|
||||
|
||||
return jobTypes.ToSelectListItems(selectedId);
|
||||
}
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobType> jobTypes, string SelectedId = null)
|
||||
{
|
||||
if (SelectedId == null)
|
||||
return jobTypes.Select(jt => new SelectListItem { Value = jt.Id, Text = jt.Description }).ToList();
|
||||
else
|
||||
return jobTypes.Select(jt => new SelectListItem { Value = jt.Id, Text = jt.Description, Selected = (SelectedId == jt.Id) }).ToList();
|
||||
}
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobType> jobTypes, List<JobType> SelectedItems)
|
||||
{
|
||||
List<string> selectedIds = default(List<string>);
|
||||
|
||||
if (SelectedItems != null)
|
||||
selectedIds = SelectedItems.Select(i => i.Id).ToList();
|
||||
|
||||
return jobTypes.ToSelectListItems(selectedIds);
|
||||
}
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobType> jobTypes, List<string> SelectedIds = null)
|
||||
{
|
||||
if (SelectedIds == null)
|
||||
return jobTypes.Select(jt => new SelectListItem { Value = jt.Id, Text = jt.Description }).ToList();
|
||||
else
|
||||
return jobTypes.Select(jt => new SelectListItem { Value = jt.Id, Text = jt.Description, Selected = (SelectedIds.Contains(jt.Id)) }).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Models.Repository;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Extensions
|
||||
{
|
||||
public static class JobTypeExtensions
|
||||
{
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobType> jobTypes, JobType SelectedItem)
|
||||
{
|
||||
string selectedId = default(string);
|
||||
|
||||
if (SelectedItem != null)
|
||||
selectedId = SelectedItem.Id;
|
||||
|
||||
return jobTypes.ToSelectListItems(selectedId);
|
||||
}
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobType> jobTypes, string SelectedId = null)
|
||||
{
|
||||
if (SelectedId == null)
|
||||
return jobTypes.Select(jt => new SelectListItem { Value = jt.Id, Text = jt.Description }).ToList();
|
||||
else
|
||||
return jobTypes.Select(jt => new SelectListItem { Value = jt.Id, Text = jt.Description, Selected = (SelectedId == jt.Id) }).ToList();
|
||||
}
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobType> jobTypes, List<JobType> SelectedItems)
|
||||
{
|
||||
List<string> selectedIds = default(List<string>);
|
||||
|
||||
if (SelectedItems != null)
|
||||
selectedIds = SelectedItems.Select(i => i.Id).ToList();
|
||||
|
||||
return jobTypes.ToSelectListItems(selectedIds);
|
||||
}
|
||||
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobType> jobTypes, List<string> SelectedIds = null)
|
||||
{
|
||||
if (SelectedIds == null)
|
||||
return jobTypes.Select(jt => new SelectListItem { Value = jt.Id, Text = jt.Description }).ToList();
|
||||
else
|
||||
return jobTypes.Select(jt => new SelectListItem { Value = jt.Id, Text = jt.Description, Selected = (SelectedIds.Contains(jt.Id)) }).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user