/// <summary>
        /// Method to Update Role
        /// </summary>
        /// <returns></returns>
        public bool UpdateRole(RoleDetail roledetail)
        {
            bool isFlag = false;
            RoleManagementDLL objrolemanagement = null;
            try
            {
                objrolemanagement = new RoleManagementDLL();
                isFlag = objrolemanagement.UpdateRole(roledetail);
                return isFlag;

            }
            catch (Exception e)
            {
                throw;
            }
            finally
            {
                objrolemanagement = null;

            }
        }
        /// <summary>
        /// Method to Insert Role
        /// </summary>
        /// <returns></returns>
        public int InsertRole(RoleDetail roledetail)
        {
            int isFlag = 0;
            RoleManagementDLL objrolemanagement = null;

            try
            {
                objrolemanagement = new RoleManagementDLL();
                isFlag = objrolemanagement.InsertRole(roledetail);
                return isFlag;

            }
            catch (Exception e)
            {
                throw;
            }
            finally
            {
                objrolemanagement = null;

            }
        }
        public static bool UpdateRole(RoleDetail roledetail)
        {
            RoleManagementBLL objRoleManagementBLL = null;
            bool isFlag = false;
            try
            {
                objRoleManagementBLL = new RoleManagementBLL();
                roledetail.ModifiedBy=GetCurrentUserName();

                isFlag = objRoleManagementBLL.UpdateRole(roledetail);

            }
            catch (Exception ex)
            {
                // Log the error to a text file in the Error folder
                Common.WriteError(ex);
            }
            finally
            {
                objRoleManagementBLL = null;
            }

            return isFlag;
        }
        public static int InsertRole(RoleDetail Roledetail)
        {
            RoleManagementBLL objRoleManagementBLL = null;
            int isFlag = 0;
            try
            {
                objRoleManagementBLL = new RoleManagementBLL();
                Roledetail.CreatedBy = GetCurrentUserName();
                isFlag = objRoleManagementBLL.InsertRole(Roledetail);

            }
            catch (Exception ex)
            {
                // Log the error to a text file in the Error folder
                Common.WriteError(ex);
            }
            finally
            {
                objRoleManagementBLL = null;
            }

            return isFlag;
        }
        /// <summary>
        /// Method to ActiveInactive RoleDetail
        /// </summary>
        /// <returns></returns>
        public bool UpdateRole(RoleDetail roledetail)
        {
            ObjSqlHelper = new SqlHelper.SqlHelper();

            string proc_name = ConstantsDLL.USP_UPDATEROLE;
            SqlParameter[] param = new SqlParameter[5];

            param[0] = new SqlParameter("@RoleId", roledetail.RoleId);
            param[1] = new SqlParameter("@IsActive", roledetail.IsActive);
            param[2] = new SqlParameter("@ModifyBy", roledetail.ModifiedBy);
            param[3] = new SqlParameter("@RoleName", roledetail.RoleName);
            param[4] = new SqlParameter("@RoleAccess", roledetail.RoleAccess);
            ObjSqlHelper.ExecNonQueryProc(proc_name, param);

            return true;
        }
        /// <summary>
        /// Method to insert RoleDetail
        /// </summary>
        /// <returns></returns>
        public Int32 InsertRole(RoleDetail roledetail)
        {
            ObjSqlHelper = new SqlHelper.SqlHelper();

               SqlParameter[] param =
            {
                new SqlParameter("@RoleName",SqlDbType.VarChar),
                new SqlParameter("@RoleAccess", SqlDbType.VarChar),
                new SqlParameter("@IsActive", SqlDbType.Bit),
                new SqlParameter("@CreatedBy", SqlDbType.VarChar),
                new SqlParameter("@Rval", SqlDbType.Int)
            };

               param[0].Value = roledetail.RoleName;
               param[0].Size = 255;
               param[1].Value = roledetail.RoleAccess;
               param[1].Size = 155;
               param[2].Value = roledetail.IsActive;
               param[2].Size = 255;
               param[3].Value = roledetail.CreatedBy;
               param[3].Size = 155;
               param[4].Direction = ParameterDirection.ReturnValue;

               //string proc_name = ConstantsDLL.USP_INSERTROLE;
               //SqlParameter[] param = new SqlParameter[4];

               //param[0] = new SqlParameter("@RoleName", roledetail.RoleName);
               //param[1] = new SqlParameter("@RoleAccess", roledetail.RoleAccess);
               //param[2] = new SqlParameter("@IsActive", roledetail.IsActive);
               //param[3] = new SqlParameter("@CreatedBy", roledetail.CreatedBy);

               //ObjSqlHelper.ExecNonQueryProc(proc_name, param);
               ObjSqlHelper.ExecNonQueryProc(ConstantsDLL.USP_INSERTROLE, param);
               return Convert.ToInt32(param[4].Value);
        }