Exemple #1
0
        public void ConfigureButtons()
        {
            var formName = this.Name;
            var buttons  = new posb.User().GetButtonsRol(formName);

            if (!buttons.Any() && this.Tag != null)
            {
                formName = this.Tag.ToString();
                buttons  = new posb.User().GetButtonsRol(formName);
            }

            if (buttons.Any())
            {
                foreach (var button in buttons)
                {
                    if (button.IsButton.Value)
                    {
                        var ctrl = this.Controls[button.Name];

                        if (ctrl != null)
                        {
                            ctrl.Enabled = button.Active.Value;
                        }
                    }
                    else
                    {
                        this.UpdateButton = button.Active.Value;
                    }
                }
            }
        }
Exemple #2
0
 private void FillRole()
 {
     using (posb.User user = new posb.User())
     {
         this.cmbRole.Fill(user.RolList());
     }
 }
Exemple #3
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 #4
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)
            {
            }
        }
Exemple #5
0
        private void Save()
        {
            if (this.txtNewPassword.Text.Equals(this.txtNewRepeatPassword.Text))
            {
                if (this.txtNewPassword.Text.Length > 5)
                {
                    using (var user = new PosBusiness.User
                    {
                        Password = this.txtCurrentPassword.Text
                    })
                    {
                        user.Alias = user.UserAlias;

                        if (user.Login())
                        {
                            if (user.ChangePassword(user.UserId.Value, this.txtNewPassword.Text))
                            {
                                this.Alert("La contraseña se cambio correctamente", eForm.TypeError.Exclamation);

                                this.Close();
                            }
                            else
                            {
                                this.Alert("Ocurrió un error al intentar cambiar la contraseña", eForm.TypeError.Error);
                            }
                        }
                        else
                        {
                            this.Alert("La contraseña proporcionada es incorrecta", eForm.TypeError.Exclamation);

                            this.txtCurrentPassword.Clear();
                        }
                    }
                }
                else
                {
                    this.Alert("La contraseña debe tener al menos 6 caracteres");

                    this.txtNewRepeatPassword.Clear();

                    this.txtNewPassword.Clear();
                    this.txtNewPassword.Focus();
                }
            }
            else
            {
                this.Alert("Las contraseñas capturadas no coinciden");

                this.txtNewRepeatPassword.Clear();
                this.txtNewPassword.Focus();
            }
        }
Exemple #6
0
        private void Save()
        {
            using (var e = new posb.User
            {
                Id = this.Id,
                Name = this.txtName.Text
            })
            {
                e.SaveRole();

                this.Result(true, "Success!!");

                this.Close();
            }
        }
Exemple #7
0
        private void Save()
        {
            using (var e = new posb.User
            {
                Id = this.Id,
                Name = this.txtName.Text,
                Alias = this.txtAlias.Text,
                IdRol = int.Parse(this.cmbRol.SelectedValue.ToString()),
                Password = this.txtNewPassword.Text,
                Active = this.cbActive.Checked,
            })
            {
                e.Save();

                this.Result(true, "Success!!");

                this.Close();
            }
        }
Exemple #8
0
        private void LoadData(int?Id)
        {
            using (var e = new posb.User
            {
                Id = this.Id
            })
            {
                e.Get();

                this.txtName.Text              = e.Name;
                this.txtAlias.Text             = e.Alias;
                this.txtNewPassword.Text       = e.Password;
                this.txtNewRepeatPassword.Text = e.Password;
                this.cbActive.Checked          = e.Active.Value;
                this.cmbRol.SelectedValue      = e.IdRol;

                this.txtNewPassword.Enabled       = false;
                this.txtNewRepeatPassword.Enabled = false;
            }
        }
Exemple #9
0
        public RoleList()
        {
            this.Entity = new posb.User();

            InitializeComponent();
        }