Posts

Oops

Inheritance:- It's a mechanism of consuming the members of one calls in another class by establishing parent/child relationship between the classes    Polymorphism:- polymorphism is a mechanism of changing the behavior based on the inputs, that is the input changes automatically the output or behavior changes Input changes  means: Changes type of input parameter (int, string, list... etc) Change number of input parameter Change order of input parameter    Method Overloading:- Method Overloading means it is an approach of defining multiple methods under the class with same name so we can define more then one method under the class with same name that is what we call method overloading Method overloading is a approach of defining multiple behavior to a method, Method is same but behavior are different    Method Overriding: - Method overriding is a approach of re-implementing a parent classes method under child class as exactly with the same definition It's an a

C#

What is an object in C#? Classes are the foundation of C#. A class is a template that defines what a data structure will look like, and how data will be stored, managed, and transferred. A class has fields, properties, methods, and other members. While classes are concepts, objects are real. Objects are created using class instances. A class defines the type of an object. Objects store real values in computer memory. Object is blue print of a class. https://www.c-sharpcorner.com/UploadFile/puranindia/C-Sharp-interview-questions/

SOLID Design Principles in C#

  The  SOLID Design Principles  are the design principles that help us to solve most of the software design problems. These design principles provide us with multiple ways to move the tightly coupled code between the software components which makes the software designs more understandable, flexible, and maintainable .  Why do we need SOLID Principles? As a developer, we start developing applications using our experience and knowledge. But over time, the applications might arise bugs. We need to alter the application design for every change request or for a new feature request. After some time we might need to put a lot of effort, even for simple tasks and it might require the full working knowledge of the entire system Advantages of SOLID Principles in C# Maintainability:  As we know, nowadays maintaining software is very important for organizations. Day by day the business may grow for the organization and you may need to enhance the software with new changes. So you need to design th

Repository Design Pattern in C#

Image
  What is the Repository Design Pattern in C#? The Repository Design Pattern in C# Mediates between the domain and the data mapping layers using a collection-like interface for accessing the domain objects. In other words, we can say that a Repository Design Patternacts as a middleman or middle layer between the rest of the application and the data access logic. That means a repository pattern isolates all the data access code from the rest of the application. The advantage of doing so is that, if you need to do any change then you need to do in one place. Another benefit is that testing your controllers becomes easy because the testing framework need not run against the actual database access code. With a repository  design pattern introduced, the above figure can be changed to: Why we need   the Repository Pattern in C#? Most of the data-driven applications need to access the data residing in one or more other data sources. Most of the time data sources will be a database. Again, the

Dependency Injection and Inversion of Control in C#

  Why do we need the Dependency Injection in C#? The Dependency Injection is a design pattern that allows us to develop loosely coupled software components. In other words, we can say that this design pattern is used to reduce the tight coupling between the software components. As a result, we can easily manage future changes and other complexity in our application. Before understanding the Dependency Injection Design Pattern using C#, first, we need to understand what is tight coupling and what is loose coupling in software development. So let’s understand these two concepts first. What is Tight Coupling in Software Design? Tight coupling means classes and objects are dependent on each other. That means when a class is dependent on another concrete class, then it is said to be a tight coupling between these two classes. In that case, if we change the dependent object, then we also need to change the classes where this dependent object is used. If your application is a small one, then

Get Dynamic Clock In or clock time in SQL

Image
 Now, I am going to generate dynamic time like real punch time for Clock In or Clock Out. When we implement punch time functionality. Create a View for Get Random value in SQL. Because SQL not allow RAND() function in user define function. So I am creating a view for this CREATE VIEW vw_getRANDValue AS SELECT RAND() AS Value Create a user define function to get real punch time. I am passing date of punch and time range in time format. GO CREATE FUNCTION [dbo].[FnGetPunchTime] (@WorkingDate DATETIME,@timeRangeBegin time,@timeRangeEnd time) RETURNS DATETIME AS BEGIN     DECLARE @Result AS DATETIME;    DECLARE @RandomTime  DATEtime, @TimeSpanInMSec int = datediff(MILLISECOND,@timeRangeBegin, @timeRangeEnd) SELECT @RandomTime=DATEADD(MILLISECOND,(SELECT Value FROM vw_getRANDValue) *  @TimeSpanInMSec,@timeRangeBegin) SELECT @Result=CONVERT(DATETIME, CONVERT(varchar, @WorkingDate, 23)   + ' ' + CONVERT(varchar, @RandomTime, 114))     RETURN (@Result); END I am putting

How to add or update query string parameter to current url in Javascript

  In this post, I will let you know how to add or update query string parameter to current URL using Javascript. function  updateQueryStringParameter(uri, key, value) {          var  re =  new  RegExp( "([?&])"  + key +  "=.*?(&|$)" ,  "i" );          var  separator = uri.indexOf( '?' ) !== -1 ?  "&"  :  "?" ;          if  (uri.match(re)) {            return  uri.replace(re,  '$1'  + key +  "="  + value +  '$2' );         }          else  {            return  uri + separator + key +  "="  + value;         }   }   In above example, you will need to pass three argument, first will be your current URL and second will be key which you want to add/update and last argument will be the value of key. using below example how to use and update a herf attribute  $( ".user_nav" ).each( function  () {                   var  $that = $( this );