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
/** | |
* Created by foyzul.karim on 6/5/2014. | |
*/ | |
public class MyXmlParser { | |
public String getValue(String node ) | |
{ | |
String s=""; | |
if (node.startsWith("<xml>") && node.endsWith("</xml>")) | |
{ | |
s = node.split("<xml>")[1].split("</xml>")[0]; |
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
import org.junit.Assert; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
public class MyXmlParserTest { | |
@Test | |
public void testGetValue() throws Exception { | |
MyXmlParser class1 = new MyXmlParser(); |
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
namespace XmlParserLibrary | |
{ | |
public class MyXmlParser | |
{ | |
public string GetValue(string node) | |
{ | |
String s = ""; | |
if (node.StartsWith("<xml>") && node.EndsWith("</xml>")) | |
{ | |
s = node.Split(new[] {"<xml>"},StringSplitOptions.None)[1].Split(new []{"</xml>"}, |
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 Response Search(SearchModel search) | |
{ | |
Dictionary<string, Expression> expressions = new Dictionary<string, Expression> | |
{ | |
{"Price", (Expression<Func<Phone, double>>) (p => p.Price)}, | |
{"Brand", (Expression<Func<Phone, string>>) (p => p.Name)} | |
}; | |
BdPhonesDbEntities db = new BdPhonesDbEntities(); | |
IQueryable<Phone> phones = db.Phones.Where(search.GetExpression()); |
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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title></title> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" /> | |
</head> | |
<body> | |
<div> | |
<div class=" container ng-scope" ng-switch=" view"> |
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
[TestMethod] | |
public void LinqTest() | |
{ | |
RouteManager manager = new RouteManager(); | |
ResponseModel responseModel = manager.Search(new RouteRequestModel()); | |
List<Route> routes = responseModel.Data as List<Route>; | |
List<Route> permittedRoutes = new List<Route> | |
{ | |
new Route() {Id = 2}, | |
new Route() {Id = 9}, |
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
var histories = await (from history in db.Histories | |
group history by history.SurahId | |
into h | |
select h.ToList().Select(x => new MemorizedAyahViewModel() | |
{ | |
Id = x.Id, | |
Surah = new SurahViewModel() | |
{ | |
Index = x.Surah.Index, | |
Name = x.Surah.Name, |
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
private static Func<IQueryable<TSource>, IOrderedQueryable<TSource>> OrderByFunc<TSource>(string propertyName, bool ascending = true) | |
{ | |
var source = Expression.Parameter(typeof(IQueryable<TSource>), "source"); | |
var item = Expression.Parameter(typeof(TSource), "item"); | |
var member = Expression.Property(item, propertyName); | |
var selector = Expression.Quote(Expression.Lambda(member, item)); | |
var body = Expression.Call( | |
typeof(Queryable), ascending ? "OrderBy" : "OrderByDescending", | |
new Type[] { item.Type, member.Type }, | |
source, selector); |
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
module App { | |
export class BaseController<T extends Entity> { | |
// my services | |
searchService: SearchService; | |
saveService: SaveService; | |
authService: AuthService; | |
url: UrlService; | |
// my variables | |
searchRequest: SearchRequest; |
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
private static bool IsForeignKey(PropertyInfo property, List<PropertyInfo> allProperties) | |
{ | |
return allProperties.Where(x => x.CustomAttributes.Any(y => y.AttributeType.Name == "ForeignKeyAttribute")).ToList() | |
.Any(x => | |
x.CustomAttributes.Where(y => y.AttributeType.Name == "ForeignKeyAttribute") | |
.Any(z => z.ConstructorArguments.Any(a => a.Value.ToString() == property.Name))); | |
} |
OlderNewer