Exemple #1
0
        private void ConfigureRol()
        {
            try
            {
                using (var e = new PosBusiness.User())
                {
                    e.Rol();

                    this.UpdateButton = e.Update.Value;

                    var ctrlNew = this.Controls["btnNew"];

                    if (ctrlNew != null)
                    {
                        var btnNew = ctrlNew as Button;

                        btnNew.Enabled = e.New.Value;
                    }

                    var ctrlDelete = this.Controls["btnDelete"];

                    if (ctrlDelete != null)
                    {
                        var btnDelete = ctrlDelete as Button;

                        btnDelete.Enabled = e.Erase.Value;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #2
0
        private void AddMenu()
        {
            try
            {
                using (var e = new PosBusiness.User())
                {
                    e.Rol();

                    var principal = e.MenuPrincipalList();

                    foreach (var p in principal)
                    {
                        var mnu       = (ToolStripMenuItem)menuStrip1.Items.Add(p.Name);
                        var secondary = e.MenuSecondaryByUserList(p.Id.Value);
                        var index     = 0;

                        foreach (var s in secondary)
                        {
                            System.Drawing.Image img = System.Drawing.Image.FromFile(this.GetPath() + "\\Menu\\" + s.Image, true);

                            mnu.DropDownItems.Add(s.Name, img, MenuClicked);
                            mnu.DropDownItems[index].Tag = s.FormName + "|" + s.Modal;

                            index++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }