src/RumahScarlett/RumahScarlett.Presentation/Helper/RoleManager.cs
/// <summary>
/// Isi data dari setiap menu di MenuStrip ke tabel role_detail
/// </summary>
/// <param name="toolStripItemCollection">ToolStripItemCollection MenuStrip</param>
Isi data dari setiap menu di MenuStrip ke tabel role_detail
Isi data dari setiap menu di MenuStrip ke tabel role_detail
private void PopulateMenuStrip(ToolStripItemCollection toolStripItemCollection)
      {
         foreach (var menu in toolStripItemCollection)
         {
            if (!(menu is ToolStripMenuItem)) continue;
            var menuItem = (ToolStripMenuItem)menu;
            if (menuItem.TagIgnore()) continue;
            var roleDetail = new RoleDetailModel()
            {
               role_kode = RoleKode,
               menu_name = menuItem.Tag.ToString(),
               menu_parent = menuItem.AccessibleDescription, 
               form_action = null,
               tag = menuItem.AccessibleName
            };
            _roleServices.Insert(roleDetail);
            PopulateMenuStrip(menuItem.DropDownItems); 
         }
      }
private void PopulateMenuStrip ( ToolStripItemCollection toolStripItemCollection ) { foreach ( var menu in toolStripItemCollection ) { if ( ! ( menu is ToolStripMenuItem ) ) continue ; var menuItem = ( ToolStripMenuItem ) menu ; if ( menuItem . TagIgnore ( ) ) continue ; var roleDetail = new RoleDetailModel ( ) { role_kode = RoleKode , menu_name = menuItem . Tag . ToString ( ) , menu_parent = menuItem . AccessibleDescription , form_action = null , tag = menuItem . AccessibleName } ; _roleServices . Insert ( roleDetail ) ; PopulateMenuStrip ( menuItem . DropDownItems ) ; } }
Isi data dari setiap menu di MenuStrip ke tabel role_detail
Isi data dari setiap menu di MenuStrip ke tabel role_detail
// Lewati menu jika bukan MenuItem (bisa saja Separator atau ComboBox) // Lewati Menu yang mempunyai Tag ignore // Menu header (parent) di MenuStrip // Simpan data Menu ke tabel role_detail // Recursive method
toolStripItemCollection
ToolStripItemCollection
None