Adsense_TOP

Saturday, 19 December 2015

Create a DataTable from a Class using reflection .

There are many solution to this problem, For this we use a technical process called Reflection.

Reflection: To dynamically create an instance  of a type, bind the type to an existing  object ad invoke its methods or access its fields and properties. If you are using attributes in your code, reflection enables you to access them.

1.Use AsEnumerable() method to support LINQ:

private List<T> ConvertToList<T>(DataTable dt)    {        var columnNames = dt.Columns.Cast<DataColumn>()            .Select(c => c.ColumnName)            .ToList();
        var properties = typeof(T).GetProperties();
        return dt.AsEnumerable().Select(row =>            {                var objT = Activator.CreateInstance<T>();
                foreach (var pro in properties)                {                    if (columnNames.Contains(pro.Name))                        pro.SetValue(objT, row[pro.Name]);                }
                return objT;            }).ToList();
    }




Friday, 27 November 2015

MVC application for Starters .


MVC is the framwork for creating Webapplication , in this we have bifercated the different components of the webapplicationas into different categories .

M stands for model , which menas the datalayer in the form of a model .

V stands for view this is the the html pages which is manupulated using the model and the controller.

C which means controller, the controller is the class having multiple methods these methods are used to call the views .

Basically the Controller is just a method function of the class inside the controller.MVC dll that is System.Web.MVC which

contains the details that how the calling process can be carried by the action method.

View are genrated using the Razor Engine which works when a view is called by the user. Razor engine Renders the whole html page and sends It as the response .

Lets have a small example of creating MVC application .
* Open visual studio.
* Click File option.
* Click new option.
* Click the project option to start creating a new project.
* Select the programming language as visual C#.
* Select Web from menu the then select ASP.Net MVC web application.
* Select the MVC from above section and click the MVC checkBox from the lower section .
* click OK.
* this will take few minutes to complete the process
* As you can see a small MVC template is in front of you now. when you directly hit F5 he template executes and the out is in front of you. This template is complete in itself . you can read a bit of programming how the things are created by the template.

I will soon upload a video to demonstrate how to create a simple MVC application .
For any further queries please contact below.

Functions in VB.Net ?


In Vb.net we use procedure in place of function. Procedure is a group of statements which combined together perform a task.

VB.net has two types of procedure


  • Functions 
  • Sub Procedure or Subs


Funcion returns a value where as sub are non- return type procedure.

Function 

Example

Function FindMax(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
   ' local variable declaration */
   Dim result As Integer
   If (num1 > num2) Then
       result = num1
   Else
       result = num2
   End If
   FindMax = result
End Function


Sub Procedure Or Sub's

Example

   Sub CalculatePay(ByVal hours As Double, ByVal wage As Decimal)
      'local variable declaration
      Dim pay As Double
      pay = hours * wage
      Console.WriteLine("Total Pay: {0:C}", pay)
   End Sub

Please Subscribe or Comment!! if you need any other details please comment below. 

Monday, 7 September 2015

How to pass model in a ajax call to a method ??



Form MVC 3 or MVC 2 the objs passed in the form of json are automatically converted model format if the model of that type of object exists.
Example
Let say we have a model 'Customer'

Public class Customer 
{
public int CustomerID {get; set;}
public string CustomerName {get; set;}
public string CustomerAddress {get; set;}
}


Here we have a model 'Customer' with 3 attributes ID, Name, Address.
Now we need to have a Get method and a post method


public ActionResult Index()
{
return View("");
}

[HttpPost]
public ActionResult Index( Customer modelCustomer)
{
// Do your stuff here 
return View ("")
}



Here i have two different Function in the above code one is the httpGet method this is used to call the view where as the other is used to call the post method form the view may be using Submit or using ajax calls.

here goes the code for ajax call


@model iEnumerable
@using (Html.BeginForm("Index", "Home" , FormMethod.Post , new {id = "form1"}))
{
@Html.TextBoxFor(x=> x.EmailAddress)
@Html.TextBoxFor(x=> x.Name)
}

-- Script --

$.ajax({

url : this.action,
type: this.method,
data: $(this).serialize(),// this will serialize the model in json format for the 
success: function (result)
{

},
error: function(result)
{

}  
});



Here we can see the function in ajax which sends the complete model to the HttpPost method .


feel free to comment about any queries, Thank you


Passing multiple models in single view .



There are two different ways of doing this .
* Passing parent view that contains both the models which we want to pass in the view .
* passing each model in a ViewBag

we have two different models

public class Customer 
{
public int CustomerID {get; set;}
public string CustomerName {get; set;}
}

public class Product
{
public int ProductId {get; set ;}
public string ProductName{get; set ;}
}


1. By passing a parent view

Here we want to pass both the models in a single view , by default the razor engine only accepts single model per view.
so we need to create a parent view that hold both the models.


public class ParentView
{
public Customer customer{get; set;}
public Product product{get ; set;}
}



then we can call the model in the view by using the following code
in view page :


@model iEmumerable <models.ParentView>

ForEach(var v in ParentView)
{
< option > @v.customer.CustomerID < / option >
< option > @v.customer.CustomerName <  / option >
< option > @v.product.ProductId < / option >
< option > @v.product.ProductName < / option >

}



thus we cann have two different modles in Single view.
we can have more that twpo models also by this method.

2. Using ViewBag


here we can place the content of model lists in the view bag


public ViewResult GetDetails()
{
ViewBag.Customer  = _repository.getCustomer() ; // basically _repository is a class from where the data is being fetched from the database
ViewBag.Product =_repository.getProducts(); // Here we are fetching the procts fromt he database using the same _repository class
return View();
}


Now we will present this data on the view using these ViewBags.



View.cshtml

Customer Details
@ (var v in ViewBag.Customer as models.Customer)
{


}
Product details
@ (var p in ViewBag.Customer as models.Customer)
{


}





Monday, 24 August 2015

A Briefing to MVC

MVC 

Its is a framework for better web application development . Before this used the Web Forms for the purpose of web application creation. Web application creates has a long runny heavy process in which the controller is connected and maintained by server. The details of every small control is connected and shared with server at every point. Thus MVC was introduced to get the a light weight web application. its uses the HTML controls to make the page .
In web forms the controls are converted to the Html tags at run time but in MVC the the Html is created at the design time thus making it faster than any other web forms based application . 

MVC has some positive points over the Web Forms  
  1. It provides better structure to web applications
  2. As controller created in MVC are class of  .Net thus its is easy to create unit cases and the automatic manual test cases.
  3. it can provide a better layored architecture to the user to work parallel on same application by multiple user.
  4. Lesser code is created as the back end code is done using the .Net classes and references. 
  5. Easy learning curve for the growing project that scale up to years. 


High end view of MVC Execution
  • ·         Receiving Request for the application
  • ·         Routing of the URL according to internal routing
  • ·         Creating MVC request handlers
  • ·         Creating controller to be called by the request
  • ·         Executing the Controller
  • ·         Invoking the required method
  • ·         Result is send back as response


Session Management in MVC
  • ·         TempData -  is used to send data from one controller to another controller.
  • ·         ViewData  -  Used to send data from controller to the view respective to the controller.
  • ·         ViewBag    -  Dynamic wrapper around a ViewData is called a ViewBag
    Flow of request in MVC








Issue happened with MOSS 2007

Problem
We have SharePoint server 2007 connected to the production environment with the SQL Data base name WSS_Content_P. Due to some technical changes we by mistake triggered the Production Front end to the Test environment Database that is WSS_Content_T . Here the Test database was just the replica of the production database with difference of 2 days. Now after some days we got to know that such a problem has been created. We found that business data of 2 days was missing from the database.
Solution : In the End we came to solution to any how sync the two databases. Now we needed the best database comparison tool to check the data from the two database server.
Tool Used:  VISUAL STUDIO
Internal Tool : SQL > DATA COMPARE
·         Click the Data compare option in visual studio.
·         Provide the connection to both the databases, one will be source and other will be the destination.
·         Now we have four different option
o   Different Records: Scans all the records in the database on the basics of primary keys to find the updates and changes.
o   Only in Source: Compares both the databases for the different rows in the source database.
o   Only in Destination: Compare both the databases for the different rows in the destination, after this we can create a script which deletes the extra file from the destination.
o   Identical records: Compare and provides the list of identical fields in the database.
·         After this it shows a comparison summary.
·         This click script button in the tool bar. This will create a query for required data change.
·         Run this query script on the production database. And reconnected the databases. 
In our case we require the data from the source to the destination, where source is the test environment and destination is the production environment.
NOTE: KINDLY TAKE THE BACKUP OF BOTH THE DATABASES TO HAVE DATA SECURITY
What we did to resolve our Problem.
1.       Selecting the Test database as source and destination as production database.
2.       Then selecting the different records and only insource option we move forwarded.
3.       A comparison summary was created which we analyzed before going further to know that we are having the correct data changes. We checked for update queries.
4.       Then we executed the queries on the production environment.

5.       Then we connected the databases back to the frontend and check to get the desired output.

Sunday, 9 August 2015

Working on Web application? Remember these Points for the UI prespective !!

We use multiple languages to create a web application but the browser is only able to understand HTML ,JS ,CSS etc.


 Remember some points to create a better web application .

  • 1. Mobile First Application - In  today's mobile world most of the people use mobile devices to access different websites. You first need to know your customer if you wish to go mobile try to keep in mind the concept of mobile first . Use responsive templates or themes to create applications. Generally before this developer use to check which device is accessing the website based on which they for the . Many of you have generally seen that when access many of the websites they shows m.website this 'm' shows that the programmer has checked for the device and then routed you to different pages that is specific for mobile device. But in many cases i have seen the developers forget to check for the opposite . so the better idea is to use a responsive template which automatically changes the website according to mobile .
  • Keep Simple and Clean - Try to keep things simple and clean. When creating a web application don't put unnecessary thing with in single page . try to keep things simple and clean for the user to understand . In many areas it also cause a performance issue as the bulky page is. Remember the average time for the page to load should be between 2 - 3 seconds. This is the worst case scenario.So keep the pages simple easy to understand for the user.
  • Don't Use Everything that you know - Use only the required things while creating a web application by which you can connect to your user or customer. It means If you know 10 different things to do with the web don't use all of them in one. As I said above keep  it simple . More the application is simple , more is there for user to do .

  • Power of Tool tip- Who so ever may be the user try to provide tool-tip for the required controls on your webpages it helps in clarity of the web navigation.generally when using responsive UI its very good to provide the tool-tip to make a better understanding of the controls.This small change in your website can change the number of users on your website. Its good for every age group to understand that what they are searching for 

Wednesday, 18 February 2015

What is Monitoring in SharePoint 2103? What are the other option in SharePoint 2013?

Health Analyzer
Review problems and solutions Here we can check for the problem in the SharePoint server. These problems may include the details of low memory, high memory usage .There are many different ways by which these problems can be resolved.
Review rule definitions Here we can see different rules that are used to manage the rule definition.
Timer Jobs
 Review job definitions Here we can review job definition i.e. hoe different jobs are scheduled with details of on which web application which timer job is running .these job can be clean up of logs list, trimming of log details, deletion of dead sites in web application.
 Check job status   It is divided into three section scheduled, running and history .It shows when and how different services are executed on the server.
 Reporting
View administrative reports Default document library of SharePoint used for managing the administrative reports. These reports may include data collected by the SharePoint health analyzer to check the efficiency of the SharePoint server.
 Configure diagnostic logging  Configuration page of the Diagnostics in the SharePoint. Configuration can be done Based on different parameters “Least critical event to report to the event log" & "Least critical event to report to the trace log ".
 Configure usage and health data collection  Configuration page of the usage and health data in the SharePoint.
 View health reports This sections shows The slowest pages with details such as duration , number of queries to the database  and number of requests.

Sunday, 8 February 2015

What is system setting in sharePoint2013? Other options in system setting in SharePoint2013?

Servers
Manage servers in this Farm : As we can have multiple server in single farm this option is to add up servers or remove server linked to the farm .
Manage services on Server: Different server has been given different services to work upon . This option help us to make the efficient use of the server by ,managing the services required to the specific server .
E-Mail and text Messaging (SMS)
Configure outgoing e-mail settings: setting outgoing Emails for the SharePoint server.
Configure incoming e-mail settings:setting Incoming Emails for the SharePoint server.
Configure mobile account: This is used to set-up mobile accounts for getting notification alerts as short messages service  on mobile device .
Farm Management
Configure alternate access mappings : mapping of web application to the protocols of internal and public URLs.
Manage farm features: enabling or disabling different features on the farm . such as search , BCS , visco services  etc.
Manage Farm Solutions : Here the SharePoint farm administrator can manage different solutions on the farms . We generally make solutions based on different projects . Here we generally deploy the solution on single web application or on the single site collection .
Manage user solutions :Management of solution based on the User name who has uploaded the solution.
Configure Privacy options:  Privacy options for different groups of the people .
Configure Cross-Firewall access zone: used to generate the URLs in mobile alert messages .

Saturday, 7 February 2015

What is Application Management? What are the meaning of the other options Available in Application Management in SharePoint 2013?

Web Application
Manage Web Applications: This section is specially for farm administrator of  the farm .This option has Manage permissions for a web application in SharePoint 2013 ,Manage permission policies for a web application in SharePoint 2013,Extend claims-based web applications in SharePoint 2013, Define managed paths in SharePoint Server 2013,  etc. we will discuss in details to these things in the upcoming blogs .
Configure Alternate Access mappings :This option can be used to to associate the mapping of any web application to the collection of internal and public URLs .Web application supports five types of collection which are :default , intranet , extra-net internet and custom .
Site collections
Create Site Collections : user can create new site collection from this link .
Delete a Site Collections: Users can delete a specific site collection from this link.
Confirm Site use and Deletion:This section is to confirm weather the site is working or not in use . When SharePoint understands Site is not in use based on the settings it automatically deletes the site collection from the database .
Specify Quota templates :In this option we can specify the limits to  a specific site collection . Its like setting a specific size for the contents in the Site collection.
Configure Quota And locks :Here we can set a manual lock to the site collection  for read only mode or no access .Here we can also increase the the quota limit of the site collection which have configured the quota  previously .
Change Site collection Administrator:here we get to know who are the site collection administrator to any specific site collection  in SharePoint.These details can only be changed by the farm administrator or the site collection administrator of that specific site collection.
View all Site Collections : Here we can see the list of all the site collection available for the user to the user .
Configure Self-Services on Server: In SharePoint we have two different ways to create new site collection .one is by the administrator  and the other is by the User with specific rights .Self- Services are active by default in SharePoint 2013. Disabling this feature prevent us from the second method then only the farm administrators can create new Site collection.
Service Applications
Manage service Applications: Here we can see the services running on the specific web application . In this section user can stop services which  are not in use to the user .
Configure service application associations:
Manage services on server :These are the services which are required by different web application . if w see this in hierarchy we get to know that the only services  running on the server can be used by the farm .
Databases
Manage content databases:These are use to set the content database to a specific site .
Specify the default database server :this is place where we specify the default database server is permanently available to the SharePoint, This is the primary Database to the SharePoint site.
Configure the Data retrieval service :This feature enable the communication between the data consumer and the data Sources using Soap and xml. These are xml webservices which returns the out in xml format .

Friday, 6 February 2015

What is Central Administration in SharePoint 2013 Central ad What it Contains ?

Central administration is a graphical interface utility to perform various functions related to SharePoint. These functions are classified as:
1. Application Management: Enables  user to manage web application, service application , create site collection and content database.
2. System Setting: Enables user to manage server, services and farm features. It also enables to configure alternate access mapping.
3. Monitoring: Enables user to review problems and solutions, web analytic
Central administration Page for SharePoint 2013. very sorry for error
report and check Job status.
4. Backup and restore: Backup and Restore enables user to perform backup, Restore from a backup and a site collection backup.
5. Security: Security enables user to manage the farm administrators group and Configure service accounts.
6. Upgrade and Migration: Upgrade and Migration enables user to convert farm license type, Check product and patch installation status And Check upgrade status
7. General Application Settings: General Application Settings enables users to Configure send to connections, Configure content deployment paths and jobs Manage form templates
8. Office 365 : Integration of SharePoint with office 365 .
9. Apps : Download apps from SharePoint store and use them where ever required.



10. . Configuration Wizard: Configuration provides various wizards to perform configuration tasks.

Monday, 2 February 2015

Environments for SharePoint .

SharePoint is very easy to install, just click few next buttons and it`s installed. To perform the SharePoint installation easily, various activities prior to installation needs to be performed. These activities are part of “Capacity Planning and management” activity.  


SharePoint installation/deployment scenarios can be classified as:


1. Standalone Installation: Most of the small enterprises prefer standalone installation scenario. This scenario enables user to install, SharePoint and SQL database on one physical server or virtual machine.


2. Complete Installation: Most of the mid or large size, enterprise prefer farm installation scenario. The server farm installation can be performed as:

·         Multiple Server Installation: Add all the components installed on different servers with ability to add more servers as per need.
Single Server Installation: Install all the components on single server 


Monday, 19 January 2015

SharePoint Basics?

SharePoint As it is clear from its name SharePoint is tool provided by Microsoft to create CMS(Content Management System) , RMS(Report Management System) and DMS (Document Management System). 
It is server based tool used to create Intranet or Internet Web based solution .
This is server based tool . It is tool to create fast and easy enterprise solution for creating Web based intranet  portal.