Monday, March 12, 2018

Nav Purchase Transaction Impact on Chart of Account

Purchase Cycle :

When a Item is purchased in MS Dynamics NAV using purchase order and purchase invoice some accounts are credited and other accounts are debited. So for functional side we must know what is the major impact. Let's see the impact in detail.

Step 1. Create an Item.

Choose any of the default Item Template to complete the Item Setup.

Step 2. Create Purchase Quote and click on Create Order.

Once this is done your quote will be converted to Order and we are receiving the order and now we will check what is the impact of receiving on accounting level.

+ in NAV means Debit and - means Credit for accounting purpose only.

For Inventory concept of sign is same.

Step 3 : When we receive a PO there is no impact on Accounting Side.


Step 4 : Lets post the Receipt using purchase Invoice Page.

When we post the invoice we get this final result.

In this final result we will check the COA in GL Entry which Account is debited and which account is credited.

1.G/L Entry :

Vendor Account Credited by 750

and

Purch. Payable Account is debited by 600 and VAT 150

What is the impact of payment for vendor invoice on G/L Account?


Now, vendor account is debited 
5410 is debited by 750
&
5310 Liability Account is credited by 750.

Sunday, March 11, 2018

Tutorial 20 What is Exception Handling in Dotnet ?

What is Exception Handling ?

Exception handling is very important in dotnet because this is a coding structure based on variables 

and basic programming structure.

Here , Dotnet framework is providing us a method to check unwanted  errors from our development and coding.

We are implementing it using 3 blocks of code :

1. try :

This block is used to complete the task.

2. catch (exception ex)

This block carries the exception and here we can also catch any  exception occurring in the code.

3. finally

This block is the final code to be executed when certain error occurs in our code structure.


What is inner class exception in Dotnet and how we handle the same?

Whenever there is an exception which depend on another exception it is termed as inner exception handling.

For Example : 

Exception 1 : We want to write the exception in a log file and send it to client.

Exception 2 : We want to divide by Zero some integer value.

So in this scenario we need to implement the solution using inner class exception. To use this exception we will use a constructor of exception class.


Can we create our own Exception class and how?

Yes we can easily create exception class defined by us and add our own exception which we cant get 

in standard dotnet framework class. We will achieve this using Inheritance concept which is 

inheriting from dotnet exception class.


What is abusing in exception handling?

Abusing exception handling means for one program you need to write multiple catch blocks.
see for example.

Tutorial 19 What is multicast Delegate in Dotnet?

 What is Multicast ?

Multi Casting means when a variable is pointing to one or more functions.

Multi Casting in Delegates means when one delegate instanced variable is pointing to one or more functions.


In this example of multi casting delegates we need to follow these steps :

Step 1 : Define Delegate as done in point 1.

Step 2 : Define Variables of Delegate.

Step 3 : Creating Instances of Delegate and also we can add the instance of variable.

Step 4 : Define Methods of instances.

Tutorial 18 What are delegates ?

What are Delegates ?

Delegate is type safe function pointer. Means the return type of method must be similar to signature of Delegate.


What is the use Delegates in C Sharp?

Just check this and get the concept of programming without delegate in dotnet.


Now we will see the implementation of method PromotedEmployee using delegate.


There are 3 steps in delegate implementation.


A delegate is a type that represents references to methods with a particular parameter list and return type. When you instantiate a delegate, you can associate its instance with any method with a compatible signature and return type. You can invoke (or call) the method through the delegate instance.

Delegates are used to pass methods as arguments to other methods. Event handlers are nothing more than methods that are invoked through delegates. You create a custom method, and a class such as a windows control can call your method when a certain event occurs.

How to implement alternative way of Delegate using Lambda Expression ?


Lambda Expression :
1. it means  => such as 
and this is called expression >= 

Friday, March 9, 2018

Tutorial 17 What are difference between abstract classes and interfaces ?

Abstract Classes and Interfaces :

Notes :

1. Abstract classes can contain definition of methods but interface cannot have definition for any method.

2. Abstract classes can contain variables but interfaces are only meant for method declaration.

3. Interface can only inherit from interface but abstract class can inherit from interface and abstract class also.

4. A class can inherit from multiple interfaces but cant inherit from multiple class at same time.

5. Abstract classes method definition can have access modifiers whereas its not possible for interfaces.

What is Diamond Problem in Dotnet ?

