July 17, 2017

Giving borders to mahApps Windoes Form

Window borders

In the previous post we have given style to Windows form. In this post we will learn how to give border to the windows form.
The MetroWindow can have…
…a border
  
  BorderThickness="1"
   BorderBrush="{DynamicResource AccentColorBrush}"

July 13, 2017

How to drop all tables from a database with one SQL query?

Note: If you have any foreign Keys defined between tables then first run the below query to disable all foreign keys present in your database.

EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
 
Use the INFORMATION_SCHEMA.TABLES view to get the list of tables. Generate Drop scripts in the select statement and drop it using Dynamic SQL:

DECLARE @sql NVARCHAR(max)='' SELECT @sql += ' Drop table ' + QUOTENAME(TABLE_SCHEMA) + '.'+ QUOTENAME(TABLE_NAME) + '; ' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' Exec Sp_executesql @sql
 

July 10, 2017

Creating Login In C# MVC



Add a class in Model Folder
Right click on the Model folder ->add new items->add class.
    Name of Class is "UserMaster"
    In a class define the properties.


public string UserName
        { get; set; }
        public string UserID
        { get; set; }
        public string Password
        { get; set; }
        public string GroupID
        { get; set; }
        public string EmployeeID
        { get; set; }
        public string UserEmail
        { get; set; }
        public string CreatedBy
        { get; set; }
        public string ModifiedBy
        { get; set; }
        public string NewPswd
        { get; set; }

Add a controller.
  • Right click on the Controllers folder ->add->Controllers.
  • Name of Controllers is "Login".
  • In a controller, define the request.
  •