Esempio n. 1
0
        /// </summary>
        /// This method is used for deleteing the Techinical Training details
        /// <param name="RaiseTraining"></param>
        /// <returns>RaiseTechnicalID</returns>
        public static bool CheckAccess(string username, string controllername, string actionName, out bool isDisabled)
        {
            DataAccessClass objGetTraining = new DataAccessClass();
            bool            isAccessible   = false;

            isDisabled = false;
            SqlParameter[] sqlParam = new SqlParameter[3];
            try
            {
                objGetTraining.OpenConnection(DBConstants.GetDBConnectionString());
                sqlParam[0]       = new SqlParameter(SPParameter.UserEmpID, SqlDbType.Int);
                sqlParam[0].Value = username;

                sqlParam[1]       = new SqlParameter(SPParameter.RaiseID, SqlDbType.Int);
                sqlParam[1].Value = controllername;

                sqlParam[2]       = new SqlParameter(SPParameter.TrainingType, SqlDbType.Int);
                sqlParam[2].Value = actionName;

                DataSet ds = new DataSet();
                ds.Clear();
                ds = objGetTraining.GetDataSet(SPNames.USP_RPL_CheckUserAccess, sqlParam);

                if (ds.Tables.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        isAccessible = Convert.ToBoolean(dr[DbTableColumn.IsDisabled]);
                        isDisabled   = Convert.ToBoolean(dr[DbTableColumn.IsDisabled]);
                    }
                }

                return(isAccessible);
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, "CheckAccess", "FunctionCheckAccess", EventIDConstants.TRAINING_DATA_ACCESS_LAYER);
            }
            finally
            {
                objGetTraining.CloseConncetion();
            }
        }
Esempio n. 2
0
        public void SaveError(string ErrorMessage, string Source, string Class, string Method, string EventId, string StackTrace)
        {
            string        user          = new AuthorizationManager.AuthorizationManager().getLoggedInUser();
            SqlConnection objConnection = null;
            SqlCommand    objCommand    = null;
            string        ConnStr       = string.Empty;

            try
            {
                ConnStr       = DBConstants.GetDBConnectionString();
                objConnection = new SqlConnection(ConnStr);
                objConnection.Open();

                objCommand             = new SqlCommand(SPNames.InsertError, objConnection);
                objCommand.CommandType = CommandType.StoredProcedure;
                SqlParameter[] sqlParam = new SqlParameter[7];
                sqlParam[0] = objCommand.Parameters.AddWithValue("@ErrorMessage", ErrorMessage);
                sqlParam[1] = objCommand.Parameters.AddWithValue("@Source", Source);
                sqlParam[2] = objCommand.Parameters.AddWithValue("@Class", Class);
                sqlParam[3] = objCommand.Parameters.AddWithValue("@Method", Method);
                sqlParam[4] = objCommand.Parameters.AddWithValue("@EventId", EventId);
                sqlParam[5] = objCommand.Parameters.AddWithValue("@StackTrace", StackTrace);
                sqlParam[6] = objCommand.Parameters.AddWithValue("@CreatedById", user);
                int result = objCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                //throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, "Projects.cs", "UpdateProject", EventIDConstants.RAVE_HR_PROJECTS_DATA_ACCESS_LAYER);
            }

            finally
            {
                if (objConnection.State == ConnectionState.Open)
                {
                    objConnection.Close();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// this function fills the dropdown
        /// </summary>
        //public DataTable FillDropDownListAccountManager(string strCategory)
        //{
        //    try
        //    {
        //        string ConnStr = DBConstants.GetDBConnectionString();
        //        objConnection = new SqlConnection(ConnStr);
        //        objConnection.Open();
        //        objCommand = new SqlCommand(SPNames.Contract_GetEmployeeByDesignation, objConnection);
        //        objCommand.CommandType = CommandType.StoredProcedure;
        //        objCommand.Parameters.Add(SPParameter.Designation, strCategory);
        //        objCommand.Parameters.Add(SPParameter.FirstID, Convert.ToInt32(MasterEnum.FinanceRole.AccountManagerAM));

        //        objReader = objCommand.ExecuteReader();
        //        DataTable objDataTable = new DataTable();
        //        objDataTable.Load(objReader);
        //        return objDataTable;

        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }

        //    finally
        //    {
        //        if (objReader != null)
        //        {
        //            objReader.Close();
        //        }
        //        if (objConnection.State == ConnectionState.Open)
        //        {
        //            objConnection.Close();
        //        }
        //    }

        //}


        /// <summary>
        /// this function gets the employee id.
        /// </summary>
        public int GetEmployeeID(string EmailId)
        {
            SqlConnection objConnection = null;
            SqlCommand    objCommand    = null;
            string        ConnStr       = string.Empty;

            try
            {
                ConnStr       = DBConstants.GetDBConnectionString();
                objConnection = new SqlConnection(ConnStr);
                objConnection.Open();

                objCommand             = new SqlCommand(SPNames.Contract_GetLoggedInEmployeeId, objConnection);
                objCommand.CommandType = CommandType.StoredProcedure;
                SqlParameter[] sqlParam = new SqlParameter[2];
                sqlParam[0]           = objCommand.Parameters.AddWithValue("@EmailId", EmailId);
                sqlParam[1]           = objCommand.Parameters.AddWithValue("@OutEmpId", SqlDbType.Int);
                sqlParam[1].Direction = ParameterDirection.Output;
                //int empId = Convert.ToInt32(sqlParam[1].Value);
                int contract = objCommand.ExecuteNonQuery();
                int empId    = Convert.ToInt32(sqlParam[1].Value);
                return(empId);
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, "Projects.cs", "UpdateProject", EventIDConstants.RAVE_HR_PROJECTS_DATA_ACCESS_LAYER);
            }

            finally
            {
                if (objConnection.State == ConnectionState.Open)
                {
                    objConnection.Close();
                }
            }
        }