This is a problem in Dotnet for multiple inheritance when we try to inherit from derived class and the function with same same is present in parent class also and the compiler is unable to identify from which class implementation is to be done.

What is the use of  interface ?

Using Interface we can achieve multi level inheritance in dotnet. Lets see with one example.








Tutorial 16 What are Interfaces and abstract class in Dotnet?

What are Interfaces ?

An interface is like an abstract base class. Any class or struct that implements the interface must implement all its members. An interface can't be instantiated directly. Its members are implemented by any class or struct that implements the interface. Interfaces can contain events, indexers, methods, and properties.

Basically Interfaces are only used to define method names and there is no implementation of method in Interfaces.

In Interface there is no access modifiers for methods.

Definition of methods or functions are done in classes calling them.


What are Abstract Classes in Dotnet ?

These classes are very similar to Interfaces where we only define the name of methods and no definition only the class using the method will have definition of methods.

Implementation of Abstract class is also very similar Lets see in Example.


Note :
1. Abstract Keyword is used to create Abstract Class in Dotnet.

2.Abstract Class can only be used as base class and no inheritance is provided with it.

3. Abstract Class cannot be instantiated as its incomplete.

4.Abstract Class cannot be sealed.

5


Tutorial 15 What are Structs in C Sharp?

Structs and Classes Difference :


Structs are similar to classes in definition and syntax. Lets see the example of structs :


What is the difference :

Struct is a value type and class is a reference type.

Structs cant have destructors.

Structs cant support inheritance.

Structs are stored on Stack and class are stored in Heap.

What is sealed Keyword mean?

We use sealed keyword to stop a class being used in inheritance purpose and structs are by default sealed.

Syntax :

class sealed ClassVariablename



Thursday, March 8, 2018

Tutorial 14 What are GET SET properties and why we want to use it?

Why we need GET SET properties?

Firstly in Dotnet we need to work with variable and many a times we want to use same variable at 

multiple places and now think of a big project where 25 special developers are working together anybody 

can use it and assign different values to same variable and can violate the project rules so we need to 

implement some rules for each variable.

Lets see with one example :

This is done only for one 

Let's see the inbuilt GET & SET properties in Dotnet :

This properties are provided from dotnet 3.0 to implement and reuse code. This logic introduces us to a defination of Encapsulation.


Can we implement GET SET property automatically?

Yes this can be done easily and we need not to define 2 fields one private and one public to validate field.

We can directly use 

public datatype variablename{get; set;}

this will automatically create one private field at backend in dotnet.

I hope this property blog is clear to you for more clarification kindly comment and we can discuss and understand.








Sunday, March 4, 2018

Tutorial 13 What is Polymorphism in Dotnet? 2nd pillar of OOPS concept

What is Polymorphism ?

Polymorphism is a feature provided by OOPS concept to use functions in base class and derived class with same name.

To use this concept we need to use virtual and override keyword infront of methods.

In below screenshot of program we had created a array of base class and tried to implement polymorphism.


What is the difference between method hiding and method overloading?

If you check in depth both are doing a same task and giving us a opportunity to check which function or method we want to use base or derived one.

Method hiding will use new keyword in derived class.

Method over loading will use virtual and over ride keyword to do the task.

What is Method OverLoading ?

This is a very simple concept but very effective technique in Dotnet.

You can define same method with different parameters in dotnet. Lets see it in example.


Tutorial 12 What is method Hiding next Level to Inheritance?

What is the concept of Method Hiding?

When we are inheriting from base class and there are 2 methods with same name in base and derived class then which method will be called.

This situation is called method hiding and for you guys method of derived class will be called. Lets see with example to understand better.


The Result is :

To use base method just we need to write while initiating the constructor as :
baseclass variablename = new dericedclass();




Tutorial 11 What is Inheritance and How we can use inheritance?

What is Inheritance? 

Inheritance means Inherit something from others. Its one of the pillar of concepts in OOPS. We can define common things inside one class and use it different class.

For E.g. In job search portal we have many tasks. Defining classes for Employee , Employers and Job Search. So we can have part time and full time jobs also. But in Part time and Full time job only pay element is different rest all are same.

What is the advantage?

Reusability of Code :- we can use code defination once and reuse it multiple times.

 What is Syntax?

AccessModifier class classname : class from where we need to inherit

So for reference and more understanding we will check the below screen.

