public int AddEmployee(Employee empObj)
        {
            int returnValue;

            try
            {
                SqlCommand cmdAddEmployee = new SqlCommand(@"usp_AddEmployee", conEmployeeMgmt);
                cmdAddEmployee.CommandType = CommandType.StoredProcedure;
                cmdAddEmployee.Parameters.AddWithValue("@EmployeeName", empObj.EmployeeName);
                cmdAddEmployee.Parameters.AddWithValue("@Department", empObj.Department);
                cmdAddEmployee.Parameters.AddWithValue("@Skills", empObj.Skills);
                cmdAddEmployee.Parameters.AddWithValue("@Gender", empObj.Gender);
                cmdAddEmployee.Parameters.AddWithValue("@Stream", empObj.Stream);

                SqlParameter prmReturn = new SqlParameter();
                prmReturn.Direction = ParameterDirection.ReturnValue;
                cmdAddEmployee.Parameters.Add(prmReturn);

                conEmployeeMgmt.Open();
                cmdAddEmployee.ExecuteNonQuery();
                returnValue = Convert.ToInt32(prmReturn.Value);
            }
            catch
            {
                returnValue = -99;
            }
            finally
            {
                conEmployeeMgmt.Close();
            }
            return returnValue;
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            foreach (ListItem li in chkSkills.Items)
            {
                string val;
                if (li.Selected == true)
                {
                    val = li.Value;
                    if (string.IsNullOrEmpty(chSkills) == true)
                    {
                        chSkills = chSkills + val;
                    }
                    else
                    {
                        chSkills = chSkills +","+ val;
                    }
                }

            }

            emDAL = new EMDataAccessLayer();
            try
            {
            Employee empObj = new Employee();
            empObj.EmployeeName = txtEmployeeName.Text;
            empObj.Department = txtDepartment.Text;
            empObj.Skills = chSkills;
            empObj.Gender = Convert.ToChar(rbGender.SelectedValue);
            empObj.Stream = ddlStream.SelectedValue;
            int retVal = emDAL.AddEmployee(empObj);

            if (retVal == 1)
            {
                lblStatus.Text = "Employee Added Successfully";
                //lblStatus.Text = chSkills;
                lblStatus.Visible = true;
            }
            else
                // lblStatus.Text = "Employee addition failed!";
                lblStatus.Text = "error is "+retVal;
                lblStatus.Visible = true;
            }
            catch
            {
                lblStatus.Text = "Operation failed!";
                lblStatus.Visible = true;
            }
            finally
            {

            }
        }
        public Employee FetchEmployee(int employeeID)
        {
            Employee empObj = new Employee();
            try
            {
                SqlCommand cmdAddEmployee = new SqlCommand(@"usp_FetchEmployeeDetailsByEmployeeID", conEmployeeMgmt);
                cmdAddEmployee.CommandType = CommandType.StoredProcedure;
                cmdAddEmployee.Parameters.AddWithValue("@EmployeeID", employeeID);
                conEmployeeMgmt.Open();
                using (SqlDataReader oReader = cmdAddEmployee.ExecuteReader())
                {
                    while (oReader.Read())
                    {
                        empObj.EmployeeName = oReader["EmployeeName"].ToString();
                        empObj.Department = oReader["DepartMent"].ToString();
                        empObj.Skills = oReader["Skills"].ToString();
                        empObj.Gender = Convert.ToChar(oReader["Gender"].ToString());
                        empObj.Stream = oReader["Stream"].ToString();
                    }

                    conEmployeeMgmt.Close();
                }

            }
            catch
            {
            }
            finally
            {
                conEmployeeMgmt.Close();
            }
            return empObj;
        }