public bool GerarEntrada(ParkingInOut parkingInOut) { var dbTableId = _dbTableApp.Search(c => c.TableName == "ParkingInOut").Select(c => new { c.Id }).FirstOrDefault(); parkingInOut.TicketNumber = _autNumApp.GerarSequencia(dbTableId.Id, "TicketNumber").GetValueOrDefault(0); parkingInOut.ParkingDateTimeInput = DateTime.Now; return(_epr.InsertOrUpdate(parkingInOut)); }
/// <summary> /// Força atualização de todos os objetos da tela. /// </summary> public void RefreshControls() { try { var fieldsForm = GetListControls().OrderBy(c => c.Index); foreach (var fieldInfo in fieldsForm) { if (StateForm != StateForm.Waiting) { if (GlobalUser.User != null) { foreach (var groupUser in GlobalUser.User.GroupUsers) { foreach (var groupPermission in groupUser.GroupAccess.GroupPermissions) { if (groupPermission.Permission.TypeComponent != TypeComponent.Field) { continue; } if (groupPermission.Permission.NamePermission != fieldInfo.Name) { continue; } if (groupPermission.Permission.Delete) { fieldInfo.Disable = false; } else if (groupPermission.Permission.Insert) { fieldInfo.Disable = false; } else if (groupPermission.Permission.Update) { fieldInfo.Disable = false; } else if (groupPermission.Permission.Visible) { fieldInfo.Visible = false; } } } } } fieldInfo.Refresh(); if (StateForm == StateForm.Inserting && !fieldInfo.DisabledAutomaticNumbering) { var fieldConf = GlobalUser.AutomaticNumberings.FirstOrDefault(c => c.DbTable.TableName == InvokeMethod.TypeModel.Name && c.FieldName == fieldInfo.Name); if (fieldConf != null) { var sequencia = AutomaticNumberingApp.GerarSequencia(fieldConf.DbTableId, fieldConf.FieldName); if (sequencia.HasValue) { var reflection = new SReflection(); var valueConvertido = reflection.ConvertValue(sequencia, fieldInfo.PropertyControl); fieldInfo.ValueControl = valueConvertido; GlobalUser.AutomaticNumberings = AutomaticNumberingApp.Search().ToList(); } fieldInfo.Disable = false; } } } } catch (Exception) { } }