예제 #1
0
        public static void InsertEmployeeByStoredProcedure()
        {
            Console.Clear();
            Demo1DataAccessLayer.DataAccessLayer dal = new Demo1DataAccessLayer.DataAccessLayer();

            Console.WriteLine("\n\t----------Employee Registration---------\n\n\n");
            Console.Write(" Please enter your Name : ");
            string ename = Console.ReadLine();

            Console.Write(" Please enter your Salary : ");
            int salary = Convert.ToInt32(Console.ReadLine());

            Console.Write(" Please enter your ManagerId : ");
            int mgrid = Convert.ToInt32(Console.ReadLine());

            long id;
            int  result = dal.InsertEmployeeByStoredProcedure(ename, salary, mgrid, out id);

            if (result == 1)
            {
                Console.WriteLine("\n\n Employee Id is : " + id + "\n");
            }
            else
            {
                Console.WriteLine("\n\n Some error occured..please try again \n");
            }
        }
예제 #2
0
 public static void AddEmployeeByExecuteNonQuery()
 {
     Demo1DataAccessLayer.DataAccessLayer dal = new Demo1DataAccessLayer.DataAccessLayer();
     if (dal.AddEmployeeByExecuteNonQuery())
     {
         Console.WriteLine("\n\n Employee info added successfully \n");
     }
     else
     {
         Console.WriteLine("\n\n Some error occurred , please try again \n");
     }
 }
예제 #3
0
 public static void TestConnection()
 {
     Console.Clear();
     Demo1DataAccessLayer.DataAccessLayer dal = new Demo1DataAccessLayer.DataAccessLayer();
     if (dal.TestConnection())
     {
         Console.WriteLine("\n\n Connection successful \n");
     }
     else
     {
         Console.WriteLine("\n\n Some error occurred \n");
     }
 }
예제 #4
0
        public static void RegisterEmpployeeInlineQuery()
        {
            Console.Clear();
            Demo1DataAccessLayer.DataAccessLayer dal = new
                                                       Demo1DataAccessLayer.DataAccessLayer();
            Console.WriteLine("\n\t----------Employee Registration---------\n\n\n");
            Console.Write(" Please enter your Name : ");
            string ename = Console.ReadLine();

            Console.Write(" Please enter your Salary : ");
            int salary = Convert.ToInt32(Console.ReadLine());

            Console.Write(" Please enter your ManagerId : ");
            int mgrid = Convert.ToInt32(Console.ReadLine());

            if (dal.RegisterEmpployeeInlineQuery(ename, salary, mgrid))
            {
                Console.WriteLine("\n\n Employee Registration Successful \n");
            }
            else
            {
                Console.WriteLine("\n\n Employee Registration failed, please try again \n");
            }
        }