Exemplo n.º 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string RoleName    = txtRolename.Text;
            string DescripRole = txtDescripRole.Text;

            if (CheckFields() == true)
            {
                MetroMessageBox.Show(this, "Debe completar todos los campos", "Error en Validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                try
                {
                    int Row = dgvRole.CurrentRow.Index;
                    ObjRole.ID_role      = Convert.ToInt32(dgvRole[0, Row].Value);
                    ObjRole.Name_role    = RoleName;
                    ObjRole.Descrip_role = DescripRole;
                    ObjRole.UpdateBy     = pIdSession;
                    ApiAccess.UpdateRole(ObjRole);
                }
                catch (Exception)
                {
                    throw;
                }
                CleanFields();
                LoadDataGrid();
                LoadDataGridAsgRole();
            }
        }
Exemplo n.º 2
0
        public RoleResp ModifyRole(RoleResp param)
        {
            bool _roles = _role.UpdateRole(param.Title, param._Desc, param.IsRoleActive, param.RoleId);

            if (_roles)
            {
                Log.InfoFormat(param.Computername, param.SystemIp, param.UserName, Constants.ActionType.ModifyUserRole.ToString());
                _audit.InsertAudit(param.UserName, Constants.ActionType.ModifyUserRole.ToString(), "Role modified", DateTime.Now, param.Computername, param.SystemIp);
                return(new RoleResp {
                    RespCode = "00",
                    RespMessage = "Success"
                });
            }
            else
            {
                Log.InfoFormat(param.Computername, param.SystemIp, param.UserName, Constants.ActionType.ModifyUserRole.ToString());
                return(new RoleResp
                {
                    RespCode = "04",
                    RespMessage = "Failure"
                });
            }
        }