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
using System; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Linq; | |
using System.Text; | |
namespace TestMigrationHistory | |
{ | |
class Program | |
{ |
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 | |
{ | |
public ActionResult Index() | |
{ | |
return View("Home"); | |
} | |
public ActionResult Login(string txtUsername, string txtPassword) | |
{ | |
var x = Request.ToObj<User>(); |
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 static class ExtendedPersianString | |
{ | |
public static string FixPersianName(this string text) | |
{ | |
if (string.IsNullOrEmpty(text)) return text; | |
return text.ApplyCorrectYeKe().ReplaceAlef().RemoveDiacritics().CleanUnderLines().RemovePunctuation().Trim().RemoveSpaces(); | |
} | |
public static string ApplyCorrectYeKe(this string text) | |
{ |
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
SELECT * FROM TempOrgan | |
LEFT OUTER JOIN TOrgan ON TempOrgan.Organ Like '%' + TOrgan.OrganName + '%' | |
WHERE TOrgan.OrganName IS NULL |
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
USE [Valieasr_336_17] | |
GO | |
WITH RowNumbers AS | |
( | |
select *, | |
RowNum = 10000000 + row_number() OVER ( order by Id ) | |
from [Person].[Persons] | |
) | |
UPDATE RowNumbers |
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 binding = new BasicHttpBinding(); | |
var address = new EndpointAddress("http://localhost:65182/TestService.svc"); | |
var factory = new ChannelFactory<ITestService>(binding, address); | |
var channel = factory.CreateChannel(); | |
Console.WriteLine("Result: {0}", channel.DoWork(2, 3)); | |
Console.ReadKey(); |
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
//http://jasondentler.com/blog/2010/01/exploiting-context_info-for-fun-and-audit/ | |
DECLARE @Ctx varbinary(128) | |
SELECT @Ctx = CONVERT(varbinary(128), 'Arman') | |
SET CONTEXT_INFO @Ctx | |
DECLARE @CtxData varchar(128) | |
SELECT @CtxData = CONVERT(VarChar(128), CONTEXT_INFO()) | |
PRINT @CtxData |
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 static class Ex | |
{ | |
public static T CopyFrom<T>(this T objTarget, T objSource) | |
{ | |
var typeSource = objSource.GetType(); | |
var propertyInfo = typeSource.GetProperties(); | |
foreach (var property in propertyInfo.Where(property => property.CanWrite)) | |
{ | |
if (property.PropertyType.IsPrimitive()) |
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 static class DbContextExtensions | |
{ | |
public static string GetMigrationHistoryModel(this DbContext dbContext) | |
{ | |
var modelBase64 = dbContext.Database.SqlQuery<string>(@" | |
DECLARE @binaryContent VARBINARY(MAX); | |
SELECT @binaryContent = Model FROM [__MigrationHistory]; | |
SELECT CAST('' AS XML).value( 'xs:base64Binary(sql:variable(''@binaryContent''))', 'varchar(max)' ) AS base64Content;" | |
).FirstOrDefault(); |
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 static class GhamariDate | |
{ | |
private const decimal GREGORIAN_EPOCH = 1721425.5M; | |
private const decimal ISLAMIC_EPOCH = 1948439.5M; | |
public static string MiladiToGhamari(DateTime date) | |
{ | |
var result = j_gh(date.Year, date.Month, date.Day); | |
return string.Format("{0}/{1}/{2}", result[0], result[1], result[2]); | |
} |
OlderNewer