Esempio n. 1
0
        /// <summary>
        /// Deletes the emergency contact.
        /// </summary>
        /// <param name="objDeleteEmergencyContact">The obj delete emergency contact.</param>
        public void DeleteEmergencyContact(BusinessEntities.EmergencyContact objDeleteEmergencyContact)
        {
            //Initialise Data Access Class object
            objDA = new DataAccessClass();

            //Initialise SqlParameter Class object
            sqlParam = new SqlParameter[2];

            try
            {
                //Open the connection to DB
                objDA.OpenConnection(DBConstants.GetDBConnectionString());

                //Check each parameters nullibality and add values to sqlParam object accordingly
                sqlParam[0] = new SqlParameter(SPParameter.EmergencyContactId, SqlDbType.Int);
                if (objDeleteEmergencyContact.EmergencyContactId == 0)
                {
                    sqlParam[0].Value = DBNull.Value;
                }
                else
                {
                    sqlParam[0].Value = objDeleteEmergencyContact.EmergencyContactId;
                }

                sqlParam[1] = new SqlParameter(SPParameter.EmpId, SqlDbType.Int);
                if (objDeleteEmergencyContact.EMPId == 0)
                {
                    sqlParam[1].Value = DBNull.Value;
                }
                else
                {
                    sqlParam[1].Value = objDeleteEmergencyContact.EMPId;
                }

                //Execute SP along with proper parameters
                objDA.ExecuteNonQuerySP(SPNames.Employee_DeleteEmergencyContact, sqlParam);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASS_NAME, DELETEEMERGENCYCONTACT, EventIDConstants.RAVE_HR_PROJECTS_DATA_ACCESS_LAYER);
            }
            finally
            {
                objDA.CloseConncetion();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the address.
        /// </summary>
        /// <param name="objEmployee">The obj get certification details.</param>
        /// <returns></returns>
        public BusinessEntities.RaveHRCollection GetEmergencyContact(BusinessEntities.EmergencyContact objGetEmergencyContact)
        {
            //Object declaration of QualificationDetails class
            Rave.HR.DataAccessLayer.Employees.EmergencyContact objEmergencyContactDAL;

            try
            {
                //Created new instance of QualificationDetails class to call objGetQualificationDetailsDAL() of Data access layer
                objEmergencyContactDAL = new Rave.HR.DataAccessLayer.Employees.EmergencyContact();

                //Call to GetQualificationDetails() of Data access layer and return the Qualifications
                return(objEmergencyContactDAL.GetEmergencyContact(objGetEmergencyContact));
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASS_NAME, GETEMERGENCYCONTACT, EventIDConstants.RAVE_HR_EMPLOYEE_BUSNIESS_LAYER);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Adds the address.
        /// </summary>
        /// <param name="objAddCertificationDetails">The obj add certification details.</param>
        public void AddEmergencyContact(BusinessEntities.EmergencyContact objEmergencyContact)
        {
            //Object declaration of objAddAddressDAL class
            Rave.HR.DataAccessLayer.Employees.EmergencyContact objAddEmergencyContactDAL;

            try
            {
                //Created new instance of CertificationDetails class to call AddCertificationDetails() of Data access layer
                objAddEmergencyContactDAL = new Rave.HR.DataAccessLayer.Employees.EmergencyContact();

                //Call to AddCertificationDetails() of Data access layer
                objAddEmergencyContactDAL.AddEmergencyContact(objEmergencyContact);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASS_NAME, ADDEMERGENCYCONTACT, EventIDConstants.RAVE_HR_EMPLOYEE_BUSNIESS_LAYER);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Deletes the qualification details.
        /// </summary>
        /// <param name="objDeleteEmergencyContact">The object delete qualification details.</param>
        public void DeleteEmergencyContact(BusinessEntities.EmergencyContact objDeleteEmergencyContact)
        {
            //Object declaration of EmergencyContact class
            Rave.HR.DataAccessLayer.Employees.EmergencyContact objDeleteEmergencyContactDAL;

            try
            {
                //Created new instance of EmergencyContact class to call DeleteEmergencyContact() of Data access layer
                objDeleteEmergencyContactDAL = new Rave.HR.DataAccessLayer.Employees.EmergencyContact();

                //Call to DeleteEmergencyContact() of Data access layer
                objDeleteEmergencyContactDAL.DeleteEmergencyContact(objDeleteEmergencyContact);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASS_NAME, DELETEEMERGENCYCONTACT, EventIDConstants.RAVE_HR_EMPLOYEE_BUSNIESS_LAYER);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Adds the EmergencyContact.
        /// </summary>
        /// <param name="objAddEmployee">The object add employee.</param>
        public int AddEmergencyContact(BusinessEntities.EmergencyContact objEmergencyContact)
        {
            int empID = 0;

            objDA    = new DataAccessClass();
            sqlParam = new SqlParameter[4];

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    objDA.OpenConnection(DBConstants.GetDBConnectionString());

                    sqlParam[0] = new SqlParameter(SPParameter.EmpId, SqlDbType.Int);
                    if (objEmergencyContact.EMPId == 0)
                    {
                        return(0);
                    }
                    else
                    {
                        sqlParam[0].Value = objEmergencyContact.EMPId;
                    }

                    sqlParam[1] = new SqlParameter(SPParameter.ContactName, SqlDbType.NVarChar, 50);
                    if (objEmergencyContact.ContactName == "" || objEmergencyContact.ContactName == null)
                    {
                        sqlParam[1].Value = DBNull.Value;
                    }
                    else
                    {
                        sqlParam[1].Value = objEmergencyContact.ContactName;
                    }

                    sqlParam[2] = new SqlParameter(SPParameter.ContactNumber, SqlDbType.NVarChar, 50);
                    if (objEmergencyContact.ContactNumber == "" || objEmergencyContact.ContactNumber == null)
                    {
                        sqlParam[2].Value = DBNull.Value;
                    }
                    else
                    {
                        sqlParam[2].Value = objEmergencyContact.ContactNumber;
                    }

                    sqlParam[3] = new SqlParameter(SPParameter.Relation, SqlDbType.Int);
                    if (objEmergencyContact.RelationType == 0)
                    {
                        sqlParam[3].Value = DBNull.Value;
                    }
                    else
                    {
                        sqlParam[3].Value = objEmergencyContact.RelationType;
                    }


                    objDA.ExecuteNonQuerySP(SPNames.Employee_AddEmergencyContact, sqlParam);

                    ts.Complete();
                }
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASS_NAME, ADDEMERGENCYCONTACT, EventIDConstants.RAVE_HR_EMPLOYEE_DATA_ACCESS_LAYER);
            }
            finally
            {
                objDA.CloseConncetion();
            }
            return(empID);
        }
Esempio n. 6
0
        /// <summary>
        /// Gets the Employee Address.
        /// </summary>
        /// <param name="objGetCertificationDetails">The object get certification details.</param>
        /// <returns></returns>
        public BusinessEntities.RaveHRCollection GetEmergencyContact(BusinessEntities.EmergencyContact objGetEmergencyContact)
        {
            //Initialise Data Access Class object
            objDA = new DataAccessClass();

            //Initialise SqlParameter Class object
            sqlParam = new SqlParameter[1];

            //Initialise Collection class object
            raveHRCollection = new BusinessEntities.RaveHRCollection();

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    //Open the connection to DB
                    objDA.OpenConnection(DBConstants.GetDBConnectionString());

                    //Check each parameters nullibality and add values to sqlParam object accordingly
                    sqlParam[0] = new SqlParameter(SPParameter.EmpId, SqlDbType.Int);
                    if (objGetEmergencyContact.EMPId == 0)
                    {
                        sqlParam[0].Value = DBNull.Value;
                    }
                    else
                    {
                        sqlParam[0].Value = objGetEmergencyContact.EMPId;
                    }

                    objDataReader = objDA.ExecuteReaderSP(SPNames.Employee_GetEmergencyContact, sqlParam);

                    while (objDataReader.Read())
                    {
                        //Initialise the Business Entity object
                        objEmergencyContact = new BusinessEntities.EmergencyContact();

                        objEmergencyContact.EmergencyContactId = Convert.ToInt32(objDataReader[DbTableColumn.EmergencyContactId].ToString());
                        objEmergencyContact.EMPId         = Convert.ToInt32(objDataReader[DbTableColumn.EMPId].ToString());
                        objEmergencyContact.ContactName   = objDataReader[DbTableColumn.ContactName].ToString();
                        objEmergencyContact.ContactNumber = objDataReader[DbTableColumn.ContactNumber].ToString();
                        objEmergencyContact.Relation      = objDataReader[DbTableColumn.Relation].ToString();
                        objEmergencyContact.RelationType  = int.Parse(objDataReader[DbTableColumn.RelationType].ToString());

                        // Add the object to Collection
                        raveHRCollection.Add(objEmergencyContact);
                    }

                    if (!objDataReader.IsClosed)
                    {
                        objDataReader.Close();
                    }

                    ts.Complete();
                }
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASS_NAME, GETEMERGENCYCONTACT, EventIDConstants.RAVE_HR_EMPLOYEE_DATA_ACCESS_LAYER);
            }
            finally
            {
                if (!objDataReader.IsClosed)
                {
                    objDataReader.Close();
                }
                objDA.CloseConncetion();
            }

            // Return the Collection
            return(raveHRCollection);
        }