Visual Studio 2015 .Net 2.0 and dotnetfx3.5 setup
Dism /online /enable-feature /featurename:NetFX3 /All /Source:D:\sources\sxs /LimitAccess
Visual Studio 2015 .Net 2.0 and dotnetfx3.5 setup
Dism /online /enable-feature /featurename:NetFX3 /All /Source:D:\sources\sxs /LimitAccess
Posted in Uncategorized | Tags: C#, vs 2015 .net 2.0 donet net fx 3.5
Use the explicit keyword to define the conversion of one business entity to another. The conversion method will be invoked when the conversion is requested in code. Here is the sample conversion code.
class Program { static void Main(string[] args) { ExternalEntity entity = new ExternalEntity() { Id = 1001, FirstName = "Dave", LastName = "Johnson" }; MyEntity convertedEntity = (MyEntity)entity; } } class MyEntity { public int Id { get; set; } public string FullName { get; set; } public static explicit operator MyEntity(ExternalEntity externalEntity) { return new MyEntity() { Id = externalEntity.Id, FullName = externalEntity.FirstName + " " + externalEntity.LastName }; } } class ExternalEntity { public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } }
Posted in Uncategorized | Tags: explicit, mapping, not use mapper
Header ve linelardan oluşan bir text dosyasını istediğiniz bir belirteç ile (header olduğunu belirten) belirtip satır satır okuyabileceğiniz kod bloğu aşağıdaki şekildedir. namespace ReadFile { class Item { public List<string> Indexes; public string Header; public Item() { Indexes = new List<string>(); } } class Program { static void Main(string[] args) { List<Item> items = new List<Item>(); var lines = File.ReadAllLines("../../TestFile1.txt"); Item currentItem = null; foreach (var line in lines) { if (line.StartsWith("H")) { if (currentItem != null) { items.Add(currentItem); } currentItem = new Item(); currentItem.Header = line; } else if (currentItem != null) { currentItem.Indexes.Add(line); } } if (currentItem != null) items.Add(currentItem); } } }
Posted in Uncategorized | Tags: ASP.NET, C#, File Reading, Header Item File Read
RESTORE DATABASE QABSI
FROM DISK = ‘C:\QABSI_BACKUP_20150819.bak’
WITH REPLACE,RECOVERY
Posted in Uncategorized
CommandPrompt u admin olarak açıp (bazen yetki kaynaklı sorun oluyor) aşağıdaki şekilde kodları çalıştırabiliriz.
Windows Servis Kurma
“C:\Windows\Microsoft.NET\Framework\v4.0.30319>InstallUtil.exe” “D:\Team Projects 2013\Ongoing Services\Notification Service\NotificationSrv-R12\NotificationService.WindowsService\bin\Debug\NotificationService.WindowsService.exe”
Windows Servis Kaldırma
“C:\Windows\Microsoft.NET\Framework\v4.0.30319>InstallUtil.exe” -u “D:\Team Projects 2013\Ongoing Services\Notification Service\NotificationSrv-R12\NotificationService.WindowsService\bin\Debug\NotificationService.WindowsService.exe”
Posted in Uncategorized
var id = ‘@ViewContext.RouteData.Values[“id”]’;
Yukarıdaki kod bloğu ile aşağıdaki şekilde bir pageurl içinden id değerini alabiliriz.
http://localhost/CourtesyCar/VehicleHistory/Index/ASD5A12340
Kodun çıkıtısı ‘ASD5A12340’ olacaktır.
Posted in Uncategorized
Sql sorgularında parametre olarak birden fazla değer gönderebilmek için kullanılabilecek bir sorgu yazım şekli
DECLARE @UserIds VARCHAR(50) = ‘4,5,7,8’
SELECT * FROM Users
WHERE PATINDEX(‘%,’ + CAST(Id as varchar(20)) + ‘,%’, ‘,’ + @UserIds + ‘,’) > (CASE @UserIds WHEN ” THEN -1 ELSE 0 END)
Posted in Uncategorized
Nedir bu Application? Session’dan ne farkı vardır? Çok pratik bir şekilde işimi görünce paylaşayım dedim.
Application, uygulamanın tümüyle ilgili bilgileri (değişkenleri, nesneleri ve metodları) tutar; Session ise ziyaretçinin sitemize girmesinden itibaren izini sürer. Örneğin bir e-ticaret sitesine giriş yapan kullanıcı browserdan sitenin adını yazıp ana sayfayı açtığı andan itibaren kullanıcının tüm davranışlarını tespit edip tutabilme olanağını bize Session sağlar. Yani başka bir deyişle kullanıcı siteye geldiğinde yeni bir session, oturum açmış olur. Application nesnesi, uygulama ilk ayağa kalktığında veritabanına erişmekten tutun da alışveriş yapmaya kadar sitede yapılacak bütün işlerin bütün kurallarını bilecek ve uygulayabilecektir.
Benim yaşadığım sorun ise DevEx kontrolleriyle alakalı. Zira TreeList içinde FileUpload kontrolü kullandım upload ettiğim resme kendim bir GUID oluşturup unique bir isim vermek istedim. Ancak TreeList’in Insert methodunda bu isme ihtiyaç duyduğumdan erişmem gerekiyordu Session bu noktada çaresiz kalıyor. FileUpload a özel bir durum bir tarafta sessiona attığınız objeyi diğer tarafta okuyamıyorsunuz. Ancak Application ile yazdığımızda server bazlı olduğu için aynı ismi diğer methodda da kullanabiliyoruz.
Burada dikkat edilmesi gereken durum (gerçi session için de geçerli) işimiz biter bitmez application üzerinden bu nesneyi temizlemek.
Posted in Uncategorized | Tags: Application, ASP.NET, C#, HttpApplicationState, HttpApplicationState.Page.Application, Page
UPDATE ProductTypes
SET ProductTypes.ERPCode = NewERPCodes.NewERPCode
FROM ProductTypes
INNER JOIN NewERPCodes ON NewERPCodes.ProductTypeID = ProductTypes.ProductTypeID
Posted in Uncategorized | Tags: INNER, query, sql, UPDATE
url = ” “;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
string line;
while ((line = readStream.ReadLine()) != null)
{
line = line.Replace(“document.write(‘”, “”);
line = line.Remove(line.Length – 3, 3);
divBanner.InnerHtml = line;
}
response.Close();
readStream.Close();
Posted in Uncategorized | Tags: ASP.NET, C#, HttpWebRequest Exam