Tuesday, October 20, 2015

AngularJS for .Net Developers Part 1

AngularJS is a popular client side MVC and MVVM Javascript library used for creating Single Page Application.

Starting an Empty Web Site Project in Visual Studio 2015 and adding Nuget packages for AngularJS Core and Routing.


Though AngularJs can be developed using any Text Editor I prefer using Visual Studio which also provides intellisense for AngularJS.


<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
    <script src="Scripts/angular.js"></script>
</head>
<body>

    <div ng-app="">
        Name <input type="text" ng-model="Name"/>
        <br/>
        Hello {{Name}}
    </div>

</body>
</html>



AngularJS comprises of Directives which can be defined as  Html Atrributes. ng-model here behind the scene creates a property in the ViewModel. 
{{}} is equivalent to <% %> in Asp .Net Web Forms.

As you type inside the textbox, the Hello message gets updated,


ng-repeat Directive
ng-repeat is equivalent to foreach in C#, ie. iterating a colleciton.

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
    <script src="Scripts/angular.js"></script>
</head>
<body>
    <div ng-app="" ng-init="names=['Shalvin P D','Ajay','Rajeev']">
        <ul>
            <li ng-repeat="x in names">
                {{ x }}
            </li>
        </ul>
    </div>
</body>
</html>


Here I am using ng-init for initilizing the data.

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
    <script src="Scripts/angular.js"></script>
</head>
<body>
    <div ng-app="" ng-init="names=[
{name:'Shalvin',location:'Kochi'},
{name:'Rajeev',location:'Kollam'},
{name:'Ajesh',location:'Alappey'}]">

        <ul>
            <li ng-repeat="x in names">
                {{ x.name + ' - ' + x.location }}
            </li>
        </ul>
    </div>
</body>
</html>




Here I am using a complex array comprising of name and location.



$scope Service

In AngularJS whatever starts with $ is  a service. $scope service is equivalent to ViewBag in Asp .Net MVC. It is the glue between Controller and View. $scope supports two way data binding.

Modules
Modules are equivalent to namespace in .Net.






<!doctype html>

<html ng-app="Contacts">
<head>
    <title>Contact Management</title>
   
    <script src="Scripts/angular.js"></script>
    
    <script>
      
      var parking = angular.module("Contacts", []);
     
      parking.controller("HomeCtrl", function ($scope) {
       
        $scope.Contacts = [
          {Name: 'Shalvin'},
          {Name: 'Sooraj'},
          {Name: 'Mahesh'}
        ];
        
      });
    </script>
</head>

<body ng-controller="HomeCtrl">
    <h3>Modules and Controllers - Shalvin</h3>
    <table>
        <thead>
            <tr>
                <th>Name</th>
            </tr>
        </thead>
        <tbody>
               <tr ng-repeat="n in Contacts">
                   <td>{{n.Name}}</td>
            </tr>
        </tbody>
    </table>
 </body>
</html>



Here I am defining a Module named Contacts which contains a controller named HomeCtrl. Inside the controller I an array of Names and passing it to View.



Friday, August 21, 2015

User Group Meeting - 22nd August 2015 (Saturday) - Kochi

Venue:

Orion India Systems Pvt Ltd, 2nd floor, Tejomaya - L&T Tech Park, Info park SEZ, Kakkanad, Cochin-682030
Agenda

09:30 - 09:45 Community updates
09:45 - 10:45 Universal app development with VS 2015 - Rajneesh Kumar
10:45 - 11:00 Tea Break & Networking (15 min)
11:15 - 12:15 VS 2015 - Introduction - Praveen Nair
12:15 - 01:00 Windows 10 IoT edition by Anuraj

Register

Monday, June 15, 2015

User Group Meeting - 20th June 2015 (Saturday) - Kochi

Kerala Microsoft User Group Meeting is a free event organised by Kerala Microsoft User Group. 

Venue:
Orion India Systems Pvt Ltd, 2nd floor, Tejomaya - L&T Tech Park, Info park SEZ, Kakkanad, Cochin-682030
Agenda

09:30 - 09:45 Community updates
09:45 - 10:30 ASP.NET on Docker by Anuraj
10:30 - 11:15 Going cross-platform in Windows 10 - Project Astoria and Islandwood by Abhilash Ashok
11:15 - 11:30 Tea Break & Networking (15 min)
11:30 - 12:15  Team Building and Technical Mentoring by Jose Vamattathil
12:15 - 01:00 SharePoint 2013 Administration by Shalvin

Speakers

Jose Vamattathil  Jose Vamattathil currently working as Technical Manager at Orion India Systems Pvt Ltd. Total 18+ years in the IT industry. 12 Years work experience in Corporate America including fortune 500 companies. Managed multiple projects in Financial, Auditing and Healthcare industry
Abhilash Ashok  Abhilash Ashok is a passionate Microsoft Technology Enthusiast working as User Experience Lead at Identitymine, Kochi. He has 8 years of rich experience in Microsoft Technologies. His area of expertise includes Windows Phone, Windows Store, Kinect for Windows, Xamarin, WPF, ASP.NET and legacy technologies like Windows Forms. He blogs at http://cametoofar.com/.
Anuraj  Anuraj works as a Tech Lead in Orion India Systems. He works in Data Analytics and Architecture. He blogs athttp://www.dotnetthoughts.net/
Shalvin  Shalvin is working as Independent .NET Corporate Trainer and Consultant with more than 15 years of experience is Microsoft Technolgies. Specializing in ASP .NET, WPF, Silverlight, Sharepoint, Entity Framework, etc. Actively associates with Microsoft User Group movement in Kerala from its very inception. He is a frequent speaker, blogger and a .Net enthusiast.  He blogs at http://shalvinpd.blogspot.in/



