This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void moveItems(ListControl sendingLB, ListControl receivingLB) | |
{ | |
ListBox temp = new ListBox(); | |
List<ListItem> tempList = new List<ListItem>(); | |
Comparison<ListItem> compare = new Comparison<ListItem>(CompareListItems); | |
foreach (ListItem li in sendingLB.Items) | |
if (li.Selected && receivingLB.Items.FindByText(li.Text) == null) | |
receivingLB.Items.Add(li); | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void moveItems(ListControl source, ListControl destination) | |
{ | |
var getListItemsFrom = new Func<ListControl, List<ListItem>> | |
(x => x.Items.Cast<ListItem>().ToList()); | |
var selectedItems = getListItemsFrom(source).Where(x => x.Selected); | |
var nonSelectedItems = getListItemsFrom(source).Where(x => !x.Selected); | |
var currentDestinationItems = getListItemsFrom(destination); | |
//Thanks Ryan for the .Except instead of the .Where(not) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class LinqToSqlRepository : IDisposable | |
{ | |
private readonly DataContext _dc; | |
protected LinqToSqlRepository() | |
{ | |
_dc = DataContext; | |
} | |
public T Load<T>(object id) where T : class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleClass | |
{ | |
public SampleObject GetById(int id) | |
{ | |
using(var repository = new LinqToSqlRepository<SampleDataContext>()) | |
{ | |
var result = repository.Load<SampleDataModel>(id); | |
return Mapper.Map<SampleObject>(result); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class ControllerTester : TestBase | |
{ | |
private IEnumerable<Type> ControllerTypes | |
{ | |
get | |
{ | |
var assembly = Assembly.GetAssembly(typeof(HomeController)); | |
return assembly.GetTypes() | |
.Where(controller => controller.IsSubclassOf(typeof(Controller)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HomeController : Controller | |
{ | |
private readonly IUserSession _userSession; | |
public HomeController(IUserSession userSession) | |
{ | |
_userSession = userSession; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestBase | |
{ | |
public TestBase() | |
{ | |
ObjectFactory.Initialize(x => x.Configure( | |
pluginGraph => pluginGraph.Scan(scanner => | |
{ | |
scanner.AssemblyContainingType<HomeController>(); | |
scanner.WithDefaultConventions(); | |
}))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Icons used here are from famfamfam.com*/ | |
<style type="text/css"> | |
a.with-icon | |
{ | |
padding-left: 20px; | |
background-position: top left; | |
background-repeat: no-repeat; | |
} | |
a.with-icon[href$='.gif'],a.with-icon[href$='.png'],a.with-icon[href$='.jpg'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<li><a href="test.jpg" class="with-icon">Link to jpg</a></li> | |
<li><a href="test.exe" class="with-icon">Link to exe</a></li> | |
<li><a href="test.zip" class="with-icon">Link to zip</a></li> | |
<li><a href="test.rss" class="with-icon">Link to rss</a></li> | |
<li><a href="test.avi" class="with-icon">Link to avi</a></li> | |
<li><a href="test.html" class="with-icon">Link to html</a></li> | |
<li><a href="test.xls" class="with-icon">Link to xls</a></li> | |
<li><a href="test.docx" class="with-icon">Link to docx</a></li> | |
<li><a href="test.pdf" class="with-icon">Link to pdf</a></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fieldset id="classification_radio_wrapper"> | |
<legend>Classification</legend> | |
<input type="radio" name="classification" id="Freshman" value="Freshman" checked /> | |
<label for="Freshman" class="Freshman">Freshman</label> | |
<input type="radio" name="classification" id="Sophomore" value="Sophomore" /> | |
<label for="Sophomore" class="Sophomore">Sophomore</label> | |
<input type="radio" name="classification" id="Junior" value="Junior" /> | |
<label for="Junior" class="Junior">Junior</label> | |
<input type="radio" name="classification" id="Senior" value="Senior" /> | |
<label for="Senior" class="Senior">Senior</label> |
OlderNewer