using System;
using System.Collections.Generic;
using System.Text;
using EmployeeManagementSystem.DataAccessLayer1;
using System.Data;

namespace EmployeeManagementSystem.Businesslayer1
{
    public class EmployeeClass
    {
        private int _EmployeeID;
        private string _FirstName;
        private string _MiddleName;
        private string _LastName;
        private string _DateOfBirth;
        private string _Sex;
        private string _MaritualStatus;
        private string _BachelorDegree;
        private string _BachelorDegreeSpecialization;
        private string _MasterDegree;
        private string _MasterDegreeSpecialization;
        private string _Address;
        private string _City;
        private string _State;
        private string _Country;
        private string _Pincode;


         DataAccess  objEmployeeDA = null;
        public int EmployeeID
        {
            get { return _EmployeeID; }
            set { _EmployeeID = value; }
        }
        public string FirstName
        {
            get { return _FirstName; }
            set { _FirstName = value; }
        }
        public string MiddleName
        {
            get { return _MiddleName; }
            set { _MiddleName = value; }
        }
        public string LastName
        {
            get { return _LastName; }
            set { _LastName = value; }
        }
        public string DateOfBirth
        {
            get { return _DateOfBirth; }
            set { _DateOfBirth = value; }
        }
        public string Sex
        {
            get { return _Sex; }
            set { _Sex = value; }
        }
        public string MaritualStatus
        {
            get { return _MaritualStatus; }
            set { _MaritualStatus = value; }
        }
        public string BachelorDegree
        {
            get { return _BachelorDegree; }
            set { _BachelorDegree = value; }
        }
        public string BachelorDegreeSpecialization
        {
            get { return _BachelorDegreeSpecialization; }
            set { _BachelorDegreeSpecialization = value; }
        }
        public string MasterDegree
        {
            get { return _MasterDegree; }
            set { _MasterDegree = value; }
        }
        public string MasterDegreeSpecialization
        {
            get { return _MasterDegreeSpecialization; }
            set { _MasterDegreeSpecialization = value; }
        }
        public string Address
        {
            get { return _Address; }
            set { _Address = value; }
        }
        public string City
        {
            get { return _City; }
            set { _City = value; }
        }
        public string State
        {
            get { return _State; }
            set { _State = value; }
        }
        public string Country
        {
            get { return _Country; }
            set { _Country = value; }
        }
        public string Pincode
        {
            get { return _Pincode; }
            set { _Pincode = value; }
        }

        public bool CreateEmployeeTable()
        {
            string CommandText = " CREATE TABLE [Employee1] ( [EmployeeID] INTEGER PRIMARY KEY , [FirstName] [nvarchar] (50) NOT NULL , [MiddleName] [nvarchar] (50)  NULL , [LastName] [nvarchar] (50)  NOT NULL ,[DateOfBirth] [nvarchar] (50)  NOT NULL , [Sex] [nvarchar] NOT NULL , [MaritalStatus] [nvarchar] NOT NULL ,[BachelorDegree] [nvarchar] (50) NOT NULL , [BachelorSpecialization] [nvarchar] (50)  NOT NULL , [MasterDegree] [nvarchar] (50)  NOT NULL , [MasterSpecialization] [nvarchar] (50)  NOT NULL , [Address] [nvarchar] (200) NOT NULL , [City] [nvarchar] (50)  NOT NULL ,[State] [nvarchar] (50)  NOT NULL , [Country] [nvarchar] (50) NOT NULL,[Pincode] [nvarchar] (6) NOT NULL) ";
            objEmployeeDA = new DataAccess();

            return objEmployeeDA.GetDataSet1(CommandText);

        }
        public bool AddEmployeeDetail()
        {
            string CommandText = "Insert into Employee1(FirstName,MiddleName,LastName,DateOfBirth,Sex,MaritalStatus,BachelorDegree,BachelorSpecialization,MasterDegree,MasterSpecialization,Address,City,State,Country,Pincode) values ( '" + this.FirstName + "','" + this.MiddleName + "','" + this.LastName + "','" + this.DateOfBirth + "','" + this.Sex + "','" + this.MaritualStatus + "','" + this.BachelorDegree + "','" + this.BachelorDegreeSpecialization + "','" + this.MasterDegree + "','" + this.MasterDegreeSpecialization + "','" + this.Address + "','" + this.City + "','" + this.State + "','" + this.Country + "','" + this.Pincode + "')";
            objEmployeeDA = new DataAccess();

            return objEmployeeDA.GetDataSet1(CommandText);
            
        }
        public bool UpdateEmployeeDetail()
        {
            
            string CommandText = "Update Employee1 set FirstName='"+this.FirstName  +"',MiddleName='"+this.MiddleName +"',LastName='"+this.LastName +"', DateOfBirth='"+this.DateOfBirth +"',Sex='"+this.Sex +"',MaritalStatus='"+this.MaritualStatus +"',BachelorDegree='"+this.BachelorDegree +"', BachelorSpecialization='"+this.BachelorDegreeSpecialization +"', MasterDegree='"+this.MasterDegree +"',MasterSpecialization='"+this.MasterDegreeSpecialization +"',Address='"+this.Address +"',City='"+this.City +"',State='"+this.State +"',Country='"+this.Country +"',Pincode='"+this.Pincode +"' where EmployeeID="+this.EmployeeID;      
            objEmployeeDA = new DataAccess();

            return objEmployeeDA.GetDataSet1(CommandText);
        }
        public bool DeleteEmployeeDetail()
        {
            string CommandText = "Delete from Employee1 Where EmployeeID="+ this.EmployeeID ;
            objEmployeeDA = new DataAccess();

            return objEmployeeDA.GetDataSet1(CommandText);
        }

        public DataSet GetEmployeeList()

        {
            string CommandText = "Select * from Employee1";
            objEmployeeDA = new DataAccess();

            return objEmployeeDA.GetDataSet2(CommandText);
        
        }
    }
}
