Example #1
0
    private void DataBindingMenuRole(int menu_ref_id)
    {
        RoleInfos role = new RoleInfos();

        UltraWebGrid2.DataSource = role.GetMenuRoles(menu_ref_id);
        UltraWebGrid2.DataBind();
    }
Example #2
0
    protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
    {
        DataRowView dr = (DataRowView)e.Data;

        int menu_ref_id = DataTypeUtility.GetToInt32(dr["MENU_REF_ID"]);

        e.Row.Cells.FromKey("MENU_TYPE_NAME").Value = GetMenuTypeName(dr["MENU_TYPE"].ToString());

        e.Row.Cells.FromKey("MENU_UPDATE").Value = string.Format("<a href=\"#null\" onclick=\"OpenMenuInfoWindow('{0}','{1}');\"><img src='../images/drafts.gif' border='0'></a>"
                                                                 , "U"
                                                                 , menu_ref_id.ToString());

        TemplatedColumn tempRole   = (TemplatedColumn)e.Row.Band.Columns.FromKey("MENU_ROLE");
        DropDownList    ddlColRole = (DropDownList)((CellItem)tempRole.CellItems[e.Row.BandIndex]).FindControl("ddlMenuRole");


        RoleInfos role = new RoleInfos();
        DataSet   ds   = role.GetMenuRoles(menu_ref_id);

        ddlColRole.Items.Clear();

        ddlColRole.DataSource     = ds;
        ddlColRole.DataTextField  = "ROLE_NAME";
        ddlColRole.DataValueField = "ROLE_REF_ID";
        ddlColRole.DataBind();

        int ddlCnt = ds.Tables[0].Rows.Count;

        if (ddlCnt > 0)
        {
            ddlColRole.SelectedIndex = ddlCnt - 1;
        }


        //if (e.Row.Index < 10)
        //{
        //    // e.Row.Cells.FromKey("MENU_ROLE").Column.ValueList

        //    //e.Row.Cells.FromKey("MENU_ROLE").Column.ValueList.Style.Padding.Top = new Unit(30);

        //    ddlColRole.Items.Clear();



        //    ddlColRole.Items.Add("시스템관리자 권한");
        //}
        //else
        //{
        //    //e.Row.Cells.FromKey("MENU_ROLE").Column.ValueList.Style.Padding.Top = new Unit(30);

        //    ddlColRole.Items.Clear();

        //    ddlColRole.Items.Add("3");
        //    ddlColRole.Items.Add("4");
        //}

        e.Row.Cells.FromKey("MENU_ROLE").Style.Padding.Top = new Unit(0);
    }
Example #3
0
    protected void iBtnAdd_Click(object sender, ImageClickEventArgs e)
    {
        RoleInfos role = new RoleInfos();

        role.AddRoleMenu(int.Parse(ddlRoles.SelectedValue), int.Parse(hdfMenu_Ref_ID.Value));
        WebCommon.SetRoleDropDownList(ddlRoles, int.Parse(hdfMenu_Ref_ID.Value));
        DataBindingMenuRole(int.Parse(hdfMenu_Ref_ID.Value));
        CheckMenuRoleCount();
    }
        //Add role in DB
        public void AddRole(RoleInfos role)
        {
            using (StationeryModel context = new StationeryModel())
            {
                roleInfo r = new roleInfo();
                r.roleID      = role.RoleId;
                r.roleName    = role.RoleName;
                r.description = role.Description;
                context.roleInfoes.Add(r);
                foreach (var ps in role.Permissions)
                {
                    rolePermission rp = new rolePermission();
                    rp.roleID       = role.RoleId;
                    rp.permissionID = ps.permissionID;

                    context.rolePermissions.Add(rp);
                }
                context.SaveChanges();
            }
        }
Example #5
0
    protected void iBtnRemove_Click(object sender, ImageClickEventArgs e)
    {
        RoleInfos role = new RoleInfos();

        CheckBox        chk;
        UltraGridRow    row;
        TemplatedColumn col;
        bool            isOK  = false;
        int             edidx = 0;

        for (int i = 0; i < this.UltraWebGrid2.Rows.Count; i++)
        {
            row = UltraWebGrid2.Rows[i];
            col = (TemplatedColumn)row.Band.Columns.FromKey("selchk");
            chk = (CheckBox)((CellItem)col.CellItems[row.BandIndex]).FindControl("cBox");

            if (chk.Checked)
            {
                try
                {
                    isOK = role.RemoveRoleMenu(int.Parse(row.Cells.FromKey("ROLE_REF_ID").Value.ToString()), int.Parse(hdfMenu_Ref_ID.Value));
                }
                catch (Exception ex)
                {
                    lblScript.Text = JSHelper.GetAlertScript("삭제 중 오류가 발생하였습니다..", false);
                    return;
                }
            }
        }

        if (!isOK)
        {
            lblScript.Text = JSHelper.GetAlertScript("삭제할 항목을 선택주세요.", false);
        }
        else
        {
            WebCommon.SetRoleDropDownList(ddlRoles, int.Parse(hdfMenu_Ref_ID.Value));
            DataBindingMenuRole(int.Parse(hdfMenu_Ref_ID.Value));
            CheckMenuRoleCount();
        }
    }
