Tuesday 24 May 2016

string.contain case insensitive

bool isContain = empList.Contains("Hamid", StringComparer.CurrentCultureIgnoreCase);

Saturday 21 May 2016

password validation in C#

public bool IsValidPassword(string password)
{
 string MatchNumberPattern = "^.*(?=.{8,})(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$";
 if (!string.IsNullOrEmpty(TextBox2.Text.Trim)) {
  if (!Regex.IsMatch(password), MatchNumberPattern)) {
   return false;
  }
 }
}

--------------------
Must be at least 8 characters
-Must contain at least one lower case,oneupper case,
-One digit and one special character

Thursday 5 May 2016

asp.net step by step

<!-- 
 
For more information on how to configure your ASP.NET application, please visit

http://go.microsoft.com/fwlink/?LinkId=169433


-->

entity framework step by step

<!-- For more information on Entity Framework configuration, visit-->
 http://go.microsoft.com/fwlink/?LinkID=237468

SQL Server 2014 Keyboard Shortcut Keys in Management Studio

how to drop constraints in sql server



DECLARE @EmpName NVARCHAR(100)
SELECT @EmpName = default_constraints.name
FROM
    sys.all_columns
        INNER JOIN
    sys.tables
        ON all_columns.object_id = tables.object_id
        INNER JOIN
    sys.schemas
        ON tables.schema_id = schemas.schema_id
        INNER JOIN
    sys.default_constraints
        ON all_columns.default_object_id = default_constraints.object_id
WHERE
        schemas.name = 'dbo'
    AND tables.name = EmpTable
    AND all_columns.name = 'EmpGuid'

EXEC ('ALTER TABLE EmpTable DROP CONSTRAINT ' + @EmpName)
Alter Table EmpTable  drop column EmpGuid

how to authenticate my webapi

Wednesday 4 May 2016

allow number only in angularjs

 $scope.allowNumberOnly = function ($event) {
            var a = [];
            var k = $event.which;
            for (var i = 48; i < 58; i++)
                a.push(i);
            if (k === 46 || k === 8) {
                a.push(k);
            }
            if (!(a.indexOf(k) >= 1))
                $event.preventDefault();
        };

latest C# interview question

constant, static and readonly
 dispose and finalize methods
ref and out parameters
string and stringbuilder
sealed class
 array and arraylist
What is using statement
 

convert string to date in C#

IFormatProvider culture = new System.Globalization.CultureInfo("en-US", true);

var dateVal = DateTime.Parse(strDate, culture, System.Globalization.DateTimeStyles.AssumeLocal);