public Int32 GetRoleId(string RoleName)
        {
            Int32 RoleId;

            RoleManagementBLL objRoleManagementBLL = null;
            try
            {
                objRoleManagementBLL = new RoleManagementBLL();
                RoleId = objRoleManagementBLL.GetRoleId(RoleName);
                return RoleId;
            }
            catch (Exception e)
            {
                throw;
            }
            finally
            {
                objRoleManagementBLL = null;
            }
        }
        public static List<RoleDetail> GetRoleDeatil()
        {
            List<RoleDetail> lstroledetail = null;
            RoleManagementBLL objRoleManagementBLL = null;
            try
            {
                objRoleManagementBLL = new RoleManagementBLL();
                lstroledetail = objRoleManagementBLL.GetRoleDetail();

            }
            catch (Exception ex)
            {
                // Log the error to a text file in the Error folder
                Common.WriteError(ex);
            }
            finally
            {
                objRoleManagementBLL = null;
            }
            return lstroledetail;
        }
        public static bool DeleteRole(string RoleId, string Comment)
        {
            RoleManagementBLL objRoleManagementBLL = null;
            bool isFlag = false;
            try
            {
                objRoleManagementBLL = new RoleManagementBLL();

                string ModifiedBy = GetCurrentUserName();

                isFlag = objRoleManagementBLL.DeleteRole(RoleId, false, ModifiedBy);

            }
            catch (Exception ex)
            {
                // Log the error to a text file in the Error folder
                Common.WriteError(ex);
            }
            finally
            {
                objRoleManagementBLL = null;
            }
            return isFlag;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    Int32 RoleId;
                    string UserName = string.Empty;
                    if (Session["RoleId"] == null)
                    {
                        Common objCommon = new Common();
                        UserName = objCommon.GetCurrentUserName();
                        using (RoleManagementBLL objRoleManagementBLL = new RoleManagementBLL())
                        {
                            RoleId = objRoleManagementBLL.GetRoleId(UserName);
                            Session["RoleId"] = RoleId;
                        }
                    }
                    else
                    {
                        RoleId = Convert.ToInt32(Session["RoleId"]);
                    }
                    switch (RoleId)
                    {
                        case 1:
                            break;
                        case 2:
                            break;
                        case 3:
                            break;
                        default:
                            Response.Redirect("~/Error.aspx");
                            break;
                    }

                }
            }
            catch(Exception ex)
            {
                // Log the error to a text file in the Error folder
                Common.WriteError(ex);
            }
        }
        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;
        }