Sunday 23 December 2018

Get Data Through Ajax || Ajax with asp.net mvc in hindi/urdu





<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<script src="~/Scripts/jquery-1.10.2.js"></script>

<div class="container">



    <table class="table table-responsive table-striped">

        <thead>

            <tr>

                <th>ID</th>

                <th>NAME</th>

                <th>EMAIL</th>

                <th>ADDRESS</th>



            </tr>

        </thead>



        <tbody id="ListData">





        </tbody>



    </table>







</div>









<script>



    $(document).ready(function () {

        GetData();



        function GetData()

        {



            var html = '';



            $.ajax({



                type: 'GET',

                url: '/Home/GetAllEmployee',

                success: function (response)

                {



                    $.each(response, function (key, item)

                    {



                        html += "<tr> <td>" + item.Id + " <td>  <td>" + item.Name + " <td> <td>" + item.Email + " <td>  <td>" + item.Address + " <td></tr>";

                    });



                    $("#ListData").append(html);



                }



            });







        }













    });









</script>

Thursday 13 December 2018

How to pass data from asp.net mvc to angularJS || step by step in Hindi...





module:

var myapp;
(function () {
    myapp = angular.module('my-employees', []);
}
)();

service:

myapp.service('employeeService', function ($http)
{


    this.getAllEmployees = function ()
    {
        return $http.get('/Home/GetAllEmployee');
    }
   

});

controller:

myapp.controller('employee-controller', function ($scope, employeeService)
{


    //Loads all Employee records when page loads
    loadEmployees();
    
    function loadEmployees()
    {
        var EmployeeRecords = employeeService.getAllEmployees();



        EmployeeRecords.then(function (d)
        {
            $scope.Employees = d.data;
        },
        function ()
        {
            alert("Error occured while fetching employee list...");

        });



    }



});

Index:


<script src="~/Scripts/angular.min.js"></script>
<script src="~/Scripts/angular.js"></script>
<link href="~/Content/bootstrap.css" rel="stylesheet" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />

<div class="container" ng-app="my-employees" ng-controller="employee-controller">
    <div class="row">
        <br />
        <br />

<input type="search"  ng-model="search" class="form-control"/>


    </div>

    <table class="table table-responsive table-striped">
        <thead>
            <tr>
                <th>ID</th>
                <th>NAME</th>
                <th>SALARY</th>
                <th>DEPARTMENT</th>

            </tr>
        </thead>


        <tbody>
            <tr ng-repeat="x in Employees|filter:search">
                <td>{{x.emp_id}}</td>
                <td>{{x.emp_name|uppercase}}</td>
                <td>{{x.emp_salary |currency}}</td>
                <td>{{x.dep_name}}</td>

            </tr>


        </tbody>



    </table>



</div>


<script src="~/AngularJSapp/Module.js"></script>
<script src="~/AngularJSapp/Service.js"></script>
<script src="~/AngularJSapp/controller.js"></script>

Wednesday 12 December 2018

Update a Record by using Primary key ||Pay Roll Management System in net...







Click here to download the source code

How to Encrypt Url in asp net mvc C# PART 1 || Learn asp.net mvc in hind...



 public static string Encrypt(string toEncrypt, bool useHashing)

        {

            byte[] keyArray;

            byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(toEncrypt);



            System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader();

            // Get the key from config file

            string key = (string)settingsReader.GetValue("SecurityKey", typeof(String));

            //System.Windows.Forms.MessageBox.Show(key);

            if (useHashing)

            {

                MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();

                keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));

                hashmd5.Clear();

            }

            else

                keyArray = UTF8Encoding.UTF8.GetBytes(key);



            TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();

            tdes.Key = keyArray;

            tdes.Mode = CipherMode.ECB;

            tdes.Padding = PaddingMode.PKCS7;



            ICryptoTransform cTransform = tdes.CreateEncryptor();

            byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);

            tdes.Clear();

            return Convert.ToBase64String(resultArray, 0, resultArray.Length);

        }

Friday 7 December 2018

Add Data in table through Form in angular js ||Basics of Angular JS || P...





<!DOCTYPE html>



<html xmlns="http://www.w3.org/1999/xhtml">



<head>



    <title></title>



    <link href="Content/bootstrap.css" rel="stylesheet" />



    <link href="Content/bootstrap.min.css" rel="stylesheet" />



    <script src="Scripts/angular.js"></script>



    <script src="Scripts/angular.min.js"></script>



    <style>

        ul li {

            list-style-type: none;

        }

    </style>







</head>



