Tuesday 30 April 2019

SQL Server INSERT Multiple Rows

In this tutorial, you have learned how to use another form of the SQL Server INSERT statement to insert multiple rows into a table using one INSERT statement

the following statement to create the table:-

CREATE TABLE sales.promotions (
    promotion_id INT PRIMARY KEY IDENTITY (1, 1),
    promotion_name VARCHAR (255) NOT NULL,
    discount NUMERIC (3, 2) DEFAULT 0,
    start_date DATE NOT NULL,
    expired_date DATE NOT NULL
);

The following statement adds multiple rows to the promotions table:

INSERT INTO sales.promotions (
    promotion_name,
    discount,
    start_date,
    expired_date
)
VALUES
    (
        '2019 Summer Promotion',
        0.15,
        '20190601',
        '20190901'
    ),
    (
        '2019 Fall Promotion',
        0.20,
        '20191001',
        '20191101'
    ),
    (
        '2019 Winter Promotion',
        0.25,
        '20191201',
        '20200101'
    );

SQL server issued the following message indicating that three rows have been inserted successfully.

(3 rows affected)

Let’s verify the insert by executing the following query:

SELECT
    *
FROM
    sales.promotions;

Here is the output:


I


Monday 29 April 2019

Finding Logged in user /Domain using System.Security

To find the Domain name using System.Security.Principal.WindowsIdentity

#C Code:-

 //Get the access if the username exists in the group 

     private bool GetUserInfo()
        {
            bool isAccess = false;
            ClsMailParameters.UsrSourceKey = Environment.UserName;
            if (CheckIdentity() == true)
            {
                isAccess = true;
            }
            return isAccess;
        }

// function for check the user exists in the group or not
//If exists return true otherwise false

private bool CheckIdentity()
        {
            bool bIsGroupie = false;
            System.Security.Principal.WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent();

            var sourceKey = identity.Name.ToString();

            // get a list of group names for the user

            ArrayList groups2 = new ArrayList();

            foreach (System.Security.Principal.IdentityReference group in identity.Groups)
            {
                groups2.Add(group.Translate(typeof(System.Security.Principal.NTAccount)).ToString());

            }

            for (int i = 0; i < groups2.Count; i++)
            {
                var ii = groups2[i].ToString();
                string checkValue = "GroupName"; // Give the group name
                try
                {
                    if (ii.ToUpper() == checkValue.ToUpper())
                    {
                        bIsGroupie = true;
                        break;
                    }
                }
                catch { }
            }
            return bIsGroupie;
        }

Wednesday 17 April 2019

Definition Of AngularJs

AngularJs:-  
  1. Angular is a java script framework that is used to build  application that run on the browser.
  2.  Angularjs is developed by Google
  3. Angularjs ia an open source project that means free to use, changed
Benefit of using AngularJs:-
  1. Dependency injection
  2. Two way Data-binding
  3. Easy to Test

You should have the knowledge:-
  • HTML
  • CSS
  • JavaScript   


MVC Folder Directory Struncture

Directory Structure:-

Some people for the fast-developing code doesn’t think about directory structure. but for the long project it will affect the project maintainability. There are lots of way to structure the application.

in this article we will learn how to create folder directory structure and what the meaning of folder.

In the directory structure, we will follow the following step: -

  1.  Open Visual Studio -> click new Project-> Asp.net web application
  2.  Give the Application Name that you want
  3. Right Click Application-> Add Folder ‘App’
then you see the application contain the folder as show in below image











































1.App_Data:- App_Data contains the data like .mdf ,Xml file and other data related files.
2. App_Start:- it contains the  class files like BundleConfig.cs, FilterConfig.cs, RouteConfig.cs etc.
     BundleConfig.cs contains the bundle of js and css , RouteConfig.cs contains the default path of the application.




2. Content:- content folder contains the file Likes CSS , icon, images etc. means related to the designing part.



3. Controller:- it the heart of the MVC application. Controller contains the class files. it is responsible for controlling the flow of application execution.



4. Model:- contains the class files that is used in the view.



5. Scripts:- it contains all the .Js Files



6. Views:- it contains the HTML files . it is the design part of the application















AngularJs Directory Structure

AngularJs Directory Structure:-

Download

Some people for the fast-developing code doesn’t think about directory structure. but for the long project it will affect the project maintainability. There are lots of way to structure the application.

In this article, we will learn how to structure the angularJs application. We will cover all the directory structure for both large and small application to increase project maintainability.



1.Standard Angular Directory Structure: -
In the standard directory structure, we will follow the following step: -

  1.  Open Visual Studio -> click new Project-> Asp.net web application
  2.  Give the Application Name that you want
  3. Right Click Application-> Add Folder ‘App’
  4. Right Click ‘App’->Add Folder ‘Content’, ‘Controller’, ’Service’, ‘View’
  5.  For the better understanding, I have attached the Image of standard directory structure: -





































Content Folder: - it contains Css and Js Folder and File.
Controller: - Contain the controller Js file
Service: - Contain the the service Js File.

View: - Contain the Html File.


Index.html: - it’s the master html and root of front end structure.
Assets Folder: - it contains all the assets you want in your application like css, js, image Folder and files.
App Folder: - app Folder contain the appModule.js and appRoute.js.

appModule.js handle the setup of your application and approute.js file will handle all the route and route configuration.

Note:- 
This is the normal standard angularJs directory structure.  When the controller and view folder size increase then it’s difficult to scroll down. Then we follow better structure foundation.

2. Better Structure Angular Structure directory: -


Index.html: - it’s the master html and root of front end structure.
Assets Folder: - it contains all the assets you want in your application like css, js, image Folder and files.
App Folder: - app Folder contain the appModule.js and appRoute.js.
appModule.js handle the setup of your application and approute.js file will handle all the route and route configuration.

Component Folder: - it is the actual folder in the application. It contains the view, controller, service in the specific site folder like ‘Home’, ‘Blog’ etc.

Shared folder: -it contains the directives and html that are used in the application multiple time.

Benefits of this: -
1    1.     Easy to maintain
2.       Easy to test
3.       Scalable
4.       Easy to debugger








Turning off policy override in TFS


Turning off policy override in TFS:- 

check  all the TFS policy from by click this link:- Policy

when the policy doesn't meet the policy then this error alert "check-in validation failed. a policy warning override reason and/or a check-in note is required."

when we are doing check in the code in TFS below error come as shown in the image.




For this we follow the following step:-

1. Click on the TFS Setting


 2. Click on the source Control




















3. click on "check in policy" tab



















4.click on "Add Button"
if any policy added by you or unwanted policy then remove it.



What is Agile,advantage and disadvantages

Introduction:- It is a software development life cycle used for software development, that is characterized by the division of tasks in...