Register

Friday, May 22, 2015

Kerala Microsoft User Group Meeting - 23rd May 2015 (Saturday) - Kochi

Kerala Microsoft User Group Meeting is a free event organised by Kerala Microsoft User Group on 4th Saturday of every month.

Venue:

Orion India Systems Pvt Ltd, 2nd floor, Tejomaya - L&T Tech Park, Info park SEZ, Kakkanad, Cochin-682030
Agenda

09:30 - 09:45 Community updates
09:45 - 10:30 Kinect for Windows by Abhilash Ashok
10:30 - 11:15 Acquainting with Asp.net 5 and MVC 6 by Aswajith
11:15 - 11:30 Tea Break & Networking (15 min)
11:30 - 12:15 Secure web api with OAuth 2.0 OWIN OAuth middleware - Rifaj Aboobackar
12:15 - 01:00 Windows 10 by Yanesh Tyagi

Register

Sunday, May 17, 2015

Editing SharePoint List with Server Object Model

I am having a list called Employees which I have to edit using Visual Web Part.


private SPListItemCollection GetEmployee()
{
    SPSite site = new SPSite("http://toshiba-pc");
    SPWeb web = site.RootWeb;

    SPList lis = web.Lists["Employee"];
    SPQuery q = new SPQuery();
    q.Query = String.Format("<Where><Contains><FieldRef Name='Title'/><Value Type='Text'>{0}</Value></Contains></Where>", txtEmployee.Text);

    q.ViewFields = "<FieldRef Name='Employee_x0020_Location'/><FieldRef Name='Years_x0020_Of_x0020_Experience'/>";
     SPListItemCollection lic = lis.GetItems(q);
     return lic;
}
protected void btnSearch_Click(object sender, EventArgs e)
{
      SPListItemCollection lic = GetEmployee();
      SPListItem li = lic[0];
      txtLocation.Text = li["Employee_x0020_Location"].ToString();
      int? intYears = Int32.Parse(li["Years_x0020_Of_x0020_Experience"].ToString());
      txtYearsOfExp.Text = intYears.ToString();
}

protected void btnEdit_Click(object sender, EventArgs e)
{
      SPListItemCollection lic = GetEmployee();
      SPListItem li = lic[0];
      li["Employee_x0020_Location"] = txtLocation.Text;
      li["Years_x0020_Of_x0020_Experience"] = txtYearsOfExp.Text;
      li.Update();
}


I am making use of CAML query to extract the details of the Employee and fill the details in the TextBox, which is later updated.


Saturday, March 7, 2015

Kerala Microsoft User Group KOCHI DEVCON 2015

KOCHI DEVCON 2015 will help you to engage and collaborate with Experts and thousands of your developer peers, building connections, learn about the Microsoft’s cutting edge technologies from the industry experts. Sessions on Cloud, Microsoft & Mobile technologies.
Saturday, 14 March 2015

Venue
InfoPark Hall, Athulya Cafeterial Block, Kakkanad

Agenda
08:30 - Registration & Networking

09:15 - Registration closing

09:30 - Welcome message by Praveen Nair, K-MUG representative

09:35 - DEVCON 2015 Inauguration
"Enabling Business through IT" by Mr. Vivek Prasannan, Co-founder of Katalyti Digital Pvt Ltd
"Thinking Globally While Working Locally" by Jennifer Kumar, CEO of Authentic Journeys
"Empowering People" by Mr. Joji Varghese, President of Smartcity Toastmasters Club
 "Data Analytics – Current Trends" by Dr. Arun Marar Ph.D, Head - Data Analytics at Orion Systems Integrators, Inc.

10:15 - "Microsoft and Azure" by Gandharv Rawat, Community Support Lead, Microsoft

11:00 - Tea Break

11:15 - "Azure Media Services" by Yanesh Tyagi - Sr. Delivery Manager, Millennium Consultants

12:00 - "Azure Websites" by Anuraj Parameswaran - Technical Architect, ORION India Systems Pvt. Ltd

01:00 - Lunch Break

02:00 - "Azure Mobile Services" by Safil Sunny, Solutions Architect - Bridge Global IT Staffing

03:00 - "Big Data on Azure" by Praveen Nair, Head of Technology and Architecture - ORION India Systems Pvt. Ltd.

04:00 - "Building Real-World Cloud Apps with Microsoft Azure" by Shiju Varghese, Solutions Architect - Accel Frontline Ltd.

05:00 - Vote of thanks & gifts distribution

Register

Sunday, February 15, 2015

User Group Meeting - 28th February 2015 (Saturday) - Kochi

Venue:

Orion India Systems Pvt Ltd, 2nd floor, Tejomaya - L&T Tech Park, Info park SEZ, Kakkanad, Cochin-682030

Agenda

09:30 - 09:45 Community updates
09:45 - 10:30 Object/Relational Impedance Mismatch by Aravindan M P
10:30 - 11:15 Sonar Qube by Jijo Emannuel
11:15 - 11:30 Tea Break & Networking (15 min)
11:30 - 12:15 HD Insight - Praveen / C# 6.0 - New Features by Anuraj
12:15 - 01:00 Modern Web Application Architecture - 2 by Yanesh Tyagi