<body ng-app="myapp" ng-controller="myctrl">



    <h1>To do List</h1>



    <div class="row">

        <div class="container">

            <form ng-submit="todoAdd()">







                <table>

                    <tr>

                        <td>Name</td>

                        <td><input type="text" class="form-control" placeholder="Enter name here...." ng-model="txtname" /></td>

                    </tr>



                    <tr>

                        <td>Email</td>

                        <td><input type="text" class="form-control" placeholder="Enter Email here...." ng-model="txtemail" /></td>

                    </tr>



                    <tr>

                        <td>Date of Birth</td>

                        <td><input type="date" class="form-control" placeholder="Enter Email here...." ng-model="txtdob" /></td>

                    </tr>







                    <tr>

                        <td>

                            <input type="submit" value="Add" class="btn btn-success" />

                        </td>

                        <td>

                            <input type="button" value="Delete" class="btn btn-danger" ng-click="remove()" />

                        </td>



                    </tr>







                </table>





             



             

             





            </form>





        </div>











        <div class="container">



            <table class="table table-dark table-responsive">

                <thead>

                    <tr>

                        <th>Name</th>



                        <th>Email</th>



                        <th>Date of Birth</th>



                        <th>Remove</th>



                    </tr>



                </thead>

               

                <tbody>

                    <tr ng-repeat="x in todoList">

                        <td>{{x.name}}</td>

                        <td>{{x.email}}</td>

                        <td>{{x.dob}}</td>

                        <td>

                            <input type="checkbox" ng-model="x.done" />



                        </td>



                    </tr>





                </tbody>









            </table>







        </div>





























    </div>

 









 

   







 



















</body>



</html>



<script>



    var app = angular.module("myapp", []);







    app.controller("myctrl", function ($scope)



    {







        $scope.todoList = [{ name: 'salman masood',email:'theideassolution@gmail.com',dob:'1991-01-12' ,done: false }];







        $scope.todoAdd = function ()



        {

            if ($scope.txtname != "" && $scope.txtemail != "" && $scope.txtdob != "")

            {

                $scope.todoList.push({ name: $scope.txtname, email: $scope.txtemail, dob: $scope.txtdob, done: false });



                $scope.txtname = "";

                $scope.txtemail = "";

                $scope.txtdob = "";

            }

         

        };







        $scope.remove = function ()



        {



            var oldList = $scope.todoList;



            $scope.todoList = [];



            angular.forEach(oldList, function (x)



            {



                if (!x.done) $scope.todoList.push(x);



            });



        };















    });











</script>

Wednesday 5 December 2018

Pay Roll Management System in net Application C# 5







Click here to download the source code


CREATE VIEW VW_GETEMPLOYEE
AS
select  e.emp_id as 'ID',e.emp_name as 'Name',d.dept_name as 'Department',e.emp_cnic as 'CNIC',E.emp_dob as 'Date of Birth',
e.emp_email as 'Email',e.emp_hiredate as 'Hire Date',s.status_year as 'Year', s.status_basicsalary as 'Basic Salary',s.status_bonus as 'Annual Bonus',s.status_medical as 'Medical Allownace', s.status_casualleaves as 'Annual Casual Leaves',s.status_sickleaves as 'Sick Leaves',s.status_annualleaves as  'Annual Leaves'
 from tbl_employee e inner join TBL_EMPLOYEEWORKINGSTATUS s on e.emp_id = s.status_emp_fk
 inner join tbl_departments d on d.dept_id=s.status_dep_fk


 SELECT * FROM VW_GETEMPLOYEE

How to store input values in an array in Angular|| Basics of Angular JS ...





<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title></title>

    <link href="Content/bootstrap.css" rel="stylesheet" />

    <link href="Content/bootstrap.min.css" rel="stylesheet" />

    <script src="Scripts/angular.js"></script>

    <script src="Scripts/angular.min.js"></script>

    <style>



        ul li{

            list-style-type:none;

        }



    </style>



</head>

<body ng-app="myapp" ng-controller="myctrl">

    <h1>To do List</h1>

    <form ng-submit="todoAdd()">



        <input type="text" class="form-control" placeholder="Enter name here...." ng-model="todoInput" />

        <input type="submit" value="Add" class="btn btn-success" />



    </form>

    <input type="button" value="Delete" class="btn btn-danger" ng-click="remove()" />



    <div class="form-control">



        <ul ng-repeat="x in todoList">

            <li>

                <input type="checkbox" ng-model="x.done" /> <span>{{x.todoText}}</span>

            </li>



        </ul>



    </div>

 







</body>

</html>

<script>

    var app = angular.module("myapp", []);



    app.controller("myctrl", function ($scope)

    {



        $scope.todoList = [{ todoText: 'salman masood', done: false }];



        $scope.todoAdd = function ()

        {

            $scope.todoList.push({ todoText: $scope.todoInput, done: false });

            $scope.todoInput = "";

        };



        $scope.remove = function ()

        {

            var oldList = $scope.todoList;

            $scope.todoList = [];

            angular.forEach(oldList, function (x)

            {

                if (!x.done) $scope.todoList.push(x);

            });

        };







    });







</script>

How to store input values in an array in Angular|| Basics of Angular JS ...