Note : Multiple class inheritance is not possible in dotnet but multi level class inheritance is possible.

But multiple interface inheritance is possible in dotnet C#. What are Interface ? Will tell you?

Instance of base class is automatically created before derived class. You can create multiple constructor and use base keyword to check 


Saturday, March 3, 2018

Tutorial 10 Static and Instance Members in Dotnet Classes

What are Static Members ?

Static members of a class are defined once in a definition and are assigned with keyword static. It simply means this variable is static variable. It will be put as a separate copy and anyone can point it.

What are Instance Members ?

Instance Members are normal variables and method which will keep as a copy.

Why we need both and what is the use of these members?

Static members will reduce the time of execution and save  memory by keeping only one copy of variable to point.

As class is concept of OOPS and our NAV is based on objects so there will be no concept of these members.

Lets see some example for reference :


Hope this part is understandable with this post if not kindly comment.

Tutorial 9 Classes and its components

What are Classes ?

Classes are collection of Data Types and methods. in Simple terms we can say a Class is a Codeunit of NAV and inside codeunit we can define multiple variables called datatypes and functions as we normally do in NAV.

As per need , we have codeunit type : Single Instance Codeunit and many events are introduced from NAV 2016. Like the same, we have multiple types of classes in dotnet. Lets see all now :

With Classes we come to following terms to understand :

1. Constructor 

Constructors are basically used to initialize class object / data types in dotnet

2. Destructor

This is used for cleaning the variables and in new versions of dotnet it is not required to define. It is done with tilt sign before class name. 

3. Overloading of Constructor 

We can define multiple constructors based on parameters for one class and these are basically termed as overloading.

Dotnet itself create on constructor for us when we define a class.
Constructor have same name as class and no return type.

Note please Dont mug up , just try and learn the use.

4. this Keyword

this keyword is pointing to the objects or variables defined in classes.

So lets have one screenshot for reference :






Tutorial 8 NameSpace in Detail

What is the Advantage of Namespace?

Namespace is code marking method to segregate code from different team and use of project demand. We can define multiple namespaces and define classes, methods and call it inside main function.


Alternative way to achieve Namespace using Project References?

We can define multiple namespaces in dotnet using class library and reference it in main project using reference option.

Then we can use namespace and functions from other class libraries also.



Friday, March 2, 2018

Tutorial 7 Methods in DotNet

What are Methods ?

Methods are normal functions which we need to create once and can be called multiple times. Its very common concept in NAV also. So we can define multiple functions.

But calling the method in Dotnet is very different and we need to follow certain rules while calling these methods and functions.

Why we need Methods ?

You can define it once and call it anywhere.

What are Static Methods and What are Instance Methods?

You might got surprised with syntax functions in Dotnet.

AccessModifier Static/or keep it blank ReturnType -FuntionName-(Parameters)

Access Modifier are E.g. Public , Private.

Static Function means you need not to create any instance of the class.
Non Static Function means you need to create instance of the class.



What are parameters and types of parameters in Dotnet?

In Dotnet, we have 4 types of parameters which we can define in methods or functions:

1. Valued Parameters :

These parameters are valued type means a copy of parameters is created inside and represented.
This concept is also common in NAV, we are using it regularly.


2. Reference Parameters :

Ref keyword is used in this case while passing parameters. This concept is also common in NAV.


3. Out Parameters :

Out Keyword is used when we need to pick multiple return type from a single function.
Like normally in NAV we can have only one type of parameters but using Out parameters we can have this achievable easily.


4. Params Parameters :

This type of Parameters we pass using params keyword and we can pass array also inside the argument.

This is also not present in NAV functions.




Tutorial 6 Loop in Dotnet

1. While Loop

This Loop is checking the condition written in brackets , if the condition is correct then Code block will be executed till the While condition is fulfilled.

Note: While is similar to NAVISION IF condition.

2. Do While Loop 

do
{

}
while(Condition);

This loop will execute once and then checks the condition if condition is found true then do code will be executed again.

Note : This code is good for providing menu option to end user of program.

3. For Loop 

For Loop is also present in NAV and the working is same as in Dotnet. I had summarized the syntax for all loops present in Dotnet.

4. For Each Loop

This loop is present in dotnet and is very easy to use with collection classes in nav.

Break & Continue:

Break is a very special type of keyword that we can use in any loop to break on condition.

Continue is also same and is used for special reasons to continue a loop.