Posts

Showing posts from May, 2016

POC on Grid View Add item to list,Delete row

POC on Grid View Add item to list,Delete row 1) create an Employee List 2)Add TextBox to enter the details 3)Add Employee details in the Grid View as a new row 4)Add CheckBox to select the list 5)Remove the Checked list. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace GridView {         public partial class Form1 : Form     {         EmployeeController ec = new EmployeeController();         DataGridViewCheckBoxColumn checkbox = new DataGridViewCheckBoxColumn();         public Form1()         {                         InitializeComponent();             ec.initialEmployee();             dataGridView2.DataSource = ec.getEmployeeList();                         checkbox.HeaderText = " ";             checkbox.Width = 30;             checkbox.Name = "CheckBox";             dataGridView2.Col

Interface can inherit from Interface,Abstract class can inherit from Interface

Interface can inherit from Interface,Abstract class can inherit from Interface and declare the method as abstract namespace Reflection {     //Interface-1     interface IB     {         void mymessageB();     }     //Interface-2 extending 1     interface IA:IB     {         void mymessageA();     }     //Abstract extending Interface2 ,Interface1 , butimplementing only one interface1     public abstract class Atest: IA     {         public abstract void mymessageA();         public void mymessageB()         {             Console.WriteLine("My Message B");         }     }     //Concrete class implementing the unimplemented Interface from inheriting abstract class     //Abstract class can inherit interface but may or may not impement the interface     //but a concrete class will have to print then     class AConcrete :Atest     {         public override void mymessageA()         {             Console.WriteLine("My Message A");         }         //public override vo

MEF - POC

MEF - POC for Dependency Injection     interface ILogger     {         void Write(string messgae);     }  class hostMEFApplication     {         [ImportMany]                 protected IEnumerable<ILogger> Logger { get; set; }         public void run()         {             Compose();             foreach(var log in Logger)             log.Write("Hello World from MEF");         }         private void Compose()         {             var catalog = new AssemblyCatalog(GetType().Assembly);             var container = new CompositionContainer(catalog);             container.ComposeParts(this);         }     }  [Export(typeof(ILogger))]     class ConsoleLogger : ILogger     {         public void Write(string message)         {             Console.WriteLine("ConsoleLogger says" + message);         }     }     [Export(typeof(ILogger))]     class SomeOtherLogger : ILogger     {         public void Write(string message)         {             Console.WriteLine(&quo
Factory Design Patten Application : Adding Items to Cart List and calculating the total price in Windows Form UI Form Design: ------------------------------------------------------------------------------------------------ namespace ShoppingCart {     partial class Form1     {         /// <summary>         /// Required designer variable.         /// </summary>         private System.ComponentModel.IContainer components = null;         /// <summary>         /// Clean up any resources being used.         /// </summary>         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>         protected override void Dispose(bool disposing)         {             if (disposing && (components != null))             {                 components.Dispose();             }             base.Dispose(disposing);         }         #region Windows Form Designer generated code         /// <summary>