<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title></title>

    <link href="Content/bootstrap.css" rel="stylesheet" />

    <link href="Content/bootstrap.min.css" rel="stylesheet" />

    <script src="Scripts/angular.js"></script>

    <script src="Scripts/angular.min.js"></script>

    <style>



        ul li{

            list-style-type:none;

        }



    </style>



</head>

<body ng-app="myapp" ng-controller="myctrl">

    <h1>To do List</h1>

    <form ng-submit="todoAdd()">



        <input type="text" class="form-control" placeholder="Enter name here...." ng-model="todoInput" />

        <input type="submit" value="Add" class="btn btn-success" />



    </form>

    <input type="button" value="Delete" class="btn btn-danger" ng-click="remove()" />



    <div class="form-control">



        <ul ng-repeat="x in todoList">

            <li>

                <input type="checkbox" ng-model="x.done" /> <span>{{x.todoText}}</span>

            </li>



        </ul>



    </div>

 







</body>

</html>

<script>

    var app = angular.module("myapp", []);



    app.controller("myctrl", function ($scope)

    {



        $scope.todoList = [{ todoText: 'salman masood', done: false }];



        $scope.todoAdd = function ()

        {

            $scope.todoList.push({ todoText: $scope.todoInput, done: false });

            $scope.todoInput = "";

        };



        $scope.remove = function ()

        {

            var oldList = $scope.todoList;

            $scope.todoList = [];

            angular.forEach(oldList, function (x)

            {

                if (!x.done) $scope.todoList.push(x);

            });

        };







    });







</script>

Monday 3 December 2018

$HTTP Service in angular js || Basics of Angular JS || Part-8



<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title></title>





    <title>

        Directives

    </title>

    <script src="Scripts/angular.min.js"></script>

    <script src="Scripts/angular.js"></script>

    <link href="Content/bootstrap.css" rel="stylesheet" />

    <link href="Content/bootstrap.min.css" rel="stylesheet" />

</head>

<body ng-app="myApp" ng-controller="myCtrl">







    <table class="table table-responsive">





        <thead>

            <tr>

                <th>ID</th>

                <th>Name</th>

                <th>City</th>

                <th>salary</th>



            </tr>

        </thead>

        <tbody>



            <tr ng-repeat="x in names">

                <td>{{x.id}}</td>

                <td>{{x.Name}}</td>

                <td>{{x.City}}</td>

                <td>{{x.salary|currency:"PKR":3}}</td>







            </tr>





        </tbody>





    </table>









    <script>



        var app = angular.module('myApp', []);

        app.controller('myCtrl', function ($scope, $http) {

            $http.get("myfile.html").then(function (response) {

                $scope.names = response.data.records;

            });

        });





    </script>



</body>



</html>

----------------------------------------------------------------------
MYFILE.HTML....................................................................
{
  "records": [
    {
       "id":"101",
      "Name": "ali ahmed",
      "City": "karachi",
"salary":"100"
    },

 {
       "id":"102",
      "Name": "salman masood",
      "City": "karachi",
"salary":"5000"
    }


  ]
}

Sorting Filters in Angular JS || Basics of Angular JS || Part-6





<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title></title>

    <script src="Scripts/angular.js"></script>

    <script src="Scripts/angular.min.js"></script>

    <link href="Content/bootstrap.css" rel="stylesheet" />

    <link href="Content/bootstrap.min.css" rel="stylesheet" />





</head>

<body ng-app="myapp" ng-controller="myctrl">

    <div class="container">



        <button class="btn btn-danger" ng-click="orderByMe('name')">Order by Name </button>

        <button class="btn btn-info" ng-click="orderByMe('country')">Order by Country </button>



        <table class="table table-responsive">



            <thead>

                <tr>

                    <th>ID</th>

                    <th>nAME</th>

                    <th>Country</th>



                </tr>

            </thead>



            <tbody>



                <tr ng-repeat="x in names | orderBy:myOrderBy">



                    <td>{{x.id}}</td>

                    <td>{{x.name}}</td>

                    <td>{{x.country}}</td>





                </tr>



            </tbody>





        </table>

    </div>



</body>

</html>





<script>

    var app = angular.module("myapp", []);

    app.controller("myctrl", function ($scope) {



        $scope.names = [

       { id: 108, name: 'ali', country: 'Norway' },

       { id: 107, name: 'ahmed', country: 'Sweden' },

       { id: 106, name: 'sami', country: 'England' },

       { id: 105, name: 'hassan', country: 'Norway' },

       { id: 104, name: 'haris', country: 'Denmark' },

       { id: 103, name: 'faris', country: 'Sweden' },

       { id: 102, name: 'faris', country: 'Sweden' },



        ];

        $scope.orderByMe = function (x)

        {

            $scope.myOrderBy = x;



        };







    }); //controller end.................







</script>

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...