Example #6
0
        private void GetRoleIdInfo(Session session, JET_DBID dbid)
        {
            using var rolesTable = new Table(session, dbid, "ROLE_IDS", OpenTableGrbit.ReadOnly);

            Api.JetSetTableSequential(session, rolesTable, SetTableSequentialGrbit.None);

            Api.MoveBeforeFirst(session, rolesTable);

            while (Api.TryMoveNext(session, rolesTable))
            {
                var roleGuid = Api.RetrieveColumnAsGuid(session, rolesTable, Api.GetTableColumnid(session, rolesTable, "RoleGuid"));
                var prodName = Api.RetrieveColumnAsString(session, rolesTable, Api.GetTableColumnid(session, rolesTable, "ProductName")).Trim('\0');
                var roleName = Api.RetrieveColumnAsString(session, rolesTable, Api.GetTableColumnid(session, rolesTable, "RoleName")).Trim('\0');

                var ri = new RoleInfo(roleGuid.Value, prodName, roleName);

                RoleInfos.Add(ri);

                _logger.Trace($"Added role info: {ri}");
            }

            Api.JetResetTableSequential(session, rolesTable, ResetTableSequentialGrbit.None);
        }
Example #7
0
        public string GetRoleDescFromGuid(Guid roleGuid)
        {
            var r = RoleInfos.SingleOrDefault(t => t.RoleGuid == roleGuid);

            return(r?.RoleName);
        }
Example #8
0
    protected void iBtnRemove_Click(object sender, ImageClickEventArgs e)
    {
        Biz_MenuInfo objMenuInfo = new Biz_MenuInfo();

        DataTable dataTable = objMenuInfo.GetDataTableSchema();

        dataTable = UltraGridUtility.GetDataTableByCheckValue(
            this.UltraWebGrid1
            , "cBox"
            , "selchk"
            , new string[] { "MENU_REF_ID", "UP_MENU_ID", "MENU_NAME", "MENU_DIR"
                             , "MENU_PAGE_NAME", "MENU_PARAM", "MENU_FULL_PATH"
                             , "MENU_DESC", "MENU_PRIORITY", "MENU_AUTH_TYPE", "MENU_TYPE"
                             , "MENU_NAME_IMAGE_PATH", "MENU_NAME_IMAGE_PATH_U"
                             , "MENU_PREV_ICON_PATH", "MENU_CREATE_DATE", "SHOW_LEFT_MENU" }
            , dataTable);

        RoleInfos role = new RoleInfos();

        foreach (DataRow row in dataTable.Rows)
        {
            int menu_ref_id = DataTypeUtility.GetToInt32(row["MENU_REF_ID"]);
            role.RemoveRoleMenu(ROLE_REF_ID, menu_ref_id);
        }

        GridBindginMenu();

        //RoleInfos role = new RoleInfos();

        //CheckBox chk;
        //UltraGridRow row;
        //TemplatedColumn col;
        //bool isOK = false;
        //int edidx = 0;

        //for (int i = 0; i < this.UltraWebGrid2.Rows.Count; i++)
        //{
        //    row = UltraWebGrid2.Rows[i];
        //    col = (TemplatedColumn)row.Band.Columns.FromKey("selchk");
        //    chk = (CheckBox)((CellItem)col.CellItems[row.BandIndex]).FindControl("cBox");

        //    if (chk.Checked)
        //    {
        //        try
        //        {
        //            isOK = role.RemoveRoleMenu(int.Parse(row.Cells.FromKey("ROLE_REF_ID").Value.ToString()), int.Parse(hdfMenu_Ref_ID.Value));
        //        }
        //        catch (Exception ex)
        //        {
        //            lblScript.Text = JSHelper.GetAlertScript("삭제 중 오류가 발생하였습니다..", false);
        //            return;
        //        }
        //    }
        //}

        //if (!isOK)
        //    lblScript.Text = JSHelper.GetAlertScript("삭제할 항목을 선택주세요.", false);
        //else
        //{
        //    WebCommon.SetRoleDropDownList(ddlRoles, int.Parse(hdfMenu_Ref_ID.Value));
        //    DataBindingMenuRole(int.Parse(hdfMenu_Ref_ID.Value));
        //    CheckMenuRoleCount();
        //}
    }